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

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


    {
        final ArrayList componentSet = new ArrayList();
        final ComponentTemplate[] components = metaData.getComponents();
        for( int i = 0; i < components.length; i++ )
        {
            final ComponentTemplate component = components[i];
            final Class type = classLoader.loadClass( component.getImplementationKey() );
            final ComponentInfo info = createListenerInfo( type );
            final ComponentProfile profile = new ComponentProfile( info,
                                                                   component );
            componentSet.add( profile );
        }
View Full Code Here


        final ArrayList componentSet = new ArrayList();
        final ComponentTemplate[] components = metaData.getComponents();
        for( int i = 0; i < components.length; i++ )
        {
            final ComponentTemplate component = components[i];
            final ComponentInfo info =
                factory.createInfo( component.getImplementationKey() );
            final ComponentProfile profile = new ComponentProfile( info,
                                                                   component );
            componentSet.add( profile );
        }
View Full Code Here

     */
    private void verifyBlockType( final ComponentProfile block,
                                  final ClassLoader classLoader )
        throws Exception
    {
        final ComponentTemplate metaData = block.getTemplate();
        final Class clazz = loadClass( "block", metaData, classLoader );

        m_infoVerifier.verifyType( metaData.getName(),
                                   block.getInfo().getType() );

        if( BLOCK_CLASS.isAssignableFrom( clazz ) )
        {
            final String message =
                REZ.format( "verifier.implements-block.error",
                            metaData.getName(),
                            metaData.getImplementationKey() );
            getLogger().error( message );
            System.err.println( message );
        }
    }
View Full Code Here

     */
    private void verifyListenerType( final ComponentProfile listener,
                                     final ClassLoader classLoader )
        throws Exception
    {
        final ComponentTemplate metaData = listener.getTemplate();
        final Class clazz = loadClass( "listener", metaData, classLoader );
        if( !BLOCKLISTENER_CLASS.isAssignableFrom( clazz ) )
        {
            final String message =
                REZ.format( "listener-noimpl-listener",
View Full Code Here

     * @throws java.lang.Exception if unable to create component
     */
    public Object createObject( final Object entry )
        throws Exception
    {
        final ComponentTemplate component = getMetaData( entry );
        final String implementationKey = component.getImplementationKey();
        return m_factory.createComponent( implementationKey );
    }
View Full Code Here

     * @throws java.lang.Exception if unable to create resource
     */
    public Parameters createParameters( final Object entry )
        throws Exception
    {
        final ComponentTemplate component = getMetaData( entry );
        final Parameters parameters = component.getParameters();
        if( null == parameters )
        {
            final String message =
                REZ.format( "resource.missing-parameters.error",
                            component.getName() );
            throw new Exception( message );
        }
        parameters.makeReadOnly();
        return parameters;
    }
View Full Code Here

     * @throws java.lang.Exception if unable to create resource
     */
    public Configuration createConfiguration( final Object entry )
        throws Exception
    {
        final ComponentTemplate component = getMetaData( entry );
        final Configuration configuration =
            ConfigurationAlchemist.toAvalonConfiguration(
                component.getConfiguration() );
        if( null == configuration )
        {
            final String message =
                REZ.format( "resource.missing-configuration.error",
                            component.getName() );
            throw new Exception( message );
        }
        return configuration;
    }
View Full Code Here

     * @throws java.lang.Exception if error aquiring a service to place in map
     */
    private Map createServiceMap( final Object entry )
        throws Exception
    {
        final ComponentTemplate component = getMetaData( entry );
        final String impl = component.getImplementationKey();
        final ComponentInfo info = m_factory.createInfo( impl );
        final DependencyDirective[] dependencies = component.getDependencies();

        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 )
            {
                final String message =
                    REZ.format( "resource.missing-dependency.error",
                                optional ? "1" : "2",
                                key,
                                component.getName() );
                if( !optional )
                {
                    throw new Exception( message );
                }
                else
View Full Code Here

            final DependencyDirective[] dependencys = buildDependencies(
                provides );

            final Configuration configuration = config.getChild( name );

            return new ComponentTemplate( name, classname,
                                          dependencys, null,
                                          configuration,
                                          disableProxy );
        }
        catch( final ConfigurationException ce )
View Full Code Here

        throws LoomException
    {
        final List listeners = new ArrayList();
        for( int i = 0; i < listenerConfigs.length; i++ )
        {
            final ComponentTemplate listener = buildBlockListener(
                listenerConfigs[ i ], config );
            listeners.add( listener );
        }
        return (ComponentTemplate[])listeners.
            toArray( new ComponentTemplate[ listeners.size() ] );
View Full Code Here

TOP

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

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.