<artifactId>archiva-indexer</artifactId>
<name>Archiva Base :: Indexer</name>
<dependencies>
+
<dependency>
<groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
+ <artifactId>archiva-repository-admin-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-configuration</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-repository-admin-default</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
* under the License.
*/
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.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.commons.lang.StringUtils;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.index.ArtifactInfo;
import org.apache.maven.index.FlatSearchRequest;
import org.apache.maven.index.FlatSearchResponse;
private NexusIndexer indexer;
- private ArchivaConfiguration archivaConfig;
+ private ManagedRepositoryAdmin managedRepositoryAdmin;
private MavenIndexerUtils mavenIndexerUtils;
@Inject
- public NexusRepositorySearch( PlexusSisuBridge plexusSisuBridge, ArchivaConfiguration archivaConfig,
+ public NexusRepositorySearch( PlexusSisuBridge plexusSisuBridge, ManagedRepositoryAdmin managedRepositoryAdmin,
MavenIndexerUtils mavenIndexerUtils )
throws PlexusSisuBridgeException
{
this.indexer = plexusSisuBridge.lookup( NexusIndexer.class );
- this.archivaConfig = archivaConfig;
+ this.managedRepositoryAdmin = managedRepositoryAdmin;
this.mavenIndexerUtils = mavenIndexerUtils;
}
{
try
{
- Configuration config = archivaConfig.getConfiguration();
- ManagedRepositoryConfiguration repoConfig = config.findManagedRepositoryById( repo );
+ ManagedRepository repoConfig = managedRepositoryAdmin.getManagedRepository( repo );
if ( repoConfig != null )
{
- String indexDir = repoConfig.getIndexDir();
+ String indexDir = repoConfig.getIndexDirectory();
File indexDirectory = null;
if ( indexDir != null && !"".equals( indexDir ) )
{
- indexDirectory = new File( repoConfig.getIndexDir() );
+ indexDirectory = new File( repoConfig.getIndexDirectory() );
}
else
{
{
log.warn( "IO error occured while accessing index of repository '" + repo + "' : " + e.getMessage() );
continue;
+ } catch ( RepositoryAdminException e )
+ {
+ log.warn( "RepositoryAdminException occured while accessing index of repository '" + repo + "' : " + e.getMessage() );
+ continue;
}
}
return indexingContextIds;
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.indexer.search"/>
- <!--
- <bean id="nexusSearch" class="org.apache.archiva.indexer.search.NexusRepositorySearch">
- <constructor-arg ref="nexusIndexer"/>
- <constructor-arg ref="archivaConfiguration#default"/>
- </bean>
- -->
<bean id="logger" class="org.apache.maven.archiva.common.utils.Slf4JPlexusLogger">
<constructor-arg type="java.lang.Class"><value>org.sonatype.nexus.index.DefaultNexusIndexer</value></constructor-arg>
</bean>
-
- <!-- <bean id="indexingContextMap" class="org.apache.archiva.indexer.IndexingContextMap"/> -->
+
</beans>
\ No newline at end of file
*/
import junit.framework.TestCase;
+import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.commons.io.FileUtils;
archivaConfig = (ArchivaConfiguration) archivaConfigControl.getMock();
- search = new NexusRepositorySearch( plexusSisuBridge, archivaConfig, mavenIndexerUtils );
+ DefaultManagedRepositoryAdmin defaultManagedRepositoryAdmin = new DefaultManagedRepositoryAdmin();
+ defaultManagedRepositoryAdmin.setArchivaConfiguration( archivaConfig );
+
+ search = new NexusRepositorySearch( plexusSisuBridge, defaultManagedRepositoryAdmin, mavenIndexerUtils );
nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );