Package org.rhq.core.domain.configuration

Examples of org.rhq.core.domain.configuration.PropertyMap


    public void testMapInMapCompare() {
        Configuration c1 = new Configuration();
        Configuration c2 = new Configuration();

        PropertyMap mapInner1 = new PropertyMap("inner", new Property[] { new PropertySimple("uno", 111) });
        PropertyMap mapInner2 = new PropertyMap("inner", new Property[] { new PropertySimple("uno", 111) });
        PropertyMap mapOuter1 = new PropertyMap("outer", new Property[] { mapInner1 });
        PropertyMap mapOuter2 = new PropertyMap("outer", new Property[] { mapInner2 });

        c1.put(mapOuter1);
        c2.put(mapOuter2);

        assert c1.equals(c1); // can compare itself
View Full Code Here


        Configuration c1 = new Configuration();
        Configuration c2 = new Configuration();

        PropertyList listInner1 = new PropertyList("inner", new Property[] { new PropertySimple("uno", 111) });
        PropertyList listInner2 = new PropertyList("inner", new Property[] { new PropertySimple("uno", 111) });
        PropertyMap mapOuter1 = new PropertyMap("outer", new Property[] { listInner1,
            new PropertySimple("hello", "world!") });
        PropertyMap mapOuter2 = new PropertyMap("outer", new Property[] { listInner2,
            new PropertySimple("hello", "world!") });

        c1.put(mapOuter1);
        c2.put(mapOuter2);
View Full Code Here

        // Automatically set by JON server
        configuration.setVersion(2);

        PropertyList propertyList = new PropertyList("applicationPolicies");

        PropertyMap applicationPolicy1 = new PropertyMap("jmx-console");
        propertyList.add(applicationPolicy1);
        // ------------------------------------
        // Application Policy Properties

        /* The following properties are used to describe the data found in the following
         * example security domain:
         *
         * 1. <application-policy name="jmx-console"> 2.   <authentication> 3.     <login-module
         * code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"> 4.       <module-option
         * name="usersProperties">props/jmx-console-users.properties</module-option> 5.       <module-option
         * name="rolesProperties">props/jmx-console-roles.properties</module-option> 6.     </login-module> 7.
         * </authentication> 8. </application-policy>
         */

        /* Refers to line 1 in the example XML above.
         * Note that the name of the property as exposed by the plugin is not necessarily identical to the underlying
         * resource name for the property. Additionally, the display name of the property may further describe the
         * property.
         */
        applicationPolicy1.put(new PropertySimple("applicationPolicyName", "jmx-console"));

        /* Refers to the login-module defined on lines 3-6. */
        PropertyMap loginModule = new PropertyMap("userRolesLoginModule");
        applicationPolicy1.put(loginModule);

        loginModule.put(new PropertySimple("code", "org.jboss.security.auth.spi.UserRolesLoginModule"));
        loginModule.put(new PropertySimple("flag", "required"));

        PropertyMap loginModuleOptions = new PropertyMap("loginModuleOptions");
        loginModuleOptions.put(new PropertySimple("usersProperties", "props/jmx-console-users.properties"));
        loginModuleOptions.put(new PropertySimple("rolesProperties", "props/jmx-console-roles.properties"));

        return configuration;
    }
View Full Code Here

        configuration.put(new PropertySimple("use-java-context", Boolean.TRUE));
        configuration.put(new PropertySimple("min-pool-size", 2));
        configuration.put(new PropertySimple("max-pool-size", null));
        configuration.put(new PropertySimple("track-statements", "Yes"));

        PropertyMap connectionProperties = new PropertyMap("connection-properties");
        connectionProperties.put(new PropertySimple("TNSNamesFile", "c:\\temp\\tnsnames.ora"));
        connectionProperties.put(new PropertySimple("ConnectionRetryDelay", "3"));

        configuration.put(connectionProperties);

        return configuration;
    }
View Full Code Here

                assertNotNull(includes, "Expected to find default property set for <includes>");
                assertEquals(includes.getList().size(), 2,
                    "Expected <includes> property list to have two property elements.");

                PropertyMap include1 = (PropertyMap) includes.getList().get(0);
                PropertySimple path1 = include1.getSimple(DriftConfigurationDefinition.PROP_PATH);
                PropertySimple pattern1 = include1.getSimple(DriftConfigurationDefinition.PROP_PATTERN);

                assertNotNull(path1, "Expected to find a simple property for the path of the first <include>");
                assertEquals(path1.getStringValue(), "lib", "The value is wrong for the path of the first <include>");

                assertNotNull(pattern1, "Expected to find a simple property for the pattern of the first <include>");
                assertEquals(pattern1.getStringValue(), "*.jar",
                    "The value is wrong for the pattern of the first <include>");

                PropertyMap include2 = (PropertyMap) includes.getList().get(1);
                PropertySimple path2 = include2.getSimple(DriftConfigurationDefinition.PROP_PATH);
                PropertySimple pattern2 = include2.getSimple(DriftConfigurationDefinition.PROP_PATTERN);

                assertNotNull(path2, "Expected to find a simple property for the path of the second <include>");
                assertEquals(path2.getStringValue(), "conf", "The value is wrong for the path of the second <include>");

                assertNotNull(pattern2, "Expected to find a simple property for the pattern of the second <include>");
View Full Code Here

                assertNotNull(excludes, "Expected to find default property set for <excludes>");
                assertEquals(excludes.getList().size(), 2,
                    "Expected <excludes> property list to have two property elements.");

                PropertyMap exclude1 = (PropertyMap) excludes.getList().get(0);
                PropertySimple path1 = exclude1.getSimple(DriftConfigurationDefinition.PROP_PATH);
                PropertySimple pattern1 = exclude1.getSimple(DriftConfigurationDefinition.PROP_PATTERN);

                assertNotNull(path1, "Expected to find a simple property for the path of the first <exclude>");
                assertEquals(path1.getStringValue(), "lib", "The value is wrong for the path of the first <exclude>");

                assertNotNull(pattern1, "Expected to find a simple property for the pattern of the first <exclude>");
                assertEquals(pattern1.getStringValue(), "*.jar",
                    "The value is wrong for the pattern of the first <exclude>");

                PropertyMap exclude2 = (PropertyMap) excludes.getList().get(1);
                PropertySimple path2 = exclude2.getSimple(DriftConfigurationDefinition.PROP_PATH);
                PropertySimple pattern2 = exclude2.getSimple(DriftConfigurationDefinition.PROP_PATTERN);

                assertNotNull(path2, "Expected to find a simple property for the path of the second <exclude>");
                assertEquals(path2.getStringValue(), "conf", "The value is wrong for the path of the second <exclude>");

                assertNotNull(pattern2, "Expected to find a simple property for the pattern of the second <exclude>");
View Full Code Here

            if (snapshotDirectory.exists()) {
                File[] files = snapshotDirectory.listFiles();

                for (File individualSnapshot : files) {
                    if (individualSnapshot.isDirectory()) {
                        PropertyMap snapshotDetails = new PropertyMap("snapshot");
                        snapshotDetails.put(new PropertySimple("name", individualSnapshot.getName()));
                        snapshotDetails.put(new PropertySimple("folder", individualSnapshot.getAbsolutePath()));
                        listOfSnapshots.add(snapshotDetails);
                    }
                }
            }
        }
View Full Code Here

                        String[] lines = output.split("\n");
                        for (String line : lines) {
                            Matcher matcher = pattern.matcher(line);
                            if (matcher.matches()) {
                                PropertyMap map = new PropertyMap("networkConnection");
                                list.add(map);
                                map.put(new PropertySimple("localHost", matcher.group(1)));
                                map.put(new PropertySimple("localPort", matcher.group(2)));
                                map.put(new PropertySimple("remoteHost", matcher.group(3)));
                                map.put(new PropertySimple("remotePort", matcher.group(4)));
                            }
                        }
                    }
                }
            } else {
                log.info("Getting network connections using the internal mechanism");
                result = new OperationResult();
                Configuration config = result.getComplexResults();
                config.put(new PropertySimple("detectionMechanism", mechanism.toString()));

                try {
                    List<NetConnection> conns;
                    conns = getResourcContext().getSystemInformation().getNetworkConnections(null, 0);
                    config.put(new PropertySimple(OPERATION_RESULT_EXITCODE, "0"));
                    if (conns.size() > 0) {
                        PropertyList list = new PropertyList("networkConnections");
                        config.put(list);
                        for (NetConnection conn : conns) {
                            PropertyMap map = new PropertyMap("networkConnection");
                            list.add(map);
                            map.put(new PropertySimple("localHost", conn.getLocalAddress()));
                            map.put(new PropertySimple("localPort", conn.getLocalPort()));
                            map.put(new PropertySimple("remoteHost", conn.getRemoteAddress()));
                            map.put(new PropertySimple("remotePort", conn.getRemotePort()));
                        }
                    }
                } catch (Exception e) {
                    config.put(new PropertySimple(OPERATION_RESULT_EXITCODE, "1"));
                    result.setErrorMessage(ThrowableUtil.getAllMessages(e));
View Full Code Here

            // If the property is a List of Maps, add 10 members to it, then recursively populate them.
            if (listMemberPropertyDefinition instanceof PropertyDefinitionMap) {
                PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) listMemberPropertyDefinition;
                PropertyList propertyList = (PropertyList) property;
                for (int i = 0; i < 10; i++) {
                    PropertyMap memberProperty = generatePropertyMap(propertyDefinitionMap);
                    propertyList.add(memberProperty);
                }
            }
        } else {
            throw new IllegalStateException("Unsupported PropertyDefinition subclass: "
View Full Code Here

        }
        return new PropertySimple(propertyDefinitionSimple.getName(), value);
    }

    private static PropertyMap generatePropertyMap(PropertyDefinitionMap propertyDefinitionMap) {
        PropertyMap propertyMap = new PropertyMap(propertyDefinitionMap.getName());
        Map<String, PropertyDefinition> childPropertyDefinitions = propertyDefinitionMap.getMap();
        if (childPropertyDefinitions.isEmpty()) {
            // open map
            for (int i = 0; i < 10; i++) {
                propertyMap.put(new PropertySimple("openMapMember" + i, "value" + i));
            }
        } else {
            for (PropertyDefinition childPropertyDefinition : childPropertyDefinitions.values()) {
                generateProperty(childPropertyDefinition, propertyMap);
            }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.configuration.PropertyMap

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.