Search in sources :

Example 6 with TopicExpressionType

use of org.oasis_open.docs.wsn.b_2.TopicExpressionType in project cxf by apache.

the class NotificationBroker method registerPublisher.

public Registration registerPublisher(Referencable publisher, List<String> topics, boolean demand) throws // CHECKSTYLE:OFF - WS-Notification spec throws a lot of faults
TopicNotSupportedFault, PublisherRegistrationFailedFault, UnacceptableInitialTerminationTimeFault, InvalidTopicExpressionFault, ResourceUnknownFault, PublisherRegistrationRejectedFault {
    // CHECKSTYLE:ON
    RegisterPublisher registerPublisherRequest = new RegisterPublisher();
    registerPublisherRequest.setPublisherReference(publisher.getEpr());
    if (topics != null) {
        for (String topic : topics) {
            TopicExpressionType topicExp = new TopicExpressionType();
            topicExp.getContent().add(topic);
            registerPublisherRequest.getTopic().add(topicExp);
        }
    }
    registerPublisherRequest.setDemand(demand);
    RegisterPublisherResponse response = getBroker().registerPublisher(registerPublisherRequest);
    return new Registration(response.getPublisherRegistrationReference());
}
Also used : TopicExpressionType(org.oasis_open.docs.wsn.b_2.TopicExpressionType) RegisterPublisherResponse(org.oasis_open.docs.wsn.br_2.RegisterPublisherResponse) RegisterPublisher(org.oasis_open.docs.wsn.br_2.RegisterPublisher)

Example 7 with TopicExpressionType

use of org.oasis_open.docs.wsn.b_2.TopicExpressionType in project cxf by apache.

the class Publisher method subscribe.

public SubscribeResponse subscribe(@WebParam(partName = "SubscribeRequest", name = "Subscribe", targetNamespace = "http://docs.oasis-open.org/wsn/b-2") Subscribe subscribeRequest) throws // CHECKSTYLE:OFF - WS-Notification spec throws a lot of faults
InvalidTopicExpressionFault, ResourceUnknownFault, InvalidProducerPropertiesExpressionFault, UnrecognizedPolicyRequestFault, TopicExpressionDialectUnknownFault, NotifyMessageNotSupportedFault, InvalidFilterFault, UnsupportedPolicyRequestFault, InvalidMessageContentExpressionFault, SubscribeCreationFailedFault, TopicNotSupportedFault, UnacceptableInitialTerminationTimeFault {
    // CHECKSYTLE:ON
    TopicExpressionType topic = null;
    if (subscribeRequest.getFilter() != null) {
        for (Object f : subscribeRequest.getFilter().getAny()) {
            JAXBElement<?> e = null;
            if (f instanceof JAXBElement) {
                e = (JAXBElement<?>) f;
                f = e.getValue();
            }
            if (f instanceof TopicExpressionType) {
                if (!e.getName().equals(QNAME_TOPIC_EXPRESSION)) {
                    InvalidTopicExpressionFaultType fault = new InvalidTopicExpressionFaultType();
                    throw new InvalidTopicExpressionFault("Unrecognized TopicExpression: " + e, fault);
                }
                topic = (TopicExpressionType) f;
            }
        }
    }
    if (topic == null) {
        InvalidFilterFaultType fault = new InvalidFilterFaultType();
        throw new InvalidFilterFault("Must specify a topic to subscribe on", fault);
    }
    PublisherSubscription pub = new PublisherSubscription(topic);
    SubscribeResponse response = new SubscribeResponse();
    response.setSubscriptionReference(pub.getEpr());
    callback.subscribe(topic);
    return response;
}
Also used : InvalidFilterFaultType(org.oasis_open.docs.wsn.b_2.InvalidFilterFaultType) TopicExpressionType(org.oasis_open.docs.wsn.b_2.TopicExpressionType) InvalidTopicExpressionFaultType(org.oasis_open.docs.wsn.b_2.InvalidTopicExpressionFaultType) JAXBElement(javax.xml.bind.JAXBElement) SubscribeResponse(org.oasis_open.docs.wsn.b_2.SubscribeResponse) InvalidTopicExpressionFault(org.oasis_open.docs.wsn.bw_2.InvalidTopicExpressionFault) InvalidFilterFault(org.oasis_open.docs.wsn.bw_2.InvalidFilterFault)

Example 8 with TopicExpressionType

use of org.oasis_open.docs.wsn.b_2.TopicExpressionType in project cxf by apache.

the class JmsTopicExpressionConverter method toTopicExpression.

public TopicExpressionType toTopicExpression(String name) {
    TopicExpressionType answer = new TopicExpressionType();
    answer.getContent().add(name);
    answer.setDialect(SIMPLE_DIALECT);
    return answer;
}
Also used : TopicExpressionType(org.oasis_open.docs.wsn.b_2.TopicExpressionType)

Example 9 with TopicExpressionType

use of org.oasis_open.docs.wsn.b_2.TopicExpressionType in project cxf by apache.

the class JaxwsPublisher method startSubscription.

@Override
protected Object startSubscription(TopicExpressionType topic) {
    try {
        Subscribe subscribeRequest = new Subscribe();
        subscribeRequest.setConsumerReference(notificationBroker.getEpr());
        subscribeRequest.setFilter(new FilterType());
        subscribeRequest.getFilter().getAny().add(new JAXBElement<TopicExpressionType>(AbstractSubscription.QNAME_TOPIC_EXPRESSION, TopicExpressionType.class, topic));
        SubscribeResponse response = notificationProducer.subscribe(subscribeRequest);
        return WSNHelper.getInstance().getPort(response.getSubscriptionReference(), SubscriptionManager.class);
    } catch (Exception e) {
        LOGGER.log(Level.INFO, "Error while subscribing on-demand publisher", e);
        return null;
    }
}
Also used : FilterType(org.oasis_open.docs.wsn.b_2.FilterType) TopicExpressionType(org.oasis_open.docs.wsn.b_2.TopicExpressionType) Subscribe(org.oasis_open.docs.wsn.b_2.Subscribe) SubscribeResponse(org.oasis_open.docs.wsn.b_2.SubscribeResponse)

Aggregations

TopicExpressionType (org.oasis_open.docs.wsn.b_2.TopicExpressionType)9 SubscribeResponse (org.oasis_open.docs.wsn.b_2.SubscribeResponse)3 JAXBElement (javax.xml.bind.JAXBElement)2 JAXBException (javax.xml.bind.JAXBException)2 FilterType (org.oasis_open.docs.wsn.b_2.FilterType)2 InvalidFilterFaultType (org.oasis_open.docs.wsn.b_2.InvalidFilterFaultType)2 InvalidTopicExpressionFaultType (org.oasis_open.docs.wsn.b_2.InvalidTopicExpressionFaultType)2 QueryExpressionType (org.oasis_open.docs.wsn.b_2.QueryExpressionType)2 Subscribe (org.oasis_open.docs.wsn.b_2.Subscribe)2 UseRaw (org.oasis_open.docs.wsn.b_2.UseRaw)2 InvalidFilterFault (org.oasis_open.docs.wsn.bw_2.InvalidFilterFault)2 InvalidTopicExpressionFault (org.oasis_open.docs.wsn.bw_2.InvalidTopicExpressionFault)2 JMSException (javax.jms.JMSException)1 DOMResult (javax.xml.transform.dom.DOMResult)1 ConsumerEventSource (org.apache.activemq.advisory.ConsumerEventSource)1 GetCurrentMessage (org.oasis_open.docs.wsn.b_2.GetCurrentMessage)1 GetCurrentMessageResponse (org.oasis_open.docs.wsn.b_2.GetCurrentMessageResponse)1 InvalidMessageContentExpressionFaultType (org.oasis_open.docs.wsn.b_2.InvalidMessageContentExpressionFaultType)1 InvalidProducerPropertiesExpressionFaultType (org.oasis_open.docs.wsn.b_2.InvalidProducerPropertiesExpressionFaultType)1 NotificationMessageHolderType (org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType)1