use of org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent in project carbon-business-process by wso2.
the class BPELPackageRepository method readPropertiesOfUpdatedDeploymentInfo.
/**
* Reads the updated properties from registry and sets the process configuration fields
*
* @param processConfiguration - Process's configuration details after updated
* @param bpelPackageName - the relevant bpel package
* @throws RegistryException on registry rollback error case, we'll init the cause to the
* original exception we got when accessing registry
* @throws ProcessManagementException
*/
public void readPropertiesOfUpdatedDeploymentInfo(ProcessConfigurationImpl processConfiguration, String bpelPackageName) throws RegistryException, ProcessManagementException {
String versionlessPackageName = BPELPackageRepositoryUtils.getVersionlessPackageName(bpelPackageName);
String packageLocation = BPELPackageRepositoryUtils.getResourcePathForDeployInfoUpdatedBPELPackage(processConfiguration.getPackage(), versionlessPackageName);
Resource bpelPackage = configRegistry.get(packageLocation);
String stateInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_STATE + processConfiguration.getProcessId());
String inMemoryInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_INMEMORY + processConfiguration.getProcessId());
String processEventsInString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_EVENTS + processConfiguration.getProcessId());
String generateTypeString = bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_EVENT_GENERATE + processConfiguration.getProcessId());
String successCleanupsInString = bpelPackage.getProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_SUCCESS + processConfiguration.getProcessId());
String failureCleanupsInString = bpelPackage.getProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_FAILURE + processConfiguration.getProcessId());
// editor has been updated, read the updated fields
if (stateInString != null) {
ProcessState state = BPELPackageRepositoryUtils.getProcessState(stateInString);
processConfiguration.setState(state);
processConfiguration.setIsTransient(Boolean.parseBoolean(inMemoryInString));
ProcessEventsListType processEventsList = new ProcessEventsListType();
EnableEventListType enabledEventList = BPELPackageRepositoryUtils.getEnabledEventsListFromString(processEventsInString);
processEventsList.setEnableEventsList(enabledEventList);
Generate_type1 generateType = BPELPackageRepositoryUtils.getProcessGenerateTypeFromString(generateTypeString);
processEventsList.setGenerate(generateType);
ScopeEventListType scopeEventList = new ScopeEventListType();
int j = 0;
while (bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_SCOPE_EVENT + (j + 1) + processConfiguration.getProcessId()) != null) {
ScopeEventType scopeEvent = BPELPackageRepositoryUtils.getScopeEventFromString(bpelPackage.getProperty(BPELConstants.BPEL_PROCESS_SCOPE_EVENT + (j + 1) + processConfiguration.getProcessId()));
scopeEventList.addScopeEvent(scopeEvent);
j++;
}
processEventsList.setScopeEventsList(scopeEventList);
processConfiguration.setProcessEventsList(processEventsList);
CleanUpListType cleanUpList = new CleanUpListType();
CleanUpType successCleanUp = BPELPackageRepositoryUtils.getSuccessCleanUpType(successCleanupsInString);
cleanUpList.addCleanUp(successCleanUp);
CleanUpType failureCleanUp = BPELPackageRepositoryUtils.getFailureCleanUpType(failureCleanupsInString);
cleanUpList.addCleanUp(failureCleanUp);
processConfiguration.setProcessCleanupConfImpl(cleanUpList);
}
}
use of org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent in project carbon-business-process by wso2.
the class BPELPackageRepositoryUtils method getScopeEventFromString.
public static ScopeEventType getScopeEventFromString(String scopeEventInString) {
ScopeEventType scopeEvent = new ScopeEventType();
EnableEventListType enableEventListType = new EnableEventListType();
String[] scopeEventEntries = getStringsFromArray(scopeEventInString);
for (int i = 0; i < scopeEventEntries.length - 1; i++) {
enableEventListType.addEnableEvent(scopeEventEntries[i + 1]);
}
scopeEvent.setScope(scopeEventEntries[0]);
scopeEvent.setEnabledEventList(enableEventListType);
return scopeEvent;
}
use of org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent in project carbon-apimgt by wso2.
the class KeyManagerDataServiceImpl method deleteScope.
@Override
public void deleteScope(ScopeEvent event) {
Scope scope = new Scope();
scope.setName(event.getName());
scope.setTimeStamp(event.getTimeStamp());
SubscriptionDataStore store = SubscriptionDataHolder.getInstance().getTenantSubscriptionStore(event.getTenantDomain());
if (store == null) {
if (log.isDebugEnabled()) {
log.debug("Ignoring the event as the tenant " + event.getTenantDomain() + " is not loaded");
}
return;
}
store.deleteScope(scope);
}
use of org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent in project carbon-apimgt by wso2.
the class KeyManagerDataServiceImpl method addScope.
@Override
public void addScope(ScopeEvent event) {
Scope scope = new Scope();
scope.setName(event.getName());
scope.setRoles(event.getRoles());
scope.setDisplayName(event.getDisplayName());
scope.setDescription(event.getDescription());
scope.setTimeStamp(event.getTimeStamp());
SubscriptionDataStore store = SubscriptionDataHolder.getInstance().getTenantSubscriptionStore(event.getTenantDomain());
if (store == null) {
if (log.isDebugEnabled()) {
log.debug("Ignoring the event as the tenant " + event.getTenantDomain() + " is not loaded");
}
return;
}
store.addOrUpdateScope(scope);
}
use of org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent in project carbon-apimgt by wso2.
the class APIProviderImpl method deleteScope.
private void deleteScope(String scopeKey, int tenantId) throws APIManagementException {
if (StringUtils.isNotEmpty(scopeKey)) {
scopesDAO.deleteScope(scopeKey, tenantId);
ScopeEvent scopeEvent = new ScopeEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.SCOPE_DELETE.name(), tenantId, tenantDomain, scopeKey, null, null);
APIUtil.sendNotification(scopeEvent, APIConstants.NotifierType.SCOPE.name());
}
}
Aggregations