Package org.codehaus.plexus

Examples of org.codehaus.plexus.PlexusContainer


    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


    private Wagon getWagon( String protocol, String repositoryId )
        throws UnsupportedProtocolException
    {
        String hint = getWagonHint( protocol, repositoryId );
        PlexusContainer container = getWagonContainer( hint );

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

        String hint;
        if ( impl != null )
        {
            hint = protocol + "-" + impl;
            PlexusContainer container = getWagonContainer( hint );
            if ( container == null || !container.hasComponent( Wagon.ROLE, hint ) )
            {
                getLogger().debug(
                    "Cannot find wagon for protocol-provider hint: '" + hint
                        + "', configured for repository: '" + repositoryId + "'. Using protocol hint: '"
                        + protocol + "' instead." );
View Full Code Here

        return hint;
    }

    private PlexusContainer getWagonContainer( String hint )
    {
        PlexusContainer container = this.container;
        if ( availableWagons.containsKey( hint ) )
        {
            container = availableWagons.get( hint );
        }
View Full Code Here

    private void releaseWagon( String protocol,
                               Wagon wagon, String repositoryId )
    {
        String hint = getWagonHint( protocol, repositoryId );

        PlexusContainer container = getWagonContainer( hint );
        try
        {
            container.release( wagon );
        }
        catch ( ComponentLifecycleException e )
        {
            getLogger().error( "Problem releasing wagon - ignoring: " + e.getMessage() );
        }
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 void contextInitialized(ServletContextEvent servletContextEvent) {
        loaded = true;

        try {
            PlexusContainer pc = new DefaultPlexusContainer();
            PlexusUtils.configure(pc, "plexus-application.xml");
            ServletContext ctx = servletContextEvent.getServletContext();
            ctx.setAttribute(KEY, pc);

            pc.initialize();
            pc.start();
        } catch (Exception e) {
            log.error("Error initializing plexus container (scope: application)", e);
        }
    }
View Full Code Here

     * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
     */
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        try {
            ServletContext ctx = servletContextEvent.getServletContext();
            PlexusContainer pc = (PlexusContainer) ctx.getAttribute(KEY);
            pc.dispose();
        } catch (Exception e) {
            log.error("Error disposing plexus container (scope: application)", e);
        }
    }
View Full Code Here

     */
    public void sessionCreated(HttpSessionEvent httpSessionEvent) {
        try {
            HttpSession session = httpSessionEvent.getSession();
            ServletContext ctx = session.getServletContext();
            PlexusContainer parent = (PlexusContainer) ctx.getAttribute(KEY);
            PlexusContainer child = parent.createChildContainer("session", Collections.EMPTY_LIST, Collections.EMPTY_MAP);
            session.setAttribute(KEY, child);
            PlexusUtils.configure(child, "plexus-session.xml");
            child.initialize();
            child.start();
        } catch (Exception e) {
            log.error("Error initializing plexus container (scope: session)", e);
        }
    }
View Full Code Here

     * @see javax.servlet.http.HttpSessionListener#sessionDestroyed(javax.servlet.http.HttpSessionEvent)
     */
    public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
        try {
            HttpSession session = httpSessionEvent.getSession();
            PlexusContainer child = (PlexusContainer) session.getAttribute(KEY);
            child.dispose();
        } catch (Exception e) {
            log.error("Error initializing plexus container (scope: session)", e);
        }
    }
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.