if (!isEnabled(mc, ENABLE_RENEW)) {
log.warn("Renew operation is disabled");
return;
}
RenewCommandBuilder builder = new RenewCommandBuilder(mc);
Subscription subscription = null;
try {
subscription = builder.toSubscription(mc.getEnvelope());
if (mc.getTo() != null) {
subscription.setAddressUrl(mc.getTo().getAddress());
}
} catch (InvalidExpirationTimeException e) {
if (log.isDebugEnabled()) {
log.debug(e.getMessage());
}
SOAPEnvelope soapEnvelope = BuilderUtils.genFaultResponse(
CommandBuilderConstants.WSE_FAULT_CODE_RECEIVER, "InvalidExpirationTime",
e.getMessage(), "", mc.isSOAP11());
dispatchResponse(soapEnvelope, CommandBuilderConstants.WSA_FAULT, mc, true);
}
if (subscription != null && subscription.getId() != null) {
if (log.isDebugEnabled()) {
log.debug("Renew request recived for Subscription ID : " +
subscription.getId());
}
String loggedInUser = EventBrokerUtils.getLoggedInUserName();
if(!loggedInUser.equals("admin") && !loggedInUser.equals(subscription.getOwner())){
throw new EventException("User "+ loggedInUser + " does not own subscription "+ subscription.getId());
}
if (getBrokerService().getSubscriptionManager().renew(subscription)) {
if (log.isDebugEnabled()) {
log.debug("Sending Renew response for Subscription ID : " +
subscription.getId());
}
SOAPEnvelope soapEnvelope =
builder.fromSubscription(subscription);
dispatchResponse(soapEnvelope, CommandBuilderConstants.WSE_RENEW_RESPONSE, mc, false);
} else {