Package org.codehaus.plexus

Examples of org.codehaus.plexus.PlexusContainer


    }

    public Wagon getWagon( String protocol )
        throws UnsupportedProtocolException
    {
        PlexusContainer container = getWagonContainer( protocol );

        Wagon wagon;
        try
        {
            wagon = (Wagon) container.lookup( Wagon.ROLE, protocol );
        }
        catch ( ComponentLookupException e1 )
        {
            throw new UnsupportedProtocolException(
                "Cannot find wagon which supports the requested protocol: " + protocol, e1 );
View Full Code Here


        return wagon;
    }

    private PlexusContainer getWagonContainer( String protocol )
    {
        PlexusContainer container = this.container;

        if ( availableWagons.containsKey( protocol ) )
        {
            container = (PlexusContainer) availableWagons.get( protocol );
        }
View Full Code Here

    }

    private void releaseWagon( String protocol,
                               Wagon wagon )
    {
        PlexusContainer container = getWagonContainer( protocol );
        try
        {
            container.release( wagon );
        }
        catch ( ComponentLifecycleException e )
        {
            getLogger().error( "Problem releasing wagon - ignoring: " + e.getMessage() );
        }
View Full Code Here

    }

    public void testDependencyInjection()
        throws Exception
    {
        PlexusContainer container = getContainer();

        ComponentDescriptor<? extends AbstractMavenLifecycleParticipant> cd =
            new ComponentDescriptor<InjectDependencyLifecycleListener>( InjectDependencyLifecycleListener.class,
                                                                        container.getContainerRealm() );
        cd.setRoleClass( AbstractMavenLifecycleParticipant.class );
        container.addComponentDescriptor( cd );

        Maven maven = container.lookup( Maven.class );
        File pom = getProject( "lifecycle-listener-dependency-injection" );
        MavenExecutionRequest request = createMavenExecutionRequest( pom );
        request.setGoals( Arrays.asList( "validate" ) );
        MavenExecutionResult result = maven.execute( request );
View Full Code Here

    }

    // TODO: need to externalize CliRequest
    public int doMain( CliRequest cliRequest )
    {
        PlexusContainer localContainer = null;
        try
        {
            initialize( cliRequest );
            cli( cliRequest );
            logging( cliRequest );
            version( cliRequest );
            properties( cliRequest );
            localContainer = container( cliRequest );
            commands( cliRequest );
            settings( cliRequest );
            populateRequest( cliRequest );
            encryption( cliRequest );
            repository( cliRequest );
            return execute( cliRequest );
        }
        catch ( ExitException e )
        {
            return e.exitCode;
        }
        catch ( UnrecognizedOptionException e )
        {
            // pure user error, suppress stack trace
            return 1;
        }
        catch ( BuildAbort e )
        {
            CLIReportingUtils.showError( slf4jLogger, "ABORTED", e, cliRequest.showErrors );

            return 2;
        }
        catch ( Exception e )
        {
            CLIReportingUtils.showError( slf4jLogger, "Error executing Maven.", e, cliRequest.showErrors );

            return 1;
        }
        finally
        {
            if ( localContainer != null )
            {
                localContainer.dispose();
            }
        }
    }
View Full Code Here

    public static PlexusContainer getContainer( PageContext pageContext )
        throws ComponentLookupException
    {
        ServletContext servletContext = pageContext.getServletContext();

        PlexusContainer xworkContainer = (PlexusContainer) servletContext.getAttribute( "webwork.plexus.container" );

        if ( xworkContainer != null )
        {
            servletContext.setAttribute( PlexusConstants.PLEXUS_KEY, xworkContainer );

            return xworkContainer;
        }

        PlexusContainer container = (PlexusContainer) servletContext.getAttribute( PlexusConstants.PLEXUS_KEY );
        if ( container == null )
        {
            throw new ComponentLookupException( "PlexusContainer is null." );
        }
        return container;
View Full Code Here

    public static PlexusContainer getContainer( PageContext pageContext )
        throws ComponentLookupException
    {
        ServletContext servletContext = pageContext.getServletContext();

        PlexusContainer xworkContainer = (PlexusContainer) servletContext.getAttribute( "webwork.plexus.container" );

        if ( xworkContainer != null )
        {
            servletContext.setAttribute( PlexusConstants.PLEXUS_KEY, xworkContainer );

            return xworkContainer;
        }

        PlexusContainer container = (PlexusContainer) servletContext.getAttribute( PlexusConstants.PLEXUS_KEY );
        if ( container == null )
        {
            throw new ComponentLookupException( "PlexusContainer is null." );
        }
        return container;
View Full Code Here

        // Create container.

        Map keys = new HashMap();

        PlexusContainer pc;
        try
        {
            pc = new DefaultPlexusContainer( "default", keys, "META-INF/plexus/application.xml", new ClassWorld(
                "plexus.core", getClass().getClassLoader() ) );
View Full Code Here

    }

    private PlexusContainer getPlexusContainer()
        throws ServletException
    {
        PlexusContainer container = (PlexusContainer) getServletContext().getAttribute( PlexusConstants.PLEXUS_KEY );
        if ( container == null )
        {
            throw new ServletException( "Unable to find plexus container." );
        }
        return container;
View Full Code Here

    private boolean isAuthorized( String projectGroupName )
    {
        // do the authz bit
        ActionContext context = ActionContext.getContext();

        PlexusContainer container = (PlexusContainer) context.getApplication().get( PlexusConstants.PLEXUS_KEY );
        SecuritySession securitySession = (SecuritySession) context.getSession().get(
            SecuritySystemConstants.SECURITY_SESSION_KEY );

        try
        {
            SecuritySystem securitySystem = (SecuritySystem) container.lookup( SecuritySystem.ROLE );

            if ( !securitySystem.isAuthorized( securitySession, ContinuumRoleConstants.CONTINUUM_VIEW_GROUP_OPERATION,
                                               projectGroupName ) )
            {
                return false;
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.PlexusContainer

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.