Search in sources :

Example 6 with ScopeEvent

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);
    }
}
Also used : ProcessState(org.apache.ode.bpel.iapi.ProcessState) ProcessEventsListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType) EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType) Generate_type1(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1) ScopeEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType) Resource(org.wso2.carbon.registry.core.Resource) CleanUpListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType) CleanUpType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType)

Example 7 with ScopeEvent

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;
}
Also used : EnableEventListType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType) ScopeEventType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType)

Example 8 with 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);
}
Also used : Scope(org.wso2.carbon.apimgt.keymgt.model.entity.Scope) SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 9 with ScopeEvent

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);
}
Also used : Scope(org.wso2.carbon.apimgt.keymgt.model.entity.Scope) SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 10 with ScopeEvent

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());
    }
}
Also used : ScopeEvent(org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent)

Aggregations

ScopeEvent (org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent)4 EnableEventListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.EnableEventListType)4 ScopeEventType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventType)4 ScopeEventListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeEventListType)3 HashSet (java.util.HashSet)2 BpelEvent (org.apache.ode.bpel.evt.BpelEvent)2 SubscriptionDataStore (org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)2 Scope (org.wso2.carbon.apimgt.keymgt.model.entity.Scope)2 CleanUpListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpListType)2 CleanUpType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.CleanUpType)2 Generate_type1 (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.Generate_type1)2 ProcessEventsListType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ProcessEventsListType)2 Gson (com.google.gson.Gson)1 Map (java.util.Map)1 Set (java.util.Set)1 QName (javax.xml.namespace.QName)1 TInvoke (org.apache.ode.bpel.dd.TInvoke)1 TProvide (org.apache.ode.bpel.dd.TProvide)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1 ProcessState (org.apache.ode.bpel.iapi.ProcessState)1