Package org.apache.avalon.fortress

Examples of org.apache.avalon.fortress.MetaInfoEntry


    public void testNullPointerException() throws Exception
    {
        try
        {
            new MetaInfoEntry( null );
            fail( "Did not throw an exception" );
        }
        catch ( NullPointerException npe )
        {
            // SUCCESS!
        }
        catch ( Exception e )
        {
            fail( "Threw wrong exception type: " + e.getClass().getName() );
        }

        try
        {
            new MetaInfoEntry( null, m_properties, m_dependencies );
            fail( "Did not throw an exception" );
        }
        catch ( NullPointerException npe )
        {
            // SUCCESS!
        }
        catch ( Exception e )
        {
            fail( "Threw wrong exception type: " + e.getClass().getName() );
        }

        try
        {
            new MetaInfoEntry( m_componentClass, null, m_dependencies );
            fail( "Did not throw an exception" );
        }
        catch ( NullPointerException npe )
        {
            // SUCCESS!
        }
        catch ( Exception e )
        {
            fail( "Threw wrong exception type: " + e.getClass().getName() );
        }

        try
        {
            new MetaInfoEntry( m_componentClass, m_properties, null );
            fail( "Did not throw an exception" );
        }
        catch ( NullPointerException npe )
        {
            // SUCCESS!
        }
        catch ( Exception e )
        {
            fail( "Threw wrong exception type: " + e.getClass().getName() );
        }

        try
        {
            MetaInfoEntry entry = new MetaInfoEntry( m_componentClass, m_properties, m_dependencies );
            entry.addRole( null );
            fail( "Did not throw an exception" );
        }
        catch ( NullPointerException npe )
        {
            // SUCCESS!
        }
        catch ( Exception e )
        {
            fail( "Threw wrong exception type: " + e.getClass().getName() );
        }

        try
        {
            MetaInfoEntry entry = new MetaInfoEntry( m_componentClass, m_properties, m_dependencies );
            entry.addRole( Role1.class.getName() );
            entry.containsRole( null );
            fail( "Did not throw an exception" );
        }
        catch ( NullPointerException npe )
        {
            // SUCCESS!
View Full Code Here


        {
            className = config.getAttribute( "class" );
        }
        else
        {
            final MetaInfoEntry roleEntry = m_metaManager.getMetaInfoForShortName( config.getName() );
            if ( null == roleEntry )
            {
                final String message = "No class found matching configuration name " +
                    "[name: " + config.getName() + ", location: " + config.getLocation() + "]";
                throw new ConfigurationException( message );
            }

            className = roleEntry.getComponentClass().getName();
        }

        if ( getLogger().isDebugEnabled() )
        {
            getLogger().debug( "Configuration processed for: " + className );
View Full Code Here

    protected void addComponent( final ComponentHandlerMetaData metaData )
            throws IllegalArgumentException, Exception
    {
        // figure out Role
        final String classname = metaData.getClassname();
        final MetaInfoEntry metaEntry = m_metaManager.getMetaInfoForClassname( classname );
        if ( null == metaEntry )
        {
            final String message = "No role defined for " + classname;
            throw new IllegalArgumentException( message );
        }

        if ( DEFAULT_ENTRY.equals( metaData.getName() ) ||
                SELECTOR_ENTRY.equals( metaData.getName() ) )
        {
            throw new IllegalArgumentException( "Using a reserved id name" + metaData.getName() );
        }

        Iterator it = metaEntry.getRoles();
        // create a handler for the combo of Role+MetaData
        final ComponentHandler handler =
                getComponentHandler( metaEntry, metaData );

        while ( it.hasNext() )
View Full Code Here

                v = new Vertex( name, entry.getHandler() );
                vertexMap.put( name, v );
                vertices.add( v );
            }

            MetaInfoEntry meta = m_metaManager.getMetaInfoForClassname( metaData.getClassname() );

            Iterator dit = meta.getDependencies().iterator();
            while ( dit.hasNext() )
            {
                Map deps = (Map) m_mapper.get( dit.next() );

                /* Ignore for now...  It is probably due to a component requiring a Container
View Full Code Here

                                 final Properties meta,
                                 final List deps )
    {
        final Class klass;

        MetaInfoEntry entry = (MetaInfoEntry) m_classnames.get( className );

        if ( null != entry )
        {
            entry.addRole( role );
            return;
        }

        if ( getLogger().isDebugEnabled() )
        {
            getLogger().debug( "addComponent component: type='" + className +
                "', meta='" + meta.toString() + "', role='" + role + "', with deps=" + deps );
        }

        try
        {
            klass = m_loader.loadClass( className );
        }
        catch ( final ClassNotFoundException e )
        {
            final String message =
                "Unable to load class " + className + ". Skipping.";
            getLogger().warn( message );
            // Do not store reference if class does not exist.
            return;
        }

        try
        {
            entry = new MetaInfoEntry( klass, meta, deps );
            entry.addRole( role );

            m_shorthands.put( entry.getConfigurationName(), entry );
            m_classnames.put( className, entry );
        }
        catch ( ClassNotFoundException cfne )
        {
            final String message =
View Full Code Here

     *
     * @return the proper {@link MetaInfoEntry}
     */
    public MetaInfoEntry getMetaInfoForClassname( final String classname )
    {
        final MetaInfoEntry metaEntry = (MetaInfoEntry) m_classnames.get( classname );
        if ( null != metaEntry )
        {
            return metaEntry;
        }
        else if ( null != m_parent )
View Full Code Here

     * @param shortname the short name
     * @return the proper {@link MetaInfoEntry}
     */
    public MetaInfoEntry getMetaInfoForShortName( final String shortname )
    {
        final MetaInfoEntry metaEntry = (MetaInfoEntry) m_shorthands.get( shortname );
        if ( null != metaEntry )
        {
            return metaEntry;
        }
        else if ( null != m_parent )
View Full Code Here

    {
        final RoleEntry roleEntry = m_manager.getRoleForShortName( shortname );

        if ( roleEntry != null )
        {
            return new MetaInfoEntry( roleEntry );
        }
        else
        {
            return null != m_parent ? m_parent.getMetaInfoForShortName(shortname ) : null;
        }
View Full Code Here

    {
        final RoleEntry roleEntry = m_manager.getRoleForClassname( classname );

        if ( roleEntry != null )
        {
            return new MetaInfoEntry( roleEntry );
        }
        else
        {
            return null != m_parent ? m_parent.getMetaInfoForClassname( classname ) : null;
        }
View Full Code Here

TOP

Related Classes of org.apache.avalon.fortress.MetaInfoEntry

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.