Lookup other capabilites

View: New views
4 Messages — Rating Filter:   Alert me  

Lookup other capabilites

by Jan Torben Heuer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I need a reference to the NotificationProducer instance in my Resource.
Therefore I wrote this method:

private NotificationProducer getNotificationProducer() throws SoapFault {
                NotificationProducer wsn = (NotificationProducer)
getResource().getCapability(WsnConstants.PRODUCER_URI);
return wsn;
}

But no matter when I call it, it is always to early: In the logs I can see
that the NotificationProducer is initialized afterwards. I tried "initialize"
and "initializeCompleted" and I even tried the actual method which is called
on external soap requests.

So my question is:
(1) Is it only a problem of my "InlineEnvironment" JUnit loader?
(2) Is there a method that should be calles after all Resources have been
initialized (I mean those that have this router-entries defined)?


Thanks,

Jan

--
Jan Torben Heuer Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany


signature.asc (196 bytes) Download Attachment

RE: Lookup other capabilites

by Chris.Twiner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jan,

The initializeCompleted always only works on a singel resource.  I assume as you couldn't get the reference from the external soap request that the producer is in a different resource.  To lookup other resources use

        getResource().getResourceManager().getResource(new EndpointReference(
                                        new URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceName)));

where resourceName is the <context-path>adapter</context-path>.

This will also work for non muse.xml resources.

cheers,
Chris

-----Original Message-----
From: Jan Torben Heuer [mailto:jan.heuer@...]
Sent: Tuesday, July 08, 2008 1:58 PM
To: muse-user@...
Subject: Lookup other capabilites

Hi,

I need a reference to the NotificationProducer instance in my Resource.
Therefore I wrote this method:

private NotificationProducer getNotificationProducer() throws SoapFault {
                NotificationProducer wsn = (NotificationProducer) getResource().getCapability(WsnConstants.PRODUCER_URI);
return wsn;
}

But no matter when I call it, it is always to early: In the logs I can see that the NotificationProducer is initialized afterwards. I tried "initialize"
and "initializeCompleted" and I even tried the actual method which is called on external soap requests.

So my question is:
(1) Is it only a problem of my "InlineEnvironment" JUnit loader?
(2) Is there a method that should be calles after all Resources have been initialized (I mean those that have this router-entries defined)?


Thanks,

Jan

--
Jan Torben Heuer Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...


Re: Lookup other capabilites

by Jan Torben Heuer-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 08 July 2008 14:23:04 Chris.Twiner@... wrote:

Hallo,

> Hi Jan,

> The initializeCompleted always only works on a singel resource.  I assume
> as you couldn't get the reference from the external soap request that the
> producer is in a different resource.  To lookup other resources use

Yes, it is (it is a different ContextPath, though I assume it is a different
resource).

>
> getResource().getResourceManager().getResource(new EndpointReference(
> new
> URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceName)
>));
>
> where resourceName is the <context-path>adapter</context-path>.
What if the resource hasn't been initialized, yet? Should I simply block until
then? Do the axis or mini-servlet engines start resources simultanously or
will it result in a deadlock?

(Hope I didn't mix something up)

Jan
--
Jan Torben Heuer Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany


signature.asc (196 bytes) Download Attachment

RE: Lookup other capabilites

by Chris.Twiner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Its a great question.  In essence they are initialized in the order they are defined within muse.xml.  As such make sure your producer is higher up.  No threads are used (that could introduce some very strange behaviour) just a single startup thread.  (NOTE that isn't strictly speaking gauranteed under osgi as there are about 4-5 threads that may start a bundle depending on the container, so if you're bundling other code it may have its activator started sooner than predicted)

-----Original Message-----
From: Jan Torben Heuer [mailto:jan.heuer@...]
Sent: Wednesday, July 09, 2008 12:21 PM
To: muse-user@...
Subject: Re: Lookup other capabilites

On Tuesday 08 July 2008 14:23:04 Chris.Twiner@... wrote:

Hallo,

> Hi Jan,

> The initializeCompleted always only works on a singel resource.  I
> assume as you couldn't get the reference from the external soap
> request that the producer is in a different resource.  To lookup other
> resources use

Yes, it is (it is a different ContextPath, though I assume it is a different resource).

>
> getResource().getResourceManager().getResource(new EndpointReference(
> new
>
>URI(museIsoLayer.getRouter().getEnvironment().getDefaultURI()+resourceN
>ame)
>));
>
> where resourceName is the <context-path>adapter</context-path>.
What if the resource hasn't been initialized, yet? Should I simply block until then? Do the axis or mini-servlet engines start resources simultanously or will it result in a deadlock?

(Hope I didn't mix something up)

Jan
--
Jan Torben Heuer Institute for Geoinformatics
jan.heuer@... Robert-Koch-Strasse 26-28
+49 251 83-31960 48151 Münster, Germany

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@...
For additional commands, e-mail: muse-user-help@...