]> source.dussan.org Git - archiva.git/commitdiff
more progress on oak lucene shaded
authorolivier lamy <olamy@apache.org>
Mon, 24 Jul 2017 04:56:21 +0000 (14:56 +1000)
committerolivier lamy <olamy@apache.org>
Mon, 24 Jul 2017 04:56:21 +0000 (14:56 +1000)
Signed-off-by: olivier lamy <olamy@apache.org>
18 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java
archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java [deleted file]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java
archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java
archiva-modules/plugins/metadata-store-jcr/src/test/resources/log4j2-test.xml
pom.xml

index c85a8fbea841c3f3315e58f08647f479cfb5cbee..69b9ba5b8c0c7936920b2a0bd10abd8a53518885 100644 (file)
@@ -22,9 +22,6 @@ package org.apache.archiva.consumers.lucene;
 import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.ConfigurationNames;
 import org.apache.archiva.configuration.FileTypes;
@@ -32,13 +29,13 @@ import org.apache.archiva.consumers.AbstractMonitoredConsumer;
 import org.apache.archiva.consumers.ConsumerException;
 import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
 import org.apache.archiva.redback.components.registry.Registry;
+import org.apache.archiva.redback.components.registry.RegistryListener;
+import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
 import org.apache.archiva.scheduler.ArchivaTaskScheduler;
 import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
 import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.context.IndexCreator;
 import org.apache.maven.index.context.IndexingContext;
-import org.apache.archiva.redback.components.registry.RegistryListener;
-import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Scope;
@@ -88,14 +85,13 @@ public class NexusIndexerConsumer
     public NexusIndexerConsumer(
         @Named( value = "archivaTaskScheduler#indexing" ) ArchivaTaskScheduler<ArtifactIndexingTask> scheduler,
         @Named( value = "archivaConfiguration" ) ArchivaConfiguration configuration, FileTypes filetypes,
-        MavenIndexerUtils mavenIndexerUtils,
-        ManagedRepositoryAdmin managedRepositoryAdmin, NexusIndexer nexusIndexer )
+        List<IndexCreator> indexCreators, ManagedRepositoryAdmin managedRepositoryAdmin, NexusIndexer nexusIndexer )
     {
         this.configuration = configuration;
         this.filetypes = filetypes;
         this.scheduler = scheduler;
         this.nexusIndexer = nexusIndexer;
-        this.allIndexCreators = mavenIndexerUtils.getAllIndexCreators();
+        this.allIndexCreators = indexCreators;
         this.managedRepositoryAdmin = managedRepositoryAdmin;
     }
 
index b5e688b8861b7fab41d3bb2dab27a10ebfe291a7..91d0c107ce6f48b50dcc5031316c6a001a3cf9a3 100644 (file)
@@ -22,7 +22,6 @@ package org.apache.archiva.consumers.lucene;
 import junit.framework.TestCase;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.FileTypes;
 import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
@@ -31,6 +30,7 @@ import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.context.IndexCreator;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -99,7 +99,7 @@ public class NexusIndexerConsumerTest
     private NexusIndexer nexusIndexer;
 
     @Inject
-    private MavenIndexerUtils mavenIndexerUtils;
+    private List<IndexCreator> indexCreators;
 
     @Inject
     private ManagedRepositoryAdmin managedRepositoryAdmin;
@@ -119,11 +119,11 @@ public class NexusIndexerConsumerTest
         FileTypes filetypes = applicationContext.getBean( FileTypes.class );
 
         nexusIndexerConsumer =
-            new NexusIndexerConsumer( scheduler, configuration, filetypes, mavenIndexerUtils,
+            new NexusIndexerConsumer( scheduler, configuration, filetypes, indexCreators,
                                       managedRepositoryAdmin, nexusIndexer );
 
         // initialize to set the file types to be processed
-        ( (NexusIndexerConsumer) nexusIndexerConsumer ).initialize();
+        nexusIndexerConsumer.initialize();
 
         repositoryConfig = new ManagedRepository();
         repositoryConfig.setId( "test-repo" );
index 663f0b63abef0adae9f4873b11728d6ed80713cc..de9342c7486d1fe3bbad743d6f14df61be1e5e98 100644 (file)
@@ -18,11 +18,10 @@ package org.apache.archiva.indexer.merger;
  * under the License.
  */
 
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.time.StopWatch;
 import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.context.IndexCreator;
 import org.apache.maven.index.context.IndexingContext;
 import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
 import org.apache.maven.index.packer.IndexPacker;
@@ -50,23 +49,22 @@ public class DefaultIndexMerger
 
     private Logger log = LoggerFactory.getLogger( getClass() );
 
-    private MavenIndexerUtils mavenIndexerUtils;
+    private final NexusIndexer indexer;
 
-    private NexusIndexer indexer;
+    private final IndexPacker indexPacker;
 
-    private IndexPacker indexPacker;
+    private final List<IndexCreator> indexCreators;
 
     private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<>();
 
-    private List<String> runningGroups = new CopyOnWriteArrayList<String>();
+    private List<String> runningGroups = new CopyOnWriteArrayList<>();
 
     @Inject
-    public DefaultIndexMerger( NexusIndexer nexusIndexer, IndexPacker indexPacker, MavenIndexerUtils mavenIndexerUtils )
-        throws PlexusSisuBridgeException
+    public DefaultIndexMerger( NexusIndexer nexusIndexer, IndexPacker indexPacker, List<IndexCreator> indexCreators )
     {
         this.indexer = nexusIndexer;
-        this.mavenIndexerUtils = mavenIndexerUtils;
         this.indexPacker = indexPacker;
+        this.indexCreators = indexCreators;
     }
 
     @Override
@@ -96,7 +94,7 @@ public class DefaultIndexMerger
             File indexLocation = new File( mergedIndexDirectory, indexMergerRequest.getMergedIndexPath() );
             IndexingContext indexingContext =
                 indexer.addIndexingContext( tempRepoId, tempRepoId, mergedIndexDirectory, indexLocation, null, null,
-                                            mavenIndexerUtils.getAllIndexCreators() );
+                                            indexCreators );
 
             for ( String repoId : indexMergerRequest.getRepositoriesIds() )
             {
@@ -127,11 +125,7 @@ public class DefaultIndexMerger
                       stopWatch.getTime() );
             return indexingContext;
         }
-        catch ( IOException e )
-        {
-            throw new IndexMergerException( e.getMessage(), e );
-        }
-        catch ( UnsupportedExistingLuceneIndexException e )
+        catch ( IOException | UnsupportedExistingLuceneIndexException e )
         {
             throw new IndexMergerException( e.getMessage(), e );
         }
index 64db78594d227036fd5436f65f9b1cfe48d54513..827eda035aafe8e04fb1139779c8cdc6df4b0354 100644 (file)
@@ -24,11 +24,9 @@ import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.beans.ProxyConnector;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.indexer.util.SearchUtil;
 import org.apache.commons.lang.StringUtils;
-
 import org.apache.maven.index.ArtifactInfo;
 import org.apache.maven.index.FlatSearchRequest;
 import org.apache.maven.index.FlatSearchResponse;
@@ -77,8 +75,6 @@ public class MavenRepositorySearch
 
     private ProxyConnectorAdmin proxyConnectorAdmin;
 
-    private MavenIndexerUtils mavenIndexerUtils;
-
     protected MavenRepositorySearch()
     {
         // for test purpose
@@ -86,14 +82,12 @@ public class MavenRepositorySearch
 
     @Inject
     public MavenRepositorySearch( NexusIndexer nexusIndexer, ManagedRepositoryAdmin managedRepositoryAdmin,
-                                  MavenIndexerUtils mavenIndexerUtils, ProxyConnectorAdmin proxyConnectorAdmin,
-                                  QueryCreator queryCreator)
+                                  ProxyConnectorAdmin proxyConnectorAdmin, QueryCreator queryCreator )
         throws PlexusSisuBridgeException
     {
         this.indexer = nexusIndexer;
         this.queryCreator = queryCreator;
         this.managedRepositoryAdmin = managedRepositoryAdmin;
-        this.mavenIndexerUtils = mavenIndexerUtils;
         this.proxyConnectorAdmin = proxyConnectorAdmin;
     }
 
@@ -162,11 +156,9 @@ public class MavenRepositorySearch
         BooleanQuery q = new BooleanQuery();
         if ( StringUtils.isNotBlank( searchFields.getGroupId() ) )
         {
-            q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch()
-                                               ? new SourcedSearchExpression( searchFields.getGroupId() )
-                                               : new UserInputSearchExpression( searchFields.getGroupId() )
-                   ), BooleanClause.Occur.MUST
-            );
+            q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch() ? new SourcedSearchExpression(
+                       searchFields.getGroupId() ) : new UserInputSearchExpression( searchFields.getGroupId() ) ),
+                   BooleanClause.Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getArtifactId() ) )
@@ -174,69 +166,64 @@ public class MavenRepositorySearch
             q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID,
                                            searchFields.isExactSearch()
                                                ? new SourcedSearchExpression( searchFields.getArtifactId() )
-                                               : new UserInputSearchExpression( searchFields.getArtifactId() )
-                   ), BooleanClause.Occur.MUST
-            );
+                                               : new UserInputSearchExpression( searchFields.getArtifactId() ) ),
+                   BooleanClause.Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getVersion() ) )
         {
             q.add( indexer.constructQuery( MAVEN.VERSION, searchFields.isExactSearch() ? new SourcedSearchExpression(
-                searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), BooleanClause.Occur.MUST );
+                       searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ),
+                   BooleanClause.Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getPackaging() ) )
         {
             q.add( indexer.constructQuery( MAVEN.PACKAGING, searchFields.isExactSearch() ? new SourcedSearchExpression(
                        searchFields.getPackaging() ) : new UserInputSearchExpression( searchFields.getPackaging() ) ),
-                   BooleanClause.Occur.MUST
-            );
+                   BooleanClause.Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getClassName() ) )
         {
             q.add( indexer.constructQuery( MAVEN.CLASSNAMES,
-                                           new UserInputSearchExpression( searchFields.getClassName() ) ), BooleanClause.Occur.MUST );
+                                           new UserInputSearchExpression( searchFields.getClassName() ) ),
+                   BooleanClause.Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getBundleSymbolicName() ) )
         {
             q.add( indexer.constructQuery( OSGI.SYMBOLIC_NAME,
                                            new UserInputSearchExpression( searchFields.getBundleSymbolicName() ) ),
-                   BooleanClause.Occur.MUST
-            );
+                   BooleanClause.Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getBundleVersion() ) )
         {
             q.add( indexer.constructQuery( OSGI.VERSION,
                                            new UserInputSearchExpression( searchFields.getBundleVersion() ) ),
-                   BooleanClause.Occur.MUST
-            );
+                   BooleanClause.Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getBundleExportPackage() ) )
         {
             q.add( indexer.constructQuery( OSGI.EXPORT_PACKAGE,
                                            new UserInputSearchExpression( searchFields.getBundleExportPackage() ) ),
-                   Occur.MUST
-            );
+                   Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getBundleExportService() ) )
         {
             q.add( indexer.constructQuery( OSGI.EXPORT_SERVICE,
                                            new UserInputSearchExpression( searchFields.getBundleExportService() ) ),
-                   Occur.MUST
-            );
+                   Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) )
         {
             q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE,
                                            new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ),
-                   Occur.MUST
-            );
+                   Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getBundleName() ) )
@@ -249,24 +236,21 @@ public class MavenRepositorySearch
         {
             q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE,
                                            new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ),
-                   Occur.MUST
-            );
+                   Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getBundleRequireBundle() ) )
         {
             q.add( indexer.constructQuery( OSGI.REQUIRE_BUNDLE,
                                            new UserInputSearchExpression( searchFields.getBundleRequireBundle() ) ),
-                   Occur.MUST
-            );
+                   Occur.MUST );
         }
 
         if ( StringUtils.isNotBlank( searchFields.getClassifier() ) )
         {
             q.add( indexer.constructQuery( MAVEN.CLASSIFIER, searchFields.isExactSearch() ? new SourcedSearchExpression(
                        searchFields.getClassifier() ) : new UserInputSearchExpression( searchFields.getClassifier() ) ),
-                   Occur.MUST
-            );
+                   Occur.MUST );
         }
         else if ( searchFields.isExactSearch() )
         {
@@ -283,7 +267,8 @@ public class MavenRepositorySearch
                        searchFields.getRepositories(), searchFields.isIncludePomArtifacts() );
     }
 
-    private static class NullSearch implements SearchTyped, SearchExpression
+    private static class NullSearch
+        implements SearchTyped, SearchExpression
     {
         private static final NullSearch INSTANCE = new NullSearch();
 
@@ -476,13 +461,6 @@ public class MavenRepositorySearch
 
     }
 
-
-    protected List<? extends IndexCreator> getAllIndexCreators()
-    {
-        return mavenIndexerUtils.getAllIndexCreators();
-    }
-
-
     private SearchResults convertToSearchResults( FlatSearchResponse response, SearchResultLimits limits,
                                                   List<? extends ArtifactInfoFilter> artifactInfoFilters,
                                                   List<String> selectedRepos, boolean includePoms )
index cab896bdbaba7fb80e348e4e6f4935dc6c6dc78c..e3b96f0430e0aa80894c99dae401f565c4eeeab7 100644 (file)
@@ -22,7 +22,6 @@ package org.apache.archiva.indexer.search;
 import junit.framework.TestCase;
 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.utils.FileUtil;
 import org.apache.archiva.configuration.ArchivaConfiguration;
@@ -37,8 +36,8 @@ import org.apache.maven.index.ArtifactScanningListener;
 import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.QueryCreator;
 import org.apache.maven.index.ScanningResult;
+import org.apache.maven.index.context.IndexCreator;
 import org.apache.maven.index.context.IndexingContext;
-import org.apache.maven.index.shaded.lucene.index.IndexUpgrader;
 import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 import org.junit.After;
@@ -85,7 +84,7 @@ public abstract class AbstractMavenRepositorySearch
     PlexusSisuBridge plexusSisuBridge;
 
     @Inject
-    MavenIndexerUtils mavenIndexerUtils;
+    List<IndexCreator> indexCreators;
 
     @Inject
     NexusIndexer nexusIndexer;
@@ -106,7 +105,7 @@ public abstract class AbstractMavenRepositorySearch
         FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ) );
         assertFalse( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ).exists() );
 
-        archivaConfigControl = EasyMock.createControl( );
+        archivaConfigControl = EasyMock.createControl();
 
         archivaConfig = archivaConfigControl.createMock( ArchivaConfiguration.class );
 
@@ -116,12 +115,11 @@ public abstract class AbstractMavenRepositorySearch
         DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin();
         defaultProxyConnectorAdmin.setArchivaConfiguration( archivaConfig );
 
-        search = new MavenRepositorySearch( nexusIndexer, defaultManagedRepositoryAdmin, mavenIndexerUtils,
-                                            defaultProxyConnectorAdmin, queryCreator );
+        search = new MavenRepositorySearch( nexusIndexer, defaultManagedRepositoryAdmin, defaultProxyConnectorAdmin,
+                                            queryCreator );
 
-        defaultManagedRepositoryAdmin.setMavenIndexerUtils( mavenIndexerUtils );
         defaultManagedRepositoryAdmin.setIndexer( nexusIndexer );
-        defaultManagedRepositoryAdmin.setIndexCreators( mavenIndexerUtils.getAllIndexCreators() );
+        defaultManagedRepositoryAdmin.setIndexCreators( indexCreators );
 
         config = new Configuration();
         config.addManagedRepository( createRepositoryConfig( TEST_REPO_1 ) );
@@ -204,8 +202,7 @@ public abstract class AbstractMavenRepositorySearch
 
         context = nexusIndexer.addIndexingContext( repository, repository, repo, indexDirectory,
                                                    repo.toURI().toURL().toExternalForm(),
-                                                   indexDirectory.toURI().toURL().toString(),
-                                                   search.getAllIndexCreators() );
+                                                   indexDirectory.toURI().toURL().toString(), indexCreators );
 
         // minimize datas in memory
 //        context.getIndexWriter().setMaxBufferedDocs( -1 );
index 8fb3728507bcef002dfb1d85c18dca45ae2b1e01..77cddb8ee804b5a0b61f9aae07aaabb7e3c1f330 100644 (file)
@@ -871,13 +871,13 @@ public class MavenRepositorySearchTest
         File indexDirectory = new File( repo, ".index" );
         FileUtils.copyDirectoryStructure( new File( "src/test/repo-release" ), repo );
 
-        IndexUpgrader.main( new String[]{indexDirectory.getAbsolutePath()} );
+        IndexUpgrader.main( new String[]{ indexDirectory.getAbsolutePath() } );
 
         createIndex( "repo-release", Collections.emptyList(), false );
 
         nexusIndexer.addIndexingContext( REPO_RELEASE, REPO_RELEASE, repo, indexDirectory,
                                          repo.toURI().toURL().toExternalForm(),
-                                         indexDirectory.toURI().toURL().toString(), search.getAllIndexCreators() );
+                                         indexDirectory.toURI().toURL().toString(), indexCreators );
 
         SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES );
         limits.setPageSize( 300 );
diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java
deleted file mode 100644 (file)
index 7f86da4..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.apache.archiva.common.plexusbridge;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.maven.index.context.IndexCreator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M1
- */
-@Service( "mavenIndexerUtils" )
-public class MavenIndexerUtils
-{
-
-    private Logger log = LoggerFactory.getLogger( getClass() );
-
-    private List<? extends IndexCreator> allIndexCreators;
-
-    private ApplicationContext applicationContext;
-
-    @Inject
-    public MavenIndexerUtils(ApplicationContext applicationContext, Map<String, IndexCreator> indexers)
-    {
-        this.applicationContext = applicationContext;
-    }
-
-    @PostConstruct
-    public void initialize()
-    {
-        allIndexCreators = new ArrayList<>( applicationContext.getBeansOfType( IndexCreator.class ).values());
-
-        if ( allIndexCreators == null || allIndexCreators.isEmpty() )
-        {
-            throw new RuntimeException( "cannot initiliaze IndexCreators" );
-        }
-
-        log.debug( "allIndexCreators {}", allIndexCreators );
-    }
-
-    public List<? extends IndexCreator> getAllIndexCreators()
-    {
-        return allIndexCreators;
-    }
-
-    public void setAllIndexCreators( List<IndexCreator> allIndexCreators )
-    {
-        this.allIndexCreators = allIndexCreators;
-    }
-}
index ad90b4e8227b230fad3e0217a3bb7c579b6f22d4..7ba503cfb5e87774533557a5adb2f5c51f29f40d 100644 (file)
@@ -23,9 +23,6 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
 import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.configuration.Configuration;
 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
@@ -95,9 +92,6 @@ public class DefaultManagedRepositoryAdmin
     @Inject
     private RepositoryStatisticsManager repositoryStatisticsManager;
 
-    @Inject
-    private MavenIndexerUtils mavenIndexerUtils;
-
     @Inject
     protected RoleManager roleManager;
 
@@ -116,15 +110,6 @@ public class DefaultManagedRepositoryAdmin
     public void initialize()
         throws RepositoryAdminException, RoleManagerException
     {
-//        try
-//        {
-//            indexCreators = mavenIndexerUtils.getAllIndexCreators();
-//            indexer = plexusSisuBridge.lookup( NexusIndexer.class );
-//        }
-//        catch ( PlexusSisuBridgeException e )
-//        {
-//            throw new RepositoryAdminException( e.getMessage(), e );
-//        }
         // initialize index context on start and check roles here
         for ( ManagedRepository managedRepository : getManagedRepositories() )
         {
@@ -817,16 +802,6 @@ public class DefaultManagedRepositoryAdmin
         this.repositoryTaskScheduler = repositoryTaskScheduler;
     }
 
-    public MavenIndexerUtils getMavenIndexerUtils()
-    {
-        return mavenIndexerUtils;
-    }
-
-    public void setMavenIndexerUtils( MavenIndexerUtils mavenIndexerUtils )
-    {
-        this.mavenIndexerUtils = mavenIndexerUtils;
-    }
-
     public NexusIndexer getIndexer()
     {
         return indexer;
index a3930c6d5213c69f2aa7e31d419589af5691e778..b1f39558b6901e50d32416714ae4244576274c73 100644 (file)
@@ -25,8 +25,6 @@ import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
 import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
 import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
 import org.apache.archiva.common.ArchivaException;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.ConfigurationEvent;
@@ -83,9 +81,6 @@ public class DefaultDownloadRemoteIndexScheduler
     @Inject
     private NetworkProxyAdmin networkProxyAdmin;
 
-    @Inject
-    private MavenIndexerUtils mavenIndexerUtils;
-
     @Inject
     private NexusIndexer nexusIndexer;
 
index 044ed87fda4972a1d25658cf21b310c6f57cd4b6..b9ad48c6815726174d7600993d14cbe45c2f30f5 100644 (file)
@@ -22,14 +22,13 @@ package org.apache.archiva.scheduler.indexing;
 import junit.framework.TestCase;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
 import org.apache.maven.index.ArtifactInfo;
 import org.apache.maven.index.FlatSearchRequest;
 import org.apache.maven.index.FlatSearchResponse;
 import org.apache.maven.index.MAVEN;
 import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.context.IndexCreator;
 import org.apache.maven.index.context.IndexingContext;
 import org.apache.maven.index.expr.SourcedSearchExpression;
 import org.apache.maven.index.expr.StringSearchExpression;
@@ -37,7 +36,9 @@ import org.apache.maven.index.shaded.lucene.search.BooleanClause;
 import org.apache.maven.index.shaded.lucene.search.BooleanQuery;
 import org.apache.maven.index.shaded.lucene.search.IndexSearcher;
 import org.apache.maven.index.shaded.lucene.search.TopDocs;
+import org.apache.maven.index.updater.DefaultIndexUpdater;
 import org.apache.maven.index.updater.IndexUpdateRequest;
+import org.apache.maven.index.updater.IndexUpdater;
 import org.assertj.core.api.Assertions;
 import org.junit.After;
 import org.junit.Before;
@@ -46,19 +47,10 @@ import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 
 import javax.inject.Inject;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.file.Files;
-import java.nio.file.Paths;
+import java.util.List;
 import java.util.Set;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
 
 /**
  * ArchivaIndexingTaskExecutorTest
@@ -77,11 +69,14 @@ public class ArchivaIndexingTaskExecutorTest
     private NexusIndexer indexer;
 
     @Inject
-    MavenIndexerUtils mavenIndexerUtils;
+    List<IndexCreator> indexCreators;
 
     @Inject
     ManagedRepositoryAdmin managedRepositoryAdmin;
 
+    @Inject
+    private IndexUpdater indexUpdater;
+
     @Before
     @Override
     public void setUp()
@@ -153,12 +148,12 @@ public class ArchivaIndexingTaskExecutorTest
 
         if ( !indexer.getIndexingContexts().containsKey( repositoryConfig.getId() ) )
         {
-            IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), repositoryConfig.getId(),
-                                                                  new File( repositoryConfig.getLocation() ),
-                                                                  new File( repositoryConfig.getLocation(),
-                                                                            ".indexer" ), null, null,
-                                                                  mavenIndexerUtils.getAllIndexCreators()
-            );
+            IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), //
+                                                                  repositoryConfig.getId(), //
+                                                                  new File( repositoryConfig.getLocation() ), //
+                                                                  new File( repositoryConfig.getLocation(), ".indexer" )
+                                                                  //
+                , null, null, indexCreators );
             context.setSearchable( true );
         }
 
@@ -260,8 +255,7 @@ public class ArchivaIndexingTaskExecutorTest
                BooleanClause.Occur.SHOULD );
         q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID,
                                        new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ),
-               BooleanClause.Occur.SHOULD
-        );
+               BooleanClause.Occur.SHOULD );
 
         assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() );
         assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() );
@@ -317,17 +311,17 @@ public class ArchivaIndexingTaskExecutorTest
         // test packed index file creation
         //no more zip
         //Assertions.assertThat(new File( indexerDirectory, "nexus-maven-repository-index.zip" )).exists();
-        Assertions.assertThat(new File( indexerDirectory, "nexus-maven-repository-index.properties" )).exists();
-        Assertions.assertThat(new File( indexerDirectory, "nexus-maven-repository-index.gz" )).exists();
+        Assertions.assertThat( new File( indexerDirectory, "nexus-maven-repository-index.properties" ) ).exists();
+        Assertions.assertThat( new File( indexerDirectory, "nexus-maven-repository-index.gz" ) ).exists();
 
         // unpack .zip index
         File destDir = new File( repositoryConfig.getLocation(), ".indexer/tmp" );
-        unzipIndex( indexerDirectory.getPath(), destDir.getPath() );
+        //unzipIndex( indexerDirectory.getPath(), destDir.getPath() );
 
-        TrackingFetcher fetcher = new TrackingFetcher( remoteRepo );
-        updateRequest = new IndexUpdateRequest( testContext, fetcher );
-        updateRequest.setLocalIndexCacheDir( localCacheDir );
-        updater.fetchAndUpdateIndex( updateRequest );
+        DefaultIndexUpdater.FileFetcher fetcher = new DefaultIndexUpdater.FileFetcher( indexerDirectory );
+        IndexUpdateRequest updateRequest = new IndexUpdateRequest( getIndexingContext(), fetcher );
+        //updateRequest.setLocalIndexCacheDir( indexerDirectory );
+        indexUpdater.fetchAndUpdateIndex( updateRequest );
 
         BooleanQuery q = new BooleanQuery();
         q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ),
index e0660c269fa1c15e02cae00d2b7aea5a21d670fb..bbb7416ce38f441365974a06e4404328c1bbb1fb 100644 (file)
@@ -23,16 +23,15 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
 import org.apache.archiva.admin.model.admin.ArchivaAdministration;
 import org.apache.archiva.admin.model.beans.ManagedRepository;
 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
-import org.apache.archiva.metadata.model.facets.AuditEvent;
 import org.apache.archiva.checksum.ChecksumAlgorithm;
 import org.apache.archiva.checksum.ChecksummedFile;
-import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.utils.VersionComparator;
 import org.apache.archiva.common.utils.VersionUtil;
 import org.apache.archiva.maven2.metadata.MavenMetadataReader;
 import org.apache.archiva.maven2.model.Artifact;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.model.facets.AuditEvent;
 import org.apache.archiva.metadata.model.maven2.MavenArtifactFacet;
 import org.apache.archiva.metadata.repository.MetadataRepository;
 import org.apache.archiva.metadata.repository.MetadataRepositoryException;
@@ -125,9 +124,6 @@ public class DefaultRepositoriesService
     @Inject
     private PlexusSisuBridge plexusSisuBridge;
 
-    @Inject
-    private MavenIndexerUtils mavenIndexerUtils;
-
     @Inject
     private SecuritySystem securitySystem;
 
index 49c0748e1e5c6020e6216ce838fd208260897e6c..830a3e6e3a916c585e680f607cc6ed5cc86c4877 100644 (file)
@@ -75,6 +75,7 @@
     <property name="queue" ref="taskQueue#repository-scanning"/>
   </bean>
 
+  <!--
   <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
     <constructor-arg ref="config"/>
   </bean>
@@ -83,6 +84,7 @@
     <constructor-arg value="${basedir}/src/test/repository.xml"/>
     <constructor-arg value="${appserver.base}/jcr"/>
   </bean>
+  -->
 
   <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"
         init-method="initialize">
index 3e8195d6a2ed5cf220363502a497da807fdb82d0..d62446b45286b0daa887fb98b1209dce779f60a5 100644 (file)
@@ -72,6 +72,7 @@
     <property name="queue" ref="taskQueue#repository-scanning"/>
   </bean>
 
+  <!--
   <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
     <constructor-arg ref="config"/>
   </bean>
@@ -79,6 +80,7 @@
     <constructor-arg value="${basedir}/src/test/repository.xml"/>
     <constructor-arg value="${appserver.base}/jcr"/>
   </bean>
+  -->
 
   <alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
   <alias name="userConfiguration#archiva" alias="userConfiguration#default"/>
index 1e02fbcc7b3ac4c18accdadcf735518710ed77c8..6b72d332a4992042846dfe244ec155b1838019e3 100644 (file)
@@ -28,6 +28,7 @@
            http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
        default-lazy-init="true">
 
+  <!--
   <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown">
     <constructor-arg ref="config"/>
   </bean>
@@ -35,6 +36,7 @@
     <constructor-arg value="${basedir}/src/test/repository.xml"/>
     <constructor-arg value="${appserver.base}/jcr"/>
   </bean>
+  -->
 
   <alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
 
index 079828fbe15a3619cdadf3e3662b3b6ddefb2181..cd59302e7569d29c750e691bbe4d7e7a582dbfa1 100644 (file)
@@ -18,23 +18,18 @@ package org.apache.archiva.webdav.util;
  * under the License.
  */
 
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.context.IndexingContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
-import java.io.IOException;
 
 /**
  * @author Olivier Lamy
@@ -46,15 +41,16 @@ public class MavenIndexerCleaner
     Logger log = LoggerFactory.getLogger( getClass() );
 
 
-    private PlexusSisuBridge plexusSisuBridge;
 
     @Inject
     private ApplicationContext applicationContext;
 
+    @Inject
+    NexusIndexer nexusIndexer;
+
     @PostConstruct
     public void startup()
     {
-        plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class );
         cleanupIndex();
     }
 
@@ -70,9 +66,6 @@ public class MavenIndexerCleaner
     {
         try
         {
-            WebApplicationContext wacu =
-                WebApplicationContextUtils.getRequiredWebApplicationContext( servletContextEvent.getServletContext() );
-            plexusSisuBridge = wacu.getBean( PlexusSisuBridge.class );
             cleanupIndex();
 
         }
@@ -103,7 +96,6 @@ public class MavenIndexerCleaner
         log.info( "cleanup IndexingContext" );
         try
         {
-            NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
             for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() )
             {
                 nexusIndexer.removeIndexingContext( context, true );
index ed864639d62034ab9726b0fcff783b418cc47b5b..fa502798d5e198b755b7dc118f4789dfe1ce0131 100644 (file)
@@ -98,7 +98,7 @@ public class JcrRepositorySessionFactory
         throws Exception
     {
 
-        // skip initialisation if not cassandra
+        // skip initialisation if not jcr
         if ( !StringUtils.equals( repositorySessionFactoryBean.getId(), "jcr" ) )
         {
             return;
index 74dd0773f81c8528fdf668b58d90e44f5e666bb2..50dab921b307f38ec521f57b23012d4a8626eda6 100644 (file)
@@ -19,7 +19,7 @@
   -->
 
 
-<configuration status="debug">
+<configuration>
 
 
 
 
   </appenders>
   <loggers>
-
-
-    <logger name="org.apache.jackrabbit" level="trace"/>
-
-    <root level="debug" includeLocation="true">
+    <logger name="org.apache.jackrabbit" level="info"/>
+    <root level="info" includeLocation="true">
       <appender-ref ref="console"/>
     </root>
   </loggers>
diff --git a/pom.xml b/pom.xml
index 8d0e5424dc37b74ffc37bef8ccfc846350281332..46a0022d5b8870576ebddad13b9ab450565f3d1e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <groupId>org.apache.jackrabbit</groupId>
         <artifactId>oak-jcr</artifactId>
         <version>${jcr-oak.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+          </exclusion>
+        </exclusions>
       </dependency>
       <dependency>
         <groupId>org.apache.jackrabbit</groupId>