All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.codehaus.plexus.personality.plexus.lifecycle.phase.CompositionPhase Maven / Gradle / Ivy

Go to download

Statistical sampling library for use in virtdata libraries, based on apache commons math 4

There is a newer version: 5.17.0
Show newest version
package org.codehaus.plexus.personality.plexus.lifecycle.phase;

import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.composition.CompositionException;
import org.codehaus.plexus.component.composition.UndefinedComponentComposerException;
import org.codehaus.plexus.component.manager.ComponentManager;
import org.codehaus.plexus.component.repository.ComponentDescriptor;
import org.codehaus.plexus.lifecycle.phase.AbstractPhase;

/**
 * @todo this little example works but is indicative of of some decoupling that
 * needs to happen wrt the lifecycle handlers. We should be able to specify by
 * configuration which entities for a lifecycle handler are required.
 */
public class CompositionPhase
    extends AbstractPhase
{
    public void execute( Object object, ComponentManager manager )
        throws PhaseExecutionException
    {
        // We only need to assemble a component if it specifies requirements.

        PlexusContainer container = manager.getContainer();

        ComponentDescriptor descriptor = manager.getComponentDescriptor();

        try
        {
            container.composeComponent( object, descriptor );
        }
        catch ( CompositionException e )
        {
            throw new PhaseExecutionException( "Error composing component", e );
        }
        catch ( UndefinedComponentComposerException e )
        {
            throw new PhaseExecutionException( "Error composing component", e );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy