Package org.apache.avalon.framework.configuration

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


     * REVISIT (MC): when we can get the resolver anywhere, we can pass the
     * configuration object directly to XMLResourceBundle.
     */
    private void configureFactory(String location) throws Exception {
        // configure the factory to log correctly and cache catalogues
        DefaultConfiguration configuration =
                new DefaultConfiguration("name", "location");
        DefaultConfiguration cacheConf =
                new DefaultConfiguration(
                        BundleFactory.ConfigurationKeys.CACHE_AT_STARTUP,
                        "location"
                );
        cacheConf.setValue(new Boolean(cacheAtStartup).toString());
        configuration.addChild(cacheConf);

        // set the root location for message catalogues
        DefaultConfiguration dirConf =
                new DefaultConfiguration(
                        BundleFactory.ConfigurationKeys.ROOT_DIRECTORY,
                        "location"
                );

        debug("catalog location:" + location);
        Source source = null;
        try {
            source = sourceResolver.resolveURI(location);
            String systemId = source.getURI();
            debug("catalog directory:" + systemId);
            dirConf.setValue(systemId);
            configuration.addChild(dirConf);
        } finally {
            if (source != null)
                sourceResolver.release(source);
        }
View Full Code Here


        if (config == null) {
            if (this.getLogger().isDebugEnabled()) {
                getLogger().debug("Sitemap has no components definition at " + tree.getLocation());
            }
            config = new DefaultConfiguration("", "");
        }

        ComponentManager manager = new CocoonComponentManager(this.parentManager);

        LifecycleHelper.setupComponent(manager,
View Full Code Here

    public void initialize() /*throws Exception*/ {

        // FIXME : need to catch exceptions since ECS doesn't propagate the throws clause of Initializable
        try {

            DefaultConfiguration config = null;

            // Ensure all system-defined hints exist.
            // NOTE : checking this here means they can be user-defined in the sitemap
            switch(this.roleId) {
                case GENERATOR :

                    config = new DefaultConfiguration(COMPONENT_NAMES[GENERATOR], "autogenerated");
                    config.setAttribute("name", "<notifier>");
                    ensureExists("<notifier>",
                        org.apache.cocoon.sitemap.NotifyingGenerator.class, config);

                    config = new DefaultConfiguration(COMPONENT_NAMES[GENERATOR], "autogenerated");
                    config.setAttribute("name", "<aggregator>");
                    ensureExists("<aggregator>",
                        org.apache.cocoon.sitemap.ContentAggregator.class, config);
                break;

                case TRANSFORMER :
                    config = new DefaultConfiguration(COMPONENT_NAMES[TRANSFORMER], "autogenerated");
                    config.setAttribute("name", "<translator>");
                    ensureExists("<translator>",
                        org.apache.cocoon.sitemap.LinkTranslator.class, config);

                    config = new DefaultConfiguration(COMPONENT_NAMES[TRANSFORMER], "autogenerated");
                    config.setAttribute("name", "<gatherer>");
                    ensureExists("<gatherer>",
                        org.apache.cocoon.sitemap.LinkGatherer.class, config);
                break;
            }

View Full Code Here

                                       LogkitLoggerManager logKitManager)
            throws Exception {

        return ComponentHandler.getComponentHandler(
                program,
                new DefaultConfiguration("", "GeneratorSelector"),
                manager, context, roles, logKitManager);
    }
View Full Code Here

    protected File file;
    protected Class clazz;
    protected DefaultConfiguration config;

    public JavascriptProgram(File file, Class clazz, Collection dependecies) {
        DefaultConfiguration child;

        this.file = file;
        this.clazz = clazz;

        config = new DefaultConfiguration("", "GeneratorSelector");
        child = new DefaultConfiguration("file", "");
        child.setValue(file.toString());
        config.addChild(child);

        for (Iterator i = dependecies.iterator(); i.hasNext(); ) {
            child = new DefaultConfiguration("dependency", "");
            child.setValue(i.next().toString());
            config.addChild(child);
        }
    }
View Full Code Here

    public PythonProgram(File file, Class clazz, Collection dependecies) {
        this.file = file;
        this.clazz = clazz;

        config = new DefaultConfiguration("", "GeneratorSelector");
        DefaultConfiguration child = new DefaultConfiguration("file", "");
        child.setValue(file.toString());
        config.addChild(child);

        for (Iterator i = dependecies.iterator(); i.hasNext(); ) {
            child = new DefaultConfiguration("dependency", "");
            child.setValue(i.next().toString());
            config.addChild(child);
        }
    }
View Full Code Here

     */
    public void initialize()
            throws Exception {
        try {
            //prepare Configurations for object and stream repositories
            DefaultConfiguration objectConfiguration
                = new DefaultConfiguration( "repository",
                                            "generated:AvalonFileRepository.compose()" );

            objectConfiguration.setAttribute("destinationURL", destination);
            objectConfiguration.setAttribute("type", "OBJECT");
            objectConfiguration.setAttribute("model", "SYNCHRONOUS");

            DefaultConfiguration streamConfiguration
                = new DefaultConfiguration( "repository",
                                            "generated:AvalonFileRepository.compose()" );

            streamConfiguration.setAttribute( "destinationURL", destination );
            streamConfiguration.setAttribute( "type", "STREAM" );
            streamConfiguration.setAttribute( "model", "SYNCHRONOUS" );

            sr = (StreamRepository) store.select(streamConfiguration);
            or = (ObjectRepository) store.select(objectConfiguration);
            lock = new Lock();
            keys = Collections.synchronizedSet(new HashSet());
View Full Code Here

        try {
            if (filestore != null) {
                Store store = (Store)componentManager.
                        lookup("org.apache.avalon.cornerstone.services.store.Store");
                //prepare Configurations for stream repositories
                DefaultConfiguration streamConfiguration
                    = new DefaultConfiguration( "repository",
                                                "generated:JDBCMailRepository.configure()" );

                streamConfiguration.setAttribute( "destinationURL", filestore );
                streamConfiguration.setAttribute( "type", "STREAM" );
                streamConfiguration.setAttribute( "model", "SYNCHRONOUS" );
                sr = (StreamRepository) store.select(streamConfiguration);

                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Got filestore for JdbcMailRepository: " + filestore);
                }
View Full Code Here

        try {
            // Instantiate the a MailRepository for outgoing mails
            MailStore mailstore = (MailStore) compMgr.lookup("org.apache.james.services.MailStore");

            DefaultConfiguration spoolConf
                = new DefaultConfiguration("repository", "generated:RemoteDelivery.java");
            spoolConf.setAttribute("destinationURL", outgoingPath);
            spoolConf.setAttribute("type", "SPOOL");
            outgoing = (SpoolRepository) mailstore.select(spoolConf);
        } catch (ComponentException cnfe) {
            log("Failed to retrieve Store component:" + cnfe.getMessage());
        } catch (Exception e) {
            log("Failed to retrieve Store component:" + e.getMessage());
View Full Code Here

   * Create a configuration from the current user details. Can be used for saving.
   *
   * @return a <code>Configuration</code>
   */
  protected Configuration createConfiguration() {
    DefaultConfiguration config = new DefaultConfiguration(IP_RANGE);
    new ItemConfiguration().save(this, config);

    DefaultConfiguration networkAddressConfig =
      new DefaultConfiguration(ELEMENT_NETWORK_ADDRESS);
    networkAddressConfig.setValue(getNetworkAddress().getHostAddress());
    config.addChild(networkAddressConfig);

    DefaultConfiguration subnetMaskConfig = new DefaultConfiguration(ELEMENT_SUBNET_MASK);
    subnetMaskConfig.setValue(getSubnetMask().getHostAddress());
    config.addChild(subnetMaskConfig);

    return 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.