public void handleRenewRequest()

in modules/core/src/main/java/org/apache/savan/atom/AtomMessageReceiverDelegator.java [121:162]


    public void handleRenewRequest(SavanMessageContext renewMessage, MessageContext outMessage)
            throws SavanException {

        try {
            if (outMessage == null)
                throw new SavanException(
                        "Eventing protocol need to sent the SubscriptionResponseMessage. But the outMessage is null");

            SOAPEnvelope outMessageEnvelope = findOrCreateSoapEnvelope(renewMessage, outMessage);
            RenewFeedResponseDocument renewFeedResponseDocument =
                    RenewFeedResponseDocument.Factory.newInstance();

            //setting the action
            outMessage.getOptions().setAction(AtomConstants.Actions.RenewResponse);
            String subscriberID = (String)renewMessage
                    .getProperty(AtomConstants.TransferedProperties.SUBSCRIBER_UUID);
            if (subscriberID == null) {
                String message = "SubscriberID TransferedProperty is not set";
                throw new SavanException(message);
            }

            SubscriberStore store = CommonUtil
                    .getSubscriberStore(renewMessage.getMessageContext().getAxisService());
            Subscriber subscriber = store.retrieve(subscriberID);
            AtomSubscriber atomSubscriber = (AtomSubscriber)subscriber;
            if (atomSubscriber == null) {
                String message = "Cannot find the AbstractSubscriber with the given ID";
                throw new SavanException(message);
            }

            Date expiration = atomSubscriber.getSubscriptionEndingTime();
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(expiration);
            renewFeedResponseDocument.addNewRenewFeedResponse().setExpires(calendar);
            outMessageEnvelope.getBody().addChild(CommonUtil.toOM(renewFeedResponseDocument));
            //setting the message type
            outMessage.setProperty(SavanConstants.MESSAGE_TYPE,
                                   new Integer(SavanConstants.MessageTypes.RENEW_RESPONSE_MESSAGE));
        } catch (AxisFault e) {
            throw new SavanException(e);
        }
    }