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.AbstractAdminThis 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
Fields Modifier and Type Field Description protected org.apache.axis2.engine.AxisConfigurationaxisConfig
-
Constructor Summary
Constructors Constructor Description ThrottleConfigAdminService()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableThrottling(String serviceName)Disengage Throttling module from the specified servicevoiddisengageGlobalThrottling()Disengage 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 operationThrottlePolicygetGlobalPolicyConfigs()ThrottlePolicygetOperationPolicyConfigs(String serviceName, String operationName)ThrottlePolicygetPolicyConfigs(String serviceName)Gives the current policy config as a ThrottlePolicyvoidgloballyEngageThrottling(ThrottlePolicy policy)Engages throttling globally.StringthrottlePolicyToString(ThrottlePolicy policy)ThrottlePolicytoThrottlePolicy(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
-
-
-
-
Method Detail
-
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
public void disableThrottling(String serviceName) throws ThrottleComponentException
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
public void disengageGlobalThrottling() throws ThrottleComponentExceptionDisengage 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
public ThrottlePolicy toThrottlePolicy(String policyXML) throws ThrottleComponentException
- Throws:
ThrottleComponentException
-
throttlePolicyToString
public String throttlePolicyToString(ThrottlePolicy policy) throws ThrottleComponentException
- Throws:
ThrottleComponentException
-
-