Package org.apache.cxf.ws.eventing.backend.database

Examples of org.apache.cxf.ws.eventing.backend.database.SubscriptionTicket


    @Override
    public GetStatusResponse getStatusOp(GetStatus body) {
        String uuid = retrieveSubscriptionUUID();
        LOG.info("received GetStatus message for UUID=" + uuid);
        SubscriptionTicket ticket = obtainTicketFromDatabaseOrThrowFault(uuid);
        GetStatusResponse response = new GetStatusResponse();
        response.setGrantedExpires(
                DurationAndDateUtil.toExpirationTypeContainingGregorianCalendar(ticket.getExpires()));
        return response;
    }
View Full Code Here


     *
     * @param uuid
     * @return the SubscriptionTicket, or throws UnknownSubscription fault if no such subscription exists
     */
    protected SubscriptionTicket obtainTicketFromDatabaseOrThrowFault(String uuid) {
        SubscriptionTicket ticket = getSubscriptionManagerBackend().findTicket(UUID.fromString(uuid));
        if (ticket == null) {
            LOG.severe("Unknown ticket UUID: " + uuid);
            throw new UnknownSubscription();
        }
        return ticket;
View Full Code Here

    @Override
    public SubscriptionTicketGrantingResponse subscribe(DeliveryType delivery, EndpointReferenceType endTo,
                                                        ExpirationType expires, FilterType filter,
                                                        FormatType format) {
        SubscriptionTicket ticket = new SubscriptionTicket();
        SubscriptionTicketGrantingResponse response = new SubscriptionTicketGrantingResponse();
        grantSubscriptionManagerReference(ticket, response);
        processDelivery(delivery, ticket, response);
        processEndTo(endTo, ticket, response);
        processExpiration(expires, ticket, response);
View Full Code Here

        return getDatabase().findById(uuid);
    }

    @Override
    public ExpirationType renew(UUID uuid, ExpirationType requestedExpiration) {
        SubscriptionTicket ticket = getDatabase().findById(uuid);
        if (ticket == null) {
            throw new UnknownSubscription();
        }
        LOG.info("[subscription=" + ticket.getUuid() + "] Requested renew expiration: "
                + requestedExpiration.getValue());
        LOG.fine("[subscription=" + ticket.getUuid() + "] Current expiration: " + ticket.getExpires().toXMLFormat());
        ExpirationType response = new ExpirationType();
        XMLGregorianCalendar grantedExpires;
        if (DurationAndDateUtil.isDuration(requestedExpiration.getValue())) {
            // duration was requested
            javax.xml.datatype.Duration requestedDuration = DurationAndDateUtil
                    .parseDuration(requestedExpiration.getValue());
            javax.xml.datatype.Duration grantedDuration = requestedDuration;
            LOG.info("[subscription=" + ticket.getUuid() + "] Granted renewal duration: " + grantedDuration.toString());
            grantedExpires = getDatabase().findById(uuid)
                    .getExpires();       // NOW() or current Expires() ????
            grantedExpires.add(grantedDuration);
            response.setValue(grantedDuration.toString());
        } else {
            // end-date was requested
            grantedExpires = DurationAndDateUtil.parseXMLGregorianCalendar(requestedExpiration.getValue());
            LOG.info("[subscription=" + ticket.getUuid() + "] Granted expiration: " + grantedExpires.toXMLFormat());
            response.setValue(grantedExpires.toXMLFormat());
        }
        getDatabase().findById(uuid).setExpires(grantedExpires);
        return response;
    }
View Full Code Here

    }

    @Override
    public void subscriptionEnd(UUID subscriptionId, String reason, SubscriptionEndStatus status) {
        synchronized (database) {
            SubscriptionTicket ticket = database.findById(subscriptionId);
            if (ticket != null) {
                database.removeTicketByUUID(subscriptionId);
                if (ticket.getEndToURL() != null) {
                    notificator.subscriptionEnd(ticket, reason, status);
                }
            } else {
                LOG.severe("No such subscription: " + subscriptionId);
            }
View Full Code Here

TOP

Related Classes of org.apache.cxf.ws.eventing.backend.database.SubscriptionTicket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.