use of org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub in project carbon-apimgt by wso2.
the class GlobalThrottleEngineClient method deploy.
/**
* 1. Check validity of execution plan
* 2. If execution plan exist with same name edit it
* 3. Else deploy new execution plan
*
* @param executionPlan execution query plan
* @param sessionCookie session cookie to use established connection
* @throws RemoteException
*/
private void deploy(String executionPlan, String sessionCookie) throws RemoteException {
ServiceClient serviceClient;
Options options;
EventProcessorAdminServiceStub eventProcessorAdminServiceStub = getEventProcessorAdminServiceStub();
serviceClient = eventProcessorAdminServiceStub._getServiceClient();
options = serviceClient.getOptions();
options.setManageSession(true);
options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
eventProcessorAdminServiceStub.deployExecutionPlan(executionPlan);
}
use of org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub in project carbon-apimgt by wso2.
the class GlobalThrottleEngineClient method validateExecutionPlan.
/**
* Checks the validity of a execution plan
*
* @param executionPlan
* @return boolean
*/
public boolean validateExecutionPlan(String executionPlan) {
ServiceClient serviceClient;
Options options;
String result = null;
try {
String sessionCookie = login();
EventProcessorAdminServiceStub eventProcessorAdminServiceStub = getEventProcessorAdminServiceStub();
serviceClient = eventProcessorAdminServiceStub._getServiceClient();
options = serviceClient.getOptions();
options.setManageSession(true);
options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
result = eventProcessorAdminServiceStub.validateExecutionPlan(executionPlan);
} catch (RemoteException e) {
return false;
} catch (MalformedURLException e) {
return false;
} catch (LoginAuthenticationExceptionException e) {
return false;
}
if ("success".equalsIgnoreCase(result)) {
return true;
}
return false;
}
use of org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub in project carbon-apimgt by wso2.
the class GlobalThrottleEngineClient method update.
/**
* Updates a deployed execution plan
*
* @param name Name of execution plan
* @param executionPlan execution query plan
* @param sessionCookie session cookie to use established connection
* @throws RemoteException
*/
private void update(String name, String executionPlan, String sessionCookie) throws RemoteException {
ServiceClient serviceClient;
Options options;
EventProcessorAdminServiceStub eventProcessorAdminServiceStub = getEventProcessorAdminServiceStub();
serviceClient = eventProcessorAdminServiceStub._getServiceClient();
options = serviceClient.getOptions();
options.setManageSession(true);
options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
eventProcessorAdminServiceStub.validateExecutionPlan(executionPlan);
eventProcessorAdminServiceStub.editActiveExecutionPlan(executionPlan, name);
}
use of org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub in project carbon-apimgt by wso2.
the class GlobalThrottleEngineClient method deleteExecutionPlan.
/**
* This method will be used to delete single execution plan.
* @param name execution plan name to be deleted.
*/
public void deleteExecutionPlan(String name) {
ServiceClient serviceClient;
Options options;
String sessionID = null;
try {
sessionID = login();
} catch (RemoteException e) {
log.error("Error while connecting to login central policy management server" + e.getMessage());
} catch (LoginAuthenticationExceptionException e) {
log.error("Error while connecting to login central policy management server, " + "Check user name and password" + e.getMessage());
} catch (MalformedURLException e) {
log.error("Error while connecting to login central policy management server, check URL" + e.getMessage());
}
EventProcessorAdminServiceStub eventProcessorAdminServiceStub = null;
try {
eventProcessorAdminServiceStub = getEventProcessorAdminServiceStub();
serviceClient = eventProcessorAdminServiceStub._getServiceClient();
options = serviceClient.getOptions();
options.setManageSession(true);
options.setProperty(HTTPConstants.COOKIE_STRING, sessionID);
eventProcessorAdminServiceStub.undeployActiveExecutionPlan(name);
} catch (AxisFault axisFault) {
log.error("Error while connecting to login central policy management server to delete " + "execution plan." + axisFault);
} catch (RemoteException e) {
log.error("Error while connecting to login central policy management server to delete " + "execution plan." + e.getMessage());
}
}
Aggregations