Examples of ComponentHandler


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

            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

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

        try {
            return super.select(hint);
        } catch (Exception e) {
            // if it isn't loaded, it may already be compiled...
            try {
                ComponentHandler handler = (ComponentHandler) this.componentHandlers.get(hint);
                Component component = (Component) handler.get();
                componentMapping.put(component, handler);
                return component;
            } catch (Exception ce) {
                getLogger().debug("Could not access component for hint: " + hint);
                throw new ComponentException("Could not access component for hint: " + hint, null);
View Full Code Here

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

            }
        }
    }

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

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

    }

    protected void addGenerator(ComponentManager newManager, Object hint, Class generator) throws Exception {
        try
        {
            final ComponentHandler handler =
                ComponentHandler.getComponentHandler( generator,
                                                      new DefaultConfiguration("", "GeneratorSelector"),
                                                      newManager,
                                                      this.context,
                                                      this.roles,
                                                      this.logKitManager );

            handler.setLogger( getLogger() );
            handler.initialize();
            this.componentHandlers.put( hint, handler );
            getLogger().debug( "Adding " + generator.getName() + " for " + hint.toString() );
        }
        catch( final Exception e )
        {
View Full Code Here

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

            throw e;
        }
    }

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

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

            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

Examples of org.apache.avalon.fortress.impl.handler.ComponentHandler

      throw new ServiceException(role, message);
    }

    try
    {
      final ComponentHandler handler = (ComponentHandler) result;
      final Object component = handler.get();

      m_used.put(new ComponentKeelKey(component), handler);

      return component;
    }
View Full Code Here

Examples of org.apache.avalon.fortress.impl.handler.ComponentHandler

  public void release(final Object component)
  {
    try
    {
      final ComponentHandler handler = (ComponentHandler) m_used.remove(new ComponentKeelKey(component));

      if (null == handler)
      {
        if (null == m_parent)
        {
          /*
           * This is a purplexing problem. SOmetimes the m_used hash
           * returns null for the component--usually a ThreadSafe
           * component. When there is no handler and no parent, that
           * is an error condition--but if the component is usually
           * ThreadSafe, the impact is essentially nill.
           */

          // Pete: This occurs when objects are released more often
          // than
          // when they are aquired
          // Pete: It also happens when a release of a
          // ComponentSelector occurs
        }
        else
        {
          m_parent.release(component);
        }
      }
      else
      {
        handler.put(component);
      }
    }
    catch (Exception x)
    {
      System.out.println("ERROR [KeelServiceManager]: " + x);
View Full Code Here

Examples of org.apache.avalon.fortress.impl.handler.ComponentHandler

        super( name );
    }

    public void testComponentHandlerEntry()
    {
        ComponentHandler handler = new TestComponentHandler();
        ComponentHandlerMetaData meta = new ComponentHandlerMetaData(
            "component1", Component1.class.getName(),
            new DefaultConfiguration( "test" ), true );
        ComponentHandlerEntry entry = new ComponentHandlerEntry( handler, meta );
View Full Code Here

Examples of org.apache.avalon.fortress.impl.handler.ComponentHandler

        assertSame( meta, entry.getMetaData() );
    }

    public void testNullPointerException()
    {
        ComponentHandler handler = new TestComponentHandler();
        ComponentHandlerMetaData meta = new ComponentHandlerMetaData(
            "component1", Component1.class.getName(),
            new DefaultConfiguration( "test" ), true );

        try
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.