Search in sources :

Example 1 with ApplicationRegistrationEvent

use of org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent in project carbon-apimgt by wso2.

the class WorkflowUtils method sendNotificationAfterWFComplete.

public static void sendNotificationAfterWFComplete(WorkflowDTO workflowDTO, String wfType) throws APIManagementException {
    if (WorkflowConstants.WF_TYPE_AM_APPLICATION_CREATION.equalsIgnoreCase(wfType)) {
        String applicationId = workflowDTO.getWorkflowReference();
        int appId = Integer.parseInt(applicationId);
        ApiMgtDAO apiMgtDAO = ApiMgtDAO.getInstance();
        Application application = apiMgtDAO.getApplicationById(appId);
        ApplicationWorkflowDTO appWFDto = (ApplicationWorkflowDTO) workflowDTO;
        appWFDto.setApplication(application);
        ApplicationEvent applicationEvent = new ApplicationEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.APPLICATION_CREATE.name(), appWFDto.getTenantId(), appWFDto.getTenantDomain(), appWFDto.getApplication().getId(), appWFDto.getApplication().getUUID(), appWFDto.getApplication().getName(), appWFDto.getApplication().getTokenType(), appWFDto.getApplication().getTier(), appWFDto.getApplication().getGroupId(), appWFDto.getApplication().getApplicationAttributes(), application.getSubscriber().getName());
        APIUtil.sendNotification(applicationEvent, APIConstants.NotifierType.APPLICATION.name());
    } else if (WorkflowConstants.WF_TYPE_AM_APPLICATION_DELETION.equalsIgnoreCase(wfType)) {
        ApplicationWorkflowDTO appWFDto = (ApplicationWorkflowDTO) workflowDTO;
        ApplicationEvent applicationEvent = new ApplicationEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.APPLICATION_DELETE.name(), appWFDto.getTenantId(), appWFDto.getTenantDomain(), appWFDto.getApplication().getId(), appWFDto.getApplication().getUUID(), appWFDto.getApplication().getName(), appWFDto.getApplication().getTokenType(), appWFDto.getApplication().getTier(), appWFDto.getApplication().getGroupId(), appWFDto.getApplication().getApplicationAttributes(), "");
        APIUtil.sendNotification(applicationEvent, APIConstants.NotifierType.APPLICATION.name());
    } else if (WorkflowConstants.WF_TYPE_AM_SUBSCRIPTION_CREATION.equalsIgnoreCase(wfType)) {
        SubscriptionWorkflowDTO subWFDto = (SubscriptionWorkflowDTO) workflowDTO;
        SubscribedAPI sub = ApiMgtDAO.getInstance().getSubscriptionById(Integer.parseInt(subWFDto.getWorkflowReference()));
        SubscriptionEvent subscriptionEvent;
        if (sub.getApiId() != null) {
            subscriptionEvent = new SubscriptionEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.SUBSCRIPTIONS_CREATE.name(), subWFDto.getTenantId(), subWFDto.getTenantDomain(), Integer.parseInt(subWFDto.getWorkflowReference()), sub.getUUID(), sub.getIdentifier().getId(), sub.getIdentifier().getUUID(), sub.getApplication().getId(), sub.getApplication().getUUID(), sub.getTier().getName(), sub.getSubCreatedStatus());
        } else {
            subscriptionEvent = new SubscriptionEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.SUBSCRIPTIONS_CREATE.name(), subWFDto.getTenantId(), subWFDto.getTenantDomain(), Integer.parseInt(subWFDto.getWorkflowReference()), sub.getUUID(), sub.getProductId().getId(), sub.getProductId().getUUID(), sub.getApplication().getId(), sub.getApplication().getUUID(), sub.getTier().getName(), sub.getSubCreatedStatus());
        }
        APIUtil.sendNotification(subscriptionEvent, APIConstants.NotifierType.SUBSCRIPTIONS.name());
    } else if (WorkflowConstants.WF_TYPE_AM_SUBSCRIPTION_UPDATE.equalsIgnoreCase(wfType)) {
        SubscriptionWorkflowDTO subWFDto = (SubscriptionWorkflowDTO) workflowDTO;
        SubscribedAPI sub = ApiMgtDAO.getInstance().getSubscriptionById(Integer.parseInt(subWFDto.getWorkflowReference()));
        SubscriptionEvent subscriptionEvent;
        if (sub.getApiId() != null) {
            subscriptionEvent = new SubscriptionEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.SUBSCRIPTIONS_UPDATE.name(), subWFDto.getTenantId(), subWFDto.getTenantDomain(), Integer.parseInt(subWFDto.getWorkflowReference()), sub.getUUID(), sub.getIdentifier().getId(), sub.getIdentifier().getUUID(), sub.getApplication().getId(), sub.getApplication().getUUID(), sub.getTier().getName(), sub.getSubCreatedStatus());
        } else {
            subscriptionEvent = new SubscriptionEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.SUBSCRIPTIONS_UPDATE.name(), subWFDto.getTenantId(), subWFDto.getTenantDomain(), Integer.parseInt(subWFDto.getWorkflowReference()), sub.getUUID(), sub.getProductId().getId(), sub.getProductId().getUUID(), sub.getApplication().getId(), sub.getApplication().getUUID(), sub.getTier().getName(), sub.getSubCreatedStatus());
        }
        APIUtil.sendNotification(subscriptionEvent, APIConstants.NotifierType.SUBSCRIPTIONS.name());
    } else if (WorkflowConstants.WF_TYPE_AM_SUBSCRIPTION_DELETION.equalsIgnoreCase(wfType)) {
        SubscriptionWorkflowDTO subWFDto = (SubscriptionWorkflowDTO) workflowDTO;
        SubscribedAPI sub = ApiMgtDAO.getInstance().getSubscriptionById(Integer.parseInt(subWFDto.getWorkflowReference()));
        SubscriptionEvent subscriptionEvent;
        if (sub.getApiId() != null) {
            subscriptionEvent = new SubscriptionEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.SUBSCRIPTIONS_DELETE.name(), subWFDto.getTenantId(), subWFDto.getTenantDomain(), Integer.parseInt(subWFDto.getWorkflowReference()), sub.getUUID(), sub.getIdentifier().getId(), sub.getIdentifier().getUUID(), sub.getApplication().getId(), sub.getApplication().getUUID(), sub.getTier().getName(), sub.getSubCreatedStatus());
        } else {
            subscriptionEvent = new SubscriptionEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.SUBSCRIPTIONS_DELETE.name(), subWFDto.getTenantId(), subWFDto.getTenantDomain(), Integer.parseInt(subWFDto.getWorkflowReference()), sub.getUUID(), sub.getProductId().getId(), sub.getProductId().getUUID(), sub.getApplication().getId(), sub.getApplication().getUUID(), sub.getTier().getName(), sub.getSubCreatedStatus());
        }
        APIUtil.sendNotification(subscriptionEvent, APIConstants.NotifierType.SUBSCRIPTIONS.name());
    } else if (WorkflowConstants.WF_TYPE_AM_API_STATE.equalsIgnoreCase(wfType) || WorkflowConstants.WF_TYPE_AM_API_PRODUCT_STATE.equalsIgnoreCase(wfType)) {
        APIStateWorkflowDTO apiStateWFDto = (APIStateWorkflowDTO) workflowDTO;
        APIEvent apiEvent = new APIEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.API_LIFECYCLE_CHANGE.name(), apiStateWFDto.getTenantId(), apiStateWFDto.getTenantDomain(), apiStateWFDto.getApiName(), Integer.parseInt(apiStateWFDto.getWorkflowReference()), apiStateWFDto.getApiUUID(), apiStateWFDto.getApiVersion(), apiStateWFDto.getApiType(), apiStateWFDto.getApiContext(), apiStateWFDto.getApiProvider(), apiStateWFDto.getApiLCAction());
        APIUtil.sendNotification(apiEvent, APIConstants.NotifierType.API.name());
    } else if (WorkflowConstants.WF_TYPE_AM_APPLICATION_REGISTRATION_PRODUCTION.equalsIgnoreCase(wfType)) {
        ApplicationRegistrationWorkflowDTO appRegWFDto = (ApplicationRegistrationWorkflowDTO) workflowDTO;
        ApplicationRegistrationEvent applicationRegistrationEvent = new ApplicationRegistrationEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.APPLICATION_REGISTRATION_CREATE.name(), appRegWFDto.getTenantId(), appRegWFDto.getTenantDomain(), appRegWFDto.getApplication().getId(), appRegWFDto.getApplication().getUUID(), appRegWFDto.getApplicationInfo().getClientId(), appRegWFDto.getApplication().getTokenType(), appRegWFDto.getKeyManager());
        APIUtil.sendNotification(applicationRegistrationEvent, APIConstants.NotifierType.APPLICATION_REGISTRATION.name());
    } else if (WorkflowConstants.WF_TYPE_AM_APPLICATION_REGISTRATION_SANDBOX.equalsIgnoreCase(wfType)) {
        ApplicationRegistrationWorkflowDTO appRegWFDto = (ApplicationRegistrationWorkflowDTO) workflowDTO;
        ApplicationRegistrationEvent applicationRegistrationEvent = new ApplicationRegistrationEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.APPLICATION_REGISTRATION_CREATE.name(), appRegWFDto.getTenantId(), appRegWFDto.getTenantDomain(), appRegWFDto.getApplication().getId(), appRegWFDto.getApplication().getUUID(), appRegWFDto.getApplicationInfo().getClientId(), appRegWFDto.getApplication().getTokenType(), appRegWFDto.getKeyManager());
        APIUtil.sendNotification(applicationRegistrationEvent, APIConstants.NotifierType.APPLICATION_REGISTRATION.name());
    }
}
Also used : SubscriptionEvent(org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionEvent) ApplicationRegistrationWorkflowDTO(org.wso2.carbon.apimgt.impl.dto.ApplicationRegistrationWorkflowDTO) ApplicationEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationEvent) ApiMgtDAO(org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO) ApplicationRegistrationEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent) APIEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIEvent) ApplicationWorkflowDTO(org.wso2.carbon.apimgt.impl.dto.ApplicationWorkflowDTO) SubscriptionWorkflowDTO(org.wso2.carbon.apimgt.impl.dto.SubscriptionWorkflowDTO) SubscribedAPI(org.wso2.carbon.apimgt.api.model.SubscribedAPI) Application(org.wso2.carbon.apimgt.api.model.Application)

Example 2 with ApplicationRegistrationEvent

use of org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent in project carbon-apimgt by wso2.

the class KeyManagerDataServiceImpl method addOrUpdateApplicationKeyMapping.

@Override
public void addOrUpdateApplicationKeyMapping(ApplicationRegistrationEvent event) {
    if (log.isDebugEnabled()) {
        log.debug("Add or Update Application keymapping in datastore in tenant " + event.getTenantDomain());
    }
    SubscriptionDataStore store = SubscriptionDataHolder.getInstance().getTenantSubscriptionStore(event.getTenantDomain());
    if (store == null) {
        if (log.isDebugEnabled()) {
            log.debug("Ignoring the Event due to tenant " + event.getTenantDomain() + " not loaded");
        }
        return;
    }
    store.addOrUpdateApplicationKeyMapping(getApplicationKeyMappingFromApplicationRegistrationEvent(event));
}
Also used : SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 3 with ApplicationRegistrationEvent

use of org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent in project carbon-apimgt by wso2.

the class KeyManagerDataServiceImpl method removeApplicationKeyMapping.

@Override
public void removeApplicationKeyMapping(ApplicationRegistrationEvent event) {
    if (log.isDebugEnabled()) {
        log.debug("Remove ApplicationKey Mapping in datastore in tenant " + event.getTenantDomain());
    }
    SubscriptionDataStore store = SubscriptionDataHolder.getInstance().getTenantSubscriptionStore(event.getTenantDomain());
    if (store == null) {
        if (log.isDebugEnabled()) {
            log.debug("Ignoring the Event due to tenant " + event.getTenantDomain() + " not loaded");
        }
        return;
    }
    store.removeApplicationKeyMapping(getApplicationKeyMappingFromApplicationRegistrationEvent(event));
}
Also used : SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 4 with ApplicationRegistrationEvent

use of org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent in project carbon-apimgt by wso2.

the class GatewayJMSMessageListener method handleNotificationMessage.

private void handleNotificationMessage(String eventType, long timestamp, String encodedEvent) {
    byte[] eventDecoded = Base64.decodeBase64(encodedEvent);
    String eventJson = new String(eventDecoded);
    if (APIConstants.EventType.DEPLOY_API_IN_GATEWAY.name().equals(eventType) || APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name().equals(eventType)) {
        DeployAPIInGatewayEvent gatewayEvent = new Gson().fromJson(new String(eventDecoded), DeployAPIInGatewayEvent.class);
        String tenantDomain = gatewayEvent.getTenantDomain();
        boolean tenantLoaded = ServiceReferenceHolder.getInstance().isTenantLoaded(tenantDomain);
        if (!tenantLoaded) {
            String syncKey = tenantDomain.concat("__").concat(this.getClass().getName());
            synchronized (syncKey.intern()) {
                tenantLoaded = ServiceReferenceHolder.getInstance().isTenantLoaded(tenantDomain);
                if (!tenantLoaded) {
                    APIUtil.loadTenantConfigBlockingMode(tenantDomain);
                }
            }
        }
        if (tenantLoaded) {
            Set<String> systemConfiguredGatewayLabels = new HashSet(gatewayEvent.getGatewayLabels());
            systemConfiguredGatewayLabels.retainAll(gatewayArtifactSynchronizerProperties.getGatewayLabels());
            if (!systemConfiguredGatewayLabels.isEmpty()) {
                ServiceReferenceHolder.getInstance().getKeyManagerDataService().updateDeployedAPIRevision(gatewayEvent);
                if (EventType.DEPLOY_API_IN_GATEWAY.name().equals(eventType)) {
                    boolean tenantFlowStarted = false;
                    try {
                        startTenantFlow(tenantDomain);
                        tenantFlowStarted = true;
                        inMemoryApiDeployer.deployAPI(gatewayEvent);
                    } catch (ArtifactSynchronizerException e) {
                        log.error("Error in deploying artifacts for " + gatewayEvent.getUuid() + "in the Gateway");
                    } finally {
                        if (tenantFlowStarted) {
                            endTenantFlow();
                        }
                    }
                }
                if (APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name().equals(eventType)) {
                    boolean tenantFlowStarted = false;
                    try {
                        startTenantFlow(tenantDomain);
                        tenantFlowStarted = true;
                        inMemoryApiDeployer.unDeployAPI(gatewayEvent);
                    } catch (ArtifactSynchronizerException e) {
                        log.error("Error in undeploying artifacts");
                    } finally {
                        if (tenantFlowStarted) {
                            endTenantFlow();
                        }
                    }
                }
            }
            if (debugEnabled) {
                log.debug("Event with ID " + gatewayEvent.getEventId() + " is received and " + gatewayEvent.getUuid() + " is successfully deployed/undeployed");
            }
        }
    }
    if (EventType.APPLICATION_CREATE.toString().equals(eventType) || EventType.APPLICATION_UPDATE.toString().equals(eventType)) {
        ApplicationEvent event = new Gson().fromJson(eventJson, ApplicationEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateApplication(event);
        ;
    } else if (EventType.SUBSCRIPTIONS_CREATE.toString().equals(eventType) || EventType.SUBSCRIPTIONS_UPDATE.toString().equals(eventType)) {
        SubscriptionEvent event = new Gson().fromJson(eventJson, SubscriptionEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateSubscription(event);
    } else if (EventType.API_UPDATE.toString().equals(eventType)) {
        APIEvent event = new Gson().fromJson(eventJson, APIEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateAPI(event);
    } else if (EventType.API_LIFECYCLE_CHANGE.toString().equals(eventType)) {
        APIEvent event = new Gson().fromJson(eventJson, APIEvent.class);
        if (APIStatus.CREATED.toString().equals(event.getApiStatus()) || APIStatus.RETIRED.toString().equals(event.getApiStatus())) {
            ServiceReferenceHolder.getInstance().getKeyManagerDataService().removeAPI(event);
        } else {
            ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateAPI(event);
        }
    } else if (EventType.APPLICATION_REGISTRATION_CREATE.toString().equals(eventType)) {
        ApplicationRegistrationEvent event = new Gson().fromJson(eventJson, ApplicationRegistrationEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateApplicationKeyMapping(event);
    } else if (EventType.SUBSCRIPTIONS_DELETE.toString().equals(eventType)) {
        SubscriptionEvent event = new Gson().fromJson(eventJson, SubscriptionEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().removeSubscription(event);
    } else if (EventType.APPLICATION_DELETE.toString().equals(eventType)) {
        ApplicationEvent event = new Gson().fromJson(eventJson, ApplicationEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().removeApplication(event);
    } else if (EventType.REMOVE_APPLICATION_KEYMAPPING.toString().equals(eventType)) {
        ApplicationRegistrationEvent event = new Gson().fromJson(eventJson, ApplicationRegistrationEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().removeApplicationKeyMapping(event);
    } else if (EventType.SCOPE_CREATE.toString().equals(eventType)) {
        ScopeEvent event = new Gson().fromJson(eventJson, ScopeEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().addScope(event);
    } else if (EventType.SCOPE_UPDATE.toString().equals(eventType)) {
        ScopeEvent event = new Gson().fromJson(eventJson, ScopeEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().addScope(event);
    } else if (EventType.SCOPE_DELETE.toString().equals(eventType)) {
        ScopeEvent event = new Gson().fromJson(eventJson, ScopeEvent.class);
        ServiceReferenceHolder.getInstance().getKeyManagerDataService().deleteScope(event);
    } else if (EventType.POLICY_CREATE.toString().equals(eventType) || EventType.POLICY_DELETE.toString().equals(eventType)) {
        PolicyEvent event = new Gson().fromJson(eventJson, PolicyEvent.class);
        boolean updatePolicy = false;
        boolean deletePolicy = false;
        if (EventType.POLICY_CREATE.toString().equals(eventType) || EventType.POLICY_UPDATE.toString().equals(eventType)) {
            updatePolicy = true;
        } else if (EventType.POLICY_DELETE.toString().equals(eventType)) {
            deletePolicy = true;
        }
        if (event.getPolicyType() == PolicyType.API) {
            APIPolicyEvent policyEvent = new Gson().fromJson(eventJson, APIPolicyEvent.class);
            if (updatePolicy) {
                ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateAPIPolicy(policyEvent);
            } else if (deletePolicy) {
                ServiceReferenceHolder.getInstance().getKeyManagerDataService().removeAPIPolicy(policyEvent);
            }
        } else if (event.getPolicyType() == PolicyType.SUBSCRIPTION) {
            SubscriptionPolicyEvent policyEvent = new Gson().fromJson(eventJson, SubscriptionPolicyEvent.class);
            if (updatePolicy) {
                ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateSubscriptionPolicy(policyEvent);
            } else if (deletePolicy) {
                ServiceReferenceHolder.getInstance().getKeyManagerDataService().removeSubscriptionPolicy(policyEvent);
            }
        } else if (event.getPolicyType() == PolicyType.APPLICATION) {
            ApplicationPolicyEvent policyEvent = new Gson().fromJson(eventJson, ApplicationPolicyEvent.class);
            if (updatePolicy) {
                ServiceReferenceHolder.getInstance().getKeyManagerDataService().addOrUpdateApplicationPolicy(policyEvent);
            } else if (deletePolicy) {
                ServiceReferenceHolder.getInstance().getKeyManagerDataService().removeApplicationPolicy(policyEvent);
            }
        }
    } else if (EventType.ENDPOINT_CERTIFICATE_ADD.toString().equals(eventType) || EventType.ENDPOINT_CERTIFICATE_REMOVE.toString().equals(eventType)) {
        CertificateEvent certificateEvent = new Gson().fromJson(eventJson, CertificateEvent.class);
        if (EventType.ENDPOINT_CERTIFICATE_ADD.toString().equals(eventType)) {
            try {
                new EndpointCertificateDeployer(certificateEvent.getTenantDomain()).deployCertificate(certificateEvent.getAlias());
            } catch (APIManagementException e) {
                log.error(e);
            }
        } else if (EventType.ENDPOINT_CERTIFICATE_REMOVE.toString().equals(eventType)) {
            boolean tenantFlowStarted = false;
            try {
                PrivilegedCarbonContext.startTenantFlow();
                PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(certificateEvent.getTenantDomain(), true);
                tenantFlowStarted = true;
                CertificateManagerImpl.getInstance().deleteCertificateFromGateway(certificateEvent.getAlias());
            } finally {
                if (tenantFlowStarted) {
                    PrivilegedCarbonContext.endTenantFlow();
                }
            }
        }
    } else if (EventType.GA_CONFIG_UPDATE.toString().equals(eventType)) {
        GoogleAnalyticsConfigEvent googleAnalyticsConfigEvent = new Gson().fromJson(eventJson, GoogleAnalyticsConfigEvent.class);
        try {
            new GoogleAnalyticsConfigDeployer(googleAnalyticsConfigEvent.getTenantDomain()).deploy();
        } catch (APIManagementException e) {
            log.error(e);
        }
    } else if (EventType.UDATE_API_LOG_LEVEL.toString().equals(eventType)) {
        APIEvent apiEvent = new Gson().fromJson(eventJson, APIEvent.class);
        APILoggerManager.getInstance().updateLoggerMap(apiEvent.getApiContext(), apiEvent.getLogLevel());
    }
}
Also used : SubscriptionEvent(org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionEvent) ApplicationEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationEvent) Gson(com.google.gson.Gson) DeployAPIInGatewayEvent(org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent) ApplicationPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationPolicyEvent) EndpointCertificateDeployer(org.wso2.carbon.apimgt.gateway.EndpointCertificateDeployer) SubscriptionPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionPolicyEvent) ApplicationRegistrationEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent) GoogleAnalyticsConfigDeployer(org.wso2.carbon.apimgt.gateway.GoogleAnalyticsConfigDeployer) APIEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIEvent) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) ArtifactSynchronizerException(org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException) APIPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIPolicyEvent) CertificateEvent(org.wso2.carbon.apimgt.impl.notifier.events.CertificateEvent) APIPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIPolicyEvent) PolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.PolicyEvent) SubscriptionPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionPolicyEvent) ApplicationPolicyEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationPolicyEvent) ScopeEvent(org.wso2.carbon.apimgt.impl.notifier.events.ScopeEvent) GoogleAnalyticsConfigEvent(org.wso2.carbon.apimgt.impl.notifier.events.GoogleAnalyticsConfigEvent) HashSet(java.util.HashSet)

Example 5 with ApplicationRegistrationEvent

use of org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent in project carbon-apimgt by wso2.

the class SolaceKeyGenNotifier method process.

/**
 * Process Application notifier event related to key generation related to Solace Applications
 *
 * @param event related to Key generation handling
 * @throws NotifierException if error occurs when casting event
 */
private void process(Event event) throws NotifierException {
    ApplicationRegistrationEvent applicationRegistrationEvent;
    applicationRegistrationEvent = (ApplicationRegistrationEvent) event;
    if (APIConstants.EventType.APPLICATION_REGISTRATION_CREATE.name().equals(event.getType())) {
        syncSolaceApplicationClientId(applicationRegistrationEvent);
    }
}
Also used : ApplicationRegistrationEvent(org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent)

Aggregations

ApplicationRegistrationEvent (org.wso2.carbon.apimgt.impl.notifier.events.ApplicationRegistrationEvent)5 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)4 ApplicationRegistrationWorkflowDTO (org.wso2.carbon.apimgt.impl.dto.ApplicationRegistrationWorkflowDTO)3 ApplicationWorkflowDTO (org.wso2.carbon.apimgt.impl.dto.ApplicationWorkflowDTO)3 SubscriptionWorkflowDTO (org.wso2.carbon.apimgt.impl.dto.SubscriptionWorkflowDTO)3 ApplicationEvent (org.wso2.carbon.apimgt.impl.notifier.events.ApplicationEvent)3 HashMap (java.util.HashMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 JSONObject (org.json.simple.JSONObject)2 Application (org.wso2.carbon.apimgt.api.model.Application)2 SubscribedAPI (org.wso2.carbon.apimgt.api.model.SubscribedAPI)2 WorkflowDTO (org.wso2.carbon.apimgt.impl.dto.WorkflowDTO)2 APIEvent (org.wso2.carbon.apimgt.impl.notifier.events.APIEvent)2 SubscriptionEvent (org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionEvent)2 WorkflowException (org.wso2.carbon.apimgt.impl.workflow.WorkflowException)2 WorkflowExecutor (org.wso2.carbon.apimgt.impl.workflow.WorkflowExecutor)2 SubscriptionDataStore (org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)2 Gson (com.google.gson.Gson)1 HashSet (java.util.HashSet)1 List (java.util.List)1