Package org.apache.maven.index.updater

Examples of org.apache.maven.index.updater.IndexUpdateRequest


    public void testRemoteUpdatesInvalidProperties()
        throws Exception
    {
        // just a dummy fetcher, it's not used here anyway
        IndexUpdateRequest request = new IndexUpdateRequest( context, new ResourceFetcher()
        {
            public InputStream retrieve( String name )
                throws IOException, FileNotFoundException
            {
                // TODO Auto-generated method stub
View Full Code Here


            {
                indexDirectory.mkdirs();
            }

            ResourceFetcher resourceFetcher = new WagonResourceFetcher( log, tempIndexDirectory, wagon );
            IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
            request.setForceFullUpdate( this.fullDownload );
            request.setLocalIndexCacheDir( indexCacheDirectory );

            this.indexUpdater.fetchAndUpdateIndex( request );
            stopWatch.stop();
            log.info( "time to download remote repository index for repository {}: {} s", this.remoteRepository.getId(),
                      ( stopWatch.getTime() / 1000 ) );
View Full Code Here

                indexDirectory.mkdirs();
            }

            ResourceFetcher resourceFetcher =
                new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository );
            IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
            request.setForceFullUpdate( this.fullDownload );
            request.setLocalIndexCacheDir( indexCacheDirectory );

            this.indexUpdater.fetchAndUpdateIndex( request );
            stopWatch.stop();
            log.info( "time update index from remote for repository {}: {} s", this.remoteRepository.getId(),
                      ( stopWatch.getTime() / 1000 ) );
View Full Code Here

                indexDirectory.mkdirs();
            }

            ResourceFetcher resourceFetcher =
                new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository );
            IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
            request.setForceFullUpdate( this.fullDownload );
            request.setLocalIndexCacheDir( indexCacheDirectory );

            this.indexUpdater.fetchAndUpdateIndex( request );
            stopWatch.stop();
            log.info( "time update index from remote for repository {}: {} s", this.remoteRepository.getId(),
                      ( stopWatch.getTime() / 1000 ) );
View Full Code Here

                        throw new FileNotFoundException( e.getMessage( ) );
                    }
                }
            };

            IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
            request.setForceFullUpdate( this.fullDownload );
            request.setLocalIndexCacheDir( indexCacheDirectory );

            this.indexUpdater.fetchAndUpdateIndex( request );
            stopWatch.stop( );
            log.info( "time to download remote repository index for repository {}: {} s",
                      this.remoteRepository.getId( ), ( stopWatch.getTime( ) / 1000 ) );
View Full Code Here

            {
                indexDirectory.mkdirs();
            }

            ResourceFetcher resourceFetcher = new WagonResourceFetcher( log, tempIndexDirectory, wagon );
            IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
            request.setForceFullUpdate( this.fullDownload );
            request.setLocalIndexCacheDir( indexCacheDirectory );

            this.indexUpdater.fetchAndUpdateIndex( request );
            stopWatch.stop();
            log.info( "time to download remote repository index for repository {}: {} s", this.remoteRepository.getId(),
                      ( stopWatch.getTime() / 1000 ) );
View Full Code Here

        repository));

    // this will force remote check for newer files
    repository.expireCaches(new ResourceStoreRequest(PUBLISHING_PATH_PREFIX));

    IndexUpdateRequest updateRequest = new IndexUpdateRequest(context, new ResourceFetcher()
    {
      public void connect(String id, String url)
          throws IOException
      {
      }

      public void disconnect()
          throws IOException
      {
      }

      public InputStream retrieve(String name)
          throws IOException
      {
        TaskUtil.checkInterruption();

        ResourceStoreRequest req = new ResourceStoreRequest(PUBLISHING_PATH_PREFIX + "/" + name);

        try {
          StorageFileItem item = null;

          // XXX: ensure it goes to remote only and throws FileNotFoundException if nothing found on remote
          // kinda turn off transparent proxying for this method
          // We need to use ProxyRepository and get it's RemoteStorage stuff to completely
          // avoid "transparent" proxying, and even the slightest possibility to return
          // some stale file from cache to the updater.
          if (ISPROXY(repository) && REMOTEACCESSALLOWED(repository)) {
            item =
                (StorageFileItem) repository.getRemoteStorage()
                    .retrieveItem(repository, req, repository.getRemoteUrl());
          }
          else {
            throw new ItemNotFoundException(req, repository);
          }

          return item.getInputStream();
        }
        catch (ItemNotFoundException ex) {
          final FileNotFoundException fne = new FileNotFoundException(name + " (remote item not found)");
          fne.initCause(ex);
          throw fne;
        }
      }
    });

    //Set request for either full or incremental-only update
    if (forceFullUpdate) {
      updateRequest.setForceFullUpdate(true);
      updateRequest.setIncrementalOnly(false);
    }
    else {
      updateRequest.setForceFullUpdate(false);
      updateRequest.setIncrementalOnly(true);
    }

    updateRequest.setFSDirectoryFactory(luceneDirectoryFactory);

    if (repository instanceof MavenRepository) {
      MavenRepository mrepository = (MavenRepository) repository;

      updateRequest.setDocumentFilter(getFilterFor(mrepository.getRepositoryPolicy()));
    }

    try {
      IndexUpdateResult result = indexUpdater.fetchAndUpdateIndex(updateRequest);
View Full Code Here

    final Predicate<Object[]> fetchAndUpdateIndexMethodArgumentsPredicate = new Predicate<Object[]>()
    {
      @Override
      public boolean apply(@Nullable Object[] input) {
        if (input != null) {
          final IndexUpdateRequest req = (IndexUpdateRequest) input[0];
          if (req != null) {
            return req.getIndexingContext().getId().startsWith(failingRepository.getId());
          }
        }
        return false;
      }
    };
View Full Code Here

          mismatchDescription.appendText("\n").appendText("Invocation ").appendValue(i + 1).appendText(
              ":\n");
          mismatchDescription.appendText("\t Arguments:\n");
          for (Object argument : item.invocationsArguments.get(i)) {
            if (argument instanceof IndexUpdateRequest) {
              IndexUpdateRequest arg = (IndexUpdateRequest) argument;
              mismatchDescription.appendText("\t\t ").appendText(
                  IndexUpdateRequest.class.getSimpleName()).appendText("->").appendText(
                  IndexingContext.class.getSimpleName()).appendText(" repository=").appendValue(
                  arg.getIndexingContext().getRepositoryId()).appendText("\n");
            }
            else {
              mismatchDescription.appendText("\t\t ").appendText(argument.toString()).appendText(
                  "\n");
            }
View Full Code Here

                indexDirectory.mkdirs();
            }

            ResourceFetcher resourceFetcher =
                new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository );
            IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher );
            request.setForceFullUpdate( this.fullDownload );
            request.setLocalIndexCacheDir( indexCacheDirectory );

            this.indexUpdater.fetchAndUpdateIndex( request );
            stopWatch.stop();
            log.info( "time update index from remote for repository {}: {} s", this.remoteRepository.getId(),
                      ( stopWatch.getTime() / 1000 ) );
View Full Code Here

TOP

Related Classes of org.apache.maven.index.updater.IndexUpdateRequest

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.