Package org.codehaus.loom.components.util.metadata

Examples of org.codehaus.loom.components.util.metadata.DependencyDirective


        final HashMap services = new HashMap();

        for( int i = 0; i < dependencies.length; i++ )
        {
            final DependencyDirective dependency = dependencies[ i ];
            final String key = dependency.getKey();
            final String providerName = dependency.getProviderName();
            final boolean optional = info.getDependency( key ).isOptional();

            final Object service =
                getService( providerName, entry );
            if( null == service )
View Full Code Here


        final DependencyDirective[] dependencies = component.getTemplate()
            .getDependencies();

        for( int i = 0; i < dependencies.length; i++ )
        {
            final DependencyDirective dependency = dependencies[ i ];
            final String providerName = dependency.getProviderName();
            final String key = dependency.getKey();
            final String type = info.getDependency( key ).getComponentType();

            //Get the other component that is providing service
            final ComponentProfile provider = getComponentProfile(
                providerName, others );
View Full Code Here

        final ComponentInfo info = component.getInfo();
        final DependencyDescriptor[] dependencies = info.getDependencies();
        for( int i = 0; i < dependencies.length; i++ )
        {
            final DependencyDescriptor dependency = dependencies[ i ];
            final DependencyDirective dependencyMetaData =
                component.getTemplate().getDependency( dependency.getKey() );

            //If there is no metaData then the user has failed
            //to specify a needed dependency.
            if( null == dependencyMetaData && !dependency.isOptional() )
View Full Code Here

            final String key = descriptors[ i ].getKey();
            final DependencyDirective[] dependencySet = block.getTemplate()
                .getDependencies( key );
            for( int j = 0; j < dependencySet.length; j++ )
            {
                final DependencyDirective dependency = dependencySet[ j ];
                final ComponentProfile other = getBlock(
                    dependency.getProviderName(), blocks );
                visitBlock( other, blocks, true, done, order );
            }
        }
    }
View Full Code Here

        throws ConfigurationException
    {
        final ArrayList dependencies = new ArrayList();
        for( int j = 0; j < provides.length; j++ )
        {
            final DependencyDirective directive = buildDependency(
                provides[ j ] );
            dependencies.add( directive );
        }

        return (DependencyDirective[])dependencies.toArray(
View Full Code Here

        throws ConfigurationException
    {
        final String requiredName = provide.getAttribute( "name" );
        final String alias = provide.getAttribute( "alias", requiredName );
        final String key = provide.getAttribute( "role" );
        return new DependencyDirective( key, requiredName, alias );
    }
View Full Code Here

        final DependencyDirective[] roles = blockEntry.getTemplate()
            .getDependencies();

        for( int i = 0; i < roles.length; i++ )
        {
            final DependencyDirective role = roles[ i ];
            final Object dependency = m_application.getBlock(
                role.getProviderName() );

            final String key = role.getKey();
            final DependencyDescriptor candidate =
                info.getDependency( key );

            if( candidate.isArray() )
            {
                ArrayList list = (ArrayList)sets.get( key );
                if( null == list )
                {
                    list = new ArrayList();
                    sets.put( key, list );
                }

                list.add( dependency );
            }
            else if( candidate.isMap() )
            {
                HashMap smap = (HashMap)sets.get( key );
                if( null == smap )
                {
                    smap = new HashMap();
                    sets.put( key, smap );
                }

                smap.put( role.getAlias(), dependency );
            }
            else
            {
                map.put( key, dependency );
            }
View Full Code Here

    extends TestCase
{
    public void testBasic()
        throws Exception
    {
        final DependencyDirective dependency =
            new DependencyDirective( Service1.class.getName(),
                                     "c2",
                                     Service1.class.getName() );
        final ComponentTemplate c1MetaData =
            new ComponentTemplate( "c1",
                                   Component1.class.getName(),
View Full Code Here

    }

    public void testComplex()
        throws Exception
    {
        final DependencyDirective dependency1 =
            new DependencyDirective(
                Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
                "c2a",
                Service1.class.getName() );
        final DependencyDirective dependency2 =
            new DependencyDirective(
                Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
                "c2b",
                Service1.class.getName() );
        final DependencyDirective dependency3 =
            new DependencyDirective(
                Service1.class.getName() + DependencyDescriptor.ARRAY_POSTFIX,
                "c2c",
                Service1.class.getName() );
        final ComponentTemplate c3MetaData =
            new ComponentTemplate( "c3",
View Full Code Here

    {
        final ComponentTemplate md1 =
            new ComponentTemplate( "c1",
                                   C1_NAME,
                                   new DependencyDirective[]{
                                       new DependencyDirective( S1_NAME,
                                                                "c2",
                                                                "c2" )},
                                   null,
                                   null,
                                   false );
View Full Code Here

TOP

Related Classes of org.codehaus.loom.components.util.metadata.DependencyDirective

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.