aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2013-02-06 21:22:04 +0000
committerOlivier Lamy <olamy@apache.org>2013-02-06 21:22:04 +0000
commit9b1ba50b0a623f04f75080fa8f2b9458c48c404e (patch)
tree7309b8fd3f76f10cdfcce2cdadafbae14e83dfb1
parenta331e649caaa8a1d428cc5614ad706ba1ea59c2c (diff)
downloadarchiva-9b1ba50b0a623f04f75080fa8f2b9458c48c404e.tar.gz
archiva-9b1ba50b0a623f04f75080fa8f2b9458c48c404e.zip
remove duplicate code with using exposed method
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1443220 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java43
1 files changed, 7 insertions, 36 deletions
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
index 6e5f24550..402a0df82 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
@@ -60,7 +60,7 @@ import java.util.Set;
/**
* RepositorySearch implementation which uses the Maven Indexer for searching.
*/
-@Service ("repositorySearch#maven")
+@Service("repositorySearch#maven")
public class MavenRepositorySearch
implements RepositorySearch
{
@@ -338,37 +338,8 @@ public class MavenRepositorySearch
if ( repoConfig != null )
{
- String indexDir = repoConfig.getIndexDirectory();
- File indexDirectory = null;
- if ( indexDir != null && !"".equals( indexDir ) )
- {
- indexDirectory = new File( repoConfig.getIndexDirectory() );
- if ( !indexDirectory.isAbsolute() )
- {
- indexDirectory = new File( repoConfig.getLocation(), repoConfig.getIndexDirectory() );
- }
- }
- else
- {
- indexDirectory = new File( repoConfig.getLocation(), ".indexer" );
- }
-
- IndexingContext context = indexer.getIndexingContexts().get( repoConfig.getId() );
- if ( context != null )
- {
- // alreday here so no need to record it again
- log.debug( "index with id {} already exists skip adding it", repoConfig.getId() );
- // set searchable flag
- context.setSearchable( repoConfig.isScanned() );
- indexingContextIds.add( context.getId() );
- indexingContextIds.addAll( getRemoteIndexingContextIds( repo ) );
- continue;
- }
- context = indexer.addIndexingContext( repoConfig.getId(), repoConfig.getId(),
- new File( repoConfig.getLocation() ), indexDirectory, null,
- null, getAllIndexCreators() );
- context.setSearchable( repoConfig.isScanned() );
+ IndexingContext context = managedRepositoryAdmin.createIndexContext( repoConfig );
if ( context.isSearchable() )
{
indexingContextIds.addAll( getRemoteIndexingContextIds( repo ) );
@@ -382,23 +353,23 @@ public class MavenRepositorySearch
}
else
{
- log.warn( "Repository '" + repo + "' not found in configuration." );
+ log.warn( "Repository '{}' not found in configuration.", repo );
}
}
catch ( UnsupportedExistingLuceneIndexException e )
{
- log.warn( "Error accessing index of repository '" + repo + "' : " + e.getMessage() );
+ log.warn( "Error accessing index of repository '{}' : {}", repo, e.getMessage() );
continue;
}
catch ( IOException e )
{
- log.warn( "IO error occured while accessing index of repository '" + repo + "' : " + e.getMessage() );
+ 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() );
+ log.warn( "RepositoryAdminException occured while accessing index of repository '{}' : {}", repo,
+ e.getMessage() );
continue;
}
}