Package org.codehaus.loom.components.util.info

Examples of org.codehaus.loom.components.util.info.ComponentInfo


            component.getTemplate().getDependencies();

        for( int i = 0; i < dependencySet.length; i++ )
        {
            final String key = dependencySet[ i ].getKey();
            final ComponentInfo info = component.getInfo();
            final DependencyDescriptor descriptor = info.getDependency( key );

            //If there is no dependency descriptor in ComponentInfo then
            //user has specified an uneeded dependency.
            if( null == descriptor )
            {
                final String name = dependencySet[ i ].getProviderName();
                final String message =
                    REZ.format( "assembly.unknown-dependency.error",
                                name,
                                key,
                                component.getTemplate().getName() );
                throw new Exception( message );
            }
        }

        //Make sure all dependencies in ComponentInfo file are satisfied
        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() );
View Full Code Here


    {
        final BlockEntry blockEntry = getBlockEntry( entry );
        final HashMap map = new HashMap();
        final HashMap sets = new HashMap();

        final ComponentInfo info = blockEntry.getInfo();
        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 );
            }
        }

        final Iterator iterator = sets.keySet().iterator();
        while( iterator.hasNext() )
        {
            final String key = (String)iterator.next();
            final Object value = sets.get( key );
            if( value instanceof List )
            {
                final List list = (List)value;
                final DependencyDescriptor dependency = info.getDependency(
                    key );

                final Object[] result = toArray( list,
                                                 dependency.getComponentType() );
                map.put( key, result );
View Full Code Here

            new PartitionTemplate( "assembly1",
                                   new String[ 0 ],
                                   new PartitionTemplate[]{blockMetaData,
                                                           listenerMetaData},
                                   ComponentTemplate.EMPTY_SET );
        final ComponentInfo c1Info =
            new ComponentInfo( Component1.class,
                               ServiceDescriptor.EMPTY_SET,
                               new DependencyDescriptor[]{
                                   new DependencyDescriptor(
                                       Service1.class.getName(),
                                       Service1.class.getName(),
                                       false )},
                               null );
        final ComponentInfo c2Info =
            new ComponentInfo( Component2.class,
                               new ServiceDescriptor[]{
                                   new ServiceDescriptor(
                                       Service1.class.getName() )},
                               DependencyDescriptor.EMPTY_SET,
                               null );
View Full Code Here

                                   new String[ 0 ],
                                   new PartitionTemplate[]{blockMetaData,
                                                           listenerMetaData},
                                   ComponentTemplate.EMPTY_SET );

        final ComponentInfo c3Info =
            new ComponentInfo( Component3.class,
                               ServiceDescriptor.EMPTY_SET,
                               new DependencyDescriptor[]{
                                   new DependencyDescriptor(
                                       Service1.class.getName() +
                                       DependencyDescriptor.ARRAY_POSTFIX,
                                       Service1.class.getName() +
                                       DependencyDescriptor.ARRAY_POSTFIX,
                                       false )},
                               null );
        final ComponentInfo c2Info =
            new ComponentInfo( Component2.class,
                               new ServiceDescriptor[]{
                                   new ServiceDescriptor(
                                       Service1.class.getName() )},
                               DependencyDescriptor.EMPTY_SET,
                               null );
View Full Code Here

TOP

Related Classes of org.codehaus.loom.components.util.info.ComponentInfo

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.