Class ThrottleConfigAdminService
java.lang.Object
org.wso2.carbon.core.AbstractAdmin
org.wso2.carbon.mediation.throttle.service.ThrottleConfigAdminService
public class ThrottleConfigAdminService
extends org.wso2.carbon.core.AbstractAdmin
This is the class which provides all the main functionalities provided by
the throttle component. This includes engaging/disengaging throttling and
providing the current policy configuration.
-
Field Summary
FieldsFields inherited from class org.wso2.carbon.core.AbstractAdmin
configurationContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddisableThrottling(String serviceName) Disengage Throttling module from the specified servicevoidDisengage throttling globallybooleandisengageThrottlingForOperation(String serviceName, String operationName) Disengages throttling from an operationvoidenableThrottling(String serviceName, ThrottlePolicy policy) Engages Throttling for the given serviceName by generating the policy according to the specified parametersbooleanengageThrottlingForOperation(ThrottlePolicy policy, String serviceName, String operationName) Engage throttling for the given operationgetOperationPolicyConfigs(String serviceName, String operationName) getPolicyConfigs(String serviceName) Gives the current policy config as a ThrottlePolicyvoidEngages throttling globally.throttlePolicyToString(ThrottlePolicy policy) toThrottlePolicy(String policyXML) Methods inherited from class org.wso2.carbon.core.AbstractAdmin
getAxisConfig, getConfigContext, getConfigSystemRegistry, getConfigUserRegistry, getGovernanceRegistry, getGovernanceSystemRegistry, getGovernanceUserRegistry, getHttpSession, getLocalRepo, getRegistry, getTenantDomain, getUserId, getUsername, getUserRealm, setConfigurationContext, setPermissionUpdateTimestamp
-
Field Details
-
axisConfig
protected org.apache.axis2.engine.AxisConfiguration axisConfig
-
-
Constructor Details
-
ThrottleConfigAdminService
public ThrottleConfigAdminService()Constructor. Retrieves the registry from the axis configuration
-
-
Method Details
-
enableThrottling
public void enableThrottling(String serviceName, ThrottlePolicy policy) throws org.apache.axis2.AxisFault, ThrottleComponentException Engages Throttling for the given serviceName by generating the policy according to the specified parameters- Parameters:
serviceName- - name of the serviceName to engage throttlingpolicy- - object containg policy configurations- Throws:
org.apache.axis2.AxisFault- - if an error is occured when accessing axisConfig or axisServiceThrottleComponentException- - throttle component specific errors
-
globallyEngageThrottling
public void globallyEngageThrottling(ThrottlePolicy policy) throws org.apache.axis2.AxisFault, ThrottleComponentException Engages throttling globally.- Parameters:
policy- - policy configuration to be used- Throws:
org.apache.axis2.AxisFault- - if error occured when dealing with axisConfigThrottleComponentException- - throttle component specific errors
-
engageThrottlingForOperation
public boolean engageThrottlingForOperation(ThrottlePolicy policy, String serviceName, String operationName) throws org.apache.axis2.AxisFault, ThrottleComponentException Engage throttling for the given operation- Parameters:
policy- - throttle configserviceName- - name of the service which contains the operationoperationName- - operation name- Returns:
- - true if already engaged throttling at the service level, else false
- Throws:
org.apache.axis2.AxisFault- - on axis errorThrottleComponentException- - throttle specific error
-
disengageThrottlingForOperation
public boolean disengageThrottlingForOperation(String serviceName, String operationName) throws ThrottleComponentException Disengages throttling from an operation- Parameters:
serviceName- - name of the service which contains the operationoperationName- - operation name- Returns:
- - true if throttling is already engaged at the service level, else false
- Throws:
ThrottleComponentException- - on error
-
disableThrottling
Disengage Throttling module from the specified service- Parameters:
serviceName- - name of the service of which throttling should be desabled- Throws:
ThrottleComponentException- - error in disabling
-
disengageGlobalThrottling
Disengage throttling globally- Throws:
ThrottleComponentException- - component specific error
-
getPolicyConfigs
public ThrottlePolicy getPolicyConfigs(String serviceName) throws org.apache.axis2.AxisFault, ThrottleComponentException Gives the current policy config as a ThrottlePolicy- Parameters:
serviceName- - name of the service of which configs are needed- Returns:
- - ThrottlePolicy object containing configs
- Throws:
org.apache.axis2.AxisFault- - error in accessing axisConfig or axis serviceThrottleComponentException- - policy config retrieving error
-
getGlobalPolicyConfigs
public ThrottlePolicy getGlobalPolicyConfigs() throws org.apache.axis2.AxisFault, ThrottleComponentException- Throws:
org.apache.axis2.AxisFaultThrottleComponentException
-
getOperationPolicyConfigs
public ThrottlePolicy getOperationPolicyConfigs(String serviceName, String operationName) throws org.apache.axis2.AxisFault, ThrottleComponentException - Throws:
org.apache.axis2.AxisFaultThrottleComponentException
-
toThrottlePolicy
- Throws:
ThrottleComponentException
-
throttlePolicyToString
- Throws:
ThrottleComponentException
-