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 [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 21, 2008 5:09 PM
To: [email protected]
Subject: Re: Dynamically register notification producers

On Wednesday 21 May 2008 15:26:05 [EMAIL PROTECTED] wrote:

Hallo,


> 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 = getResource().getResourceManager();
>
>               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 = getResource().getResourceManager();
>               advertisePath =
> manager.getResourceContextPath(AdvertisementCapability.class);
>       }
> }

Jan

-- 
Jan Torben Heuer                Institute for Geoinformatics
[EMAIL PROTECTED]       Robert-Koch-Strasse 26-28
+49 251 83-31960                48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to