[Batchserver-cvs] batchserver/src/org/jmonks/batchserver/io FieldSpec.java, 1.5, 1.6 FileReader.jav
Brought to you by:
suresh_pragada
Update of /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7914 Modified Files: FieldSpec.java FileReader.java FileSpec.java FileWriter.java ReaderRecord.java Record.java RecordType.java Log Message: no message Index: RecordType.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/RecordType.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RecordType.java 14 Jun 2006 03:46:10 -0000 1.8 --- RecordType.java 22 Jun 2006 22:52:01 -0000 1.9 *************** *** 16,22 **** * This defines the constants to identify all the records as enums. This record * type information should be provided when defining the record spec in file spec. - * <br> - * TODO ::: Override the java.lang.Object#equals() and java.lang.Object#hashCode() - * to use this record type in maps. * </p> * --- 16,19 ---- Index: Record.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/Record.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Record.java 8 Jun 2006 03:39:13 -0000 1.4 --- Record.java 22 Jun 2006 22:52:01 -0000 1.5 *************** *** 19,23 **** * <br> * TODO :: Based on the memory statistics on handling huge files introduces a method to ! * remove the data from the records, once they have been done using. * </p> * --- 19,23 ---- * <br> * TODO :: Based on the memory statistics on handling huge files introduces a method to ! * remove the data from the records, once they have been used. * </p> * Index: FileReader.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/FileReader.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** FileReader.java 13 Jun 2006 22:09:53 -0000 1.13 --- FileReader.java 22 Jun 2006 22:52:01 -0000 1.14 *************** *** 19,26 **** /** * <p> ! * FileReader reads/parses the specified file based on the given file spec and ! * returns the data in the form of ReaderRecord's to read the interested field values. * This provides the methods to reads the records in an iterative manner. Once finished ! * reading the records file reader should be closed by calling * the appropriate methods. This provides the factory method to create the file reader * based on the file spec. Here is a sample code snippet to use the file reader. --- 19,26 ---- /** * <p> ! * FileReader reads the specified file based on the given file spec and ! * returns the data in the form of ReaderRecord's to read the required values referring the field names. * This provides the methods to reads the records in an iterative manner. Once finished ! * reading all or required records from the file reader, it should be closed by calling * the appropriate methods. This provides the factory method to create the file reader * based on the file spec. Here is a sample code snippet to use the file reader. *************** *** 28,32 **** * <p> * <pre> ! * FileReader fileReader=FileReader.getFileReader("/data/consumer.dat","/config/consumer-file-spec.xml"); * ReaderRecord record=null; * while((record=fileReader.getNextRecord())!=null) --- 28,34 ---- * <p> * <pre> ! * InputStream fileSpecInputStream=...; ! * InputStream fileInputStream=....; ! * FileReader fileReader=FileReader.getFileReader(fileInputStream,fileSpecInputStream); * ReaderRecord record=null; * while((record=fileReader.getNextRecord())!=null) *************** *** 52,56 **** /** * <p> ! * Gets the next record from the file. If file doesnt have any more records * it returns null. * </p> --- 54,58 ---- /** * <p> ! * Gets the next available record from the file. If file doesnt have any more records * it returns null. * </p> *************** *** 102,106 **** * @param fileSpec File spec to create the file reader. * ! * @return Returns the appropriate reader. * * @throws IllegalArgumentException If the given fileInputStream or fileSpec is null. --- 104,108 ---- * @param fileSpec File spec to create the file reader. * ! * @return Returns the appropriate file reader. * * @throws IllegalArgumentException If the given fileInputStream or fileSpec is null. *************** *** 138,142 **** * @return Returns the appropriate reader. * ! * @throws IllegalArgumentException If the given fileInputStream or fileSpecInputStream is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. --- 140,144 ---- * @return Returns the appropriate reader. * ! * @throws IllegalArgumentException If the given reader or fileSpecInputStream is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. *************** *** 164,168 **** * @return Returns the appropriate reader. * ! * @throws IllegalArgumentException If the given fileInputStream or fileSpec is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. --- 166,170 ---- * @return Returns the appropriate reader. * ! * @throws IllegalArgumentException If the given reader or fileSpec is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. Index: FileSpec.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/FileSpec.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** FileSpec.java 21 Jun 2006 22:02:29 -0000 1.12 --- FileSpec.java 22 Jun 2006 22:52:01 -0000 1.13 *************** *** 35,39 **** * <p> * File spec defines the file type and possible records could exists in the file. ! * Each record will have possible fields. Every file spec will contains one or * more record specs. Element file-spec should contain one attribute file-type * defines the type of the file this spec is going to represent. Based on the file --- 35,39 ---- * <p> * File spec defines the file type and possible records could exists in the file. ! * Every file spec will contains one or * more record specs. Element file-spec should contain one attribute file-type * defines the type of the file this spec is going to represent. Based on the file *************** *** 77,84 **** /** ! * Constructs the FileSpec object by accepting the path of the file contains ! * the file specification and file type. * - * @param fileSpecPath Path of a file contains the spec. * @param fileType Type of the file this spec is representing. */ --- 77,82 ---- /** ! * Constructs the FileSpec object by accepting file type. * * @param fileType Type of the file this spec is representing. */ *************** *** 125,129 **** * </p> * ! * @return Returns record spec's as a list. */ public Collection getRecordSpecs() --- 123,127 ---- * </p> * ! * @return Returns record spec's as a collection. */ public Collection getRecordSpecs() *************** *** 150,153 **** --- 148,158 ---- } + /** + * Tells whether a record spec is exists with the given record type in the file spec. + * + * @param recordType Type of the record to check in the file spec. + * + * @return Return true if there is a record spec with this type, false otherwise. + */ public boolean isValidRecordType(RecordType recordType) { Index: ReaderRecord.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/ReaderRecord.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReaderRecord.java 8 Jun 2006 03:39:13 -0000 1.2 --- ReaderRecord.java 22 Jun 2006 22:52:01 -0000 1.3 *************** *** 13,17 **** /** * <p> ! * ReaderRecord provides the methods to read the values of the fields for a record. * This record will be generated from the FileReader's. * </p> --- 13,17 ---- /** * <p> ! * ReaderRecord provides the methods to read the values of the fields from a record. * This record will be generated from the FileReader's. * </p> Index: FieldSpec.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/FieldSpec.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FieldSpec.java 8 Jun 2006 03:39:13 -0000 1.5 --- FieldSpec.java 22 Jun 2006 22:52:01 -0000 1.6 *************** *** 14,28 **** /** * <p> ! * FieldSpec represents the <field-spec> element in reocrd spec. * Field spec specifies the name of the field and additional attributes to * identifies the field among the record and other properties based on the file type. ! * Every field-spec element contains field-name attribute identifies among the ! * record spec. The field-name values should be unique across one record spec. * </p> * <p> - * Here is a sample record-spec configuration. - * <br> * <pre> ! * <field-spec field-name="consumer-id"> * </pre> * </p> --- 14,26 ---- /** * <p> ! * FieldSpec represents the <field-spec> element in file spec. * Field spec specifies the name of the field and additional attributes to * identifies the field among the record and other properties based on the file type. ! * Every field-spec element contains <code>field-name</code> attribute identifies among the ! * record spec. The <code>field-name</code> values should be unique across one record spec. * </p> * <p> * <pre> ! * <field-spec field-name="consumer-id"/> * </pre> * </p> Index: FileWriter.java =================================================================== RCS file: /cvsroot/batchserver/batchserver/src/org/jmonks/batchserver/io/FileWriter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FileWriter.java 13 Jun 2006 22:09:54 -0000 1.8 --- FileWriter.java 22 Jun 2006 22:52:01 -0000 1.9 *************** *** 20,24 **** /** * <p> ! * FileWriter writes/generates the specified file based on the given file spec with * the data written in the form of WriterRecord's. This provides the methods * to create the required records and write them into the file writer. Once finished --- 20,24 ---- /** * <p> ! * FileWriter writes the specified file based on the given file spec with * the data written in the form of WriterRecord's. This provides the methods * to create the required records and write them into the file writer. Once finished *************** *** 29,33 **** * <p> * <pre> ! * FileWriter fileWriter=FileWriter.getFileWriter("/data/consumer.dat","/config/consumer-file-spec.xml"); * WriterRecord record=fileWriter.createWriterRecord(RecordType.DETAIL); * record.writeField("consumer-id","123456"); --- 29,35 ---- * <p> * <pre> ! * InputStream fileSpecInputStream=...; ! * OutputStream fileOutputStream=...; ! * FileWriter fileWriter=FileWriter.getFileWriter(fileOutputStream,fileSpecInputStream); * WriterRecord record=fileWriter.createWriterRecord(RecordType.DETAIL); * record.writeField("consumer-id","123456"); *************** *** 47,51 **** /** ! * Writes the given record into the file. * * @throws org.jmonks.batchserver.io.FileParseException Problems while writing the record into file. --- 49,56 ---- /** ! * Writes the given record into the file. The record should be obtained ! * from this file writer using the <code>createWriterRecord</code> method. ! * ! * @param record WriterRecord that you want to write into the file. * * @throws org.jmonks.batchserver.io.FileParseException Problems while writing the record into file. *************** *** 81,85 **** * @return Returns the appropriate writer. * ! * @throws IllegalArgumentException If the given file output stream or file spec is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. --- 86,90 ---- * @return Returns the appropriate writer. * ! * @throws IllegalArgumentException If the given file output stream or file spec input stream is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. *************** *** 142,146 **** * @return Returns the appropriate writer. * ! * @throws IllegalArgumentException If the given file output stream or file spec is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. --- 147,151 ---- * @return Returns the appropriate writer. * ! * @throws IllegalArgumentException If the given file output stream or file spec input stream is null. * @throws org.jmonks.batchserver.io.FileSpecException If the configured file type in file spec doesnt * exist in FileType class. |