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;
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;
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;
}
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;
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;
private NexusIndexer nexusIndexer;
@Inject
- private MavenIndexerUtils mavenIndexerUtils;
+ private List<IndexCreator> indexCreators;
@Inject
private ManagedRepositoryAdmin managedRepositoryAdmin;
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" );
* 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;
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
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() )
{
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 );
}
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;
private ProxyConnectorAdmin proxyConnectorAdmin;
- private MavenIndexerUtils mavenIndexerUtils;
-
protected MavenRepositorySearch()
{
// for test purpose
@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;
}
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() ) )
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() ) )
{
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() )
{
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();
}
-
- protected List<? extends IndexCreator> getAllIndexCreators()
- {
- return mavenIndexerUtils.getAllIndexCreators();
- }
-
-
private SearchResults convertToSearchResults( FlatSearchResponse response, SearchResultLimits limits,
List<? extends ArtifactInfoFilter> artifactInfoFilters,
List<String> selectedRepos, boolean includePoms )
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;
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;
PlexusSisuBridge plexusSisuBridge;
@Inject
- MavenIndexerUtils mavenIndexerUtils;
+ List<IndexCreator> indexCreators;
@Inject
NexusIndexer nexusIndexer;
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 );
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 ) );
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 );
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 );
+++ /dev/null
-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;
- }
-}
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;
@Inject
private RepositoryStatisticsManager repositoryStatisticsManager;
- @Inject
- private MavenIndexerUtils mavenIndexerUtils;
-
@Inject
protected RoleManager roleManager;
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() )
{
this.repositoryTaskScheduler = repositoryTaskScheduler;
}
- public MavenIndexerUtils getMavenIndexerUtils()
- {
- return mavenIndexerUtils;
- }
-
- public void setMavenIndexerUtils( MavenIndexerUtils mavenIndexerUtils )
- {
- this.mavenIndexerUtils = mavenIndexerUtils;
- }
-
public NexusIndexer getIndexer()
{
return indexer;
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;
@Inject
private NetworkProxyAdmin networkProxyAdmin;
- @Inject
- private MavenIndexerUtils mavenIndexerUtils;
-
@Inject
private NexusIndexer nexusIndexer;
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;
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;
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
private NexusIndexer indexer;
@Inject
- MavenIndexerUtils mavenIndexerUtils;
+ List<IndexCreator> indexCreators;
@Inject
ManagedRepositoryAdmin managedRepositoryAdmin;
+ @Inject
+ private IndexUpdater indexUpdater;
+
@Before
@Override
public void setUp()
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 );
}
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() );
// 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" ) ),
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;
@Inject
private PlexusSisuBridge plexusSisuBridge;
- @Inject
- private MavenIndexerUtils mavenIndexerUtils;
-
@Inject
private SecuritySystem securitySystem;
<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>
<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">
<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>
<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"/>
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>
<constructor-arg value="${basedir}/src/test/repository.xml"/>
<constructor-arg value="${appserver.base}/jcr"/>
</bean>
+ -->
<alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
* 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
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();
}
{
try
{
- WebApplicationContext wacu =
- WebApplicationContextUtils.getRequiredWebApplicationContext( servletContextEvent.getServletContext() );
- plexusSisuBridge = wacu.getBean( PlexusSisuBridge.class );
cleanupIndex();
}
log.info( "cleanup IndexingContext" );
try
{
- NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() )
{
nexusIndexer.removeIndexingContext( context, true );
throws Exception
{
- // skip initialisation if not cassandra
+ // skip initialisation if not jcr
if ( !StringUtils.equals( repositorySessionFactoryBean.getId(), "jcr" ) )
{
return;
-->
-<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>
<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>