As a starting point, here is what I have done in my private branch. It's not perfect and I'm looking for feedback before suggesting we introduce these changes to CVS.
I created a parallel set of classes DbEventInterceptorSupport2, DbEventInterceptor2. With the difference being they use the InterceptorParameters class to pass parameters to the preX() and postX() methods. I modified Table.processInterceptors() to determine which interface to use at runtime. The class DbiChooser, makes the calling pattern sequence the same. I plan on adding setData(Object) and getData() to InterceptorParameters, to pass data between preX() and postX(). But I have not done so yet, it would require a lot of changes and deadline was approaching. ===================== > We have had this discussion sometime ago. > With the result that we should'nt break backward compatibility. And i > have had the idea how to: > Just change the interfaces. Implement the new interfaces in the > default implementation classes. There you make an tranformation > between the old and the new interfaces and call just empty procedures with the old interface. > So everybody can use it's old code - the methods will be called > through overriding. This would translate to public class DbEventInterceptorSupport2 implements DbEventInterceptor {}, Correct ? Then I wouldn't need to the DbiChooser anymore. I'll have to see if that's doable. Neal Katz ====================== Some random snippets. public class InterceptorParameters { HttpServletRequest request = null; Table table = null; FieldValues fieldValues = null; DbFormsConfig config = null; Connection con = null; DatabaseEvent databaseEvent = null; String keyId = null; { public DbFormsConfig getConfig() {} public DatabaseEvent getDatabaseEvent() {} ... } public class GradeInterceptor extends DbEventInterceptorSupport2 { public int preInsert(InterceptorParameters iparms) throws ValidationException { HttpServletRequest request = iparms.getRequest(); } } public class DbEventInterceptorSupport2 implements DbEventInterceptor2 { public int preInsert(InterceptorParameters iparms) throws ValidationException { return GRANT_OPERATION; } ... } public interface DbEventInterceptor2 { int preInsert(InterceptorParameters iparms) throws ValidationException, MultipleValidationException; ... } public class DbiChooser { DbEventInterceptor dbi = null; DbEventInterceptor2 dbi2 = null; InterceptorParameters iparms = null; public DbiChooser(DbEventInterceptor a) { dbi = a; } public DbiChooser(DbEventInterceptor2 a) { dbi2 = a; } /** * @return */ public InterceptorParameters getIparms() { return iparms; } /** * @param parameters */ public void setIparms(InterceptorParameters parameters) { iparms = parameters; } /** * @param map */ public void setParams(Map map) { if (dbi != null) { dbi.setParams(map); } else if (dbi2 != null) { dbi2.setParams(map); } } /** * @param request * @param table * @param fieldValues * @param config * @param con * @return */ public int preInsert( HttpServletRequest request, Table table, FieldValues fieldValues, DbFormsConfig config, Connection con) throws MultipleValidationException, ValidationException, ClassNotFoundException { if (dbi != null) { return dbi.preInsert(request, table, fieldValues, config, con); } else if (dbi2 != null) { return dbi2.preInsert(iparms); } throw new ClassNotFoundException("no interceptor"); } } ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ DbForms Mailing List http://www.wap-force.net/dbforms