Hi Isomorphic,
we are in the process of converting our repeatedly run jobs (Mail sending, Mail receiving and DB Jobs) from wget-Cronjobs to Quartz.
This is working fine for Mail sending and DB Jobs, which are not doing many DSRequests.
Mail receiving, which involves creating entries, has a lot of complex validators. Here we do have problems.
Validator-Java classes can only have one validate()-method with a given parameter list (constructed with parameters from here), no overloading allowed. This is fine, if it wasn't for the 2nd problem (see after code example).
Example:
Here a 2nd
is not allowed. Now in a non-servlet (=Quartz) use case in the 1st case an exception is thrown because the framework does not find data for HttpServletRequest and ValidationContext (as there are none).
IMHO in this case the method should be called with null for these, perhaps a warning logged, but the method should be called and no Exception thrown.
My code then has to handle the null (which might be easy for HttpServletRequest, which we only use to cache stuff in queues).
Also it would be great if ValidationContext would work in the non-servlet case of StandaloneDataSourceUsage).
The root problem also applies to ServerObject.lookupStyle of factory and
, where the same exception is thrown because of the missing httpServletRequest
Best regards
Blama
we are in the process of converting our repeatedly run jobs (Mail sending, Mail receiving and DB Jobs) from wget-Cronjobs to Quartz.
This is working fine for Mail sending and DB Jobs, which are not doing many DSRequests.
Mail receiving, which involves creating entries, has a lot of complex validators. Here we do have problems.
Validator-Java classes can only have one validate()-method with a given parameter list (constructed with parameters from here), no overloading allowed. This is fine, if it wasn't for the 2nd problem (see after code example).
Example:
Code:
package com.lmscompany.lms.server.worker.validator; import java.util.Map; import javax.servlet.http.HttpServletRequest; import com.isomorphic.datasource.DSRequest; import com.isomorphic.datasource.DataSource; import com.isomorphic.datasource.ValidationContext; import com.isomorphic.datasource.Validator; public class ValidatorSetStringToUppercase { public boolean condition(Object value, Validator validator, String fieldName, Map<Object, Object> record, DataSource ds, DSRequest request, HttpServletRequest httpServletRequest, ValidationContext validationContext) throws Exception { validationContext.setResultingValue((String) value != null ? value.toString().toUpperCase() : value); return true; } }
Code:
public boolean condition(Object value, Validator validator, String fieldName, Map<Object, Object> record, DataSource ds, DSRequest request) throws Exception { ...
IMHO in this case the method should be called with null for these, perhaps a warning logged, but the method should be called and no Exception thrown.
My code then has to handle the null (which might be easy for HttpServletRequest, which we only use to cache stuff in queues).
Also it would be great if ValidationContext would work in the non-servlet case of StandaloneDataSourceUsage).
The root problem also applies to ServerObject.lookupStyle of factory and
Code:
create(DSRequest dsRequest, HttpServletRequest httpServletRequest) throws Exception { ...
Best regards
Blama
Comment