Search in sources :

Example 11 with SubscriptionPolicyEvent

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

the class KeyManagerDataServiceImpl method removeSubscriptionPolicy.

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

Example 12 with SubscriptionPolicyEvent

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

the class KeyManagerDataServiceImpl method addOrUpdateSubscriptionPolicy.

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

Aggregations

SubscriptionPolicyEvent (org.wso2.carbon.apimgt.impl.notifier.events.SubscriptionPolicyEvent)9 APIPolicyEvent (org.wso2.carbon.apimgt.impl.notifier.events.APIPolicyEvent)5 ApplicationPolicyEvent (org.wso2.carbon.apimgt.impl.notifier.events.ApplicationPolicyEvent)5 GlobalPolicyEvent (org.wso2.carbon.apimgt.impl.notifier.events.GlobalPolicyEvent)4 SubscriptionPolicy (org.wso2.carbon.apimgt.throttle.policy.deployer.dto.SubscriptionPolicy)4 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)3 APIPolicy (org.wso2.carbon.apimgt.api.model.policy.APIPolicy)3 ApplicationPolicy (org.wso2.carbon.apimgt.api.model.policy.ApplicationPolicy)3 GlobalPolicy (org.wso2.carbon.apimgt.api.model.policy.GlobalPolicy)3 Pipeline (org.wso2.carbon.apimgt.api.model.policy.Pipeline)3 SubscriptionPolicy (org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy)3 Gson (com.google.gson.Gson)2 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)2 UnsupportedPolicyTypeException (org.wso2.carbon.apimgt.api.UnsupportedPolicyTypeException)2 PolicyEvent (org.wso2.carbon.apimgt.impl.notifier.events.PolicyEvent)2 SubscriptionDataStore (org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore)2 HashSet (java.util.HashSet)1 OperationPolicy (org.wso2.carbon.apimgt.api.model.OperationPolicy)1