Package org.apache.avalon.fortress

Examples of org.apache.avalon.fortress.MetaInfoEntry


    if (re != null)
    {
      return re.getComponentClass();
    }

    MetaInfoEntry me = utilMetaInfoManager.getMetaInfoForShortName(shortName);

    if (me != null)
    {
      return me.getComponentClass();
    }

    return null;
  }
View Full Code Here


    if (re != null)
    {
      return re.getComponentClass();
    }

    MetaInfoEntry me = utilMetaInfoManager.getMetaInfoForShortName(shortName);

    if (me != null)
    {
      return me.getComponentClass();
    }

    return null;
  }
View Full Code Here

        m_lifecycleMap = Collections.unmodifiableMap( lifecycleMap );
    }

    public void testFullySpecified() throws Exception
    {
        MetaInfoEntry entry = new MetaInfoEntry( m_componentClass, m_properties, m_dependencies );
        checkMetaInfoEntry( entry, ThreadSafeComponentHandler.class, "component1", false );
    }
View Full Code Here

        m_properties.remove( "x-avalon.lifestyle" );
        m_properties.remove( "x-avalon.name" );
        m_properties.setProperty( "fortress.handler", ThreadSafeComponentHandler.class.getName() );
        m_componentClass = MetaInfoEntry.class;

        MetaInfoEntry entry = new MetaInfoEntry( m_componentClass, m_properties, m_dependencies );

        checkMetaInfoEntry( entry, ThreadSafeComponentHandler.class, "meta-info-entry", false );
    }
View Full Code Here

        Iterator it = m_lifecycleMap.keySet().iterator();
        while ( it.hasNext() )
        {
            String type = (String) it.next();
            m_properties.setProperty( "x-avalon.lifestyle", type );
            MetaInfoEntry entry = new MetaInfoEntry( m_componentClass, m_properties, m_dependencies );
            checkMetaInfoEntry( entry, (Class) m_lifecycleMap.get( type ), name, false );
        }
    }
View Full Code Here

    public void testRoleEntryParent() throws Exception
    {
        RoleEntry roleEntry = new RoleEntry( Role1.class.getName(), "component1",
            m_componentClass, ThreadSafeComponentHandler.class );

        MetaInfoEntry entry = new MetaInfoEntry( roleEntry );

        checkMetaInfoEntry( entry, ThreadSafeComponentHandler.class, "component1", true );
    }
View Full Code Here

    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

                              final String[] roles,
                              final String className,
                              final String handlerClassname )
        throws ClassNotFoundException
    {
        final MetaInfoEntry metaEntry = m_manager.getMetaInfoForShortName( shortname );
        assertNotNull( "MetaInfoEntry", metaEntry );

        assertEquals( "componentClass:",
            metaEntry.getComponentClass(), Class.forName( className ) );

        for ( int i = 0; i < roles.length; i++ )
        {
            assertTrue( "Role:", metaEntry.containsRole( roles[i] ) );
        }
        assertEquals( "Handler:",
            metaEntry.getHandlerClass(), Class.forName( handlerClassname ) );
    }
View Full Code Here

        {
            className = config.getAttribute( "role" );
        }
        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 );
            }

            Iterator roleIterator = roleEntry.getRoles();
            if ( roleIterator.hasNext() )
            {
                className = (String)roleIterator.next();
            }
            else
            {
                className = roleEntry.getComponentClass().getName();
            }
        }

        return className;
    }
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();
            }
        }

        return className;
    }
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.