/Hi,

If I get hold of a service manager one can query a component based on the ROLE so far so good. But suppose one has delcared multiple instances of a block in the assembly.xml. When I have declared the using and the used block in assembly.xml I have determined which instance exactly the using component should use. Now when I'm using the service manager from a non-block component, that is a component that does not appear in assembly.xml, how would the service manager know which block instance to pass back to the caller?/

Is there a JNDI-enabled service manager that additionally exposes its blocks via JNDI? It is certainly a common case that a application would want to access a block e.g. from a web app but not only and that would be a good case for a general mechanism not a project-specific one, or?

The special case where I have the problem is for example a web service using Axis. Axis requires a servlet container such as Tomcat or Jetty. So I do not really have a case where a servlet can contact a remote server but the web service should be a component of my server. Ok so I use the Sevak block in my server and then have to either communicate with the other component this web service implementation depends on via Sockets, RMI etc. or have a mechanism to get a object-reference via JNDI. This way Phoenix is used quasi as a web service hosting environment and I find that exciting enough to try to find a general solution to this problem! :-)


Regards, Peter

Paul Hammant wrote:

Peter,

> Hi,
>
> Is it possible to use a block from a Java-class that is not a block?
> For example, take Sevak that runs Tomcat/Jetty as block; Given a web
> application that is deployed in Sevak. Or take another Java class that
> has access to a service manager but is not by itself a block declared
> in assembly.xml. How can such a Java class access a block by its ROLE?


No problem. With Sevak, we took a wrapper strategy. The Jetty
implementation knows nothing of Avalon, but the wrapper classes in our
CVS does. Hypothetically speaking, the block can instantiate an number
of beans (yes normal Java classes) and pass in ServiceManager in any way
it sees fit. All Perfectly fine.

Webapps are a different matter, as we do not modify Jetty's source.....

>
> For Sevak it is even worse I guess because the webapp has no access to
> a service manager at all?


That is true. The servlet spec grants nothing from Avalon-Framework to
the servlet itself.

> What I would try is using ServiceManager.lookup(Service.ROLE) from the
> other Java class.


There is no static lookup for services. Typically they have to use JNDI
to lookup a service. The container (in this case the jetty block) would
have registered things in JNDI for the hosted servlets. This is no
different to the way that servlets have to lookup services in the J2EE
model. The servlet has to use RMI/IIOP to poke the business logic, or
more latterly via some optimized 'LocalHome' mechanism, but stil looked up.



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

Reply via email to