Package org.apache.avalon.meta.info

Examples of org.apache.avalon.meta.info.Type


                }
                writeService( service );
            }
            else
            {
                Type type = new TypeTag( javaClass ).getType();
                if( type == null )
                {
                    continue;
                }
View Full Code Here


          new DependencyTag( getJavaClass() ).getDependencies();
        final StageDescriptor[] stages = new StageTag( getJavaClass() ).getStages();
        final ExtensionDescriptor[] extensions = new ExtensionTag( getJavaClass() ).getExtensions();
        final ContextDescriptor context = new ContextTag( getJavaClass() ).getContext();

        return new Type( info, loggers, context, services, dependencies, stages, extensions, null );
    }
View Full Code Here

        final StageDescriptor[] phases = buildStages( configuration );

        configuration = info.getChild( "extensions" );
        final ExtensionDescriptor[] extensions = buildExtensions( configuration );

        return new Type(
          descriptor, loggers, context, services, dependencies, phases,
          extensions, defaults );
    }
View Full Code Here

        configuration = info.getChild( "extensions" );
        final ExtensionDescriptor[] extensions =
          buildExtensions( configuration );

        return new Type(
            descriptor, loggers, context, services, dependencies,
            phases, extensions );
    }
View Full Code Here

        //
        // build the configuration defaults and the profiles and
        // supply these as arguments to thye type build
        //

        final Type info = buildFromSerDescriptor( clazz );
        if( null != info )
        {
            return info;
        }
        else
View Full Code Here

     * @throws Exception if an error occurs
     */
    private Type buildFromSerDescriptor( final Class clazz )
        throws Exception
    {
        Type type = buildFromSerDescriptor( clazz, ".ztype" );
        if( type != null )
        {
            return type;
        }
        else
View Full Code Here

                        fail( "Unexpected (invalid) service reference: " + service );
                    }
                }
                else
                {
                    Type type = new TypeTag( c ).getType();
                    if( type == null )
                    {
                        fail( "encounter null type: " + c );
                    }
                    if( type.getInfo().getClassname().equals( PRIMARY ) )
                    {
                        m_primary = type;
                    }
                    else if( type.getInfo().getClassname().equals( SECONDARY ) )
                    {
                        m_secondary = type;
                    }
                    else
                    {
View Full Code Here

        assertTrue( "classname", service.getClassname().equals( SECONDARY_S ) );
    }

    public void testPrimaryType() throws Exception
    {
        Type type = m_primary;
        assertTrue( "version", type.getInfo().getVersion().toString().equals( "1.3.0" ) );
        assertTrue( "name", type.getInfo().getName().equals( "primary-component" ) );
        assertTrue(
          "lifestyle", type.getInfo().getLifestyle().equals( "singleton" ) );

        ContextDescriptor context = m_primary.getContext();
        EntryDescriptor entry = context.getEntry( "home" );
        if( entry == null )
        {
View Full Code Here

        }
    }

    public void testSecondaryType() throws Exception
    {
        Type type = m_secondary;
        assertTrue( "version", type.getInfo().getVersion().toString().equals( "2.4.0" ) );
        assertTrue( "name", type.getInfo().getName().equals( "secondary-component" ) );
        CategoryDescriptor[] loggers = type.getCategories();
        if( loggers.length == 1 )
        {
            CategoryDescriptor logger = loggers[0];
            if( !logger.getName().equals( "system" ) )
            {
                assertTrue( "Logger name is not system", false );
                throw new Exception( "Logger name is not system" );
            }
        }
        else
        {
            assertTrue( "Loggers length != 1", false );
            throw new Exception( "Loggers length != 1" );
        }
        DependencyDescriptor[] dependencies = type.getDependencies();
        if( dependencies.length == 1 )
        {
            DependencyDescriptor dep = dependencies[0];
            if( !dep.getReference().getClassname().equals( PRIMARY_S ) )
            {
                assertTrue( "dependency classname", false );
                throw new Exception( "Dependency name is incorrect" );
            }
            if( !dep.getReference().getVersion().toString().equals( "1.3.0" ) )
            {
                assertTrue( "dependency version: " + dep.getReference().getVersion(), false );
                throw new Exception( "Dependency version is incorrect" );
            }
            if( !dep.getKey().equals( "primary" ) )
            {
                assertTrue( "dependency role : " + dep.getKey(), false );
                throw new Exception( "Dependency role name is incortrect" );
            }
        }
        else
        {
            throw new Exception( "Dependency length != 1" );
        }

        //
        // test if the service descriptor is valid
        //

        ServiceDescriptor[] services = type.getServices();
        if( services.length == 1 )
        {
            ServiceDescriptor dep = services[0];
            if( !dep.getReference().getClassname().equals( SECONDARY_S ) )
            {
View Full Code Here

        configuration = info.getChild( "extensions" );
        final ExtensionDescriptor[] extensions =
          buildExtensions( configuration );

        return new Type(
            descriptor, loggers, context, services, dependencies,
            phases, extensions );
    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.meta.info.Type

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.