Package org.apache.felix.scr.impl.manager

Examples of org.apache.felix.scr.impl.manager.SingleComponentManager


     * @throws IllegalAccessException
     */
    private void ensureMethodNotFoundMethod( BaseObject obj, String methodName, DSVersion version )
    {
        ComponentContainer container = newContainer();
        SingleComponentManager icm = new SingleComponentManager( container, new ComponentMethods() );
        ActivateMethod am = new ActivateMethod( methodName, methodName != null, obj.getClass(), version, false, false );
        am.invoke( obj, new ActivatorParameter( m_ctx, -1 ), null, icm );
        Method m = am.getMethod();
        assertNull( m );
        assertNull( obj.getCalledMethod() );
View Full Code Here


    private void testMethod( final String methodName, final T1 component, final DSVersion dsVersion,
        final String expectCallPerformed )
    {
        ComponentContainer container = newContainer();
        SingleComponentManager icm = new SingleComponentManager( container, new ComponentMethods() );
        BindMethod bm = new BindMethod( methodName, component.getClass(),
                FakeService.class.getName(), dsVersion, false, ReferenceMetadata.ReferenceScope.bundle );
        RefPair refPair = new SingleRefPair( m_serviceReference );
        ComponentContextImpl<T1> cc = new ComponentContextImpl(icm, null);
        assertTrue( bm.getServiceObject( cc, refPair, m_context, icm ) );
View Full Code Here

    {
        log( LogService.LOG_DEBUG, "ImmediateComponentHolder configuration deleted for pid {0}",
                new Object[] {pid}, null);

        // component to deconfigure or dispose of
        final SingleComponentManager icm;
        boolean deconfigure = false;

        synchronized ( m_components )
        {
            // FELIX-2231: nothing to do any more, all components have been disposed off
            if (m_singleComponent == null)
            {
                return;
            }

            if ( pid.equals( getComponentMetadata().getConfigurationPid() ) )
            {
                // singleton configuration has pid equal to component name
                icm = m_singleComponent;
                deconfigure = true;
            }
            else
            {
                // remove the component configured with the deleted configuration
                icm = m_components.remove( pid );
                if ( icm == null )
                {
                    // we already removed the component with the deleted configuration
                    return;
                }

                // special casing if the single component is deconfigured
                if ( m_singleComponent == icm )
                {

                    // if the single component is the last remaining, deconfig
                    if ( m_components.isEmpty() )
                    {

                        // if the single component is the last remaining
                        // deconfigure it
                    deconfigure = true;

                    }
                    else
                    {

                        // replace the single component field with another
                        // entry from the map
                        m_singleComponent = m_components.values().iterator().next();

                    }
                }
            }
        }

        // icm may be null if the last configuration deleted was the
        // single component's configuration. Otherwise the component
        // is not the "last" and has to be disposed off
        if ( deconfigure )
        {
          icm.reconfigure( null, -1, null );
        }
        else
        {
            icm.dispose( ComponentConstants.DEACTIVATION_REASON_CONFIGURATION_DELETED );
        }
    }
View Full Code Here

    {
        log( LogService.LOG_DEBUG, "ImmediateComponentHolder configuration updated for pid {0} with properties {1}",
                new Object[] {pid, props}, null);

        // component to update or create
        final SingleComponentManager icm;
        final String message;
        final boolean enable;
        Object[] notEnabledArguments = null;
        boolean created = false;

        synchronized ( m_components )
        {
            // FELIX-2231: nothing to do any more, all components have been disposed off
            if (m_singleComponent == null)
            {
                return false;
            }

            if ( pid.equals( getComponentMetadata().getConfigurationPid() ) )
            {
                // singleton configuration has pid equal to component name
                icm = m_singleComponent;
                message = "ImmediateComponentHolder reconfiguring single component for pid {0} ";
                enable = false;
            }
            else
            {
                final SingleComponentManager existingIcm = m_components.get( pid );
                if ( existingIcm != null )
                {
                    // factory configuration updated for existing component instance
                    icm = existingIcm;
                    message = "ImmediateComponentHolder reconfiguring existing component for pid {0} ";
View Full Code Here

        }
    }

    public TargetedPID getConfigurationTargetedPID(TargetedPID pid)
    {
        SingleComponentManager icm = null;
        synchronized (m_components)
        {
            if ( pid.getServicePid().equals( m_componentMetadata.getConfigurationPid() )) {
                //singleton
                icm = m_singleComponent;
            }
            else
            {
                icm = m_components.get( pid.getServicePid() );
            }
        }
        if ( icm != null)
        {
            return icm.getConfigurationTargetedPID();
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.scr.impl.manager.SingleComponentManager

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.