Tomcat JNDI: managed stack of objects
I have a class
class ObjFactory {
MyObject getObject() {...}
void returnObject() {...}
}
How can we configure Tomcat so that it would provide this factory through JNDI and manages this factory?
Say, one web app should get access to this factory and it must exist only 1 factory in Tomcat, every copy of a web app references the 开发者_开发技巧same object.
What are specific rules to design this factory class? Maybe it should implement some interface to work with Tomcat, JNDI in the way I described?
How to glue this class, tomcat and webapp (what should be written in what file,
web.xml
,context.xml
, etc)?
If you are using Tomcat 5.5, this is a good place to start: JNDI Resources HOW-TO.
Scroll down to the 'Adding Custom Resource Factories' section for a step-by-step explanation.
精彩评论