Class EndpointAdmin

java.lang.Object
org.wso2.carbon.core.AbstractAdmin
org.wso2.carbon.mediation.initializer.AbstractServiceBusAdmin
org.wso2.carbon.endpoint.service.EndpointAdmin

public class EndpointAdmin extends org.wso2.carbon.mediation.initializer.AbstractServiceBusAdmin
Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

  • Field Details

  • Constructor Details

    • EndpointAdmin

      public EndpointAdmin()
  • Method Details

    • switchOn

      public void switchOn(String endpointName) throws EndpointAdminException
      Set Endpoint status to Active
      Parameters:
      endpointName - name of the endpoint
      Throws:
      EndpointAdminException - in case of an error
    • switchOff

      public void switchOff(String endpointName) throws EndpointAdminException
      Switch off Endpoint
      Parameters:
      endpointName - name of the endpoint
      Throws:
      EndpointAdminException - in case of an error
    • addEndpoint

      public boolean addEndpoint(String epString) throws EndpointAdminException
      Add an Endpoint described by the given configuration
      Parameters:
      epString - - configuration representing the endpoint that needs to be added
      Returns:
      true if the endpoint was successfully added and false otherwise
      Throws:
      EndpointAdminException - if the element is not an endpoint or if an endpoint with the same name exists
    • addEndpointForTenant

      public boolean addEndpointForTenant(String endpointData, String tenantDomain) throws EndpointAdminException
      Set the tenant domain when a publisher publishes his API in MT mode. When publisher publishes the API, we login the gateway as super tenant. But we need to create the endpoint file in the particular tenant domain.
      Parameters:
      endpointData - Endpoint file content
      tenantDomain - Domain of the logged tenant
      Returns:
      true if the endpoint was successfully added to tenant space and false otherwise
      Throws:
      EndpointAdminException - Thrown if an error occur
    • deleteEndpointForTenant

      public boolean deleteEndpointForTenant(String endpointName, String tenantDomain) throws EndpointAdminException
      Set the tenant domain when a publisher publishes his API in MT mode. When publisher publishes the API, we login the gateway as super tenant. But we need to delete the endpoint file in the particular tenant domain.
      Parameters:
      endpointName - Name of the endpoint file to be deleted
      tenantDomain - Domain of the logged tenant
      Returns:
      true if the endpoint was successfully deleted from tenant space and false otherwise
      Throws:
      EndpointAdminException - Thrown if an error occur
    • getEndPointsNamesForTenant

      public String[] getEndPointsNamesForTenant(String tenantDomain) throws EndpointAdminException
      Set the tenant domain when a publisher publishes his API in MT mode. When publisher publishes the API, we login the gateway as super tenant. But we need to get the names of the endpoint files in the particular tenant domain.
      Parameters:
      tenantDomain - Domain of the logged tenant
      Returns:
      Returns an array of Strings with endpoint names
      Throws:
      EndpointAdminException - Thrown if an error occurs
    • deleteEndpoint

      public boolean deleteEndpoint(String endpointName) throws EndpointAdminException
      Deletes the endpoint from the SynapseConfiguration
      Parameters:
      endpointName - - name of the endpoint to be deleted
      Returns:
      true if the endpoint was successfully deleted and false otherwise
      Throws:
      EndpointAdminException - if the proxy service name given is not existent in the synapse configuration
    • deleteSelectedEndpoint

      public void deleteSelectedEndpoint(String[] endpointNames) throws EndpointAdminException
      Delete selected endpoints
      Parameters:
      endpointNames -
      Throws:
      EndpointAdminException
    • deleteAllEndpointGroups

      public void deleteAllEndpointGroups() throws EndpointAdminException
      Delete
      Throws:
      EndpointAdminException
    • getEndpointConfiguration

      public String getEndpointConfiguration(String endpointName) throws EndpointAdminException
      Gets the endpoint element as a string
      Parameters:
      endpointName - - name of the endpoint
      Returns:
      String representing the endpoint with the given endpoint name
      Throws:
      Exception - in case of an error
      EndpointAdminException
    • getEndpoints

      public String[] getEndpoints() throws EndpointAdminException
      Get all endpoint configurations from the synapse configuration
      Returns:
      a list of all the endpoints
      Throws:
      EndpointAdminException - in case of an error
    • getEndpointsData

      public EndpointMetaData[] getEndpointsData()
      Get Metadata of all Endpoints of Synapse configuration
      Returns:
      EndpointMetaData
    • enableStatistics

      public void enableStatistics(String endpointName) throws EndpointAdminException
      Enable statistics collection for the specified endpoint
      Parameters:
      endpointName - name of the endpoint
      Throws:
      EndpointAdminException - in case of an error
    • disableStatistics

      public void disableStatistics(String endpointName) throws EndpointAdminException
      Stop collecting statistics for a specified endpoint
      Parameters:
      endpointName - name of the endpoint
      Throws:
      EndpointAdminException - on error
    • saveEndpoint

      public boolean saveEndpoint(String epString) throws EndpointAdminException
      Update an existing endpoint from the given String representation of the XML
      Parameters:
      epString - - String representing the XML which describes the Endpoint element
      Returns:
      true if the endpoint was saved successfully and false otherwise
      Throws:
      EndpointAdminException - if the endpoint does not exists in the SynapseConfiguration
    • saveDynamicEndpoint

      public boolean saveDynamicEndpoint(String key, String epName) throws EndpointAdminException
      Update an existing Endpoint endpoint in the registry
      Parameters:
      key - dynamic endpoint key
      epName - endpoint name
      Returns:
      whether operation is successful
      Throws:
      EndpointAdminException - on Error
    • addDynamicEndpoint

      public boolean addDynamicEndpoint(String key, String epConfiguration) throws EndpointAdminException
      Add an endpoint to the Synapse registry
      Parameters:
      key - of the dynamic endpoint
      epConfiguration - endpoint configuration
      Throws:
      EndpointAdminException - in case of an error
    • getDynamicEndpoint

      public String getDynamicEndpoint(String key) throws EndpointAdminException
      Get a dynamic endpoint from the registry
      Parameters:
      key - dynamic endpoint key
      Returns:
      dynamic endpoint configuration
      Throws:
      EndpointAdminException - on an error
    • isRegisterNull

      public boolean isRegisterNull() throws EndpointAdminException
      Check registry is available or not
      Returns:
      boolean
      Throws:
      EndpointAdminException
    • getDynamicEndpoints

      public String[] getDynamicEndpoints() throws EndpointAdminException
      Get all endpoints stored in the registry
      Returns:
      endpoints in the registry
      Throws:
      EndpointAdminException - in case of an error
    • deleteDynamicEndpoint

      public boolean deleteDynamicEndpoint(String key) throws EndpointAdminException
      Remove a endpoint form the registry
      Parameters:
      key - dynamic endpoint key
      Returns:
      whether operation is successful
      Throws:
      EndpointAdminException - in case of an error
    • getDependents

      public org.wso2.carbon.mediation.dependency.mgt.ConfigurationObject[] getDependents(String endpointName)
      Get dependents of a particular endpoint.
      Parameters:
      endpointName - endpoint name
      Returns:
      dependants of a endpoints
    • getEndPointsNames

      public String[] getEndPointsNames() throws EndpointAdminException
      Throws:
      EndpointAdminException
    • getEndpointCount

      public int getEndpointCount() throws EndpointAdminException
      Throws:
      EndpointAdminException
    • getDynamicEndpointCount

      public int getDynamicEndpointCount() throws EndpointAdminException
      Throws:
      EndpointAdminException
    • isEndpointExist

      public boolean isEndpointExist(String endpointName) throws EndpointAdminException
      Check endpoint entry exist in the synapseConfiguration
      Parameters:
      endpointName - - endpoint name to be check exist
      Returns:
      true if the endpoint was exist
      Throws:
      EndpointAdminException - if there error when checking endpoint existence.
    • isEndpointExistForTenant

      public boolean isEndpointExistForTenant(String endpointName, String tenantDomain) throws EndpointAdminException
      Check endpoint entry exist in the tenant synapseConfiguration
      Parameters:
      endpointName - - Endpoint name to be checked
      tenantDomain - tenantDomain
      Returns:
      whether the local entry is exist
      Throws:
      EndpointAdminException - if there any error in check existence.