Class WarHelperImpl

  • All Implemented Interfaces:
    WarHelper

    public class WarHelperImpl
    extends java.lang.Object
    implements WarHelper
    Performs logic for the Module Management Tool.
    Author:
    Gethin James
    • Field Detail

      • VERSION_PROPERTIES

        public static final java.lang.String VERSION_PROPERTIES
        See Also:
        Constant Field Values
      • MANIFEST_SPECIFICATION_TITLE

        public static final java.lang.String MANIFEST_SPECIFICATION_TITLE
        See Also:
        Constant Field Values
      • MANIFEST_SPECIFICATION_VERSION

        public static final java.lang.String MANIFEST_SPECIFICATION_VERSION
        See Also:
        Constant Field Values
      • MANIFEST_IMPLEMENTATION_TITLE

        public static final java.lang.String MANIFEST_IMPLEMENTATION_TITLE
        See Also:
        Constant Field Values
      • MANIFEST_COMMUNITY

        public static final java.lang.String MANIFEST_COMMUNITY
        See Also:
        Constant Field Values
      • REGEX_NUMBER_OR_DOT

        protected static final java.lang.String REGEX_NUMBER_OR_DOT
        See Also:
        Constant Field Values
    • Constructor Detail

      • WarHelperImpl

        public WarHelperImpl​(LogOutput log)
    • Method Detail

      • checkCompatibleVersion

        public void checkCompatibleVersion​(de.schlichtherle.truezip.file.TFile war,
                                           ModuleDetails installingModuleDetails)
        Description copied from interface: WarHelper
        Checks to see if the module is compatible with the version of Alfresco.
        Specified by:
        checkCompatibleVersion in interface WarHelper
        Parameters:
        war - a valid war file or exploded directory from a war
      • checkCompatibleVersionUsingManifest

        protected void checkCompatibleVersionUsingManifest​(de.schlichtherle.truezip.file.TFile war,
                                                           ModuleDetails installingModuleDetails)
        Checks if the module is compatible using the entry in the manifest. This is more accurate and works for both alfresco.war and share.war, however valid manifest entries weren't added until 3.4.11, 4.1.1 and Community 4.2
        Parameters:
        war - TFile
        installingModuleDetails - ModuleDetails
      • findManifestArtibute

        protected java.lang.String findManifestArtibute​(de.schlichtherle.truezip.file.TFile war,
                                                        java.lang.String attributeName)
                                                 throws ModuleManagementToolException
        Finds a single attribute from a war manifest file.
        Parameters:
        war - the war
        attributeName - key name of attribute
        Returns:
        attribute value
        Throws:
        ModuleManagementToolException
      • checkCompatibleEdition

        public void checkCompatibleEdition​(de.schlichtherle.truezip.file.TFile war,
                                           ModuleDetails installingModuleDetails)
        Description copied from interface: WarHelper
        This checks to see if the module that is being installed is compatible with the war. If not module edition is specfied then it will just return. However, if an edition is specified and it doesn't match then an error is thrown.
        Specified by:
        checkCompatibleEdition in interface WarHelper
        Parameters:
        war - a valid war file or exploded directory from a war
        installingModuleDetails - ModuleDetails
      • checkCompatibleEditionUsingManifest

        public void checkCompatibleEditionUsingManifest​(de.schlichtherle.truezip.file.TFile war,
                                                        ModuleDetails installingModuleDetails)
        Checks to see if the module that is being installed is compatible with the war, (using the entry in the manifest). This is more accurate and works for both alfresco.war and share.war, however valid manifest entries weren't added until 3.4.11, 4.1.1 and Community 4.2
        Parameters:
        war - TFile
        installingModuleDetails - ModuleDetails
      • checkModuleDependencies

        public void checkModuleDependencies​(de.schlichtherle.truezip.file.TFile war,
                                            ModuleDetails installingModuleDetails)
        Description copied from interface: WarHelper
        Checks the dependencies of this module
        Specified by:
        checkModuleDependencies in interface WarHelper
        Parameters:
        war - TFile
        installingModuleDetails - ModuleDetails
      • getModuleDetailsOrAlias

        public ModuleDetails getModuleDetailsOrAlias​(de.schlichtherle.truezip.file.TFile war,
                                                     ModuleDetails installingModuleDetails)
        Description copied from interface: WarHelper
        Gets the module details or an available alias
        Specified by:
        getModuleDetailsOrAlias in interface WarHelper
        Parameters:
        war - a valid war file or exploded directory from a war
        installingModuleDetails - ModuleDetails
        Returns:
        ModuleDetails
      • isShareWar

        public boolean isShareWar​(de.schlichtherle.truezip.file.TFile warFile)
        Description copied from interface: WarHelper
        Indicates if the war file specified is a "Share" war. The default is FALSE Returns true if the Share war manifest states its a share war.
        Specified by:
        isShareWar in interface WarHelper
        Parameters:
        warFile - TFile
        Returns:
        boolean - true if it is a share war
      • listModules

        public java.util.List<ModuleDetails> listModules​(de.schlichtherle.truezip.file.TFile war)
        Lists all the currently installed modules in the WAR
        Specified by:
        listModules in interface WarHelper
        Parameters:
        war - the war
        Returns:
        an unordered list of module details.
        Throws:
        ModuleManagementToolException
      • backup

        public java.lang.String backup​(de.schlichtherle.truezip.file.TFile file)
                                throws java.io.IOException
        Backs up a given file or directory.
        Specified by:
        backup in interface WarHelper
        Parameters:
        file - the file to backup
        Returns:
        the absolute path to the backup file.
        Throws:
        java.io.IOException
      • getModuleDetails

        protected ModuleDetails getModuleDetails​(de.schlichtherle.truezip.file.TFile war,
                                                 java.lang.String moduleId)
        Gets the module details for the specified module from the war.
        Parameters:
        war - a valid war file or exploded directory from a war
        moduleId - String
        Returns:
        ModuleDetails