Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.maven.archiva.indexer.lucene;
  
  /*
   * 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 java.io.File;

Factory for Lucene repository content index instances.

Author(s):
Brett Porter
Joakim Erdfelt
Plexus.component:
role="org.apache.maven.archiva.indexer.RepositoryContentIndexFactory" role-hint="lucene"
 
     implements RepositoryContentIndexFactory
 {
    

Plexus.requirement:
 
 
     {
         File indexDir = toIndexDirrepository"bytecode" );
         return new LuceneRepositoryContentIndexrepositoryindexDirnew BytecodeHandlers() );
     }
 
     {
         File indexDir = toIndexDirrepository"filecontent" );
         return new LuceneRepositoryContentIndexrepositoryindexDirnew FileContentHandlers() );
     }
 
     {
         File indexDir = toIndexDirrepository"hashcodes" );
         return new LuceneRepositoryContentIndexrepositoryindexDirnew HashcodesHandlers() );
     }

    
Obtain the index directory for the provided repository.

Parameters:
repository the repository to obtain the index directory from.
indexId the id of the index
Returns:
the directory to put the index into.
 
     private File toIndexDirManagedRepositoryConfiguration repositoryString indexId )
     {
         // Attempt to get the specified indexDir in the configuration first.
         ManagedRepositoryConfiguration repoConfig =
             .getConfiguration().findManagedRepositoryByIdrepository.getId() );
         File indexDir;
 
         if ( repoConfig == null )
         {
             // No configured index dir, use the repository path instead.
             String repoPath = repository.getLocation();
             indexDir = new FilerepoPath".index/" + indexId + "/" );
         }
         else
         {
             // Use configured index dir.
             String repoPath = repoConfig.getIndexDir();
             if ( StringUtils.isBlankrepoPath ) )
             {
                 repoPath = repository.getLocation();
                 if ( !repoPath.endsWith"/" ) )
                 {
                     repoPath += "/";
                 }
                 repoPath += ".index";
             }
             indexDir = new FilerepoPath"/" + indexId + "/" );
        }
        return indexDir;
    }
New to GrepCode? Check out our FAQ X