[Batchserver-cvs] Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl SignUpMsgsRsV1Impl.java
Brought to you by:
suresh_pragada
Update of /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6306 Modified Files: MessageSetImpl.java MessageSetReader.java MessageSetWriter.java OFXWriterSupport.java SignOnMsgsRqV1Impl.java SignOnMsgsRqV2Impl.java SignOnMsgsRsV1Impl.java SignOnMsgsRsV2Impl.java SignUpMsgsRqV1Impl.java Added Files: SignUpMsgsRsV1Impl.java Removed Files: SignUpMsgsRqV2Impl.java Log Message: no message Index: OFXWriterSupport.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/OFXWriterSupport.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OFXWriterSupport.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- OFXWriterSupport.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 12,20 **** /** * ! * @author Suresh Pragada */ public interface OFXWriterSupport { String[] getMethodNamesInSortedOrder(); } --- 12,29 ---- /** + * <p> + * OFXWriterSupport makes aggregate instances to be usable by MessageSetImpl + * to write the aggregate to the output stream. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public interface OFXWriterSupport { + /** + * Returns the set of method in the order to be written to the output stream. + */ String[] getMethodNamesInSortedOrder(); } Index: SignOnMsgsRsV1Impl.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/SignOnMsgsRsV1Impl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SignOnMsgsRsV1Impl.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- SignOnMsgsRsV1Impl.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 21,35 **** /** * ! * @author Suresh Pragada */ public class SignOnMsgsRsV1Impl extends MessageSetImpl implements SignOnMsgsRsV1 { - - /** Creates a new instance of SignOnMsgsRsV1Impl */ public SignOnMsgsRsV1Impl() { } ! public MessageSetType getMessageSetType() { --- 21,41 ---- /** + * <p> + * SignOnMsgsRsV1Impl provides the implementation for the SignOnMsgsRsV1 interface. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public class SignOnMsgsRsV1Impl extends MessageSetImpl implements SignOnMsgsRsV1 { public SignOnMsgsRsV1Impl() { } ! ! /** ! * Returns the SignOn response V1 Message Set Type. ! */ public MessageSetType getMessageSetType() { *************** *** 37,45 **** } public SignOnMsgRsV1 getSignOnMsgRsV1() { return (SignOnMsgRsV1)super.readNextMessage(new Class[]{SignOnRsV1.class, PinChTrnRsV1.class, ChallengeTrnRsV1.class}); } ! public void addSignOnMsgRsV1(SignOnMsgRsV1 signOnMsgRsV1) { --- 43,57 ---- } + /** + * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRsV1#getSignOnMsgRsV1() + */ public SignOnMsgRsV1 getSignOnMsgRsV1() { return (SignOnMsgRsV1)super.readNextMessage(new Class[]{SignOnRsV1.class, PinChTrnRsV1.class, ChallengeTrnRsV1.class}); } ! ! /** ! * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRsV1#addSignOnMsgRsV1(SignOnMsgRsV1) ! */ public void addSignOnMsgRsV1(SignOnMsgRsV1 signOnMsgRsV1) { Index: MessageSetWriter.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/MessageSetWriter.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MessageSetWriter.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- MessageSetWriter.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 15,25 **** /** * ! * @author Suresh Pragada */ public interface MessageSetWriter { void initializeWriter(MessageSetType messageSetType, OFXWriterHelper writerHelper); boolean writeMessage(Object message); void finishedWritingMessages(); } --- 15,49 ---- /** + * <p> + * MessageSetWriter provides the interface to the OFXFileWriter to create the message + * sets should be written to the output stream. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public interface MessageSetWriter { + /** + * Initializes Message set implementation to write the messages to the given stream. + * + * @param messageSetType Type of the message set it is representing. + * @param writerHelper Writer to write the OFX data. + */ void initializeWriter(MessageSetType messageSetType, OFXWriterHelper writerHelper); + + /** + * Writes the message to the output stream. The message class should be + * configured in type defintions for this message set and it should support + * the OFXWriterSupport interface. + * + * @param message Message to be written to the output stream. + */ boolean writeMessage(Object message); + + /** + * Writes the information that denotes the end of message set. + */ void finishedWritingMessages(); } --- SignUpMsgsRqV2Impl.java DELETED --- Index: SignUpMsgsRqV1Impl.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/SignUpMsgsRqV1Impl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SignUpMsgsRqV1Impl.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- SignUpMsgsRqV1Impl.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 12,29 **** import org.jmonks.batch.io.ofx.messageset.MessageSetType; import org.jmonks.batch.io.ofx.messageset.SignUpMsgsRqV1; ! import org.jmonks.batch.io.ofx.messageset.aggregates.signup.EnrollTrnRq; /** * ! * @author Suresh Pragada */ public class SignUpMsgsRqV1Impl extends MessageSetImpl implements SignUpMsgsRqV1 { - - /** Creates a new instance of SignUpMsgsRqV1Impl */ public SignUpMsgsRqV1Impl() { } ! public MessageSetType getMessageSetType() { --- 12,38 ---- import org.jmonks.batch.io.ofx.messageset.MessageSetType; import org.jmonks.batch.io.ofx.messageset.SignUpMsgsRqV1; ! import org.jmonks.batch.io.ofx.messageset.aggregates.signup.EnrollTrnRqV1; ! import org.jmonks.batch.io.ofx.messageset.aggregates.signup.SignUpMsgRqV1; ! import org.jmonks.batch.io.ofx.messageset.aggregates.signup.SignUpMsgType; ! import org.jmonks.batch.io.ofx.parser.OFXStreamException; /** + * <p> + * SignUpMsgsRqV1Impl provides the implementation for the SignUpMsgsRqV1 interface. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public class SignUpMsgsRqV1Impl extends MessageSetImpl implements SignUpMsgsRqV1 { public SignUpMsgsRqV1Impl() { } ! ! /** ! * Returns the SignUp request V1 Message Set Type. ! */ public MessageSetType getMessageSetType() { *************** *** 31,42 **** } ! public EnrollTrnRq getNextEnrollTrnRq() { ! return (EnrollTrnRq)super.readNextMessage(new Class[]{EnrollTrnRq.class}); } ! public void addEnrollTrnRq(EnrollTrnRq enrollTrnRq) { ! super.writeMessage(enrollTrnRq); } } --- 40,61 ---- } ! /** ! * @see org.jmonks.batch.io.ofx.messageset.SignUpMsgsRqV1#getSignUpMsgRqV1() ! */ ! public SignUpMsgRqV1 getSignUpMsgRqV1() { ! return (SignUpMsgRqV1)super.readNextMessage(new Class[]{EnrollTrnRqV1.class}); } ! /** ! * @see org.jmonks.batch.io.ofx.messageset.SignUpMsgsRqV1#addSignUpMsgRqV1(SignUpMsgRqV1) ! */ ! public void addSignUpMsgRqV1(SignUpMsgRqV1 signUpMsgRqV1) { ! SignUpMsgType msgType=signUpMsgRqV1.getSignUpMsgType(); ! if(msgType==SignUpMsgType.ENROLLTRN_RQV1) ! super.writeMessage(signUpMsgRqV1); ! else ! throw new OFXStreamException("Invalid message to be written to the " + this.getMessageSetType().toString()); } } Index: MessageSetImpl.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/MessageSetImpl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MessageSetImpl.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- MessageSetImpl.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 25,30 **** /** * ! * @author Suresh Pragada */ public abstract class MessageSetImpl implements MessageSetReader, MessageSetWriter --- 25,37 ---- /** + * <p> + * MessageSetImpl provides most of the core and common tasks for all the message sets. + * The tasks are like reading the next message from the stream and write the + * message to the stream. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public abstract class MessageSetImpl implements MessageSetReader, MessageSetWriter *************** *** 32,42 **** private static Logger logger=Logger.getLogger(MessageSetImpl.class); protected MessageSetType messageSetType=null; ! private OFXParser parser=null; protected OFXWriterHelper writerHelper=null; ! private boolean servedAllMessages=false; public void initializeReader(MessageSetType messageSetType, OFXParser parser) { --- 39,65 ---- private static Logger logger=Logger.getLogger(MessageSetImpl.class); + /** + * Type of message set it is building + */ protected MessageSetType messageSetType=null; ! /** ! * Parser to get the next message from the stream ! */ private OFXParser parser=null; + /** + * Writer to write the message to the stream + */ protected OFXWriterHelper writerHelper=null; ! /** ! * Tells whether it has served all the messages or not ! */ private boolean servedAllMessages=false; + /** + * Initializes Message set implementation to read the messages from the given parser. + * + * @param messageSetType Type of the message set it is representing. + * @param parser OFXParser to read the messages. + */ public void initializeReader(MessageSetType messageSetType, OFXParser parser) { *************** *** 46,51 **** --- 69,83 ---- } + /** + * Reads the next message from the parser. Caller would typically provide + * the expected classes from the stream. + * + * @param expectedMessageClassNames Array of classes caller is expecting. + * + * @return Returns the next message, null it no messages were found. + */ public Object readNextMessage(Class[] expectedMessageClassNames) { + logger.trace("Entering readNextMessage = " + servedAllMessages); if(this.servedAllMessages) return null; *************** *** 55,58 **** --- 87,94 ---- while((nextEvent=parser.getNextEvent())!=null) { + /** + * End element means, we need to create either an + * aggregate or message or it is the end of the message set. + */ if(nextEvent.getEventType()==OFXEvent.END_ELEMENT) { *************** *** 106,118 **** } ! public void finishedReadingMessages() { if(this.servedAllMessages) ! { ! /** ! * All the messages have been served. ! */ ! } else { --- 142,153 ---- } ! /** ! * Read all the unread messages from this message set to keep the pointer ! * to the next message set. ! */ public void finishedReadingMessages() { if(this.servedAllMessages) ! logger.trace("All messages have been served."); else { *************** *** 127,130 **** --- 162,173 ---- } + /** + * Constructs the aggregate for the given element name and element value map. + * + * @param elementName Aggregate name. + * @param elementValueMap Map consists of the simple elements to be injected to the aggregate. + * + * @return Returns the aggregate instance. + */ private Object handleAggregate(String elementName, Map elementValueMap) { *************** *** 182,186 **** } ! public void initializeWriter(MessageSetType messageSetType, OFXWriterHelper writerHelper) { --- 225,234 ---- } ! /** ! * Initializes Message set implementation to write the messages to the given stream. ! * ! * @param messageSetType Type of the message set it is representing. ! * @param writerHelper Writer to write the OFX data. ! */ public void initializeWriter(MessageSetType messageSetType, OFXWriterHelper writerHelper) { *************** *** 190,193 **** --- 238,244 ---- } + /** + * Writes the information that denotes the end of message set. + */ public void finishedWritingMessages() { *************** *** 196,199 **** --- 247,257 ---- } + /** + * Writes the message to the output stream. The message class should be + * configured in type defintions for this message set and it should support + * the OFXWriterSupport interface. + * + * @param message Message to be written to the output stream. + */ public boolean writeMessage(Object message) { Index: SignOnMsgsRsV2Impl.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/SignOnMsgsRsV2Impl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SignOnMsgsRsV2Impl.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- SignOnMsgsRsV2Impl.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 21,35 **** /** * ! * @author Suresh Pragada */ public class SignOnMsgsRsV2Impl extends MessageSetImpl implements SignOnMsgsRsV2 { - - /** Creates a new instance of SignOnMsgsRsV2Impl */ public SignOnMsgsRsV2Impl() { } public MessageSetType getMessageSetType() { --- 21,41 ---- /** + * <p> + * SignOnMsgsRsV2Impl provides the implementation for the SignOnMsgsRsV2 interface. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public class SignOnMsgsRsV2Impl extends MessageSetImpl implements SignOnMsgsRsV2 { public SignOnMsgsRsV2Impl() { } + /** + * Returns the SignOn response V2 Message Set Type. + */ public MessageSetType getMessageSetType() { *************** *** 37,40 **** --- 43,49 ---- } + /** + * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRsV2#getSignOnMsgRsV2() + */ public SignOnMsgRsV2 getSignOnMsgRsV2() { *************** *** 42,45 **** --- 51,57 ---- } + /** + * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRsV2#addSignOnMsgRsV2(SignOnMsgRsV2) + */ public void addSignOnMsgRsV2(SignOnMsgRsV2 signOnMsgRsV2) { Index: SignOnMsgsRqV2Impl.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/SignOnMsgsRqV2Impl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SignOnMsgsRqV2Impl.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- SignOnMsgsRqV2Impl.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 21,26 **** /** * ! * @author Suresh Pragada */ public class SignOnMsgsRqV2Impl extends MessageSetImpl implements SignOnMsgsRqV2 --- 21,31 ---- /** + * <p> + * SignOnMsgsRqV2Impl provides the implementation for the SignOnMsgsRqV2 interface. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public class SignOnMsgsRqV2Impl extends MessageSetImpl implements SignOnMsgsRqV2 *************** *** 30,33 **** --- 35,41 ---- } + /** + * Returns the SignOn request V2 Message Set Type. + */ public MessageSetType getMessageSetType() { *************** *** 35,43 **** } public SignOnMsgRqV2 getSignOnMsgRqV2() { return (SignOnMsgRqV2)super.readNextMessage(new Class[]{SignOnRqV2.class, PinChTrnRqV2.class, ChallengeTrnRqV2.class}); } ! public void addSignOnMsgRqV2(SignOnMsgRqV2 signOnMsgRqV2) { --- 43,57 ---- } + /** + * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRqV2#getSignOnMsgRqV2() + */ public SignOnMsgRqV2 getSignOnMsgRqV2() { return (SignOnMsgRqV2)super.readNextMessage(new Class[]{SignOnRqV2.class, PinChTrnRqV2.class, ChallengeTrnRqV2.class}); } ! ! /** ! * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRqV2#addSignOnMsgRqV2(SignOnMsgRqV2) ! */ public void addSignOnMsgRqV2(SignOnMsgRqV2 signOnMsgRqV2) { Index: SignOnMsgsRqV1Impl.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/SignOnMsgsRqV1Impl.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SignOnMsgsRqV1Impl.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- SignOnMsgsRqV1Impl.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 20,25 **** /** * ! * @author Suresh Pragada */ public class SignOnMsgsRqV1Impl extends MessageSetImpl implements SignOnMsgsRqV1 --- 20,30 ---- /** + * <p> + * SignOnMsgsRqV1Impl provides the implementation for the SignOnMsgsRqV1 interface. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public class SignOnMsgsRqV1Impl extends MessageSetImpl implements SignOnMsgsRqV1 *************** *** 29,32 **** --- 34,40 ---- } + /** + * Returns the SignOn request V1 Message Set Type. + */ public MessageSetType getMessageSetType() { *************** *** 34,42 **** } public SignOnMsgRqV1 getSignOnMsgRqV1() { return (SignOnMsgRqV1)super.readNextMessage(new Class[]{SignOnRqV1.class, PinChTrnRqV1.class, ChallengeTrnRqV1.class}); } ! public void addSignOnMsgRqV1(SignOnMsgRqV1 signOnMsgRqV1) { --- 42,56 ---- } + /** + * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRqV1#getSignOnMsgRqV1() + */ public SignOnMsgRqV1 getSignOnMsgRqV1() { return (SignOnMsgRqV1)super.readNextMessage(new Class[]{SignOnRqV1.class, PinChTrnRqV1.class, ChallengeTrnRqV1.class}); } ! ! /** ! * @see org.jmonks.batch.io.ofx.messageset.SignOnMsgsRqV1#addSignOnMsgRqV1(SignOnMsgRqV1) ! */ public void addSignOnMsgRqV1(SignOnMsgRqV1 signOnMsgRqV1) { Index: MessageSetReader.java =================================================================== RCS file: /cvsroot/batchserver/Batch_IO_1.1/src/org/jmonks/batch/io/ofx/messageset/impl/MessageSetReader.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MessageSetReader.java 18 Oct 2006 03:19:18 -0000 1.1.1.1 --- MessageSetReader.java 18 Oct 2006 23:05:38 -0000 1.2 *************** *** 16,26 **** /** * ! * @author Suresh Pragada */ public interface MessageSetReader { void initializeReader(MessageSetType messageSetType, OFXParser parser); Object readNextMessage(Class[] expectedMessageClassNames); void finishedReadingMessages(); } --- 16,52 ---- /** + * <p> + * MessageSetReader provides the interface to the OFXFileReader to create the message + * sets should be constructed from the input stream. + * </p> * ! * @author Suresh Pragada ! * @version 1.1 ! * @since 1.1 */ public interface MessageSetReader { + /** + * Initializes Message set implementation to read the messages from the given parser. + * + * @param messageSetType Type of the message set it is representing. + * @param parser OFXParser to read the messages. + */ void initializeReader(MessageSetType messageSetType, OFXParser parser); + + /** + * Reads the next message from the parser. Caller would typically provide + * the expected classes from the stream. + * + * @param expectedMessageClassNames Array of classes caller is expecting. + * + * @return Returns the next message, null it no messages were found. + */ Object readNextMessage(Class[] expectedMessageClassNames); + + /** + * Read all the unread messages from this message set to keep the pointer + * to the next message set. + */ void finishedReadingMessages(); } --- NEW FILE: SignUpMsgsRsV1Impl.java --- /* * SignUpMsgsRsV1Impl.java * * Created on October 11, 2006, 11:47 AM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */ package org.jmonks.batch.io.ofx.messageset.impl; import org.jmonks.batch.io.ofx.messageset.MessageSetType; import org.jmonks.batch.io.ofx.messageset.SignUpMsgsRsV1; import org.jmonks.batch.io.ofx.messageset.aggregates.signup.EnrollTrnRsV1; import org.jmonks.batch.io.ofx.messageset.aggregates.signup.SignUpMsgRsV1; import org.jmonks.batch.io.ofx.messageset.aggregates.signup.SignUpMsgType; import org.jmonks.batch.io.ofx.parser.OFXStreamException; /** * <p> * SignUpMsgsRsV1Impl provides the implementation for the SignUpMsgsRsV1 interface. * </p> * * @author Suresh Pragada * @version 1.1 * @since 1.1 */ public class SignUpMsgsRsV1Impl extends MessageSetImpl implements SignUpMsgsRsV1 { public SignUpMsgsRsV1Impl() { } /** * Returns the SignUp response V1 Message Set Type. */ public MessageSetType getMessageSetType() { return MessageSetType.SIGNUP_MSGS_RSV1; } /** * @see org.jmonks.batch.io.ofx.messageset.SignUpMsgsRsV1#getSignUpMsgRsV1() */ public SignUpMsgRsV1 getSignUpMsgRsV1() { return (SignUpMsgRsV1)super.readNextMessage(new Class[]{EnrollTrnRsV1.class}); } /** * @see org.jmonks.batch.io.ofx.messageset.SignUpMsgsRsV1#addSignUpMsgRsV1(SignUpMsgRsV1) */ public void addSignUpMsgRsV1(SignUpMsgRsV1 signUpMsgRsV1) { SignUpMsgType msgType=signUpMsgRsV1.getSignUpMsgType(); if(msgType==SignUpMsgType.ENROLLTRN_RSV1) super.writeMessage(signUpMsgRsV1); else throw new OFXStreamException("Invalid message to be written to the " + this.getMessageSetType().toString()); } } |