Package org.apache.maven.index.context

Examples of org.apache.maven.index.context.IndexingContext


        try
        {
            NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );

            IndexingContext context = nexusIndexer.getIndexingContexts().get( repository.getId() );
            if ( context != null )
            {
                // delete content only if directory exists
                nexusIndexer.removeIndexingContext( context,
                                                    deleteContent && context.getIndexDirectoryFile().exists() );
            }
        }
        catch ( PlexusSisuBridgeException e )
        {
            throw new RepositoryAdminException( e.getMessage(), e );
View Full Code Here


        if ( updateIndexContext )
        {
            try
            {
                IndexingContext indexingContext = indexer.getIndexingContexts().get( managedRepository.getId() );
                if ( indexingContext != null )
                {
                    indexer.removeIndexingContext( indexingContext, true );
                }

                // delete directory too as only content is deleted
                File indexDirectory = indexingContext.getIndexDirectoryFile();
                FileUtils.deleteDirectory( indexDirectory );

                createIndexContext( managedRepository );
            }
            catch ( IOException e )
View Full Code Here

    @Override
    public IndexingContext createIndexContext( ManagedRepository repository )
        throws RepositoryAdminException
    {

        IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );

        if ( context != null )
        {
            log.debug( "skip creating repository indexingContent with id {} as already exists", repository.getId() );
            return context;
        }

        // take care first about repository location as can be relative
        File repositoryDirectory = new File( repository.getLocation() );

        if ( !repositoryDirectory.isAbsolute() )
        {
            repositoryDirectory =
                new File( getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories",
                          repository.getLocation() );
        }

        if ( !repositoryDirectory.exists() )
        {
            repositoryDirectory.mkdirs();
        }

        try
        {

            String indexDir = repository.getIndexDirectory();
            //File managedRepository = new File( repository.getLocation() );

            File indexDirectory = null;
            if ( StringUtils.isNotBlank( indexDir ) )
            {
                indexDirectory = new File( repository.getIndexDirectory() );
                // not absolute so create it in repository directory
                if ( !indexDirectory.isAbsolute() )
                {
                    indexDirectory = new File( repositoryDirectory, repository.getIndexDirectory() );
                }
                repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
            }
            else
            {
                indexDirectory = new File( repositoryDirectory, ".indexer" );
                if ( !repositoryDirectory.isAbsolute() )
                {
                    indexDirectory = new File( repositoryDirectory, ".indexer" );
                }
                repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
            }

            if ( !indexDirectory.exists() )
            {
                indexDirectory.mkdirs();
            }

            context = indexer.getIndexingContexts().get( repository.getId() );

            if ( context == null )
            {
                context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory,
                                                      indexDirectory,
                                                      repositoryDirectory.toURI().toURL().toExternalForm(),
                                                      indexDirectory.toURI().toURL().toString(), indexCreators );

                context.setSearchable( repository.isScanned() );
            }
            return context;
        }
        catch ( MalformedURLException e )
        {
View Full Code Here

    {
        List<IndexingContext> contexts = new ArrayList<>( ids.size() );

        for ( String id : ids )
        {
            IndexingContext context = indexer.getIndexingContexts().get( id );
            if ( context != null )
            {
                contexts.add( context );
            }
            else
View Full Code Here

                ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repo );

                if ( repoConfig != null )
                {

                    IndexingContext context = managedRepositoryAdmin.createIndexContext( repoConfig );
                    if ( context.isSearchable() )
                    {
                        indexingContextIds.addAll( getRemoteIndexingContextIds( repo ) );
                        indexingContextIds.add( context.getId() );
                    }
                    else
                    {
                        log.warn( "indexingContext with id {} not searchable", repoConfig.getId() );
                    }
View Full Code Here

        }

        for ( ProxyConnector proxyConnector : proxyConnectors )
        {
            String remoteId = "remote-" + proxyConnector.getTargetRepoId();
            IndexingContext context = indexer.getIndexingContexts().get( remoteId );
            if ( context != null && context.isSearchable() )
            {
                ids.add( remoteId );
            }
        }
View Full Code Here

    public MergedRemoteIndexesTaskResult execute()
        throws IndexMergerException
    {
        IndexMerger indexMerger = mergedRemoteIndexesTaskRequest.getIndexMerger();

        IndexingContext indexingContext =
            indexMerger.buildMergedIndex( mergedRemoteIndexesTaskRequest.getIndexMergerRequest() );

        return new MergedRemoteIndexesTaskResult( indexingContext );
    }
View Full Code Here

        NexusIndexer indexer = plexus.lookup( NexusIndexer.class );

        long tstart = System.currentTimeMillis();

        IndexingContext context = indexer.addIndexingContext( //
            repositoryName, // context id
            repositoryName, // repository id
            repositoryFolder, // repository folder
            indexFolder, // index folder
            null, // repositoryUrl
View Full Code Here

        List<? extends IndexCreator> indexers )
        throws IOException, UnsupportedExistingLuceneIndexException
    {
        try
        {
            IndexingContext context =
                indexer.createIndexingContext( id, repositoryId, repository, indexDirectory, repositoryUrl,
                                               indexUpdateUrl, true, false, indexers );
            indexingContexts.put( context.getId(), context );
            return context;
        }
        catch ( ExistingLuceneIndexMismatchException e )
        {
            throw new UnsupportedExistingLuceneIndexException( e.getMessage(), e );
View Full Code Here

    public IndexingContext addIndexingContextForced( String id, String repositoryId, File repository,
        File indexDirectory, String repositoryUrl, String indexUpdateUrl,
        List<? extends IndexCreator> indexers )
        throws IOException
    {
        IndexingContext context =
            indexer.createIndexingContext( id, repositoryId, repository, indexDirectory, repositoryUrl, indexUpdateUrl,
                                           true, true, indexers );
        indexingContexts.put( context.getId(), context );
        return context;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.index.context.IndexingContext

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.