} else if( part instanceof FeatureDirective ) { put( key, part );
    public void addEntry( String key, Part part )       throws ComponentException, PartHandlerNotFoundException, DelegationException    {        if( null == key )        {            throw new NullPointerException( "key" );        }        else if( null == part )        {            throw new NullPointerException( "part" );        }        else if( containsKey( key ) )        {            throw new DuplicateKeyException( key );        }        else if( part instanceof ReferenceDirective )        {            ReferenceDirective reference = (ReferenceDirective) part;            URI uri = reference.getURI();            if( "parts".equals( uri.getScheme() ) )            {                if( null == m_parent )                {                    final String error =                       "Cannot resolve a reference to an enclosing container from a root component."                      + "\nComponent: " + m_component.getURI()                      + "\nContext Key: " + key;                    throw new ComponentException( error );                }                String ref = uri.getSchemeSpecificPart();                if( m_parent instanceof Container )                {                    Container container = (Container) m_parent;                    try                    {                        Component entry = container.getComponent( ref );                        addEntry( key, entry );                    }                    catch( ComponentNotFoundException cnfe )                    {                        final String error =                           "Component not found."                          + "\nContainer: " + m_parent.getURI()                          + "\nComponent: " + m_component.getURI()                          + "\nContext Key: " + key;                        throw new ComponentException( error );                    }                }                else                {                    final String error =                       "Enclosing component is not a container."                      + "\nComponent: " + m_component.getURI()                      + "\nEnclosing Component: " + m_parent.getURI()                      + "\nContext Key: " + key;                    throw new ComponentException( error );                }            }            else if( m_parent instanceof ServiceContext )            {                ServiceContext context = (ServiceContext) m_parent;                try                {                    Component service = context.lookup( uri );                    addEntry( key, service );                }                catch( ServiceException e )                {                    final String error =                       "Unresolvable context reference."                      + "\nComponent: " + m_component.getURI()                      + "\nContext Key: " + key                      + "\nContext Entry URI: " + uri;                    throw new ComponentException( error, e );                }            }            else            {                final String error =                   "Part reference resolution not supported at this time."                  + "\nReference URI: " + uri                  + "\nContainer: " + m_parent.getURI()                  + "\nComponent: " + m_component.getURI()                  + "\nContext Key: " + key;                throw new ComponentException( error );            }        }        else        {            CompositionController controller = m_component.getController();            Component provider = controller.newComponent( m_component, part, key );            addEntry( key, provider );        }    }