org.wso2.carbon.webapp.mgt

## Class WebappAdmin

- java.lang.Object
- - org.wso2.carbon.core.AbstractAdmin
  - - org.wso2.carbon.webapp.mgt.WebappAdmin

-     public class WebappAdmin
      extends org.wso2.carbon.core.AbstractAdmin

  The Admin service for managing webapps

- - ### Field Summary

    - ### Fields inherited from class org.wso2.carbon.core.AbstractAdmin

      `axisConfig, configurationContext`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebappAdmin()`
    `WebappAdmin(org.apache.axis2.engine.AxisConfiguration axisConfig)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `changeDefaultAppVersion(String appGroupName, String fileName, String hostName)`
    `void` | `deleteAllFaultyWebapps()` Delete all faulty webapps
    `void` | `deleteAllStartedWebapps()` Delete all started webapps
    `void` | `deleteAllStoppedWebapps()` Delete all stopped webapps
    `void` | `deleteAllWebApps(String[] webappKey)` Delete set of all types of webapps.
    `void` | `deleteFaultyWebapps(String[] webappKey)` Delete a set of faulty webapps
    `void` | `deleteStartedWebapps(String[] webappKey)` Delete a set of started webapps
    `void` | `deleteStoppedWebapps(String[] webappKey)` Delete a set of stopped webapps
    `protected boolean` | `doesWebappSatisfySearchString(WebApplication webapp, String searchString)`
    `DataHandler` | `downloadWarFileHandler(String fileName, String hostName, String webappType)` Downloads the webapp archive (.war) file
    `void` | `expireAllSessions(String webappKey)` Expire a given session in a webapp
    `void` | `expireSessions(String webappFileName, String[] sessionIDs, String hostName)` Expire a given session in a webapp
    `void` | `expireSessionsInAllWebapps()` Expire all sessions in all webapps
    `void` | `expireSessionsInWebapp(String webappKey, long maxSessionLifetimeMillis)` Expire all sessions in the specified webapp which has a lifetime >= `maxSessionLifetimeMillis`
    `void` | `expireSessionsInWebapps(String[] webappKeySet)` Expire all sessions in specified webapps
    `SessionsWrapper` | `getActiveSessions(String webappFileName, int pageNumber, String hostName)` Get all active sessions of a webapp
    `String` | `getBamConfiguration(String webappFileName, String hostName)` This method returns the bam configuration statistic enabled or not
    `WebappsWrapper` | `getPagedFaultyWebappsSummary(String webappSearchString, String webappType, int pageNumber)`
    `WebappsWrapper` | `getPagedWebappsSummary(String webappSearchString, String webappState, String webappType, int pageNumber)` Get a page of started webapps
    `WebappMetadata` | `getStartedWebapp(String webappFileName, String hostName)` Get the details of a deplyed webapp
    `WebappMetadata` | `getStoppedWebapp(String webappFileName, String hostName)` Get the details of an stopped webapp
    `VhostHolder` | `getVhostHolder()`
    `protected String` | `getWebappDeploymentDirPath(String webappType)`
    `protected String` | `getWebappDeploymentDirPath(String webappType, String hostName)`
    `protected String` | `getWebappDeploymentFile(String fileName, String hostName, String webappType)` Return the location of the actual webapp file
    `boolean` | `isDefaultVersionManagementEnabled()`
    `boolean` | `isUnpackWARs()` check if unpack wars enabled
    `protected boolean` | `isWebappRelevant(WebApplication webapp, String webappType)` This method can be used to check whether the given web app is relevant for this Webapp type.
    `void` | `reloadAllWebapps()` Reload all webapps
    `void` | `reloadWebapps(String[] webappKey)` Reload a set of webapps
    `void` | `setBamConfiguration(String webappFileName, String value, String hostName)` Reset the bam enable and disable option.
    `void` | `startAllWebapps()` Redeploy all webapps
    `void` | `startWebapps(String[] webappKeys)` Redeploy a set of webapps
    `void` | `stopAllWebapps()` Undeploy all webapps
    `void` | `stopWebapps(String[] webappKeys)` Undeploy a set of webapps
    `boolean` | `uploadWebapp(WebappUploadData[] webappUploadDataList)` Upload a webapp

    - ### Methods inherited from class org.wso2.carbon.core.AbstractAdmin

      `getAxisConfig, getConfigContext, getConfigSystemRegistry, getConfigUserRegistry, getGovernanceRegistry, getGovernanceSystemRegistry, getGovernanceUserRegistry, getHttpSession, getLocalRepo, getRegistry, getTenantDomain, getUsername, getUserRealm, setConfigurationContext, setPermissionUpdateTimestamp`

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

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

- - ### Constructor Detail

    - #### WebappAdmin

          public WebappAdmin()

    - #### WebappAdmin

          public WebappAdmin(org.apache.axis2.engine.AxisConfiguration axisConfig)
                      throws Exception

      Throws:
        `Exception`

  - ### Method Detail

    - #### getPagedWebappsSummary

          public WebappsWrapper getPagedWebappsSummary(String webappSearchString,
                                                       String webappState,
                                                       String webappType,
                                                       int pageNumber)
                                                throws org.apache.axis2.AxisFault

      Get a page of started webapps
      Parameters:
        `webappSearchString` - Search string
        `webappState` - State of the webapp. Can be either WebappsConstants.WebappState.STARTED or WebappsConstants.WebappState.STOPPED
        `webappType` - application type
        `pageNumber` - The pageNumber of the page to be fetched
      Returns:
        WebappsWrapper
      Throws:
        `org.apache.axis2.AxisFault`

    - #### getStartedWebapp

          public WebappMetadata getStartedWebapp(String webappFileName,
                                                 String hostName)

      Get the details of a deplyed webapp
      Parameters:
        `webappFileName` -
        `hostName` -
      Returns:
        meta data for webapp

    - #### getStoppedWebapp

          public WebappMetadata getStoppedWebapp(String webappFileName,
                                                 String hostName)

      Get the details of an stopped webapp
      Parameters:
        `webappFileName` -
        `hostName` -
      Returns:
        meta data for webapp

    - #### getPagedFaultyWebappsSummary

          public WebappsWrapper getPagedFaultyWebappsSummary(String webappSearchString,
                                                             String webappType,
                                                             int pageNumber)
                                                      throws org.apache.axis2.AxisFault

      Parameters:
        `webappSearchString` -
        `webappType` - application type
        `pageNumber` -
      Returns:
      Throws:
        `org.apache.axis2.AxisFault`

    - #### doesWebappSatisfySearchString

          protected boolean doesWebappSatisfySearchString(WebApplication webapp,
                                                          String searchString)

    - #### isWebappRelevant

          protected boolean isWebappRelevant(WebApplication webapp,
                                             String webappType)

      This method can be used to check whether the given web app is relevant for this Webapp type. Only generic webapps are relevant for this Admin service.
      Parameters:
        `webapp` - - WebApplication instance
        `webappType` - application type
      Returns:
        - true if relevant

    - #### deleteStartedWebapps

          public void deleteStartedWebapps(String[] webappKey)
                                    throws org.apache.axis2.AxisFault

      Delete a set of started webapps
      Parameters:
        `webappKey` - The name:hostname pairs of the webapp files to be deleted
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while deleting a webapp

    - #### deleteStoppedWebapps

          public void deleteStoppedWebapps(String[] webappKey)
                                    throws org.apache.axis2.AxisFault

      Delete a set of stopped webapps
      Parameters:
        `webappKey` - The name:hostname pairs of the webapp files to be deleted
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while deleting a webapp

    - #### deleteFaultyWebapps

          public void deleteFaultyWebapps(String[] webappKey)
                                   throws org.apache.axis2.AxisFault

      Delete a set of faulty webapps
      Parameters:
        `webappKey` - The name:hostname pairs of the webapp files to be deleted
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while deleting a webapp

    - #### deleteAllWebApps

          public void deleteAllWebApps(String[] webappKey)
                                throws org.apache.axis2.AxisFault

      Delete set of all types of webapps. (started, stopped, faulty)
      Parameters:
        `webappKey` - The name:hostname pairs of the webapp files to be deleted
      Throws:
        `org.apache.axis2.AxisFault` - AxisFault If an error occurs while deleting a webapp

    - #### deleteAllStartedWebapps

          public void deleteAllStartedWebapps()
                                       throws org.apache.axis2.AxisFault

      Delete all started webapps
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while deleting a webapp

    - #### deleteAllStoppedWebapps

          public void deleteAllStoppedWebapps()
                                       throws org.apache.axis2.AxisFault

      Delete all stopped webapps
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while deleting a webapp

    - #### deleteAllFaultyWebapps

          public void deleteAllFaultyWebapps()
                                      throws org.apache.axis2.AxisFault

      Delete all faulty webapps
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while deleting a webapp

    - #### reloadAllWebapps

          public void reloadAllWebapps()

      Reload all webapps

    - #### reloadWebapps

          public void reloadWebapps(String[] webappKey)

      Reload a set of webapps
      Parameters:
        `webappKey` - The file_name:hostname pairs of the webapps to be reloaded

    - #### setBamConfiguration

          public void setBamConfiguration(String webappFileName,
                                          String value,
                                          String hostName)

      Reset the bam enable and disable option.
      Parameters:
        `webappFileName` -
        `value` -

    - #### getBamConfiguration

          public String getBamConfiguration(String webappFileName,
                                            String hostName)

      This method returns the bam configuration statistic enabled or not
      Parameters:
        `webappFileName` -
      Returns:

    - #### stopAllWebapps

          public void stopAllWebapps()
                              throws org.apache.axis2.AxisFault

      Undeploy all webapps
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while undeploying

    - #### stopWebapps

          public void stopWebapps(String[] webappKeys)
                           throws org.apache.axis2.AxisFault

      Undeploy a set of webapps
      Parameters:
        `webappKeys` - The hostname:file_name pairs of the webapps to be stopped
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while undeploying

    - #### startAllWebapps

          public void startAllWebapps()
                               throws org.apache.axis2.AxisFault

      Redeploy all webapps
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while restarting webapps

    - #### startWebapps

          public void startWebapps(String[] webappKeys)
                            throws org.apache.axis2.AxisFault

      Redeploy a set of webapps
      Parameters:
        `webappKeys` - The hostname:file_name pairs of the webapps to be restarted
      Throws:
        `org.apache.axis2.AxisFault` - If a deployment error occurs

    - #### getActiveSessions

          public SessionsWrapper getActiveSessions(String webappFileName,
                                                   int pageNumber,
                                                   String hostName)

      Get all active sessions of a webapp
      Parameters:
        `webappFileName` - The names of the webapp file
        `pageNumber` - The number of the page to fetch, starting with 0
      Returns:
        The session array

    - #### expireSessionsInAllWebapps

          public void expireSessionsInAllWebapps()

      Expire all sessions in all webapps

    - #### expireSessionsInWebapps

          public void expireSessionsInWebapps(String[] webappKeySet)

      Expire all sessions in specified webapps
      Parameters:
        `webappKeySet` - The file names of the webapps whose sessions should be expired

    - #### expireSessionsInWebapp

          public void expireSessionsInWebapp(String webappKey,
                                             long maxSessionLifetimeMillis)

      Expire all sessions in the specified webapp which has a lifetime >= `maxSessionLifetimeMillis`
      Parameters:
        `webappKey` - The file name of the webapp whose sessions should be expired
        `maxSessionLifetimeMillis` - The max allowed lifetime for the sessions

    - #### expireSessions

          public void expireSessions(String webappFileName,
                                     String[] sessionIDs,
                                     String hostName)
                              throws org.apache.axis2.AxisFault

      Expire a given session in a webapp
      Parameters:
        `webappFileName` - The file name of the webapp whose sessions should be expired
        `sessionIDs` - Array of session IDs
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurs while retrieving sessions

    - #### expireAllSessions

          public void expireAllSessions(String webappKey)

      Expire a given session in a webapp
      Parameters:
        `webappKey` - The hostname:file_name pairs of the webapp whose sessions should be expired

    - #### uploadWebapp

          public boolean uploadWebapp(WebappUploadData[] webappUploadDataList)
                               throws org.apache.axis2.AxisFault

      Upload a webapp
      Parameters:
        `webappUploadDataList` - Array of data representing the webapps that are to be uploaded
      Returns:
        true - if upload was successful
      Throws:
        `org.apache.axis2.AxisFault` - If an error occurrs while uploading

    - #### getWebappDeploymentDirPath

          protected String getWebappDeploymentDirPath(String webappType,
                                                      String hostName)

    - #### getWebappDeploymentDirPath

          protected String getWebappDeploymentDirPath(String webappType)

    - #### getWebappDeploymentFile

          protected String getWebappDeploymentFile(String fileName,
                                                   String hostName,
                                                   String webappType)

      Return the location of the actual webapp file
      Parameters:
        `fileName` - name of the webapp file
        `webappType` - type of the webapp
      Returns:

    - #### downloadWarFileHandler

          public DataHandler downloadWarFileHandler(String fileName,
                                                    String hostName,
                                                    String webappType)

      Downloads the webapp archive (.war) file
      Parameters:
        `fileName` - name of the .war that needs to be downloaded
        `webappType` - application type
        `hostName` - virtualhost
      Returns:
        the corresponding data handler of the .war that needs to be downloaded

    - #### isUnpackWARs

          public boolean isUnpackWARs()

      check if unpack wars enabled
      Returns:
        true if enabled.

    - #### changeDefaultAppVersion

          public void changeDefaultAppVersion(String appGroupName,
                                              String fileName,
                                              String hostName)
                                       throws org.apache.axis2.AxisFault,
                                              org.wso2.carbon.core.persistence.metadata.ArtifactMetadataException

      Throws:
        `org.apache.axis2.AxisFault`
        `org.wso2.carbon.core.persistence.metadata.ArtifactMetadataException`

    - #### isDefaultVersionManagementEnabled

          public boolean isDefaultVersionManagementEnabled()

    - #### getVhostHolder

          public VhostHolder getVhostHolder()

      Returns:
        new VhostHolder instance

Copyright © 2019 WSO2. All rights reserved.