Package org.rhq.modules.plugins.jbossas7.json

Examples of org.rhq.modules.plugins.jbossas7.json.Address


    public  void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {

         for (MeasurementScheduleRequest req : metrics) {
            if (req.getName().equals("appuid")) {

                Address addr = new Address("core-service=platform-mbean,type=runtime");
                ReadAttribute op = new ReadAttribute(addr,"system-properties");
                ASConnection conn = parent.getASConnection();
                ComplexResult result = conn.executeComplex(op);

                if (result.isSuccess()) {
View Full Code Here


        if (verbose) {
            log.info("total path: [" + path + "]");
        }

        Address addr = new Address(parentPath);
        Result result = connection.execute(new ReadChildrenNames(addr, confPath));

        if (result.isSuccess()) {

            @SuppressWarnings("unchecked")
View Full Code Here

    // TODO: Re-enable if appropriate.
    @Test(enabled = false)
    public void readSocketBindings() throws Exception {
        ConfigurationDefinition configDef = loadServiceDescriptor("SocketBindingGroupDomain");

        Address a = new Address("socket-binding-group=standard-sockets");
        ConfigurationLoadDelegate loadDelegate = new ConfigurationLoadDelegate(configDef,
            getDomainControllerASConnection(), a);
        Configuration conf = loadDelegate.loadResourceConfiguration();

        assert conf != null : "Did not get a configuration back";
View Full Code Here

    // TODO: Re-enable if appropriate.
    @Test(enabled = false)
    public void readUpdateSocketBindings() throws Exception {
        ConfigurationDefinition configDef = loadServiceDescriptor("SocketBindingGroupDomain");

        Address a = new Address("socket-binding-group=standard-sockets");
        ConfigurationLoadDelegate loadDelegate = new ConfigurationLoadDelegate(configDef,
            getDomainControllerASConnection(), a);
        Configuration conf = loadDelegate.loadResourceConfiguration();

        assert conf != null : "Did not get a configuration back";
View Full Code Here

@Test(groups = "unit")
public class CompositeOperationTest {

    public void serializationTest() throws Exception {

        Address address= new Address();
        address.add("subsystem","web");
        address.add("connector","http");
        address.add("profile","default");

        CompositeOperation op = new CompositeOperation();

        Operation step1 = new Operation("add", address);
        op.addStep(step1);
View Full Code Here

    }

    public void serializationTest2() throws Exception {


        Address deploymentsAddress = new Address();
        String TEST_WAR = "test.war";
        deploymentsAddress.add("deployment", TEST_WAR);
        Operation step1 = new Operation("add",deploymentsAddress);
        String bytes_value = "123";
        step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
        step1.addAdditionalProperty("name", TEST_WAR);

        Address serverGroupAddress = new Address();
        serverGroupAddress.add("server-group","main-server-group");
        serverGroupAddress.add("deployment", TEST_WAR);
        Operation step2 = new Operation("add",serverGroupAddress);
        step2.addAdditionalProperty("enabled","true");


        Operation step3 = new Operation("remove",serverGroupAddress);
View Full Code Here

            } else
                subTypes.add(confPath);

            for (String cpath : subTypes) {

                Address addr = new Address(parentPath);
                Result result = connection.execute(new ReadChildrenNames(addr, cpath));

                if (result.isSuccess()) {

                    @SuppressWarnings("unchecked")
                    List<String> subsystems = (List<String>) result.getResult();

                    // There may be multiple children of the given type
                    for (String val : subsystems) {

                        String newPath = cpath + "=" + val;
                        Configuration config2 = context.getDefaultPluginConfiguration();

                        String resKey;

                        if (path == null || path.isEmpty())
                            resKey = newPath;
                        else {
                            if (path.startsWith(","))
                                path = path.substring(1);
                            resKey = path + "," + cpath + "=" + val;
                        }

                        PropertySimple pathProp = new PropertySimple("path", resKey);
                        config2.put(pathProp);

                        DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), // DataType
                            resKey, // Key
                            val, // Name
                            null, // Version
                            context.getResourceType().getDescription(), // subsystem.description
                            config2, null);
                        details.add(detail);
                    }
                }
            }
        } else {
            // Single subsystem
            path += "," + confPath;
            if (path.startsWith(","))
                path = path.substring(1);
            Result result = connection.execute(new ReadResource(new Address(path)));
            if (result.isSuccess()) {

                String resKey = path;
                String name = resKey.substring(resKey.lastIndexOf("=") + 1);
                Configuration config2 = context.getDefaultPluginConfiguration();
View Full Code Here

        JsonNode resultNode = node.get("result");
        return resultNode.get("BYTES_VALUE").getTextValue();
    }

    Operation addDeployment(String deploymentName, String bytes_value) {
        Address deploymentsAddress = new Address("deployment", deploymentName);
        Operation op = new Operation("add", deploymentsAddress);
        List<Object> content = new ArrayList<Object>(1);
        Map<String, Object> contentValues = new HashMap<String, Object>();
        contentValues.put("hash", new PROPERTY_VALUE("BYTES_VALUE", bytes_value));
        content.add(contentValues);
View Full Code Here

        }
        return results;
    }

    private Result executeRead(ASConnection asConnection) {
        return asConnection.execute(new ReadAttribute(new Address("/"), "product-version"));
    }
View Full Code Here

        mapper = new ObjectMapper();
        mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);

        //create new Security Domain
        Address destination = new Address(PROFILE);
        destination.addSegment(SECURITY_RESOURCE_KEY);
        String securityDomainId = TEST_DOMAIN + "2";
        destination.addSegment(SECURITY_DOMAIN_RESOURCE_KEY + "=" + securityDomainId);

        ASConnection connection = getDomainControllerASConnection();
        Result result = new Result();
        Operation op = null;
        //delete old one if present to setup clean slate
        op = new Operation("remove", destination);
        result = connection.execute(op);

        //build/rebuild hierarchy
        op = new Operation("add", destination);
        result = connection.execute(op);
        assert result.getOutcome().equals("success") : "Add of Security Domain has failed: "
            + result.getFailureDescription();

        //Ex. profile=standalone-ha,subsystem=security,security-domain
        String addressPrefix = PROFILE + "," + SECURITY_RESOURCE_KEY + "," + SECURITY_DOMAIN_RESOURCE_KEY;

        //loop over standard types and add base details for all of them to security domain
        String address = "";
        for (String attribute : jsonMap.keySet()) {
            if (attribute.equals("policy-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",authorization=classic";
            } else if (attribute.equals("acl-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",acl=classic";
            } else if (attribute.equals("mapping-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",mapping=classic";
            } else if (attribute.equals("trust-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",identity-trust=classic";
            } else if (attribute.equals("provider-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",audit=classic";
            } else if (attribute.equals("login-modules")) {
                address = addressPrefix + "=" + securityDomainId + ",authentication=classic";
            } else {
                assert false : "An unknown attribute '" + attribute
                    + "' was found. Is there a new type to be supported?";
            }

            //build the operation to add the component
            ////Load json map into ModuleOptionType
            try {
                // loading jsonMap contents for Ex. 'login-module'
                JsonNode node = mapper.readTree(jsonMap.get(attribute));
                Object obj = mapper.treeToValue(node, Object.class);
                result.setResult(obj);
                result.setOutcome("success");
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }

            //populate the Value component complete with module Options.
            List<Value> moduleTypeValue = populateSecurityDomainModuleOptions(result, loadModuleOptionType(attribute));
            op = createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
            //submit the command
            result = connection.execute(op);
            assert result.getOutcome().equals("success") : "Add ModuleOptionType has failed: "
                + result.getFailureDescription();
        }
View Full Code Here

TOP

Related Classes of org.rhq.modules.plugins.jbossas7.json.Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.