Package org.apache.avalon.excalibur.component

Examples of org.apache.avalon.excalibur.component.ComponentHandler


        }
    }

    public Component select(Object hint) throws ComponentException {

        ComponentHandler handler = (ComponentHandler) this.componentHandlers.get(hint);
        if (handler == null) {
            throw new ComponentException(ROLE, "Could not find component for hint: " + hint);
        }

        try {
            Component component = (Component) handler.get();
            componentMapping.put(component, handler);
            return component;
        } catch (Exception ce) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("Could not access component for hint: " + hint, ce);
View Full Code Here


            throw new ComponentException(ROLE, "Could not access component for hint: " + hint, ce);
        }
    }

    public void release(Component component) {
        ComponentHandler handler = (ComponentHandler)componentMapping.remove(component);
        if (handler != null) {
            try {
                handler.put(component);
            } catch (Exception e) {
                getLogger().error("Error trying to release component", e);
            }
        }
    }
View Full Code Here

    protected void addGenerator(ComponentManager newManager,
                                Object hint, Program generator)
            throws Exception {
        try {
            final ComponentHandler handler =
                    generator.getHandler(newManager, this.context, this.roles, this.logKitManager);
            handler.enableLogging(getLogger());
            handler.initialize();
            this.componentHandlers.put(hint, handler);
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Adding " + generator.getName() + " for " + hint);
            }
        } catch(final Exception e) {
View Full Code Here

            throw e;
        }
    }

    protected void removeGenerator(Object hint) {
        ComponentHandler handler = (ComponentHandler) this.componentHandlers.remove(hint);
        if (handler != null) {
            handler.dispose();
            this.classManager.reinstantiate();
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Removing " + handler.getClass().getName() + " for " + hint.toString());
            }
        }
    }
View Full Code Here

            Iterator keys = this.componentHandlers.keySet().iterator();
            List keyList = new ArrayList();

            while(keys.hasNext()) {
                Object key = keys.next();
                ComponentHandler handler =
                    (ComponentHandler)this.componentHandlers.get(key);

                handler.dispose();

                keyList.add(key);
            }

            keys = keyList.iterator();
View Full Code Here

        }
    }

    public Component select(Object hint) throws ComponentException {

        ComponentHandler handler = (ComponentHandler) this.componentHandlers.get(hint);
        if (handler == null) {
            throw new ComponentException("Could not find component for hint: " + hint);
        }

        try {
            Component component = (Component) handler.get();
            componentMapping.put(component, handler);
            return component;
        } catch (Exception ce) {
            getLogger().debug("Could not access component for hint: " + hint, ce);
            throw new ComponentException("Could not access component for hint: " + hint, null);
View Full Code Here

            throw new ComponentException("Could not access component for hint: " + hint, null);
        }
    }

    public void release(Component component) {
        ComponentHandler handler = (ComponentHandler)componentMapping.remove(component);
        if (handler != null) {
            try {
                handler.put(component);
            } catch (Exception e) {
                getLogger().error("Error trying to release component", e);
            }
        }
    }
View Full Code Here

    protected void addGenerator(ComponentManager newManager,
                                Object hint, Program generator)
            throws Exception {
        try {
            final ComponentHandler handler =
                    generator.getHandler(newManager, this.context, this.roles, this.logKitManager);
            handler.setLogger(getLogger());
            handler.initialize();
            this.componentHandlers.put(hint, handler);
            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Adding " + generator.getName() + " for " + hint);
            }
        } catch(final Exception e) {
View Full Code Here

            throw e;
        }
    }

    protected void removeGenerator(Object hint) {
        ComponentHandler handler = (ComponentHandler) this.componentHandlers.remove(hint);
        if (handler != null) {
            handler.dispose();
            this.classManager.reinstantiate();
            getLogger().debug("Removing " + handler.getClass().getName() + " for " + hint.toString());
        }
    }
View Full Code Here

            Iterator keys = this.componentHandlers.keySet().iterator();
            List keyList = new ArrayList();

            while(keys.hasNext()) {
                Object key = keys.next();
                ComponentHandler handler =
                    (ComponentHandler)this.componentHandlers.get(key);

                handler.dispose();

                keyList.add(key);
            }

            keys = keyList.iterator();
View Full Code Here

TOP

Related Classes of org.apache.avalon.excalibur.component.ComponentHandler

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.