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.

Regards,

- Paul


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



Reply via email to