Update of /cvsroot/xdoclet/xdoclet/samples/src/java/test/dao In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3914/samples/src/java/test/dao
Added Files: ExampleDAOFactory.java Log Message: DAO changes. Allow a factory class to be used for generating DAO instances (XDT-1068). Also eliminate duplicate finders & create methods in DAO interface if the bean's finder/create methods have @dao.call tags but automatic generation is being used (XDT-47). --- NEW FILE: ExampleDAOFactory.java --- package test.dao; /** * Example of a DAO factory class. To see it in action, edit the CustomerBMPBean * to use impl-factory="test.dao.ExampleDAOFactory" in its class-level ejb.dao * tag instead of impl-jndi="dao". */ public class ExampleDAOFactory { /* Prevent instance creation, since it's not needed */ private ExampleDAOFactory() { } public static Object getDaoInstance(Class clazz) { if (clazz == null) { throw new IllegalArgumentException("No type supplied"); } // This example only handles the CustomerDAO. Additional cases could be // added for other types, or a more sophisticated factory might use dynamic // proxies. if ("test.dao.CustomerDAO".equals(clazz.getName())) { return new CustomerExampleDAO(); } else { throw new IllegalArgumentException("Don't know how to create DAO of type " + clazz.getName()); } } } ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ xdoclet-devel mailing list xdoclet-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-devel