Package org.rhq.core.domain.configuration

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


    public PropertyList getKeySpaceDataFileLocations() {
        EmsBean emsBean = loadBean(KeyspaceService.STORAGE_SERVICE_BEAN);
        EmsAttribute attribute = emsBean.getAttribute("AllDataFileLocations");

        PropertyList list = new PropertyList("keyspaceFileLocations");
        String[] dirs = (String[]) attribute.getValue();
        for (String dir : dirs) {
            if (!dir.endsWith("/")) {
                dir = dir + "/";
            }

            list.add(new PropertySimple("directory", dir + context.getResourceKey()));
        }

        return list;
    }
View Full Code Here


        if (propertyDefinition instanceof PropertyDefinitionSimple) {
            property = generatePropertySimple((PropertyDefinitionSimple) propertyDefinition);
        } else if (propertyDefinition instanceof PropertyDefinitionMap) {
            property = generatePropertyMap((PropertyDefinitionMap) propertyDefinition);
        } else if (propertyDefinition instanceof PropertyDefinitionList) {
            property = new PropertyList(propertyDefinition.getName());
            PropertyDefinitionList propertyDefinitionList = (PropertyDefinitionList) propertyDefinition;
            PropertyDefinition listMemberPropertyDefinition = propertyDefinitionList.getMemberDefinition();
            // 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: "
                + propertyDefinition.getClass().getName());
View Full Code Here

        return RESOURCE_TYPE_NAME;
    }

    protected Configuration getExpectedResourceConfig() {
        Configuration config = new Configuration();
        PropertyList entries = new PropertyList(".");
        config.put(entries);

        PropertyMap entry;

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "127.0.0.1"));
        entry.put(new PropertySimple("canonical", "localhost"));
        entry.put(new PropertySimple("alias", "localhost.localdomain\nlocalhost4\nlocalhost4.localdomain4"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "::1"));
        entry.put(new PropertySimple("canonical", "localhost"));
        entry.put(new PropertySimple("alias", "localhost.localdomain\nlocalhost6\nlocalhost6.localdomain6"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "1.1.1.1"));
        entry.put(new PropertySimple("canonical", "one-one-one-one.com"));
        entry.put(new PropertySimple("alias", null));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "2.2.2.2"));
        entry.put(new PropertySimple("canonical", "two-two-two-two.com"));
        entry.put(new PropertySimple("alias", "alias"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "3.3.3.3"));
        entry.put(new PropertySimple("canonical", "three-three-three-three.com"));
        entry.put(new PropertySimple("alias", "alias1\nalias2"));
        entries.getList().add(entry);

        return config;
    }
View Full Code Here

        return config;
    }

    protected Configuration getUpdatedResourceConfig() {
        Configuration config = new Configuration();
        PropertyList entries = new PropertyList(".");
        config.put(entries);

        PropertyMap entry;

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "127.0.0.1"));
        entry.put(new PropertySimple("canonical", "localhost"));
        entry.put(new PropertySimple("alias", "hehe\nlocalhost4\nlocalhost4.localdomain4"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "::1"));
        entry.put(new PropertySimple("canonical", "localhost"));
        entry.put(new PropertySimple("alias", "localhost.localdomain\nlocalhost6\nlocalhost6.localdomain6"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "1.1.1.1"));
        entry.put(new PropertySimple("canonical", "one-one-one-one.com"));
        entry.put(new PropertySimple("alias", ""));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "2.2.2.2"));
        entry.put(new PropertySimple("canonical", "two-two-two-two.com"));
        entry.put(new PropertySimple("alias", ""));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "3.3.3.3"));
        entry.put(new PropertySimple("canonical", "three-three-three-three.com"));
        entry.put(new PropertySimple("alias", "aliast1.org\nalias2.org"));
        entries.getList().add(entry);
        return config;
    }
View Full Code Here

    public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, Exception {
        if (name.equals("listChannels")) {
            OperationResult result = new OperationResult();
            Configuration resultConfig = result.getComplexResults();
            PropertyList channelList = new PropertyList("channelList");

            this.bot.listChannels();

            Thread.sleep(5000); // TODO is this long enough... any other way to know when the list is done?

            for (ChannelInfo channelInfo : info.values()) {
                PropertyMap channelMap = new PropertyMap("channelMap");
                channelMap.put(new PropertySimple("channel", channelInfo.channel));
                channelMap.put(new PropertySimple("userCount", channelInfo.userCount));
                channelMap.put(new PropertySimple("topic", channelInfo.topic));
                channelList.add(channelMap);
            }
            resultConfig.put(channelList);
            return result;
        }
        return null;
View Full Code Here

    @Override
    public Configuration loadResourceConfiguration() throws Exception {
        Configuration resourceConfig = new Configuration();
        resourceConfig.setNotes("Loaded at " + new Date());
        PropertyList entriesProp = new PropertyList("services");
        resourceConfig.put(entriesProp);

        for (String name : getSysVServices()) {
            PropertyMap entryProp = new PropertyMap("service");
            entriesProp.add(entryProp);
            entryProp.put(new PropertySimple("name", name));
            entryProp.put(new PropertySimple("type", "Sys V Service"));
        }

        for (String name : getXinetDServices()) {
            PropertyMap entryProp = new PropertyMap("service");
            entriesProp.add(entryProp);
            entryProp.put(new PropertySimple("name", name));
            entryProp.put(new PropertySimple("type", "XinetD Service"));
        }
        return resourceConfig;
View Full Code Here

                EmsAttribute attribute = getEmsBean().getAttribute(propertyDefinition.getName());

                if (attribute != null) {
                    Object result = attribute.refresh();

                    PropertyList propertyList = new PropertyList(propertyDefinition.getName());

                    if (result instanceof Map) {
                        PropertyDefinitionMap propertyDefinitionMap = (PropertyDefinitionMap) ((PropertyDefinitionList) propertyDefinition)
                            .getMemberDefinition();

                        String mapName = propertyDefinitionMap.getName();

                        Collection<PropertyDefinition> subPropertyDefinitions = propertyDefinitionMap
                            .getOrderedPropertyDefinitions();
                        Iterator<PropertyDefinition> iterator = subPropertyDefinitions.iterator();
                        String keyName = ((PropertyDefinitionSimple) iterator.next()).getName();
                        String valueName = ((PropertyDefinitionSimple) iterator.next()).getName();

                        Map<Object, Object> mapValue = (Map<Object, Object>) result;

                        PropertyMap propertyMap;
                        for (Entry<Object, Object> entry : mapValue.entrySet()) {
                            propertyMap = new PropertyMap(mapName);
                            propertyMap.put(new PropertySimple(keyName, entry.getKey().toString()));
                            propertyMap.put(new PropertySimple(valueName, entry.getValue().toString()));

                            propertyList.add(propertyMap);
                        }
                    } else if (result instanceof Iterable<?>) {
                        String entryName = ((PropertyDefinitionSimple) ((PropertyDefinitionList) propertyDefinition)
                            .getMemberDefinition()).getName();

                        Iterable<?> iterable = (Iterable<?>) result;
                        for (Object entry : iterable) {
                            propertyList.add(new PropertySimple(entryName, entry.toString()));
                        }
                    } else if (result instanceof Object[]) {
                        String entryName = ((PropertyDefinitionSimple) ((PropertyDefinitionList) propertyDefinition)
                            .getMemberDefinition()).getName();

                        Object[] arrayValue = (Object[]) result;

                        for (Object entry : arrayValue) {
                            propertyList.add(new PropertySimple(entryName, entry.toString()));
                        }
                    }

                    if (propertyList.getList().size() != 0) {
                        configuration.put(propertyList);
                    }
                }
            }
        }
View Full Code Here

public class SudoersComponentTest extends AbstractAugeasConfigurationComponentTest {

    @Override
    protected Configuration getExpectedResourceConfig() {
        Configuration config = new Configuration();
        PropertyList entries = new PropertyList(".");
        config.put(entries);
        PropertyMap entry;
        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "root"));
        entry.put(new PropertySimple("host_group/host", "ALL"));
        entry.put(new PropertySimple("host_group/command", "ALL"));
        entry.put(new PropertySimple("host_group/command/runas_user", "ALL"));
        entry.put(new PropertySimple("host_group/command/tag", true));
        entries.getList().add(entry);

        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "%wheel"));
        entry.put(new PropertySimple("host_group/host", "ALL"));
        entry.put(new PropertySimple("host_group/command", "ALL"));
        entry.put(new PropertySimple("host_group/command/runas_user", "ALL"));
        entry.put(new PropertySimple("host_group/command/tag", false));
        entries.getList().add(entry);

        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "apache"));
        entry.put(new PropertySimple("host_group/host", "ALL"));
        entry.put(new PropertySimple("host_group/command", "/bin/env"));
        entry.put(new PropertySimple("host_group/command/runas_user", "root"));
        entry.put(new PropertySimple("host_group/command/tag", false));
        entries.getList().add(entry);

        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "foo"));
        entry.put(new PropertySimple("host_group/host", "ALL"));
        entry.put(new PropertySimple("host_group/command", "NETWORKING"));
        entry.put(new PropertySimple("host_group/command/runas_user", "root"));
        entry.put(new PropertySimple("host_group/command/tag", true));
        entries.getList().add(entry);
        return config;
    }
View Full Code Here

    }

    @Override
    protected Configuration getUpdatedResourceConfig() {
        Configuration config = new Configuration();
        PropertyList entries = new PropertyList(".");
        config.put(entries);
        PropertyMap entry;
        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "root"));
        entry.put(new PropertySimple("host_group/host", "fooo"));
        entry.put(new PropertySimple("host_group/command", "/bin/env"));
        entry.put(new PropertySimple("host_group/command/runas_user", "ALL"));
        entry.put(new PropertySimple("host_group/command/tag", true));
        entries.getList().add(entry);

        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "%wheel"));
        entry.put(new PropertySimple("host_group/host", "ALL"));
        entry.put(new PropertySimple("host_group/command", "ALL"));
        entry.put(new PropertySimple("host_group/command/runas_user", "ALL"));
        entry.put(new PropertySimple("host_group/command/tag", false));
        entries.getList().add(entry);

        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "apache"));
        entry.put(new PropertySimple("host_group/host", "ALL"));
        entry.put(new PropertySimple("host_group/command", "/bin/env"));
        entry.put(new PropertySimple("host_group/command/runas_user", "root"));
        entry.put(new PropertySimple("host_group/command/tag", false));
        entries.getList().add(entry);

        entry = new PropertyMap("spec");
        entry.put(new PropertySimple("user", "foo"));
        entry.put(new PropertySimple("host_group/host", "ALL"));
        entry.put(new PropertySimple("host_group/command", "NETWORKING"));
        entry.put(new PropertySimple("host_group/command/runas_user", "root"));
        entry.put(new PropertySimple("host_group/command/tag", true));
        entries.getList().add(entry);
        return config;
    }
View Full Code Here

    }

    @Override
    protected Configuration getExpectedResourceConfig() {
        Configuration config = new Configuration();
        PropertyList entries = new PropertyList(".");
        config.put(entries);

        PropertyMap entry;

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "127.0.0.1"));
        entry.put(new PropertySimple("canonical", "localhost"));
        entry.put(new PropertySimple("alias", "localhost.localdomain\nlocalhost4\nlocalhost4.localdomain4"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "::1"));
        entry.put(new PropertySimple("canonical", "localhost"));
        entry.put(new PropertySimple("alias", "localhost.localdomain\nlocalhost6\nlocalhost6.localdomain6"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "1.1.1.1"));
        entry.put(new PropertySimple("canonical", "one-one-one-one.com"));
        entry.put(new PropertySimple("alias", null));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "2.2.2.2"));
        entry.put(new PropertySimple("canonical", "two-two-two-two.com"));
        entry.put(new PropertySimple("alias", "alias"));
        entries.getList().add(entry);

        entry = new PropertyMap("*[canonical]");
        entry.put(new PropertySimple("ipaddr", "3.3.3.3"));
        entry.put(new PropertySimple("canonical", "three-three-three-three.com"));
        entry.put(new PropertySimple("alias", "alias1\nalias2"));
        entries.getList().add(entry);

        return config;
    }
View Full Code Here

TOP

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

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.