Class ServiceAdmin

java.lang.Object
org.wso2.carbon.core.AbstractAdmin
org.wso2.carbon.service.mgt.ServiceAdmin
All Implemented Interfaces:
ServiceAdminMBean

public class ServiceAdmin extends org.wso2.carbon.core.AbstractAdmin implements ServiceAdminMBean
  • Field Details

  • Constructor Details

    • ServiceAdmin

      public ServiceAdmin() throws Exception
      Throws:
      Exception
    • ServiceAdmin

      public ServiceAdmin(org.apache.axis2.engine.AxisConfiguration axisConfig) throws Exception
      Throws:
      Exception
  • Method Details

    • setConfigurationContext

      public void setConfigurationContext(org.apache.axis2.context.ConfigurationContext configurationContext)
      Overrides:
      setConfigurationContext in class org.wso2.carbon.core.AbstractAdmin
    • addPoliciesToService

      public void addPoliciesToService(String serviceName, org.apache.neethi.Policy policy, int policyType, String[] modulePaths) throws Exception
      This method add Policy to service at the Registry. Does not add the policy to Axis2. To all Bindings available

      todo find from where addPoliciesToService is invoked and make sure the returned modulePaths conform to new persistence logic - kasung Make it look Strings like name-version

      Parameters:
      serviceName -
      policy -
      policyType -
      Throws:
      Exception
    • removeServicePoliciesByNamespace

      public void removeServicePoliciesByNamespace(String serviceName, String namesapce) throws Exception
      Throws:
      Exception
    • engageModuleToService

      public void engageModuleToService(String serviceName, String moduleName, String version) throws Exception
      Throws:
      Exception
    • listServiceGroup

      public ServiceGroupMetaData listServiceGroup(String serviceGroupName) throws org.apache.axis2.AxisFault
      Return service group details for a given service group
      Parameters:
      serviceGroupName -
      Returns:
      ServiceGroupMetaData
      Throws:
      org.apache.axis2.AxisFault - TODO: Do we need this in ServiceAdmin?
    • listServices

      public ServiceMetaDataWrapper listServices(String serviceTypeFilter, String serviceSearchString, int pageNumber) throws org.apache.axis2.AxisFault
      List all the available services
      Parameters:
      serviceTypeFilter - Service type of services to be returned
      serviceSearchString - Service name or part of a service name
      pageNumber - The number of the page to be retrieved
      Returns:
      The service metadata
      Throws:
      org.apache.axis2.AxisFault - If an error occurs while retrieving services
    • getNumberOfServiceGroups

      public int getNumberOfServiceGroups() throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • getNumberOfActiveServices

      public int getNumberOfActiveServices() throws org.apache.axis2.AxisFault
      Description copied from interface: ServiceAdminMBean
      Get the currently active number of services
      Specified by:
      getNumberOfActiveServices in interface ServiceAdminMBean
      Returns:
      Currently active number of services
      Throws:
      org.apache.axis2.AxisFault
    • getNumberOfInactiveServices

      public int getNumberOfInactiveServices() throws Exception
      Description copied from interface: ServiceAdminMBean
      Get the currently inactive number of services
      Specified by:
      getNumberOfInactiveServices in interface ServiceAdminMBean
      Returns:
      Currently inactive number of services
      Throws:
      Exception - If an error occurs while getting the service count
    • getNumberOfFaultyServices

      public int getNumberOfFaultyServices()
      Description copied from interface: ServiceAdminMBean
      Get the number of faulty services
      Specified by:
      getNumberOfFaultyServices in interface ServiceAdminMBean
      Returns:
      number of faulty services
    • getFaultyServiceArchives

      public FaultyServicesWrapper getFaultyServiceArchives(int pageNumber) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • deleteFaultyServiceGroup

      public boolean deleteFaultyServiceGroup(String archiveName) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • deleteAllNonAdminServiceGroups

      public void deleteAllNonAdminServiceGroups() throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • deleteAllFaultyServiceGroups

      public void deleteAllFaultyServiceGroups() throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • checkForGroupedServices

      public boolean checkForGroupedServices(String[] serviceGroupsList) throws org.apache.axis2.AxisFault
      Check the service group list for service groups which has more than one service
      Parameters:
      serviceGroupsList - - list of service groups
      Returns:
      true if found
      Throws:
      org.apache.axis2.AxisFault - on error
    • deleteServiceGroups

      public void deleteServiceGroups(String[] serviceGroups) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • deleteFaultyServiceGroups

      public void deleteFaultyServiceGroups(String[] fileNames) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • getServiceData

      public ServiceMetaData getServiceData(String serviceName) throws Exception
      Throws:
      Exception
    • changeServiceState

      public void changeServiceState(String serviceName, boolean isActive) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • configureMTOM

      public void configureMTOM(String flag, String serviceName) throws org.apache.axis2.AxisFault
      set the service parameter enableMTOM to manipulate MTOM flag true/false/optional
      Parameters:
      flag -
      serviceName -
      Throws:
      org.apache.axis2.AxisFault
    • startService

      public void startService(String serviceName) throws Exception
      Description copied from interface: ServiceAdminMBean
      Start the service specified by serviceName
      Specified by:
      startService in interface ServiceAdminMBean
      Parameters:
      serviceName - Name of the service to be restarted
      Throws:
      Exception - If an error occurs while starting the service
    • stopService

      public void stopService(String serviceName) throws Exception
      Description copied from interface: ServiceAdminMBean
      Stop the service specified by serviceName
      Specified by:
      stopService in interface ServiceAdminMBean
      Parameters:
      serviceName - Name of the service to be restarted
      Throws:
      Exception - If an error occurs while stopping the service
    • getExposedTransports

      public String[] getExposedTransports(String serviceId) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • addTransportBinding

      public String addTransportBinding(String serviceId, String transportProtocol) throws Exception
      Throws:
      Exception
    • removeTransportBinding

      public String removeTransportBinding(String serviceId, String transportProtocol) throws Exception
      Throws:
      Exception
    • removeBindingPolicy

      public void removeBindingPolicy(String serviceName, String policyKey, String[] moduleNames) throws org.wso2.carbon.utils.ServerException
      Removes policy given the key
      Parameters:
      serviceName - Name of the service
      policyKey - Key of the policy to be removed
      moduleNames - Array of module names
      Throws:
      org.wso2.carbon.utils.ServerException - on error
    • setServiceParameters

      public void setServiceParameters(String serviceName, String[] parameters) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • removeServiceParameter

      public void removeServiceParameter(String serviceName, String parameterName) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • getServiceParameters

      public String[] getServiceParameters(String serviceName) throws org.wso2.carbon.utils.ServerException
      Throws:
      org.wso2.carbon.utils.ServerException
    • getPolicy

      public String getPolicy(String serviceName) throws org.apache.axis2.AxisFault
      Returns the Service Policy for a given service.
      Parameters:
      serviceName - The name of the service
      Returns:
      A string representing the Policy XML
      Throws:
      org.apache.axis2.AxisFault - on error
    • getModulePolicy

      public String getModulePolicy(String moduleName, String moduleVersion) throws org.apache.axis2.AxisFault
      Retrieves the merged policy from a given modiule
      Parameters:
      moduleName - Name of the module
      moduleVersion - Version string of the string
      Returns:
      A string representaiton of the policy
      Throws:
      org.apache.axis2.AxisFault - on error
    • setModulePolicy

      public void setModulePolicy(String moduleName, String moduleVersion, String policyString) throws Exception
      Throws:
      Exception
    • getOperationPolicy

      public String getOperationPolicy(String serviceName, String operationName) throws org.apache.axis2.AxisFault
      Returns the policy for a given service and it's operation
      Parameters:
      serviceName - The name of the service
      operationName - The operation
      Returns:
      a String representing the Policy XML
      Throws:
      org.apache.axis2.AxisFault - on error
    • getOperationMessagePolicy

      public String getOperationMessagePolicy(String serviceName, String operationName, String messageType) throws org.apache.axis2.AxisFault
      Returns the policy for a given message
      Parameters:
      serviceName - The name of the service
      operationName - The name of the operation
      messageType - The type of message
      Returns:
      A string representation of the Policy XML
      Throws:
      org.apache.axis2.AxisFault - on error
    • getPolicies

      public PolicyMetaData[] getPolicies(String serviceName) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • getBindingPolicy

      public String getBindingPolicy(String serviceName, String bindingName) throws org.apache.axis2.AxisFault
      Returns the policy for a given service binding
      Parameters:
      serviceName - The name of the service
      bindingName - The name of the binding in question
      Returns:
      A String representing the Policy XML
      Throws:
      org.apache.axis2.AxisFault - on error
    • getBindingOperationPolicy

      public String getBindingOperationPolicy(String serviceName, String bindingName, String operationName) throws org.apache.axis2.AxisFault
      Returns a policy for an operation of a given service binding
      Parameters:
      serviceName - Name of the service
      bindingName - Name of the service binding
      operationName - Name of the service operation
      Returns:
      A policy
      Throws:
      org.apache.axis2.AxisFault - on error
    • getBindingOperationMessagePolicy

      public String getBindingOperationMessagePolicy(String serviceName, String bindingName, String operationName, String messageType) throws org.apache.axis2.AxisFault
      Returns the policy of a given message for a given service binding's operation
      Parameters:
      serviceName - Service name
      bindingName - Service binding name
      operationName - Service operation name
      messageType - Message type
      Returns:
      Policy key
      Throws:
      org.apache.axis2.AxisFault - on error
    • setPolicy

      public void setPolicy(String serviceName, String policyString) throws Exception
      Throws:
      Exception
    • setServicePolicy

      public void setServicePolicy(String serviceName, String policyString) throws Exception
      Throws:
      Exception
    • setServiceOperationPolicy

      public void setServiceOperationPolicy(String serviceName, String operationName, String policyString) throws Exception
      Throws:
      Exception
    • setServiceOperationMessagePolicy

      public void setServiceOperationMessagePolicy(String serviceName, String operationName, String messageType, String policyString) throws Exception
      Throws:
      Exception
    • setBindingPolicy

      public void setBindingPolicy(String serviceName, String bindingName, String policyString) throws Exception
      Throws:
      Exception
    • setBindingOperationPolicy

      public void setBindingOperationPolicy(String serviceName, String bindingName, String operationName, String policyString) throws Exception
      Throws:
      Exception
    • setBindingOperationMessagePolicy

      public void setBindingOperationMessagePolicy(String serviceName, String bindingName, String operationName, String messageType, String policyString) throws Exception
      Throws:
      Exception
    • getWSDL

      public org.apache.axiom.om.OMElement getWSDL(String serviceName) throws org.apache.axis2.AxisFault
      Throws:
      org.apache.axis2.AxisFault
    • getServiceBindings

      public String[] getServiceBindings(String serviceName) throws Exception
      Throws:
      Exception
    • downloadServiceArchive

      public ServiceDownloadData downloadServiceArchive(String serviceGroupName)
      Downloads service archive files
      Parameters:
      serviceGroupName - name of the service group needs to be downloaded
      Returns:
      the corresponding data handler and the name of the service archive / file that's downloaded