Package org.apache.muse.ws.notification.remote

Source Code of org.apache.muse.ws.notification.remote.NotificationProducerClient

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/

package org.apache.muse.ws.notification.remote;

import java.util.Date;

import javax.xml.namespace.QName;

import org.w3c.dom.Element;

import org.apache.muse.core.Environment;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.notification.Filter;
import org.apache.muse.ws.notification.NotificationMessage;
import org.apache.muse.ws.notification.WsnConstants;
import org.apache.muse.ws.notification.impl.GetCurrentMessage;
import org.apache.muse.ws.notification.impl.GetCurrentMessageResponse;
import org.apache.muse.ws.notification.impl.Subscribe;
import org.apache.muse.ws.notification.impl.SubscribeResponse;
import org.apache.muse.ws.resource.remote.WsResourceClient;
import org.apache.muse.ws.addressing.soap.SoapClient;
import org.apache.muse.ws.addressing.soap.SoapFault;

/**
*
* NotificationProducerClient is a web services client for resources that
* implement the WS-N NotificationProducer port type. It adds the subscribe()
* and getCurrentMessage() methods to the base WS-RF interfaces.
*
* @author Dan Jemiolo (danj)
*
*/

public class NotificationProducerClient extends WsResourceClient
{
    public NotificationProducerClient(EndpointReference destination)
    {
        super(destination);
    }
   
    public NotificationProducerClient(EndpointReference destination,
                                      EndpointReference source)
    {
        super(destination, source);
    }
   
    public NotificationProducerClient(EndpointReference destination,
                                      EndpointReference source,
                                      Environment environment)
    {
        super(destination, source, environment);
    }
     
    public NotificationProducerClient(EndpointReference destination,
                                      EndpointReference source,
                                      SoapClient soapClient)
    {
        super(destination, source, soapClient);
    }
   
    public NotificationMessage getCurrentMessage(QName topicPath)
        throws SoapFault
    {
        GetCurrentMessage get = new GetCurrentMessage(topicPath);
       
        Element responseXML = invoke(WsnConstants.GET_CURRENT_URI, get.toXML());
       
        GetCurrentMessageResponse response = new GetCurrentMessageResponse(responseXML);
        return response.getMessage();
    }
   
    public SubscriptionClient subscribe(EndpointReference consumer,
                                        Filter filter,
                                        Date termination)
        throws SoapFault
    {
        Subscribe sub = new Subscribe(consumer, filter, termination);
       
        Element responseXML = invoke(WsnConstants.SUBSCRIBE_URI, sub.toXML());
       
        SubscribeResponse response = new SubscribeResponse(responseXML);
        EndpointReference epr = response.getSubscriptionReference();
       
        return new SubscriptionClient(epr, getSource());
    }
}
TOP

Related Classes of org.apache.muse.ws.notification.remote.NotificationProducerClient

TOP
Copyright © 2018 www.massapi.com. 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.