use of org.wso2.broker.core.Broker in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method updatePolicy.
@Override
public void updatePolicy(PolicyValidationData policyValidationData) throws GatewayException {
if (policyValidationData != null) {
PolicyEvent policyEvent = new PolicyEvent(APIMgtConstants.GatewayEventTypes.POLICY_UPDATE);
policyEvent.setId(policyValidationData.getId());
policyEvent.setName(policyValidationData.getName());
policyEvent.setStopOnQuotaReach(policyValidationData.isStopOnQuotaReach());
publishToThrottleTopic(policyEvent);
if (log.isDebugEnabled()) {
log.debug("Policy : " + policyValidationData.getName() + " update event has been successfully " + "published " + "to broker");
}
}
}
use of org.wso2.broker.core.Broker in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method updateApplication.
@Override
public void updateApplication(Application application) throws GatewayException {
if (application != null) {
ApplicationEvent applicationEvent = new ApplicationEvent(APIMgtConstants.GatewayEventTypes.APPLICATION_UPDATE);
applicationEvent.setApplicationId(application.getId());
applicationEvent.setName(application.getName());
applicationEvent.setThrottlingTier(application.getPolicy().getUuid());
applicationEvent.setSubscriber(application.getCreatedUser());
publishToStoreTopic(applicationEvent);
if (log.isDebugEnabled()) {
log.debug("Application : " + application.getName() + " updated event has been successfully published " + "to broker");
}
}
}
use of org.wso2.broker.core.Broker in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method deleteAPISubscription.
/**
* {@inheritDoc}
*/
@Override
public void deleteAPISubscription(List<SubscriptionValidationData> subscriptionValidationDataList) throws GatewayException {
SubscriptionEvent subscriptionDeleteEvent = new SubscriptionEvent(APIMgtConstants.GatewayEventTypes.SUBSCRIPTION_DELETE);
subscriptionDeleteEvent.setSubscriptionsList(subscriptionValidationDataList);
publishToStoreTopic(subscriptionDeleteEvent);
if (log.isDebugEnabled()) {
log.debug("Subscription deleted event has been successfully published to broker");
}
}
use of org.wso2.broker.core.Broker in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method addApplication.
@Override
public void addApplication(Application application) throws GatewayException {
if (application != null) {
ApplicationEvent applicationEvent = new ApplicationEvent(APIMgtConstants.GatewayEventTypes.APPLICATION_CREATE);
applicationEvent.setApplicationId(application.getId());
applicationEvent.setName(application.getName());
applicationEvent.setThrottlingTier(application.getPolicy().getUuid());
applicationEvent.setSubscriber(application.getCreatedUser());
publishToStoreTopic(applicationEvent);
if (log.isDebugEnabled()) {
log.debug("Application : " + application.getName() + " created event has been successfully published " + "to broker");
}
}
}
use of org.wso2.broker.core.Broker in project carbon-apimgt by wso2.
the class APIGatewayPublisherImpl method addBlockCondition.
@Override
public void addBlockCondition(BlockConditions blockConditions) throws GatewayException {
if (blockConditions != null) {
BlockEvent blockEvent = new BlockEvent(APIMgtConstants.GatewayEventTypes.BLOCK_CONDITION_ADD);
blockEvent.setConditionId(blockConditions.getConditionId());
blockEvent.setUuid(blockConditions.getUuid());
blockEvent.setConditionType(blockConditions.getConditionType());
blockEvent.setEnabled(blockConditions.isEnabled());
blockEvent.setConditionValue(blockConditions.getConditionValue());
if (APIMgtConstants.ThrottlePolicyConstants.BLOCKING_CONDITIONS_IP.equals(blockConditions.getConditionType())) {
blockEvent.setFixedIp(APIUtils.ipToLong(blockConditions.getConditionValue()));
}
if (APIMgtConstants.ThrottlePolicyConstants.BLOCKING_CONDITION_IP_RANGE.equals(blockConditions.getConditionType())) {
blockEvent.setStartingIP(APIUtils.ipToLong(blockConditions.getStartingIP()));
blockEvent.setEndingIP(APIUtils.ipToLong(blockConditions.getEndingIP()));
}
publishToThrottleTopic(blockEvent);
if (log.isDebugEnabled()) {
log.debug("BlockCondition : " + blockConditions.getUuid() + " add event has been successfully " + "published " + "to broker");
}
}
}
Aggregations