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

com.github.htfv.maven.plugins.testing.internal.PlexusContainer Maven / Gradle / Ivy

package com.github.htfv.maven.plugins.testing.internal;

import org.codehaus.plexus.PlexusTestCase;

/**
 * Facade for the Plexus container.
 *
 * @author htfv (Aliaksei Lahachou)
 */
public class PlexusContainer
{
    /**
     * Plexus container.
     *
     * @author htfv (Aliaksei Lahachou)
     */
    private static class PlexusContainerImpl extends PlexusTestCase
    {
        /**
         * Looks up a component from the container.
         *
         * @param 
         *            the type of the component to look up.
         * @param componentClass
         *            the type of the component to look up.
         *
         * @return The component from the container.
         *
         * @throws Exception
         *             if the component could not be looked up.
         */
        public  T doLookup(final Class componentClass) throws Exception
        {
            return super.lookup(componentClass);
        }

        /**
         * Tears down the Plexus container.
         *
         * @throws Exception
         *             if the container could not be teared down.
         */
        public void doTearDown() throws Exception
        {
            super.tearDown();
        }
    }

    /**
     * The Plexus container.
     */
    private PlexusContainerImpl impl = new PlexusContainerImpl();

    /**
     * Looks up a component from the container.
     *
     * @param 
     *            the type of the component to look up.
     * @param componentClass
     *            the type of the component to look up.
     *
     * @return The component from the container.
     *
     * @throws Exception
     *             if the component could not be looked up.
     */
    public  T lookup(final Class componentClass) throws Exception
    {
        return impl.doLookup(componentClass);
    }

    /**
     * Tears down the Plexus container.
     *
     * @throws Exception
     *             if the container could not be teared down.
     */
    public void tearDown() throws Exception
    {
        impl.doTearDown();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy