Class AppDefinition

java.lang.Object
com.iizix.server.app.AppDefinition

public class AppDefinition extends Object
Application definition when loading the applications/projects.
Author:
Christopher Mindus
  • Field Details Link icon

    • id Link icon

      public final String id
      The ID of the application.
  • Constructor Details Link icon

    • AppDefinition Link icon

      public AppDefinition(DBApp dbApp, boolean doHotDeploy)
      Constructor for an app definition from a database definition.
      Parameters:
      dbApp - The database app instance.
      doHotDeploy - Hot deploy flag.
    • AppDefinition Link icon

      public AppDefinition(String id, String serverEnvironmentName, File iiziAppFile, boolean doHotDeploy)
      Constructor for an app definition for a Jar file (iiziAppFile is non-null) or separate directories (call addModuleDirectory(File) to add module directories, used for development server only).
      Parameters:
      id - The application ID.
      serverEnvironmentName - The server environment name to use, null for default.
      iiziAppFile - The application file.
      doHotDeploy - Hot deploy flag.
  • Method Details Link icon

    • dispose Link icon

      public void dispose()
      Disposes of the application definition.

      This method is intended to be called from the server: DO NOT CALL THIS METHOD.

    • addListener Link icon

      public boolean addListener(IAppChangedListener listener)
      Adds an app change listener to be informed of app load/reloads and/or app dispose.
      Parameters:
      listener - The listener to add.
      Returns:
      true if the listener was added, false otherwise (nothing changed).
      Throws:
      NullPointerException - If the listener is null.
    • removeListener Link icon

      public boolean removeListener(IAppChangedListener listener)
      Adds an app change listener to be informed of app load/reloads and/or app dispose.
      Parameters:
      listener - The listener to remove.
      Returns:
      true if listener is successfully removed, false otherwise, i.e. if not previous an added listener instance.
    • getFactory Link icon

      public AppFactory getFactory()
      Gets the application factory.
      Returns:
      The application factory once loaded, null otherwise.
    • addModuleDirectory Link icon

      public void addModuleDirectory(File dir) throws IOException
      Adds a directory for loading.
      Parameters:
      dir - The Module directory to load.
      Throws:
      IOException - if the directory is already added, or if the application definition is a compiled application.
    • hasAppChanged Link icon

      public boolean hasAppChanged()
      Checks if the iiziApp has been changed and needs reload.
      Returns:
      true if app has changed and hot deploy is used, false when not changed or hot deploy is not used.
    • getServerEnvironmentName Link icon

      public String getServerEnvironmentName()
      Returns the Server environment for the application.
    • loadApplication Link icon

      public void loadApplication(ServerShell server) throws PropException, IOException, ServerApplicationSetupException
      Loads the application.
      Throws:
      IOException - For file errors.
      PropException - For property errors.
      ServerApplicationSetupException - In case a plug-in fail to initialize.
    • isHotDeployEnabled Link icon

      public boolean isHotDeployEnabled()
      Checks if hot deploy is used for this application.
      Returns:
      true if hot deploy is enabled, false otherwise.
    • reload Link icon

      public boolean reload(ServerShell server, boolean forceReload) throws PropException, IOException, ServerApplicationSetupException
      Reloads the application if it has changed. Apps loaded from databases are not reloaded using this method.
      Returns:
      true if reloaded, false if not changed or not loaded with hot deploy.
      Throws:
      IOException - For file errors.
      PropException - For property errors.
      ServerApplicationSetupException - In case a plug-in fail to initialize.
    • disposeHotDeploy Link icon

      public void disposeHotDeploy()
      Disposes of the application's hot deploy.
    • getAppSessionFileProvider Link icon

      public WSFileProvider getAppSessionFileProvider() throws IOException
      Get the web server file provider for the application session.
      Returns:
      The web server file provider.
      Throws:
      IOException - If the directory for the application session files failed to be created.
      IllegalStateException - If the application is not yet loaded or is disposed of.