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)?