Package org.codehaus.plexus

Examples of org.codehaus.plexus.PlexusContainer


        addRemoteRepositories(deployTask);
        return deployTask;
    }

    private void addProtocolProvider(CustomDeployTask deployTask) {
        PlexusContainer plexusContainer = deployTask.getContainer();
        for (File wagonProviderJar : getJars()) {
            try {
                plexusContainer.addJarResource(wagonProviderJar);
            } catch (PlexusContainerException e) {
                throw new RuntimeException(e);
            }
        }
    }
View Full Code Here


  // ------------------------------
  // Plexus Lifecycle
  // ------------------------------

  public final void contextualize(Context context) throws ContextException {
    PlexusContainer plexusContainer = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);
    try {
      archiverManager = (ArchiverManager) plexusContainer.lookup(ArchiverManager.ROLE);
    } catch (ComponentLookupException e) {
      throw new ContextException(e.getMessage(), e);
    }
  }
View Full Code Here

 
    public void installArchetype() throws CoreException {
        try {
            IMaven maven = MavenPlugin.getMaven();
            // first get the plexus container
            PlexusContainer container = ((MavenImpl) MavenPlugin.getMaven()).getPlexusContainer();

            // then get the DefaultMaven
            DefaultMaven mvn = (DefaultMaven) container.lookup(Maven.class);

            // now create a RepositorySystemSession
            MavenExecutionRequest request = new DefaultMavenExecutionRequest();
            request.setLocalRepository(maven.getLocalRepository());

            // We need to support Maven 3.0.x as well, so we use reflection to
            // access Aether APIs in a manner which is compatible with all Maven 3.x versions
            // See https://maven.apache.org/docs/3.1.0/release-notes.html
            MavenSession session = reflectiveCreateMavenSession(container, mvn, request);
            LegacySupport legacy = container.lookup(LegacySupport.class);
            legacy.setSession(session);

            // then lookup the DefaultArtifactInstaller
            DefaultArtifactInstaller dai = (DefaultArtifactInstaller) container.lookup(ArtifactInstaller.class);

            final Set<Entry<String, InputStream>> entries = origins.entrySet();
            for (Iterator<Entry<String, InputStream>> it = entries.iterator(); it.hasNext();) {
                final Entry<String, InputStream> entry = it.next();
                final String fileExtension = entry.getKey();
View Full Code Here

                                    String role )
        throws ComponentLookupException, PluginManagerException
    {
        PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptor( plugin );

        PlexusContainer pluginContainer = getPluginContainer( pluginDescriptor );

        return pluginContainer.lookupMap( role );
    }
View Full Code Here

        ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
                                                                                 "legacy" );

        ArtifactRepository repo = new DefaultArtifactRepository( "local", "target/repo", repoLayout );

        PlexusContainer container = getContainer();
        MavenSession session = createSession( container, repo );

        MojoDescriptor mojo = new MojoDescriptor();
        mojo.setPluginDescriptor( pluginDescriptor );
        mojo.setGoal( "goal" );

        MojoExecution mojoExecution = new MojoExecution( mojo );

        return new PluginParameterExpressionEvaluator( session, mojoExecution, null, container.getLogger(), project,
                                                       executionProperties );
    }
View Full Code Here

        return getDummySession( new Properties() );
    }

    private MavenSession getDummySession( Properties executionProperties )
    {
        PlexusContainer container = null;
        Settings settings = null;
        ArtifactRepository localRepo = null;
        EventDispatcher eventDispatcher = null;
        ReactorManager reactorManager = null;
        List goals = null;
View Full Code Here

            // just do your best to delete this.
        }

        basedir.mkdirs();

        PlexusContainer container = new DefaultPlexusContainer();

        IndexCreator min = container.lookup( IndexCreator.class, "min" );
        IndexCreator jar = container.lookup( IndexCreator.class, "jarContent" );

        List<IndexCreator> creators = new ArrayList<IndexCreator>();
        creators.add( min );
        creators.add( jar );

        String repositoryId = "test";
        String repositoryUrl = "http://localhost:8081/nexus/content/groups/sonatype-public/";
        // String repositoryUrl = "http://repository.sonatype.org/content/groups/public/";
        // String repositoryUrl = "http://repository.sonatype.org/content/groups/sonatype/";
        String indexUrl = repositoryUrl + ".index";

        IndexingContext ctx =
            new DefaultIndexingContext( repositoryId, repositoryId, basedir, basedir, repositoryUrl, indexUrl,
                creators, true );

        // craft the Wagon based Resource

        TransferListener tl = new TransferListener()
        {

            private int col = 0;

            private int count = 0;

            private int mb = 0;

            public void transferStarted( final TransferEvent transferEvent )
            {
                System.out.println( "Started transfer: " + transferEvent.getResource().getName() );
            }

            public void transferProgress( final TransferEvent transferEvent, final byte[] buffer, final int length )
            {
                if ( buffer == null )
                {
                    return;
                }

                count += buffer.length;

                if ( ( count / ONE_MEGABYTE ) > mb )
                {
                    if ( col > 80 )
                    {
                        System.out.println();
                        col = 0;
                    }

                    System.out.print( '.' );
                    col++;
                    mb++;
                }
            }

            public void transferInitiated( final TransferEvent transferEvent )
            {
            }

            public void transferError( final TransferEvent transferEvent )
            {
                System.out.println( "[ERROR]: " + transferEvent.getException().getLocalizedMessage() );
                transferEvent.getException().printStackTrace();
            }

            public void transferCompleted( final TransferEvent transferEvent )
            {
                System.out.println( "\nCompleted transfer: " + transferEvent.getResource().getName() + " ("
                    + (double) ( count / ONE_MEGABYTE ) + " MB)" );
            }

            public void debug( final String message )
            {
                System.out.println( "[DEBUG]: " + message );
            }
        };

        WagonHelper wh = new WagonHelper( container );

        WagonFetcher wf = wh.getWagonResourceFetcher( tl, null, null );

        IndexUpdateRequest updateRequest = new IndexUpdateRequest( ctx, wf );

        container.lookup( IndexUpdater.class ).fetchAndUpdateIndex( updateRequest );
    }
View Full Code Here

     * instantiation/composition problem.
     */
    public void contextualize( final Context context )
        throws ContextException
    {
        final PlexusContainer container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );

        try
        {
            archiverManager = (ArchiverManager) container.lookup( ArchiverManager.ROLE );
        }
        catch ( final ComponentLookupException e )
        {
            throw new ContextException( "Error retrieving ArchiverManager instance: " + e.getMessage(), e );
        }
View Full Code Here

    private boolean isAuthorized( ProjectSummary project )
    {
        // 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,
                                               project.getProjectGroupName() ) )
            {
                return false;
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.