Class ApplicationArchive

    • Constructor Detail

      • ApplicationArchive

        public ApplicationArchive()
    • Method Detail

      • setRootPath

        protected void setRootPath​(String root)
        Sets the root directory where apps directory is contained.
        Parameters:
        root - top-level directory path
      • getRootPath

        public String getRootPath()
        Returns the root directory where apps directory is contained.
        Returns:
        top-level directory path
      • getApplicationNames

        public Set<String> getApplicationNames()
        Returns the set of installed application names.
        Returns:
        installed application names
      • getUpdateTime

        public long getUpdateTime​(String appName)
        Returns the timestamp in millis since start of epoch, of when the specified application was last modified or changed state.
        Parameters:
        appName - application name
        Returns:
        number of millis since start of epoch
      • getApplicationDescription

        public ApplicationDescription getApplicationDescription​(String appName)
        Loads the application descriptor from the specified application archive stream and saves the stream in the appropriate application archive directory.
        Parameters:
        appName - application name
        Returns:
        application descriptor
        Throws:
        ApplicationException - if unable to read application description
      • saveApplication

        public ApplicationDescription saveApplication​(InputStream stream)
        Loads the application descriptor from the specified application archive stream and saves the stream in the appropriate application archive directory.
        Parameters:
        stream - application archive stream
        Returns:
        application descriptor
        Throws:
        ApplicationException - if unable to read the archive stream or store the application archive
      • purgeApplication

        public void purgeApplication​(String appName)
        Purges the application archive directory.
        Parameters:
        appName - application name
      • getApplicationInputStream

        public InputStream getApplicationInputStream​(String appName)
        Returns application archive stream for the specified application. This will be either the application OAR file, JAR file or the plain XML file.
        Parameters:
        appName - application name
        Returns:
        application archive stream
      • setActive

        protected boolean setActive​(String appName)
        Marks the app as active by creating token file in the app directory.
        Parameters:
        appName - application name
        Returns:
        true if file was created
      • clearActive

        protected boolean clearActive​(String appName)
        Clears the app as active by deleting token file in the app directory.
        Parameters:
        appName - application name
        Returns:
        true if file was deleted
      • updateTime

        protected boolean updateTime​(String appName)
        Updates the time-stamp of the app descriptor file.
        Parameters:
        appName - application name
        Returns:
        true if the app descriptor was updated
      • isActive

        protected boolean isActive​(String appName)
        Indicates whether the app was marked as active by checking for token file.
        Parameters:
        appName - application name
        Returns:
        true if the app is marked as active