- java.lang.Object
-
- org.apache.lucene.util.CommandLineUtil
-
public final class CommandLineUtil extends java.lang.Object
Class containing some useful methods used by command line tools
-
-
Constructor Summary
Constructors Modifier Constructor Description private
CommandLineUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.String
adjustDirectoryClassName(java.lang.String clazzName)
static java.lang.Class<? extends Directory>
loadDirectoryClass(java.lang.String clazzName)
Loads a specific Directory implementationstatic java.lang.Class<? extends FSDirectory>
loadFSDirectoryClass(java.lang.String clazzName)
Loads a specific FSDirectory implementationstatic FSDirectory
newFSDirectory(java.lang.Class<? extends FSDirectory> clazz, java.nio.file.Path path)
Creates a new specific FSDirectory instancestatic FSDirectory
newFSDirectory(java.lang.Class<? extends FSDirectory> clazz, java.nio.file.Path path, LockFactory lf)
Creates a new specific FSDirectory instancestatic FSDirectory
newFSDirectory(java.lang.String clazzName, java.nio.file.Path path)
Creates a specific FSDirectory instance starting from its class name, using the default lock factorystatic FSDirectory
newFSDirectory(java.lang.String clazzName, java.nio.file.Path path, LockFactory lf)
Creates a specific FSDirectory instance starting from its class name
-
-
-
Method Detail
-
newFSDirectory
public static FSDirectory newFSDirectory(java.lang.String clazzName, java.nio.file.Path path)
Creates a specific FSDirectory instance starting from its class name, using the default lock factory- Parameters:
clazzName
- The name of the FSDirectory class to loadpath
- The path to be used as parameter constructor- Returns:
- the new FSDirectory instance
-
newFSDirectory
public static FSDirectory newFSDirectory(java.lang.String clazzName, java.nio.file.Path path, LockFactory lf)
Creates a specific FSDirectory instance starting from its class name- Parameters:
clazzName
- The name of the FSDirectory class to loadpath
- The path to be used as parameter constructorlf
- The lock factory to be used- Returns:
- the new FSDirectory instance
-
loadDirectoryClass
public static java.lang.Class<? extends Directory> loadDirectoryClass(java.lang.String clazzName) throws java.lang.ClassNotFoundException
Loads a specific Directory implementation- Parameters:
clazzName
- The name of the Directory class to load- Returns:
- The Directory class loaded
- Throws:
java.lang.ClassNotFoundException
- If the specified class cannot be found.
-
loadFSDirectoryClass
public static java.lang.Class<? extends FSDirectory> loadFSDirectoryClass(java.lang.String clazzName) throws java.lang.ClassNotFoundException
Loads a specific FSDirectory implementation- Parameters:
clazzName
- The name of the FSDirectory class to load- Returns:
- The FSDirectory class loaded
- Throws:
java.lang.ClassNotFoundException
- If the specified class cannot be found.
-
adjustDirectoryClassName
private static java.lang.String adjustDirectoryClassName(java.lang.String clazzName)
-
newFSDirectory
public static FSDirectory newFSDirectory(java.lang.Class<? extends FSDirectory> clazz, java.nio.file.Path path) throws java.lang.ReflectiveOperationException
Creates a new specific FSDirectory instance- Parameters:
clazz
- The class of the object to be createdpath
- The file to be used as parameter constructor- Returns:
- The new FSDirectory instance
- Throws:
java.lang.NoSuchMethodException
- If the Directory does not have a constructor that takesPath
.java.lang.InstantiationException
- If the class is abstract or an interface.java.lang.IllegalAccessException
- If the constructor does not have public visibility.java.lang.reflect.InvocationTargetException
- If the constructor throws an exceptionjava.lang.ReflectiveOperationException
-
newFSDirectory
public static FSDirectory newFSDirectory(java.lang.Class<? extends FSDirectory> clazz, java.nio.file.Path path, LockFactory lf) throws java.lang.ReflectiveOperationException
Creates a new specific FSDirectory instance- Parameters:
clazz
- The class of the object to be createdpath
- The file to be used as parameter constructorlf
- The lock factory to be used- Returns:
- The new FSDirectory instance
- Throws:
java.lang.NoSuchMethodException
- If the Directory does not have a constructor that takesPath
.java.lang.InstantiationException
- If the class is abstract or an interface.java.lang.IllegalAccessException
- If the constructor does not have public visibility.java.lang.reflect.InvocationTargetException
- If the constructor throws an exceptionjava.lang.ReflectiveOperationException
-
-