Package org.apache.avalon.framework.service

Examples of org.apache.avalon.framework.service.DefaultServiceSelector


    }

    protected void setUp()
        throws Exception
    {
        m_componentSelector = new DefaultServiceSelector();
        m_exceptionThrown =false;
    }
View Full Code Here


    }

    protected void setUp()
        throws Exception
    {
        m_componentSelector = new DefaultServiceSelector();
        m_exceptionThrown =false;
    }
View Full Code Here

        // create a selector and add the factory to the selector,
        // add the selector to the manager, and service the resolver
        // NOTE: javadoc missing on the serviceable method
        //

        final DefaultServiceSelector selector = new DefaultServiceSelector();
        selector.put( "resource", factory );

        final DefaultServiceManager manager = new DefaultServiceManager();
        manager.put( SourceFactory.ROLE + "Selector", selector );

        resolver.service( manager );
View Full Code Here

    }

    protected void setUp()
        throws Exception
    {
        m_componentSelector = new DefaultServiceSelector();
        m_exceptionThrown =false;
    }
View Full Code Here

        }

        // matchers
        Configuration child = components.getChild("matchers",false);
        if (child != null) {
            final DefaultServiceSelector matcherSelector = new DefaultServiceSelector();
            m_defaultMatcher = child.getAttribute("default");
            final Configuration[] matchers = child.getChildren("matcher");
            for (int i = 0; i < matchers.length; i++) {
                String name = matchers[i].getAttribute("name");
                String src  = matchers[i].getAttribute("src");
                Matcher matcher = (Matcher) createComponent(src, matchers[i]);
                matcherSelector.put(name, matcher);
            }
            matcherSelector.makeReadOnly();
            if (!matcherSelector.isSelectable(m_defaultMatcher)) {
                throw new ConfigurationException("Default matcher is not defined.");
            }
            m_manager.put(Matcher.ROLE+"Selector", matcherSelector);
        }

        // selectors
        child = components.getChild("selectors",false);
        if (child != null) {
            final DefaultServiceSelector selectorSelector = new DefaultServiceSelector();
            m_defaultSelector = child.getAttribute("default");
            final Configuration[] selectors = child.getChildren("selector");
            for (int i = 0; i < selectors.length; i++) {
                String name = selectors[i].getAttribute("name");
                String src  = selectors[i].getAttribute("src");
                Selector selector = (Selector) createComponent(src,selectors[i]);
                selectorSelector.put(name,selector);
            }
            selectorSelector.makeReadOnly();
            if (!selectorSelector.isSelectable(m_defaultSelector)) {
                throw new ConfigurationException("Default selector is not defined.");
            }
            m_manager.put(Selector.ROLE+"Selector",selectorSelector);
        }
       
        // actions
        child = components.getChild("actions",false);
        if (child != null) {
            final DefaultServiceSelector actionSelector = new DefaultServiceSelector();
            m_defaultAction = child.getAttribute("default");
            final Configuration[] actions = child.getChildren("action");
            for (int i = 0; i < actions.length; i++) {
                String name = actions[i].getAttribute("name");
                String src  = actions[i].getAttribute("src");
                Action action = (Action) createComponent(src,actions[i]);
                actionSelector.put(name,action);
            }
            actionSelector.makeReadOnly();
            if (!actionSelector.isSelectable(m_defaultAction)) {
                throw new ConfigurationException("Default action is not defined.");
            }
            m_manager.put(Action.ROLE+"Selector",actionSelector);
        }
View Full Code Here

        final Configuration components = configuration.getChild("components");

        // matchers
        Configuration child = components.getChild("matchers",false);
        if (child != null) {
            final DefaultServiceSelector matcherSelector = new DefaultServiceSelector();
            m_defaultMatcher = child.getAttribute("default");
            final Configuration[] matchers = child.getChildren("matcher");
            for (int i = 0; i < matchers.length; i++) {
                String name = matchers[i].getAttribute("name");
                String src  = matchers[i].getAttribute("src");
                Matcher matcher = (Matcher) createComponent(src, matchers[i]);
                matcherSelector.put(name, matcher);
            }
            matcherSelector.makeReadOnly();
            if (!matcherSelector.isSelectable(m_defaultMatcher)) {
                throw new ConfigurationException("Default matcher is not defined.");
            }
            m_manager.put(Matcher.ROLE+"Selector", matcherSelector);
        }

        // selectors
        child = components.getChild("selectors",false);
        if (child != null) {
            final DefaultServiceSelector selectorSelector = new DefaultServiceSelector();
            m_defaultSelector = child.getAttribute("default");
            final Configuration[] selectors = child.getChildren("selector");
            for (int i = 0; i < selectors.length; i++) {
                String name = selectors[i].getAttribute("name");
                String src  = selectors[i].getAttribute("src");
                Selector selector = (Selector) createComponent(src,selectors[i]);
                selectorSelector.put(name,selector);
            }
            selectorSelector.makeReadOnly();
            if (!selectorSelector.isSelectable(m_defaultSelector)) {
                throw new ConfigurationException("Default selector is not defined.");
            }
            m_manager.put(Selector.ROLE+"Selector",selectorSelector);
        }
View Full Code Here

        final Configuration components = configuration.getChild("components");

        // matchers
        Configuration child = components.getChild("matchers",false);
        if (child != null) {
            final DefaultServiceSelector matcherSelector = new DefaultServiceSelector();
            m_defaultMatcher = child.getAttribute("default");
            final Configuration[] matchers = child.getChildren("matcher");
            for (int i = 0; i < matchers.length; i++) {
                String name = matchers[i].getAttribute("name");
                String src  = matchers[i].getAttribute("src");
                Matcher matcher = (Matcher) createComponent(src, matchers[i]);
                matcherSelector.put(name, matcher);
            }
            matcherSelector.makeReadOnly();
            if (!matcherSelector.isSelectable(m_defaultMatcher)) {
                throw new ConfigurationException("Default matcher is not defined.");
            }
            m_manager.put(Matcher.ROLE+"Selector", matcherSelector);
        }

        // selectors
        child = components.getChild("selectors",false);
        if (child != null) {
            final DefaultServiceSelector selectorSelector = new DefaultServiceSelector();
            m_defaultSelector = child.getAttribute("default");
            final Configuration[] selectors = child.getChildren("selector");
            for (int i = 0; i < selectors.length; i++) {
                String name = selectors[i].getAttribute("name");
                String src  = selectors[i].getAttribute("src");
                Selector selector = (Selector) createComponent(src,selectors[i]);
                selectorSelector.put(name,selector);
            }
            selectorSelector.makeReadOnly();
            if (!selectorSelector.isSelectable(m_defaultSelector)) {
                throw new ConfigurationException("Default selector is not defined.");
            }
            m_manager.put(Selector.ROLE+"Selector",selectorSelector);
        }
View Full Code Here

     * @throws Exception when there is an error.
     */
    protected void initializeDefaultSourceResolver() throws Exception
    {
        final DefaultServiceManager manager = new DefaultServiceManager();
        final DefaultServiceSelector selector = new DefaultServiceSelector();
        final URLSourceFactory file = new URLSourceFactory();
        file.enableLogging( getLogger() );
        selector.put( "*", file );
        final ResourceSourceFactory resource = new ResourceSourceFactory();
        resource.enableLogging( getLogger() );
        selector.put( "resource", resource );

        manager.put( ResourceSourceFactory.ROLE + "Selector", selector );

        final SourceResolverImpl resolver = new SourceResolverImpl();
        ContainerUtil.enableLogging( resolver, getLogger() );
View Full Code Here

     * @throws Exception when there is an error.
     */
    protected void initializeDefaultSourceResolver() throws Exception
    {
        final DefaultServiceManager manager = new DefaultServiceManager();
        final DefaultServiceSelector selector = new DefaultServiceSelector();
        final URLSourceFactory file = new URLSourceFactory();
        file.enableLogging( getLogger() );
        selector.put( "*", file );
        final ResourceSourceFactory resource = new ResourceSourceFactory();
        resource.enableLogging( getLogger() );
        selector.put( "resource", resource );

        manager.put( ResourceSourceFactory.ROLE + "Selector", selector );

        final SourceResolverImpl resolver = new SourceResolverImpl();
        ContainerUtil.enableLogging( resolver, getLogger() );
View Full Code Here

        }

        // matchers
        Configuration child = components.getChild("matchers",false);
        if (child != null) {
            final DefaultServiceSelector matcherSelector = new DefaultServiceSelector();
            m_defaultMatcher = child.getAttribute("default");
            final Configuration[] matchers = child.getChildren("matcher");
            for (int i = 0; i < matchers.length; i++) {
                String name = matchers[i].getAttribute("name");
                String src  = matchers[i].getAttribute("src");
                Matcher matcher = (Matcher) createComponent(src, matchers[i]);
                matcherSelector.put(name, matcher);
            }
            matcherSelector.makeReadOnly();
            if (!matcherSelector.isSelectable(m_defaultMatcher)) {
                throw new ConfigurationException("Default matcher is not defined.");
            }
            m_manager.put(Matcher.ROLE+"Selector", matcherSelector);
        }

        // selectors
        child = components.getChild("selectors",false);
        if (child != null) {
            final DefaultServiceSelector selectorSelector = new DefaultServiceSelector();
            m_defaultSelector = child.getAttribute("default");
            final Configuration[] selectors = child.getChildren("selector");
            for (int i = 0; i < selectors.length; i++) {
                String name = selectors[i].getAttribute("name");
                String src  = selectors[i].getAttribute("src");
                Selector selector = (Selector) createComponent(src,selectors[i]);
                selectorSelector.put(name,selector);
            }
            selectorSelector.makeReadOnly();
            if (!selectorSelector.isSelectable(m_defaultSelector)) {
                throw new ConfigurationException("Default selector is not defined.");
            }
            m_manager.put(Selector.ROLE+"Selector",selectorSelector);
        }
       
        // actions
        child = components.getChild("actions",false);
        if (child != null) {
            final DefaultServiceSelector actionSelector = new DefaultServiceSelector();
            m_defaultAction = child.getAttribute("default");
            final Configuration[] actions = child.getChildren("action");
            for (int i = 0; i < actions.length; i++) {
                String name = actions[i].getAttribute("name");
                String src  = actions[i].getAttribute("src");
                Action action = (Action) createComponent(src,actions[i]);
                actionSelector.put(name,action);
            }
            actionSelector.makeReadOnly();
            if (!actionSelector.isSelectable(m_defaultAction)) {
                throw new ConfigurationException("Default action is not defined.");
            }
            m_manager.put(Action.ROLE+"Selector",actionSelector);
        }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.service.DefaultServiceSelector

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.