Search in sources :

Example 16 with SubscriptionDataStore

use of org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore in project carbon-apimgt by wso2.

the class KeyManagerDataServiceImpl method updateDeployedAPIRevision.

@Override
public void updateDeployedAPIRevision(DeployAPIInGatewayEvent event) {
    if (log.isDebugEnabled()) {
        log.debug("Add or Update API 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.addOrUpdateAPIRevisionWithUrlTemplates(event);
}
Also used : SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 17 with SubscriptionDataStore

use of org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore in project carbon-apimgt by wso2.

the class KeyManagerDataServiceImpl method addOrUpdateApplicationPolicy.

@Override
public void addOrUpdateApplicationPolicy(ApplicationPolicyEvent event) {
    if (log.isDebugEnabled()) {
        log.debug("Add or Update Application Policy 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.addOrUpdateApplicationPolicy(getApplicationPolicyFromApplicationPolicyEvent(event));
}
Also used : SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 18 with SubscriptionDataStore

use of org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore in project carbon-apimgt by wso2.

the class KeyManagerDataServiceImpl method removeAPI.

@Override
public void removeAPI(APIEvent event) {
    if (log.isDebugEnabled()) {
        log.debug("Remove API 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.removeAPI(getAPIFromAPIEvent(event));
}
Also used : SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 19 with SubscriptionDataStore

use of org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore in project carbon-apimgt by wso2.

the class KeyManagerDataServiceImpl method addOrUpdateApplication.

@Override
public void addOrUpdateApplication(ApplicationEvent event) {
    if (log.isDebugEnabled()) {
        log.debug("Add or Update Application 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.addOrUpdateApplication(getApplicationFromApplicationEvent(event));
}
Also used : SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Example 20 with SubscriptionDataStore

use of org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore in project carbon-apimgt by wso2.

the class KeyManagerDataServiceImpl method addOrUpdateAPI.

@Override
public void addOrUpdateAPI(APIEvent event) {
    if (log.isDebugEnabled()) {
        log.debug("Add or Update API 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.addOrUpdateAPIWithUrlTemplates(getAPIFromAPIEvent(event));
}
Also used : SubscriptionDataStore(org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)

Aggregations

SubscriptionDataStore (org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)43 API (org.wso2.carbon.apimgt.keymgt.model.entity.API)14 SubscriptionDataHolder (org.wso2.carbon.apimgt.keymgt.SubscriptionDataHolder)9 Test (org.junit.Test)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)8 ArrayList (java.util.ArrayList)7 Application (org.wso2.carbon.apimgt.keymgt.model.entity.Application)6 Subscription (org.wso2.carbon.apimgt.keymgt.model.entity.Subscription)5 SubscriptionDataLoaderImpl (org.wso2.carbon.apimgt.keymgt.model.impl.SubscriptionDataLoaderImpl)5 MessageContext (org.apache.synapse.MessageContext)4 DataLoadingException (org.wso2.carbon.apimgt.keymgt.model.exception.DataLoadingException)4 ErrorDTO (org.wso2.carbon.apimgt.rest.api.gateway.dto.ErrorDTO)4 ApiPolicy (org.wso2.carbon.apimgt.keymgt.model.entity.ApiPolicy)3 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)2 URLMapping (org.wso2.carbon.apimgt.api.model.subscription.URLMapping)2 API (org.wso2.carbon.apimgt.common.analytics.publishers.dto.API)2 DeployAPIInGatewayEvent (org.wso2.carbon.apimgt.impl.notifier.events.DeployAPIInGatewayEvent)2 ApplicationPolicy (org.wso2.carbon.apimgt.keymgt.model.entity.ApplicationPolicy)2 Scope (org.wso2.carbon.apimgt.keymgt.model.entity.Scope)2 SubscriptionPolicy (org.wso2.carbon.apimgt.keymgt.model.entity.SubscriptionPolicy)2