Package org.apache.maven.index.context

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


                                                  String repositoryUrl, String indexUpdateUrl, boolean searchable,
                                                  boolean reclaim, List<? extends IndexCreator> indexers )
        throws IOException, ExistingLuceneIndexMismatchException, IllegalArgumentException
    {
        final IndexingContext context =
            new DefaultIndexingContext( id, repositoryId, repository, indexDirectory, repositoryUrl, indexUpdateUrl,
                IndexCreatorSorter.sort( indexers ), reclaim );
        context.setSearchable( searchable );
        return context;
    }
View Full Code Here


        creators.add( min );
        creators.add( jar );

        String repositoryId = "test";

        return new DefaultIndexingContext( repositoryId, repositoryId, basedir, basedir, baseUrl, baseUrl, creators,
            true );
    }
View Full Code Here

        // 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()
View Full Code Here

        throws IOException, UnsupportedExistingLuceneIndexException
    {
        try
        {
            IndexingContext context =
                new DefaultIndexingContext( id, repositoryId, repository, directory, repositoryUrl, indexUpdateUrl,
                                            IndexCreatorSorter.sort( indexers ), false );
            indexingContexts.put( context.getId(), context );
            return context;
        }
        catch ( ExistingLuceneIndexMismatchException e )
        {
            throw new UnsupportedExistingLuceneIndexException( e.getMessage(), e );
View Full Code Here

        Directory directory, String repositoryUrl, String indexUpdateUrl,
        List<? extends IndexCreator> indexers )
        throws IOException
    {
        IndexingContext context =
            new DefaultIndexingContext( id, repositoryId, repository, directory, repositoryUrl, indexUpdateUrl,
                                        IndexCreatorSorter.sort( indexers ), true );
        indexingContexts.put( context.getId(), context );
        return context;
    }
View Full Code Here

            final FSDirectory directory = FSDirectory.open( tmpDir );
            if ( update )
            {
                IndexUtils.copyDirectory( context.getIndexDirectory(), directory );
            }
            tmpContext = new DefaultIndexingContext( context.getId() + "-tmp", //
                                                     context.getRepositoryId(), //
                                                     context.getRepository(), //
                                                     directory, //
                                                     context.getRepositoryUrl(), //
                                                     context.getIndexUpdateUrl(), //
View Full Code Here

    File location = File.createTempFile(indexId, null, getTempDirectory());

    DirSupport.delete(location.toPath());
    DirSupport.mkdir(location.toPath());

    final DefaultIndexingContext temporary = new DefaultIndexingContext(indexId, //
        repository.getId(), //
        getRepositoryLocalStorageAsFile(repository), // repository local storage
        openFSDirectory(location), //
        null, // repository url
        null, // repository update url
        indexCreators, true);
    log.debug("Created temporary indexing context " + location + " for repository " + repository.getId());

    try {
      runnable.run(temporary);

      temporary.updateTimestamp(true);

      exclusiveSingle(repository, new Runnable()
      {
        @Override
        public void run(IndexingContext target)
            throws IOException
        {
          // TODO igorf guard against concurrent configuration changes
          // it is possible that Repository and/or target IndexingContext configuration have changed
          // and temporary context is populated based contains old/stale configuration
          // need to detect when this happens based on target timestamp for example and skip replace

          if (target != null) {
            target.replace(temporary.getIndexDirectory());
          }
          else {
            log.warn("Could not perform index operation on repository {}", repository.getId(),
                new Exception());
          }
        }
      });
    }
    finally {
      temporary.close(false);
      DirSupport.deleteIfExists(location.toPath());
    }
  }
View Full Code Here

TOP

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

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.