org.licas.service

## Class JarFactory

- java.lang.Object
- - org.licas.service.JarFactory

-     public abstract class JarFactory
      extends java.lang.Object

  This class controls the local or remote handling of jar files by the server.
  Author:
    Kieran Greer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JarFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JarFactory` | `getInstance()` Get the created instance of the jar factory.
    `abstract java.util.ArrayList<java.lang.String>` | `getModuleJars()` Get the list of all jar files in the modules folder.
    `abstract java.util.ArrayList<java.lang.String>` | `getServiceJars()` Get the list of all jar files in the services folder.
    `abstract FileObject` | `jarToFile(java.lang.String sourceFile)` Read the contents of the jar file into a `FileObject` and return.
    `static void` | `removeJarFactory(java.lang.String thisFactoryKey)` Remove the current jar factory by re-setting it to null.
    `abstract java.lang.String` | `saveJarFile(FileObject fileObject)` Save the contents of the `FileObject` to the default services location.
    `static void` | `setJarFactory(JarFactory thisJarFactory, java.lang.String thisFactoryKey)` Set the instance of the jar factory to be used.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JarFactory

          public JarFactory()

  - ### Method Detail

    - #### getInstance

          public static JarFactory getInstance()

      Get the created instance of the jar factory.
      Returns:
        the value of jarFactory.

    - #### setJarFactory

          public static void setJarFactory(JarFactory thisJarFactory,
                                           java.lang.String thisFactoryKey)

      Set the instance of the jar factory to be used. This can be set if either: the jar factory is currently null, or the factory key is correct. This will also set the factory key value for the initial (if null) assignment.
      Parameters:
        `thisJarFactory` - the jar factory that is retrieved for any method call.
        `thisFactoryKey` - a key to protect dynamic changing of the factory.

    - #### removeJarFactory

          public static void removeJarFactory(java.lang.String thisFactoryKey)

      Remove the current jar factory by re-setting it to null.
      Parameters:
        `thisFactoryKey` - a key to protect dynamic changing of the factory.

    - #### getServiceJars

          public abstract java.util.ArrayList<java.lang.String> getServiceJars()
                                                                        throws java.lang.Exception

      Get the list of all jar files in the services folder.
      Returns:
        the list of all jar filenames in the services folder.
      Throws:
        `java.lang.Exception` - any error.

    - #### getModuleJars

          public abstract java.util.ArrayList<java.lang.String> getModuleJars()
                                                                       throws java.lang.Exception

      Get the list of all jar files in the modules folder.
      Returns:
        the list of all jar filenames in the modules folder.
      Throws:
        `java.lang.Exception` - any error.

    - #### jarToFile

          public abstract FileObject jarToFile(java.lang.String sourceFile)
                                        throws java.lang.Exception

      Read the contents of the jar file into a `FileObject` and return.
      Parameters:
        `sourceFile` - the file path to the jar file.
      Returns:
        a FileObject that contains the file contents.
      Throws:
        `java.lang.Exception` - any error.

    - #### saveJarFile

          public abstract java.lang.String saveJarFile(FileObject fileObject)
                                                throws java.lang.Exception

      Save the contents of the `FileObject` to the default services location.
      Parameters:
        `fileObject` - the file object with the file contents.
      Returns:
        the jar file path formatted if the file was saved, null otherwise.
      Throws:
        `java.lang.Exception` - any error.