Implement handler class which extends MessageHandler abstract class.
package com.ism.common.task; import java.util.Hashtable; public abstract class MessageHandler { protected byte [] data; protected byte [] message; protected String jobId; protected String systemId; /** * @return the systemId */ public String getSystemId() { return systemId; } /** * @param systemId the systemId to set */ public void setSystemId(String systemId) { this.systemId = systemId; } /** * The whole data. * @param message */ public void setMessage( byte [] message ) { this.message = message; } /** * Defines only data division. * @param data */ public void setData( byte [] data ) { this.data = data; } /** * Data division return. * @return */ public byte [] getData() { return this.data; } /** * get service task rule id. * @return */ public abstract String getRuleId(); /** * Generates the whole message and return it. * @return */ public abstract byte [] getMessage(); public abstract boolean isSuccess(); public abstract int getErrorCode(); public abstract void setParameters(Hashtable params); public void setJobId( String jobId ){ this.jobId = jobId; } }
package com.ism.deferred; public interface DateManager { /** * Return the next data by today's date * @param today Today's date * @param format today Fix the parameter yyyyMMdd * @return */ public String next(String today, String format); }
package com.ism.common.custom; /** * @changed 2008-02-03 Move from ISM_deferred to ISM_common. * @author user * */ public interface TableNameManager { /** * When there's #TableName# on inquiry query, determines the table's name and return the table name. * @param ruleId String Current rule's ID * @param bizdate String The business date of the current rule can be null. * @throws Exception If an error occurs on determining the table name * @return String Table name * @deprecated Use {@link #getTableName(String,String,boolean)} instead */ public String getTableName(String ruleId, String bizdate) throws Exception; /** * When there's #TableName# on inquiry query, determines this table name and return the table name. * @param ruleId String Current rule's ID * @param bizdate String The business date of the current rule can be null. * @param changed TODO * @throws Exception If an error occurs on determining the table name * @return String Table name */ public String getTableName(String ruleId, String bizdate, boolean changed) throws Exception; }
package com.ism.rule.matcher.route; import com.ism.rule.matcher.IMultiValueMatcher; public interface IRoutingMatcher extends IMultiValueMatcher{ }
package com.ism.rule.matcher; import java.io.Serializable; public interface IMultiValueMatcher extends Serializable{ /** * Verify whether it is the right service code corresponding to the service mapping function * @param service code * @return svccode If it has to be processed to the pertinent service, true, or false */ public boolean matches(String[] svccode); }
File name can contain variable information like timestamp. if a file name must have such information, File name converter can be used to include such information. Abstract file name generator generates final file name while asking custom converter class to convert parameters.
public abstract String convert(String exp);
File name in file service
output.#SEQUENCE#.txt
package com.ism.tutorial; import com.ism.common.context.RuntimeContext; import com.ism.common.context.RuntimeContextFactory; import com.ism.common.file.FilenameGenerator; public class FileNameConverter extends FilenameGenerator { private static int sequence = 0; @Override public String convert(String exp) { // TODO Auto-generated method stub if ( "SEQUENCE".equals(exp) ) { return ++sequence; } return null; } }