Search in sources :

Example 11 with DeployAPIInGatewayEvent

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

the class ExternalGatewayNotifier method process.

/**
 * Process gateway notifier events related to External gateway deployments
 *
 * @param event related to deployments
 * @throws NotifierException if error occurs when casting event
 */
private void process(Event event) throws NotifierException {
    DeployAPIInGatewayEvent deployAPIInGatewayEvent;
    deployAPIInGatewayEvent = (DeployAPIInGatewayEvent) event;
    if (isExternalGatewayAvailableToDeployment(deployAPIInGatewayEvent))
        if (APIConstants.EventType.DEPLOY_API_IN_GATEWAY.name().equals(event.getType())) {
            deployApi(deployAPIInGatewayEvent);
        } else if (APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name().equals(event.getType())) {
            unDeployApi(deployAPIInGatewayEvent);
        }
}
Also used : DeployAPIInGatewayEvent(org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent)

Example 12 with DeployAPIInGatewayEvent

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

the class APIGatewayManager method sendUnDeploymentEvent.

private void sendUnDeploymentEvent(API api, String tenantDomain, Set<String> removedGateways) {
    APIIdentifier apiIdentifier = api.getId();
    DeployAPIInGatewayEvent deployAPIInGatewayEvent = new DeployAPIInGatewayEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name(), api.getOrganization(), api.getId().getId(), api.getUuid(), removedGateways, apiIdentifier.getName(), apiIdentifier.getVersion(), apiIdentifier.getProviderName(), api.getType(), api.getContext());
    APIUtil.sendNotification(deployAPIInGatewayEvent, APIConstants.NotifierType.GATEWAY_PUBLISHED_API.name());
}
Also used : APIIdentifier(org.wso2.carbon.apimgt.api.model.APIIdentifier) DeployAPIInGatewayEvent(org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent)

Example 13 with DeployAPIInGatewayEvent

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

the class APIGatewayManager method sendUnDeploymentEvent.

private void sendUnDeploymentEvent(APIProduct apiProduct, String tenantDomain, Set<String> removedGateways, Set<API> associatedAPIs) {
    APIProductIdentifier apiProductIdentifier = apiProduct.getId();
    Set<APIEvent> apiEvents = transformAPIToAPIEvent(associatedAPIs);
    DeployAPIInGatewayEvent deployAPIInGatewayEvent = new DeployAPIInGatewayEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.REMOVE_API_FROM_GATEWAY.name(), tenantDomain, apiProduct.getProductId(), apiProduct.getUuid(), removedGateways, apiProductIdentifier.getName(), apiProductIdentifier.getVersion(), PRODUCT_PREFIX, APIConstants.API_PRODUCT, apiProduct.getContext(), apiEvents);
    APIUtil.sendNotification(deployAPIInGatewayEvent, APIConstants.NotifierType.GATEWAY_PUBLISHED_API.name());
}
Also used : APIProductIdentifier(org.wso2.carbon.apimgt.api.model.APIProductIdentifier) APIEvent(org.wso2.carbon.apimgt.impl.notifier.events.APIEvent) DeployAPIInGatewayEvent(org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent)

Example 14 with DeployAPIInGatewayEvent

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

the class APIGatewayManager method sendDeploymentEvent.

private void sendDeploymentEvent(APIProduct api, String tenantDomain, Set<String> publishedGateways) {
    APIProductIdentifier apiIdentifier = api.getId();
    DeployAPIInGatewayEvent deployAPIInGatewayEvent = new DeployAPIInGatewayEvent(UUID.randomUUID().toString(), System.currentTimeMillis(), APIConstants.EventType.DEPLOY_API_IN_GATEWAY.name(), tenantDomain, api.getProductId(), api.getUuid(), publishedGateways, apiIdentifier.getName(), apiIdentifier.getVersion(), PRODUCT_PREFIX, api.getType(), api.getContext());
    APIUtil.sendNotification(deployAPIInGatewayEvent, APIConstants.NotifierType.GATEWAY_PUBLISHED_API.name());
    if (debugEnabled) {
        log.debug("Event sent to Gateway with eventID " + deployAPIInGatewayEvent.getEventId() + " for api " + "with apiID " + api + " at " + deployAPIInGatewayEvent.getTimeStamp());
    }
}
Also used : APIProductIdentifier(org.wso2.carbon.apimgt.api.model.APIProductIdentifier) DeployAPIInGatewayEvent(org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent)

Aggregations

DeployAPIInGatewayEvent (org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent)8 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)3 API (org.wso2.carbon.apimgt.api.model.API)3 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)3 APIProductIdentifier (org.wso2.carbon.apimgt.api.model.APIProductIdentifier)3 ArtifactSynchronizerException (org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException)3 APIEvent (org.wso2.carbon.apimgt.impl.notifier.events.APIEvent)3 SubscriptionDataStore (org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)3 APIProvider (org.wso2.carbon.apimgt.api.APIProvider)2 GatewayAPIDTO (org.wso2.carbon.apimgt.api.gateway.GatewayAPIDTO)2 Environment (org.wso2.carbon.apimgt.api.model.Environment)2 APIGatewayAdmin (org.wso2.carbon.apimgt.gateway.service.APIGatewayAdmin)2 ExternalGatewayDeployer (org.wso2.carbon.apimgt.impl.deployer.ExternalGatewayDeployer)2 DeployerException (org.wso2.carbon.apimgt.impl.deployer.exceptions.DeployerException)2 NotifierException (org.wso2.carbon.apimgt.impl.notifier.exceptions.NotifierException)2 Gson (com.google.gson.Gson)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 AxisFault (org.apache.axis2.AxisFault)1 EndpointCertificateDeployer (org.wso2.carbon.apimgt.gateway.EndpointCertificateDeployer)1