Search in sources :

Example 1 with RegisterPublisherResponse

use of org.oasis_open.docs.wsn.br_2.RegisterPublisherResponse in project cxf by apache.

the class AbstractNotificationBroker method handleRegisterPublisher.

public RegisterPublisherResponse handleRegisterPublisher(RegisterPublisher registerPublisherRequest) throws InvalidTopicExpressionFault, PublisherRegistrationFailedFault, PublisherRegistrationRejectedFault, ResourceUnknownFault, TopicNotSupportedFault {
    AbstractPublisher publisher = null;
    boolean success = false;
    try {
        publisher = createPublisher(idGenerator.generateSanitizedId());
        publisher.register();
        publisher.create(registerPublisherRequest);
        RegisterPublisherResponse response = new RegisterPublisherResponse();
        response.setPublisherRegistrationReference(publisher.getEpr());
        if (publisher.getPublisherReference() != null) {
            publishers.put(WSNHelper.getInstance().getWSAAddress(publisher.getPublisherReference()), publisher);
        } else {
            nonContactPublishers.add(publisher);
        }
        success = true;
        return response;
    } catch (EndpointRegistrationException e) {
        LOGGER.log(Level.WARNING, "Unable to register new endpoint", e);
        PublisherRegistrationFailedFaultType fault = new PublisherRegistrationFailedFaultType();
        throw new PublisherRegistrationFailedFault("Unable to register new endpoint", fault, e);
    } finally {
        if (!success && publisher != null) {
            try {
                publisher.destroy();
            } catch (ResourceNotDestroyedFault e) {
                LOGGER.log(Level.INFO, "Error destroying publisher", e);
            }
        }
    }
}
Also used : PublisherRegistrationFailedFaultType(org.oasis_open.docs.wsn.br_2.PublisherRegistrationFailedFaultType) ResourceNotDestroyedFault(org.oasis_open.docs.wsn.brw_2.ResourceNotDestroyedFault) RegisterPublisherResponse(org.oasis_open.docs.wsn.br_2.RegisterPublisherResponse) PublisherRegistrationFailedFault(org.oasis_open.docs.wsn.brw_2.PublisherRegistrationFailedFault)

Example 2 with RegisterPublisherResponse

use of org.oasis_open.docs.wsn.br_2.RegisterPublisherResponse 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)

Aggregations

RegisterPublisherResponse (org.oasis_open.docs.wsn.br_2.RegisterPublisherResponse)2 TopicExpressionType (org.oasis_open.docs.wsn.b_2.TopicExpressionType)1 PublisherRegistrationFailedFaultType (org.oasis_open.docs.wsn.br_2.PublisherRegistrationFailedFaultType)1 RegisterPublisher (org.oasis_open.docs.wsn.br_2.RegisterPublisher)1 PublisherRegistrationFailedFault (org.oasis_open.docs.wsn.brw_2.PublisherRegistrationFailedFault)1 ResourceNotDestroyedFault (org.oasis_open.docs.wsn.brw_2.ResourceNotDestroyedFault)1