Package org.apache.avalon.framework.configuration

Examples of org.apache.avalon.framework.configuration.DefaultConfiguration


     * Create a configuration containing the role details
     *
     * @return a <code>Configuration</code>
     */
    private Configuration createConfiguration() {
        DefaultConfiguration config = new DefaultConfiguration(ROLE);
        new ItemConfiguration().save(this, config);
        return config;
    }
View Full Code Here


    /**
     * @see org.apache.lenya.ac.file.FileUser#createConfiguration()
     */
    protected Configuration createConfiguration() {
        DefaultConfiguration config = (DefaultConfiguration) super.createConfiguration();

        // add ldap_id node
        DefaultConfiguration child = new DefaultConfiguration(LDAP_ID);
        child.setValue(ldapId);
        config.addChild(child);

        return config;
    }
View Full Code Here

     * Create a configuration containing the group details
     *
     * @return a <code>Configuration</code>
     */
    private Configuration createConfiguration() {
        DefaultConfiguration config = new DefaultConfiguration(GROUP);
        new ItemConfiguration().save(this, config);

        return config;
    }
View Full Code Here

     */
    public void save(AbstractItem manageable, DefaultConfiguration configuration) {
        configuration.setAttribute(CLASS_ATTRIBUTE, manageable.getClass().getName());
        configuration.setAttribute(ID_ATTRIBUTE, manageable.getId());

        DefaultConfiguration child = null;

        // add name node
        child = new DefaultConfiguration(NAME);
        child.setValue(manageable.getName());
        configuration.addChild(child);

        // add description node
        child = new DefaultConfiguration(DESCRIPTION);
        child.setValue(manageable.getDescription());
        configuration.addChild(child);

    }
View Full Code Here

     * be used for saving.
     *
     * @return a <code>Configuration</code>
     */
    protected Configuration createConfiguration() {
        DefaultConfiguration config = new DefaultConfiguration(ID);
        new ItemConfiguration().save(this, config);

        DefaultConfiguration child = null;

        // add email node
        child = new DefaultConfiguration(EMAIL);
        child.setValue(getEmail());
        config.addChild(child);

        // add password node
        child = new DefaultConfiguration(PASSWORD);
        child.setValue(getEncryptedPassword());
        child.setAttribute(PASSWORD_ATTRIBUTE, "md5");
        config.addChild(child);

        // add group nodes
        child = new DefaultConfiguration(GROUPS);
        config.addChild(child);

        Group[] groups = getGroups();

        for (int i = 0; i < groups.length; i++) {
            DefaultConfiguration groupNode = new DefaultConfiguration(GROUP);
            groupNode.setValue(groups[i].getId());
            child.addChild(groupNode);
        }

        return config;
    }
View Full Code Here

    /* (non-Javadoc)
     * @see TestElementTraverser#startTestElement(TestElement)
     */
    public void startTestElement(TestElement el)
    {
        DefaultConfiguration config =
            new DefaultConfiguration("testelement", "testelement");
        config.setAttribute("class", el.getClass().getName());
        if (rootConfig == null)
        {
            rootConfig = config;
            if (name != null && name.length() > 0)
            {
View Full Code Here

        try
        {
            Object parent = stack.getLast();
            if (!(parent instanceof Configuration))
            {
                DefaultConfiguration config =
                    new DefaultConfiguration("property", "property");
                config.setValue(value != null ? value.toString() : "");
                config.setAttribute("name", parent.toString());
                config.setAttribute(XML_SPACE, PRESERVE);
                stack.removeLast();
                stack.add(config);
            }

            if (parent instanceof DefaultConfiguration
                && value instanceof Configuration)
            {
                ((DefaultConfiguration) parent).addChild((Configuration) value);
            }
            else if (
                parent instanceof DefaultConfiguration
                    && !(value instanceof Configuration))
            {
                DefaultConfiguration config =
                    new DefaultConfiguration("string", "string");
                config.setValue(value.toString());
                config.setAttribute(XML_SPACE, PRESERVE);
                ((DefaultConfiguration) parent).addChild(config);
            }
        }
        catch (NoSuchElementException e)
        {}
View Full Code Here

    /* (non-Javadoc)
     * @see TestElementTraverser#startMap(MapProperty)
     */
    public void startMap(MapProperty map)
    {
        DefaultConfiguration config = new DefaultConfiguration("map", "map");
        config.setAttribute("class", map.getObjectValue().getClass().getName());
        config.setAttribute("name",map.getName());
        config.setAttribute("propType",map.getClass().getName());
        stack.add(config);
    }
View Full Code Here

    /* (non-Javadoc)
     * @see TestElementTraverser#startCollection(CollectionProperty)
     */
    public void startCollection(CollectionProperty col)
    {
        DefaultConfiguration config =
            new DefaultConfiguration("collection", "collection");
        config.setAttribute("class", col.getObjectValue().getClass().getName());
        config.setAttribute("name",col.getName());
        config.setAttribute("propType",col.getClass().getName());
        stack.add(config);
    }
View Full Code Here

        {
            stack.addLast(key.getName());
        }
        else
        {
            DefaultConfiguration config =
                new DefaultConfiguration("property", "property");
            config.setValue(key.getStringValue());
            config.setAttribute("name", key.getName());
            config.setAttribute("propType", key.getClass().getName());
            config.setAttribute(XML_SPACE, PRESERVE);
            stack.addLast(config);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.configuration.DefaultConfiguration

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.