[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/framework/common ErrorCode.java,1.8,1.9 Fra
Brought to you by:
suresh_pragada
From: Suresh <sur...@us...> - 2006-03-10 08:14:24
|
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1092 Modified Files: ErrorCode.java FrameworkUtil.java Log Message: no message Index: FrameworkUtil.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/FrameworkUtil.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FrameworkUtil.java 6 Mar 2006 23:54:55 -0000 1.5 --- FrameworkUtil.java 10 Mar 2006 08:14:21 -0000 1.6 *************** *** 2,5 **** --- 2,6 ---- import java.util.Map; + import java.util.StringTokenizer; import org.w3c.dom.Element; import org.w3c.dom.Node; *************** *** 78,80 **** --- 79,118 ---- } } + + /** + * <p> + * Loads the property elements exists in the given element to the given map. + * This looks for the <property> elements in the given element and looks + * for the value of "key" attribute and the values of <property> element + * and load them as key values pairs. + * </p> + * <p> + * Property elements should be in the following format.<br><br> + * <property key="some-config-key1">some-config-value1</property> + * </p> + * + * @param configElement DOM Element consists of <property> elements. + * @param propertyMap Map to be loaded with property key values. + * + * @throws IllegalArgumentException If either configElement or propertyMap is null. + */ + public static void loadPropertiesFromStringToMap(String propertiesString,Map propertyMap) + { + if(propertiesString==null) + throw new IllegalArgumentException("Input properties string cannot be null"); + + if(propertyMap==null) + throw new IllegalArgumentException("Input properties map propertyMap cannot be null"); + + StringTokenizer propertiesTokenizer=new StringTokenizer(propertiesString,":"); + while(propertiesTokenizer.hasMoreTokens()) + { + String property=propertiesTokenizer.nextToken(); + StringTokenizer propertyTokenizer=new StringTokenizer(property,"="); + String key=propertyTokenizer.nextToken(); + String value=propertyTokenizer.nextToken(); + propertyMap.put(key,value); + } + } + } \ No newline at end of file Index: ErrorCode.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/framework/common/ErrorCode.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ErrorCode.java 8 Mar 2006 23:20:38 -0000 1.8 --- ErrorCode.java 10 Mar 2006 08:14:21 -0000 1.9 *************** *** 118,121 **** --- 118,125 ---- public static final ErrorCode NONE_OR_MULTIPLE_JOB_POOL_ELEMENTS_FOUND = new ErrorCode(2019,"None or multiple job pool elements found in job controller"); public static final ErrorCode POOL_JOB_POOL_CLASS_NAME_NOT_DEFINED = new ErrorCode(2020,"job-pool-class-name is not defined in job-pool element."); + + public static final ErrorCode DB_JOB_CONFIG_FACTORY_PROPERTIES_INVALID = new ErrorCode(2021,"required properties to create db job config factory are missing or values are not valid"); + public static final ErrorCode CANNOT_CREATE_DB_JOB_CONFIG = new ErrorCode(2022,"Cannot create JobConfig due sql exception"); + public static final ErrorCode BASIC_JOB_CONTROLLER_CONFIG_NOT_FOUND = new ErrorCode(2023,"basic job controller cofiguration not defined"); } |