Class ModuleDetailsHelper


  • public class ModuleDetailsHelper
    extends java.lang.Object
    Module details helper used by the module mangement tool
    Author:
    Roy Wetherall, Derek Hulley
    • Constructor Detail

      • ModuleDetailsHelper

        public ModuleDetailsHelper()
    • Method Detail

      • createModuleDetailsFromPropertiesStream

        public static ModuleDetails createModuleDetailsFromPropertiesStream​(java.io.InputStream is)
                                                                     throws java.io.IOException
        Factory method to create module details from a stream of a properties file
        Parameters:
        is - the properties input stream, which will be closed during the call
        Returns:
        Returns the initialized module details
        Throws:
        java.io.IOException
      • createModuleDetailsFromPropertiesStream

        public static ModuleDetails createModuleDetailsFromPropertiesStream​(java.io.InputStream is,
                                                                            LogOutput log)
                                                                     throws java.io.IOException
        Factory method to create module details from a stream of a properties file
        Parameters:
        is - the properties input stream, which will be closed during the call
        log - logger
        Returns:
        Returns the initialized module details
        Throws:
        java.io.IOException
      • createModuleDetailsFromPropertyLocation

        public static ModuleDetails createModuleDetailsFromPropertyLocation​(java.lang.String location)
                                                                     throws java.io.IOException
        Creates a module details helper object based on a file location.
        Parameters:
        location - file location
        Returns:
        Returns the module details or null if the location points to nothing
        Throws:
        java.io.IOException
      • createModuleDetailsFromPropertyLocation

        public static ModuleDetails createModuleDetailsFromPropertyLocation​(java.lang.String location,
                                                                            LogOutput log)
                                                                     throws java.io.IOException
        Creates a module details helper object based on a file location.
        Parameters:
        location - file location
        log - logger
        Returns:
        Returns the module details or null if the location points to nothing
        Throws:
        java.io.IOException
      • createModuleDetailsFromWarAndId

        public static ModuleDetails createModuleDetailsFromWarAndId​(java.lang.String warLocation,
                                                                    java.lang.String moduleId)
                                                             throws java.io.IOException
        Creates a module details instance based on a war location and the module id
        Parameters:
        warLocation - the war location
        moduleId - the module id
        Returns:
        Returns the module details for the given module ID as it occurs in the WAR, or null if there are no module details available.
        Throws:
        java.io.IOException
      • getModuleDetailsFileFromWarAndId

        public static de.schlichtherle.truezip.file.TFile getModuleDetailsFileFromWarAndId​(java.lang.String warLocation,
                                                                                           java.lang.String moduleId)
        Parameters:
        warLocation - the location of the WAR file
        moduleId - the module ID within the WAR
        Returns:
        Returns a file handle to the module properties file within the given WAR. The file may or may not exist.
      • getModulePropertiesFileLocation

        public static java.lang.String getModulePropertiesFileLocation​(java.lang.String warLocation,
                                                                       java.lang.String moduleId)
        Gets the file location
        Parameters:
        warLocation - the war location
        moduleId - the module id
        Returns:
        the file location
      • getModulePropertiesFilePathInWar

        public static java.lang.String getModulePropertiesFilePathInWar​(java.lang.String moduleId)
        Parameters:
        moduleId - the module ID
        Returns:
        Returns the path of the module file within a WAR
      • saveModuleDetails

        public static void saveModuleDetails​(java.lang.String warLocation,
                                             ModuleDetails moduleDetails)
        Saves the module details to the war in the correct location based on the module id
        Parameters:
        warLocation - the war location
        moduleDetails - the module id