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

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


            "dependency" );
        final ArrayList dependencies = new ArrayList();

        for( int i = 0; i < elements.length; i++ )
        {
            final DependencyDescriptor dependency = buildDependency( classname,
                                                                     elements[ i ] );
            dependencies.add( dependency );
        }

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


                    "legacy.builder.redundent-key.notice", classname, key );
                getLogger().warn( message );
            }
        }

        return new DependencyDescriptor( key, implementationKey, false );
    }
View Full Code Here

            final Attribute attribute = attributes[i];
            final String key = attribute.getParameter( "key" );
            final String depType = attribute.getParameter( "type" );
            final boolean optional =
              attribute.getParameter( "optional", "" ).equals( "true" );
            deps.add( new DependencyDescriptor( key, depType, optional ) );
        }

        return (DependencyDescriptor[])deps.toArray( DependencyDescriptor.EMPTY_SET );
    }
View Full Code Here

        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() );

            //If there is no metaData then the user has failed
            //to specify a needed dependency.
            if( null == dependencyMetaData && !dependency.isOptional() )
            {
                final String message =
                    REZ.format( "assembly.unspecified-dependency.error",
                                dependency.getKey(),
                                component.getTemplate().getName() );
                throw new Exception( message );
            }
        }
    }
View Full Code Here

            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 );

                if( key.equals( dependency.getType() ) )
                {
                    final String classname =
                        "[L" + dependency.getComponentType() + ";";
                    map.put( classname, result );
                }
            }
            else
            {
View Full Code Here

                                   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 =
View Full Code Here

        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 )},
View Full Code Here

TOP

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

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.