Search in sources :

Example 26 with GatewayException

use of org.wso2.carbon.apimgt.core.exception.GatewayException in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method deleteApplication.

@Override
public void deleteApplication(String applicationId) throws GatewayException {
    if (applicationId != null) {
        ApplicationEvent applicationEvent = new ApplicationEvent(APIMgtConstants.GatewayEventTypes.APPLICATION_DELETE);
        applicationEvent.setApplicationId(applicationId);
        publishToStoreTopic(applicationEvent);
        if (log.isDebugEnabled()) {
            log.debug("Application : " + applicationId + " deleted event has been successfully published " + "to broker");
        }
    }
}
Also used : ApplicationEvent(org.wso2.carbon.apimgt.core.models.events.ApplicationEvent)

Example 27 with GatewayException

use of org.wso2.carbon.apimgt.core.exception.GatewayException in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method updateAPISubscriptionStatus.

@Override
public void updateAPISubscriptionStatus(List<SubscriptionValidationData> subscriptionValidationDataList) throws GatewayException {
    SubscriptionEvent subscriptionBlockEvent = new SubscriptionEvent(APIMgtConstants.GatewayEventTypes.SUBSCRIPTION_STATUS_CHANGE);
    subscriptionBlockEvent.setSubscriptionsList(subscriptionValidationDataList);
    publishToStoreTopic(subscriptionBlockEvent);
    if (log.isDebugEnabled()) {
        log.debug("Subscription updated event has been successfully published to broker");
    }
}
Also used : SubscriptionEvent(org.wso2.carbon.apimgt.core.models.events.SubscriptionEvent)

Example 28 with GatewayException

use of org.wso2.carbon.apimgt.core.exception.GatewayException in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method updateThreatProtectionPolicy.

/**
 * {@inheritDoc}
 */
@Override
public void updateThreatProtectionPolicy(ThreatProtectionPolicy policy) throws GatewayException {
    ThreatProtectionEvent event = new ThreatProtectionEvent(APIMgtConstants.GatewayEventTypes.THREAT_PROTECTION_POLICY_UPDATE);
    event.setPolicy(policy);
    publishToThreatProtectionTopic(event);
}
Also used : ThreatProtectionEvent(org.wso2.carbon.apimgt.core.models.events.ThreatProtectionEvent)

Example 29 with GatewayException

use of org.wso2.carbon.apimgt.core.exception.GatewayException in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method updateAPI.

@Override
public void updateAPI(API api) throws GatewayException {
    // build the message to send
    APIEvent apiUpdateEvent = new APIEvent(APIMgtConstants.GatewayEventTypes.API_UPDATE);
    apiUpdateEvent.setLabels(api.getLabels());
    apiUpdateEvent.setApiSummary(toAPISummary(api));
    publishToPublisherTopic(apiUpdateEvent);
    if (log.isDebugEnabled()) {
        log.debug("API : " + api.getName() + " updated event has been successfully published to broker");
    }
}
Also used : APIEvent(org.wso2.carbon.apimgt.core.models.events.APIEvent)

Example 30 with GatewayException

use of org.wso2.carbon.apimgt.core.exception.GatewayException in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method deleteEndpoint.

@Override
public void deleteEndpoint(Endpoint endpoint) throws GatewayException {
    EndpointEvent dto = new EndpointEvent(APIMgtConstants.GatewayEventTypes.ENDPOINT_DELETE);
    dto.setEndpoint(endpoint);
    publishToPublisherTopic(dto);
}
Also used : EndpointEvent(org.wso2.carbon.apimgt.core.models.events.EndpointEvent)

Aggregations

GatewayException (org.wso2.carbon.apimgt.core.exception.GatewayException)14 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)13 API (org.wso2.carbon.apimgt.core.models.API)12 HashMap (java.util.HashMap)7 APIMgtDAOException (org.wso2.carbon.apimgt.core.exception.APIMgtDAOException)7 ArrayList (java.util.ArrayList)6 APIGateway (org.wso2.carbon.apimgt.core.api.APIGateway)6 APIEvent (org.wso2.carbon.apimgt.core.models.events.APIEvent)6 Test (org.junit.Test)5 Broker (org.wso2.carbon.apimgt.core.api.Broker)5 GatewaySourceGenerator (org.wso2.carbon.apimgt.core.api.GatewaySourceGenerator)4 Endpoint (org.wso2.carbon.apimgt.core.models.Endpoint)4 Subscription (org.wso2.carbon.apimgt.core.models.Subscription)4 ErrorDTO (org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO)4 Test (org.testng.annotations.Test)3 APILifecycleManager (org.wso2.carbon.apimgt.core.api.APILifecycleManager)3 APIMgtResourceNotFoundException (org.wso2.carbon.apimgt.core.exception.APIMgtResourceNotFoundException)3 ApplicationEvent (org.wso2.carbon.apimgt.core.models.events.ApplicationEvent)3 PolicyEvent (org.wso2.carbon.apimgt.core.models.events.PolicyEvent)3 ThreatProtectionEvent (org.wso2.carbon.apimgt.core.models.events.ThreatProtectionEvent)3