I need to use a Factory pattern to create services class.
i have an interface --> MyService
i can have an abstract class --> MyAbstractService
i have several concrete class for this service --> MyServiceVersion1_1
MyServiceVersion1_2.
I would like to create a factory which could instantiate object using
String (from XML file) as Class identifier. (maybe using a abstract
creator).
So that i'll be able to add some implementation class without rewritte
any lines on my code, only add concrete class to jar file and configure
XML file to use this.
example of a XML configuration file :
<IPNX>
<IPADDR>127.0.0.1</IPADDR>
<COMPSERVICE>
<VERSION>1.1</VERSION>
<IMPL-SERVICE-CLASS>
ict.wtl.ipnx.service.MyServiceVersion1_1
</IMPL-SERVICE-CLASS>
</COMPSERVICE>
</IPNX>
Thank's
--
-------------------
Sebastien Degardin
Intercall-Telecom
Java - J2EE (beginner)
sdeg...@powerdevNOSPAM.be
Using my psychic powers, I'll guess that you need a pointer to look at
java.lang.Class.forName() and java.lang.Class.newInstance().
If you are interested in a pattern that does this that has been very
successful (integrates great with third party implementations), take a
look at java.sql.DriverManager.
Ray
--
XML is the programmer's duct tape.
Yes, of course, i would like to get the concrete class from a XML file
dynamicaly at runtime.
To be able to add some implementation class easily in the future.
I'm gonna take a look at these class.