Package org.apache.avalon.fortress.impl.handler

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


        {
            final String message = "hint cannot be null";
            throw new IllegalArgumentException( message );
        }

        final ComponentHandler handler =
            (ComponentHandler) m_container.get( m_key, hint );
        if ( null == handler )
        {
            final String message =
                "The hint does not exist in the ComponentSelector";
View Full Code Here


        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

        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

            throws Exception
    {
        final Configuration configuration = metaData.getConfiguration();

        // get info from params
        final ComponentHandler handler;

        try
        {
            final ObjectFactory factory =
                    createObjectFactory( classname, configuration );

            // create the appropriate handler instance
            final ComponentHandler targetHandler =
                    (ComponentHandler) handlerClass.newInstance();

            // do the handler lifecycle
            ContainerUtil.enableLogging( targetHandler, getLogger() );
            ContainerUtil.contextualize( targetHandler, m_context );
View Full Code Here

            {
                throw new IllegalArgumentException( "Using a reserved id name" + metaData.getName() );
            }

            // create a handler for the combo of Role+MetaData
            final ComponentHandler handler =
                    getComponentHandler( className,
                                         getComponentHandlerClass( className, shortName),
                                         metaData );

            // put the role into our role mapper. If the role doesn't exist
View Full Code Here

            throw new ServiceException( role, message );
        }

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

            // we only have to keep track of components that don't implement
            // the ReleasableComponent interface
            if ( !(component instanceof ReleasableComponent) )
            {
View Full Code Here

        if ( component instanceof ReleasableComponent )
        {
            ((ReleasableComponent)component).releaseOnComponentHandler();
            return;
        }
        final ComponentHandler handler = (ComponentHandler) m_used.remove( new ComponentKey( 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 );
        }
    }
View Full Code Here

    public Object select( final Object hint )
        throws ServiceException
    {
        try
        {
            final ComponentHandler handler = getHandler( hint );
            final Object component = handler.get();
            // we only have to keep track of components that don't implement
            // the ReleasableComponent interface
            if ( !(component instanceof ReleasableComponent) )
            {
                m_used.put( new ComponentKey( component ), handler );
View Full Code Here

        if ( component instanceof ReleasableComponent )
        {
            ((ReleasableComponent)component).releaseOnComponentHandler();
            return;
        }
        final ComponentHandler handler =
            (ComponentHandler) m_used.remove( new ComponentKey( component ) );
        if ( null != handler )
        {
            handler.put( component );
        }
    }
View Full Code Here

        {
            final String message = "hint cannot be null";
            throw new IllegalArgumentException( message );
        }

        final ComponentHandler handler =
            (ComponentHandler) m_container.get( m_key, hint );
        if ( null == handler )
        {
            final String message =
                "The hint does not exist in the ComponentSelector";
View Full Code Here

TOP

Related Classes of org.apache.avalon.fortress.impl.handler.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.