/*=============================================================================*
* Copyright 2004 The Apache Software Foundation
*
* Licensed 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.ws.notification.topics;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.addressing.XmlBeansEndpointReference;
import org.apache.ws.pubsub.DeliveryMode;
import org.apache.ws.pubsub.Filter;
import org.apache.ws.pubsub.NotificationConsumer;
import org.apache.ws.pubsub.NotificationProducer;
import org.apache.ws.pubsub.Subscription;
import org.apache.ws.pubsub.SubscriptionEndConsumer;
import org.apache.ws.pubsub.TopicFilter;
import org.apache.ws.pubsub.XPathFilter;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI;
import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
import java.util.Calendar;
import java.util.StringTokenizer;
/**
* @author Sal Campana
*/
public class NotifProducer
implements NotificationProducer
{
/**
* Returns the last notification message published for the given set of filters.
*
* @param filters
* @return
*/
public Object getCurrentMessage( Filter[] filters )
{
return null;
}
/**
* Returns this producer's endpoint reference.
*
* @return this producer's endpoint reference
*/
public EndpointReference getEPR( )
{
EndpointReferenceType epr = EndpointReferenceType.Factory.newInstance( );
AttributedURI attributedURI = AttributedURI.Factory.newInstance( );
attributedURI.setStringValue( "http://foo" );
epr.setAddress( attributedURI );
return new XmlBeansEndpointReference( epr );
}
/**
* DOCUMENT_ME
*
* @param args DOCUMENT_ME
*/
public static void main( String[] args )
{
StringTokenizer tok = new StringTokenizer( " / " );
while ( tok.hasMoreElements( ) )
{
System.out.println( "[" + tok.nextElement( ) + "]" );
}
}
/**
* Subscribe to notifications from this producer.
*
* @param notificationConsumer
* @param subscriptionEndConsumer the callback Interface for SubscriptionEnd Notifications, or null if no SubscriptionEnd should be send
* @param filters
* @param initialTerminationTime
* @param deliveryMode the notification delivery mode, or null to use default mode
* @return the subscription
*/
public Subscription subscribe( NotificationConsumer notificationConsumer,
SubscriptionEndConsumer subscriptionEndConsumer,
TopicFilter tf,
XPathFilter xf,
Calendar initialTerminationTime,
boolean UseNotify )
{
return null; //todo *SJC* implement
}
/**
* Subscribe to notifications from this producer.
*
* @param notificationConsumer
* @param filters
* @param initialTerminationTime
* @param deliveryMode the notification delivery mode, or null to use default mode
* @param policy a policy to be associated with the subscription, or null if no policy should be used
* @return the subscription
*/
public Subscription subscribe( NotificationConsumer notificationConsumer,
Filter[] filters,
Calendar initialTerminationTime,
DeliveryMode deliveryMode,
Object policy )
{
return null;
}
}