Hi Hiranya, Please switch the working copy to trunk, we are no more on the 1.2-branch and the trunk svn location is;
https://svn.apache.org/repos/asf/synapse/trunk/java Thanks, Ruwan On Wed, Jun 25, 2008 at 10:05 AM, <[EMAIL PROTECTED]> wrote: > Author: hiranya > Date: Tue Jun 24 21:35:35 2008 > New Revision: 671420 > > URL: http://svn.apache.org/viewvc?rev=671420&view=rev > Log: > * Introduced a new service parameter (transport.fix.BeginStringValidation) > * Disabled BeginString validation (as per SYNAPSE-373) > > > Modified: > > > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXConstants.java > > > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXTransportSender.java > > Modified: > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXConstants.java > URL: > http://svn.apache.org/viewvc/synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXConstants.java?rev=671420&r1=671419&r2=671420&view=diff > > ============================================================================== > --- > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXConstants.java > (original) > +++ > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXConstants.java > Tue Jun 24 21:35:35 2008 > @@ -96,4 +96,6 @@ > > public static final String FIX_RESPONSE_HANDLER_APPROACH = > "transport.fix.SendAllToInSequence"; > > + public static final String FIX_BEGIN_STRING_VALIDATION = > "transport.fix.BeginStringValidation"; > + > } > \ No newline at end of file > > Modified: > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXTransportSender.java > URL: > http://svn.apache.org/viewvc/synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXTransportSender.java?rev=671420&r1=671419&r2=671420&view=diff > > ============================================================================== > --- > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXTransportSender.java > (original) > +++ > synapse/branches/1.2/modules/transports/src/main/java/org/apache/synapse/transport/fix/FIXTransportSender.java > Tue Jun 24 21:35:35 2008 > @@ -128,13 +128,15 @@ > } > } > > - private boolean isTargetVald(Map<String, String> fieldValues, > SessionID targetSession) { > + private boolean isTargetVald(Map<String, String> fieldValues, > SessionID targetSession, > + boolean beginStrValidation) { > + > String beginString = fieldValues.get(FIXConstants.BEGIN_STRING); > String deliverToCompID = > fieldValues.get(FIXConstants.DELIVER_TO_COMP_ID); > String deliverToSubID = > fieldValues.get(FIXConstants.DELIVER_TO_SUB_ID); > String deliverToLocationID = > fieldValues.get(FIXConstants.DELIVER_TO_LOCATION_ID); > > - if (!targetSession.getBeginString().equals(beginString)) { > + if (beginStrValidation && > !targetSession.getBeginString().equals(beginString)) { > return false; > } else if > (!targetSession.getTargetCompID().equals(deliverToCompID)) { > return false; > @@ -268,9 +270,12 @@ > String beginString = fieldValues.get(FIXConstants.BEGIN_STRING); > String deliverToCompID = > fieldValues.get(FIXConstants.DELIVER_TO_COMP_ID); > > + AxisService service = > cfgCtx.getAxisConfiguration().getService(serviceName); > + > //match BeginString values > - if (beginString != null && > !beginString.equals(sessionID.getBeginString())) { > - handleException("Cannot forward messages to a session with a > different BeginString"); > + if (isValidationOn(service) && beginString != null && > !beginString.equals(sessionID.getBeginString())) { > + handleException("BeginString validation is on. Cannot forward > messages to a session" + > + " with a different BeginString"); > } > > if (deliverToCompID != null) { > @@ -285,7 +290,6 @@ > > if (!Session.doesSessionExist(sessionID)) { > //try to create initiator to send the message > - AxisService service = > cfgCtx.getAxisConfiguration().getService(serviceName); > sessionFactory.createFIXInitiator(targetEPR, service, > sessionID); > } > > @@ -319,9 +323,12 @@ > String beginString = fieldValues.get(FIXConstants.BEGIN_STRING); > String deliverToCompID = > fieldValues.get(FIXConstants.DELIVER_TO_COMP_ID); > > + AxisService service = > cfgCtx.getAxisConfiguration().getService(serviceName); > + > //match BeginString values > - if (beginString != null && > !beginString.equals(sessionID.getBeginString())) { > - handleException("Cannot forward messages to a session with a > different BeginString"); > + if (isValidationOn(service) && beginString != null && > !beginString.equals(sessionID.getBeginString())) { > + handleException("BeginString validation is on. Cannot forward > messages to a session" + > + " with a different BeginString"); > } > > if (deliverToCompID != null) { > @@ -330,7 +337,6 @@ > handleException("Cannot forward messages that do not have a > valid DeliverToCompID field"); > } else { > prepareToForwardMessage(fixMessage, fieldValues); > - AxisService service = > cfgCtx.getAxisConfiguration().getService(serviceName); > setDeliverToXFields(fixMessage, service); > } > } else { > @@ -366,18 +372,20 @@ > Acceptor acceptor = sessionFactory.getAccepter(serviceName); > SessionID sessionID = null; > > + AxisService service = > cfgCtx.getAxisConfiguration().getService(serviceName); > + > if (acceptor != null) { > ArrayList<SessionID> sessions = acceptor.getSessions(); > if (sessions.size() == 1) { > sessionID = sessions.get(0); > - if (deliverToCompID != null && !isTargetVald(fieldValues, > sessionID)) { > + if (deliverToCompID != null && !isTargetVald(fieldValues, > sessionID, isValidationOn(service))) { > sessionID = null; > } > > } else if (sessions.size() > 1 && deliverToCompID != null) { > for (int i = 0; i < sessions.size(); i++) { > sessionID = sessions.get(i); > - if (isTargetVald(fieldValues, sessionID)) { > + if (isTargetVald(fieldValues, sessionID, > isValidationOn(service))) { > break; > } > } > @@ -392,8 +400,25 @@ > return false; > } > > + /** > + * Checks whether BeginString validation is on for the specified > + * service. > + * > + * @param service the AxisService of the message > + * @return a boolean value indicating the validation state > + */ > + private boolean isValidationOn(AxisService service) { > + Parameter validationParam = > service.getParameter(FIXConstants.FIX_BEGIN_STRING_VALIDATION); > + if (validationParam != null) { > + if ("true".equals(validationParam.getValue().toString())) { > + return true; > + } > + } > + return false; > + } > + > public void logOutIncomingSession(SessionID sessionID) { > messageSender.cleanUpMessages(sessionID.toString()); > } > > -} > \ No newline at end of file > +} > > > -- Ruwan Linton http://wso2.org - "Oxygenating the Web Services Platform" http://ruwansblog.blogspot.com/
