ws-muse-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lenni Madsen" <>
Subject SV: Dynamically register notification producers
Date Thu, 22 May 2008 10:44:27 GMT
Hi Jan

While I'm not sure the fits your question entirely, it does give a small
view of the EPR creating and the ability you've at modifying it
programmatically during creation of a resource instance.

public EndpointReference createWithEprOperation(String ResourceID, String
ResourceType) throws Exception    {
    	ResourceManager manager = getResource().getResourceManager();
		EndpointReference epr = null;
		try	{
			Resource next =
			epr = next.getEndpointReference();
QName("", "ResourceId", "muse-wsa"));
QName("", "ResourceId", "muse-wsa"),
			// don't change the EPR after the following
// step
			manager.addResource(epr, next);
		} catch (Throwable error){
		return epr;

Be sure to get it a thorough test as I pulled this from some unused code in
an old project, but it should be functional.

Of course this function comes from a generic factory, where the type of
resource you wish to instantiate is referenced by ResourceType. In my case I
had two different wsdl's in my project, one for the factory and one for the
Resource, but as long as the ResourceType stays unique it should scale.


-----Oprindelig meddelelse-----
Fra: [] 
Sendt: 22. maj 2008 08:46
Emne: RE: Dynamically register notification producers

createResource automatically provides an epr thats unique for you but you
will have no control over its content (by default).  It is also, by default,
not thread safe, so if you have multiple requests using createResource you
will have a problem (you can override this for a given resource with by
implementing ResourceIdFactory and configuring with java-id-factory-class).

Also it seems that you aren't, in this example, creating the resource based
on any criteria.  Will there be something set in the resource later before
subscriptions are made?  If not then I'm not sure what benefit there is to
creating multiple NotificationProducers when multiple subscriptions would
seem to suffice.

Although its very likely I've missed something in your requirements :-)

-----Original Message-----
From: Jan Torben Heuer [] 
Sent: Wednesday, May 21, 2008 5:09 PM
Subject: Re: Dynamically register notification producers

On Wednesday 21 May 2008 15:26:05 wrote:


> The approach seems great, just don't forget you must have a different 
> endpoint for each created resource, using reference parameters.  The 
> link I sent covers that but it makes a lot of sense to play with it as 
> a learning

I had a look at how subscriptions work. But I cannot find a code exampe on
how a ERP is actually created. Can you give me a hint? For example the
SimpleNotificationProducer as a method #subscribe. But that method get the
ERP as parameter, so It was already created before.

What did I miss?

> public class MyAdvertisementCapability extends 
> AbstractWsResourceCapability implements AdvertisementCapability {
> // is called to create a new producer
> 	public EndpointReference addAdvertisement() throws SoapFault {
> 		ResourceManager manager =
> 		String endpoint = getAdvertiseContextPath();
> 		WsResource advertise = null;
> 		advertise = (WsResource) manager.createResource(endpoint);
> 	        EndpointReference epr = advertise.getEndpointReference();
>         	return epr;
> 	}
> 	@Override
> 	public void initialize() throws SoapFault {
> 		super.initialize();
> 		//
> 		// find pullpoint resource type so we can create instances
of it
> 		// in createPullPoint()
> 		//
> 		ResourceManager manager =
> 		advertisePath =
> manager.getResourceContextPath(AdvertisementCapability.class);
> 	}
> }


Jan Torben Heuer		Institute for Geoinformatics	Robert-Koch-Strasse 26-28
+49 251 83-31960		48151 M√ľnster, Germany

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message