Package org.opengrok.indexer.history
Class RepositoryFactory
java.lang.Object
org.opengrok.indexer.history.RepositoryFactory
This is a factory class for the different repositories.
- Author:
- austvik
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
<Class<? extends Repository>> Gets a list of all disabled repository handlers.static Repository
getRepository
(File file) static Repository
getRepository
(File file, CommandTimeoutType cmdType) static Repository
getRepository
(File file, CommandTimeoutType cmdType, boolean isNested) Returns a repository for the given file, or null if no repository was found.static Repository
getRepository
(RepositoryInfo info, CommandTimeoutType cmdType) Returns a repository for the given file, or null if no repository was found.static List
<Class<? extends Repository>> Get a list of all available repository handlers.static void
Go through all supported repository types, and add their ignored items to the environment's lists of ignored files/directories -- but skip any repository types which are named inRuntimeEnvironment.getDisabledRepositories()
()}.static String
matchRepositoryByName
(String name) Tries to match a supported repositories by name or nickname -- e.g.
-
Method Details
-
getRepositoryClasses
Get a list of all available repository handlers.- Returns:
- a list that contains non-
null
values only
-
getDisabledRepositoryClasses
Gets a list of all disabled repository handlers.- Returns:
- a list that contains non-
null
values only
-
getRepository
public static Repository getRepository(File file) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, IOException, ForbiddenSymlinkException -
getRepository
public static Repository getRepository(File file, CommandTimeoutType cmdType) throws IllegalAccessException, InvocationTargetException, ForbiddenSymlinkException, InstantiationException, NoSuchMethodException, IOException - Parameters:
file
- filecmdType
- command timeout type- Returns:
- repository object
- Throws:
IllegalAccessException
- on errorInvocationTargetException
- on errorForbiddenSymlinkException
- on errorInstantiationException
- on errorNoSuchMethodException
- on errorIOException
- on error
-
getRepository
public static Repository getRepository(File file, CommandTimeoutType cmdType, boolean isNested) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, IOException, ForbiddenSymlinkException Returns a repository for the given file, or null if no repository was found.Note that the operations performed by this method take quite a long time thanks to external commands being executed. For that reason, when run on multiple files, it should be parallelized (e.g. like it is done in
invalidateRepositories()
) and the commands run within should use interactive command timeout (as specified inConfiguration
).- Parameters:
file
- File that might contain a repositorycmdType
- command timeout typeisNested
- a value indicating if a nestableRepository
is required- Returns:
- Correct repository for the given file or
null
- Throws:
InstantiationException
- in case we cannot create the repository objectIllegalAccessException
- in case no permissions to repository fileNoSuchMethodException
- in case we cannot create the repository objectInvocationTargetException
- in case we cannot create the repository objectIOException
- when resolving repository pathForbiddenSymlinkException
- when resolving repository path
-
getRepository
public static Repository getRepository(RepositoryInfo info, CommandTimeoutType cmdType) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, IOException, ForbiddenSymlinkException Returns a repository for the given file, or null if no repository was found.- Parameters:
info
- Information about the repositorycmdType
- command timeout type- Returns:
- Correct repository for the given file
- Throws:
InstantiationException
- in case we cannot create the repository objectIllegalAccessException
- in case no permissions to repositoryNoSuchMethodException
- in case we cannot create the repository objectInvocationTargetException
- in case we cannot create the repository objectIOException
- when resolving repository pathForbiddenSymlinkException
- when resolving repository path
-
initializeIgnoredNames
Go through all supported repository types, and add their ignored items to the environment's lists of ignored files/directories -- but skip any repository types which are named inRuntimeEnvironment.getDisabledRepositories()
()}. This way per-repository ignored entries are set inside repository classes rather than globally in IgnoredFiles/Dirs.(Should be called after
RuntimeEnvironment.setConfiguration(Configuration)
.) -
matchRepositoryByName
Tries to match a supported repositories by name or nickname -- e.g."CVSRepository"
or"CVS"
or"cvs"
.- Returns:
- a defined, class simple name (e.g.
"CVSRepository"
when"cvs"
is passed); ornull
if no match found
-