Class 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 implementation
      static java.lang.Class<? extends FSDirectory> loadFSDirectoryClass​(java.lang.String clazzName)
      Loads a specific FSDirectory implementation
      static FSDirectory newFSDirectory​(java.lang.Class<? extends FSDirectory> clazz, java.nio.file.Path path)
      Creates a new specific FSDirectory instance
      static FSDirectory newFSDirectory​(java.lang.Class<? extends FSDirectory> clazz, java.nio.file.Path path, LockFactory lf)
      Creates a new specific FSDirectory instance
      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
      static FSDirectory newFSDirectory​(java.lang.String clazzName, java.nio.file.Path path, LockFactory lf)
      Creates a specific FSDirectory instance starting from its class name
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandLineUtil

        private CommandLineUtil()
    • 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 load
        path - 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 load
        path - The path to be used as parameter constructor
        lf - 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 created
        path - 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 takes Path.
        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 exception
        java.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 created
        path - The file to be used as parameter constructor
        lf - The lock factory to be used
        Returns:
        The new FSDirectory instance
        Throws:
        java.lang.NoSuchMethodException - If the Directory does not have a constructor that takes Path.
        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 exception
        java.lang.ReflectiveOperationException