sorry, seems attachments don't work. added inline....
------ PullPointCreation
package muse.wsn.impl;
import org.apache.muse.core.ResourceManager;
import org.apache.muse.ws.addressing.EndpointReference;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.notification.PullPoint;
import
org.apache.muse.ws.notification.faults.UnableToCreatePullPointFault;
import org.apache.muse.ws.resource.WsResource;
import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
/**
* factory that creates a new resource for doing pullpoints.
*
* @author TGDTWCH1
*
*/
public class PullPointCreation extends AbstractWsResourceCapability
implements
org.apache.muse.ws.notification.PullPointCreation {
//
// context path of the pullpoint resource type
//
private String _pullPointPath = null;
public EndpointReference createPullPoint()
throws UnableToCreatePullPointFault
{
ResourceManager manager = getResource().getResourceManager();
//
// create the resource to represent the pullpoint
//
String endpoint = getPullPointContextPath();
WsResource pullPoint = null;
try
{
pullPoint = (WsResource)manager.createResource(endpoint);
}
catch (SoapFault error)
{
throw new UnableToCreatePullPointFault(error);
}
EndpointReference epr = pullPoint.getEndpointReference();
//
// initialize pullpoint to complete creation process
//
try
{
pullPoint.initialize(); // adds itself to the consumer
manager.addResource(epr, pullPoint);
}
catch (SoapFault error)
{
throw new UnableToCreatePullPointFault(error);
}
return epr;
}
/**
*
* @return pullpoint context path
*/
protected String getPullPointContextPath()
{
return _pullPointPath;
}
public void initialize() throws SoapFault
{
super.initialize();
//
// find pullpoint resource type so we can create instances of it
// in createPullPoint()
//
ResourceManager manager = getResource().getResourceManager();
_pullPointPath =
manager.getResourceContextPath(PullPoint.class);
if (_pullPointPath == null)
throw new RuntimeException("No PullPoint endpoint
deployed");
}
}
------ PullPoint
package muse.wsn.impl;
import org.apache.muse.ws.addressing.soap.SoapFault;
import org.apache.muse.ws.notification.Filter;
import org.apache.muse.ws.notification.NotificationConsumer;
import org.apache.muse.ws.notification.NotificationMessage;
import org.apache.muse.ws.notification.NotificationMessageListener;
import org.apache.muse.ws.notification.PullPointDataStore;
import org.apache.muse.ws.notification.WsnConstants;
import org.apache.muse.ws.notification.faults.UnableToGetMessagesFault;
import org.apache.muse.ws.notification.impl.SimplePullPointDataStore;
import org.apache.muse.ws.resource.WsResource;
import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
/**
* This version doesn't do its own subscribe all !!!!
*
* @author TGDTWCH1
*
*/
public class PullPoint extends AbstractWsResourceCapability implements
org.apache.muse.ws.notification.PullPoint, NotificationMessageListener {
//
// the place where we keep messages until a client asks for them
//
private PullPointDataStore _dataStore = null;
/**
*
* Users can override this method to provide an alternate
implementation
* of the PullPointDataStore API.
*
* @return An instance of SimplePullPointDataStore
*
*/
protected PullPointDataStore createDataStore()
{
return new SimplePullPointDataStore();
}
public PullPointDataStore getDataStore()
{
return _dataStore;
}
/**
*
* @return An instance of PublishAllMessagesFilter. This allows the
pullpoint
* to add all messages to its data store.
*
*/
public Filter getFilter()
{
return null;
}
public NotificationMessage[] getMessages(int maxNumber)
throws UnableToGetMessagesFault
{
return getDataStore().getMessages(maxNumber);
}
public void initialize()
throws SoapFault
{
super.initialize();
_dataStore = createDataStore();
_dataStore.initialize();
//
// register for messages so we can add them to the data store
//
NotificationConsumer wsn =
(NotificationConsumer)getResource().getCapability(WsnConstants.CONSUMER_
URI);
wsn.addMessageListener(this);
}
public void process(NotificationMessage message)
throws SoapFault
{
getDataStore().addMessage(message);
}
public void shutdown()
throws SoapFault
{
getDataStore().shutdown();
super.shutdown();
}
public boolean accepts(NotificationMessage message)
{
// the fact its routed to here means the message headers
MUST have the correct resource
return true;
}
// the subscription methods aren't used here, subscriptions
belong to the client of a pullpoint
public WsResource getSubscription() {
return null;
}
public void setSubscription(WsResource arg0) {
}
}
-----Original Message-----
From: Twiner Chris, IT-TBU-DL2-EAI-EDE
Sent: Wednesday, July 25, 2007 5:15 PM
To: [email protected]
Subject: PullPoint subscriptions - PublishAllMessagesFilter and statics
in AbstractIsolationLayer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]