Added: webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties?rev=423350&view=auto ============================================================================== --- webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties (added) +++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/i18n/resource.properties Tue Jul 18 19:58:31 2006 @@ -0,0 +1,246 @@ +# Translation instructions. +# 1. Each message line is of the form key=value. +# Translate the value, DO NOT translate the key. +# 2. The messages may contain arguments that will be filled in +# by the runtime. These are of the form: {0}, {1}, etc. +# These must appear as is in the message, though the order +# may be changed to support proper language syntax. +# 3. If a single quote character is to appear in the resulting +# message, it must appear in this file as two consecutive +# single quote characters. +# 4. Lines beginning with "#" (like this one) are comment lines +# and may contain translation instructions. They need not be +# translated unless your translated file, rather than this file, +# will serve as a base for other translators. + + +#------------------------------------- +# +# General Sandesha messages +# +#------------------------------------- + +cannotInitInMemoryStorageManager=Cannot initialize the given in-memory storage manager due to exception {0}. +cannotInitPersistentStorageManager=Cannot initialize the given persistent storage manager due to exception {0}. +cannotProceedDueToStorageManager=Sandesha2 Internal Error: the StorageManager is not available due to exception {0}. +cannotGetStorageKey=Sandesha2 Internal Error: could not obtain the sandesha2 storage key in order to store the message. +cannotGetStorageManager=Sandesha2 Internal Error: could not load the specified storage manager. +storageManagerMustImplement=StorageManager {0} must implement the org.apache.sandesha2.storage.StorageManager interface. + +commitError=Exception thrown when trying to commit the transaction: {0} +rollbackError=Exception thrown when trying to rollback the transaction: {0} +inMsgError=Sandesha2 got an exception when processing an in message: {0} +outMsgError=Sandesha2 got an exception when processing an out message: {0} +invokeMsgError=Sandesha2 got an exception when invoking message: {0} +msgError=Sandesha2 got an exception when processing a message: {0} +sendMsgError=Sandesha2 got an exception when sending a message: {0} +noValidSyncResponse=Sandesha2 sender thread has not received a valid synchronous response... +generalError=Sandesha2 Internal Error: sandesha2 encountered the following exception {0} +classLoaderNotFound=Module class loader not found. + +defaultPropertyBeanNotSet=Sandesha2 Internal Error: ''DefaultPropertyBean'' is not set. +optionsObjectNotSet=Sandesha2 Internal Error: ''Options'' object is not set. +serviceContextNotSet=Sandesha2 Internal Error: ''ServiceContext'' is not set +sequenceIdBeanNotSet=Sandesha2 Internal Error: ''SequenceIdBean'' is not set +configContextNotSet=Sandesha2 Internal Error: ''ConfigurationContext'' is not set +soapEnvNotSet=Sandesha2 Internal Error: SOAP envelope is not set +soapBodyNotPresent=Invalid SOAP message: the body is not present. +unknownSoapVersion=Unknow SOAP version {0} +axisServiceIsNull=Sandesha2 Internal Error: ''AxisService'' is null +msgContextNotSetInbound=Sandesha2 Internal Error: ''MessageContext'' is null on the inbound message. +msgContextNotSetOutbound=Sandesha2 Internal Error: ''MessageContext'' is null on the outbound message. +msgContextNotSet=Sandesha2 Internal Error: ''MessageContext'' is null. +requestMsgContextNull=Request message context is null: cannot find out the request side sequenceID. +axisOperationError=Sandesha2 Internal Error: could not create the ''AxisOperation'' due to an error {0} +axisOperationRegisterError=Sandesha2 Internal Error: could not register an ''OutInAxisOperation'' due to exception {0} +transportOutNotPresent=Sandesha2 Internal Error: original transport sender is not present +storedKeyNotPresent=Sandesha2 Internal Error: stored key not present in the retransmittable message. +invalidQName=Invalid QName string: {0} + +dummyCallback=Sandesha2 Internal Error: dummy callback was called but this should never happen. +dummyCallbackError=Sandesha2 Internal Error: dummy callback received an error but this should never happen. +invalidMsgNumber=Sandesha2 Internal Error: invalid message number {0} +processTokenMethodError=Exception occured when invoking processTokenMethod: {0} +policyProcessingException=Exception {0} occured when processing policy {1} +errorOnTokenStack=Sandesha2 Internal Error: error on token stack - no current token. +unknownTokenAbortTran=Aborting transaction because of unknown token: {0} +commitingUnknownToken=Sandesha2 Internal error: token stack commiting an unknown token: {0} +cannotStartTransportListenerDueToError=Sandesha2 Internal error: could not start the transport listener due to error {0}. +cannotStartListenerForIncommingMsgs=Sandesha2 Internal error: cannot start the listner for incoming messages. You must set the ''transport in'' protocol in order to get async acknowledgement messages. +selectRSNotSupported=Sandesha2 Internal error: selectRS() methods are not currently supported +nonUniqueResult=Sandesha2 Internal error: A search for a unique object resulted in several matches. +invalidStringArray=Sandesha2 Internal error: invalid String array : {0}. +nextMsgNotSetCorrectly=Sandesha2 Internal error: next message not set correctly. Removing the invalid entry: {0}. +invalidNextMsgNumber=Sandesha2 Internal error: message number {0} is not valid as the Next Message Number. +cannotCointinueSender=Sandesha2 Internal error: cannot continue the Sender due to exception: {0} +msgContextNotPresentInStorage=Sandesha2 Internal error: message context {0} is not present in the store. +sendHasUnavailableMsgEntry=Sandesha2 Internal error: sender has an unavailable message entry {0}. +cannotInnitMessage=Sandesha2 Internal error: cannot initialize the message. +propertyInvalidValue=Sandesha2 Internal error: property {0} contains an invalid value. +couldNotCopyParameters=Could not copy parameters when creating the new RM Message. + + +#------------------------------------- +# +# Protocol Oriented Messages +# +#------------------------------------- + +rmNamespaceNotMatchSequence=Validation failed. The RM namespace value {0} of the message does not match {1} for sequence {2}. +wsaNamespaceNotMatchSequence=Validation failed. The WS-Addressing namespace value {0} of the message does not match {1} for sequence {2}. +unknownWSAVersion=Unknown WS-Addressing version {0} +rmNamespaceMismatch=Cannot process message as the rm namespace value {0} is different from the reqistered namespace value {1} for the sequence {2}. +emptyAckRequestSpecLevel=Empty AckRequest messages can only be sent with the v1_1 spec. You are using spec version {0}. +closeSequenceSpecLevel=Close sequence messages can only be sent with the v1_1 spec. You are using spec version {0}. +unknownSpec=Unknown specification version {0}. +unknownRMNamespace=Unknown rm namespace value {0}. +unknownNamespace=Unsupported namespace {0}. +cannotDecideRMVersion=Message does not has a valid RM namespace value - cannot decide the RM version. +specVersionPropertyNotAvailable=''SpecVersion'' sequence property is not available for the incoming sequence {0}: cannot find the RM version for outgoing side. +specVersionNotSet=Error: 'SpecVersion'' is not set. + +couldNotSendTerminate=Could not send the terminate message due to error {0}. +couldNotSendClose=Could not send the close sequence message due to error {0}. +couldNotSendAck=Could not send the ack message on sequence {0} due to an exception: {1} +couldNotSendTerminateResponse=Could not send the terminate sequence response due to exception {0}. +couldNotSendTerminateSeqNotFound=Internal sequenceID {0} was not found: cannot send the terminate message. +couldNotSendFault=Could not send the fault message due to an exception: {0} +cannotSendAckRequestNotActive=Cannot send the ackRequest message since the sequence with internal ID {0} is not active. +cannotSendAckRequestException=Could not send the ackRequest message on sequence {0} due to an exception: {1} +cannotCloseSequenceNotActive=Cannot close the sequence with internal ID {0} since it is not active. +noSequenceEstablished=A sequence with the given internal sequence ID {0} has not been established, has been terminated or could not be found. +invalidInternalSequenceID=Sandesha2 Internal Error: The internal sequence ID {0} is not valid. +tempNotSetOnReceivedMsg=''TempSequenceId'' is not set correctly in the received message. +completedMsgBeanIsNull=Completed messages bean is null for the sequence {0}. +internalSeqBeanNotAvailableOnSequence=Error: ''InternalSequenceBean'' is not available for the sequence with internal ID {0}. +createSeqEntryNotFound=''Create Sequence'' entry is not found. + +toEPRNotValid=The ''To'' endpoint reference address is not set correctly: {0} +noWSAACtionValue=Create sequence message does not have the ''WSA:Action'' value set correctly. +cannotFindSequence=Cannot find the sequence with ID {0}. +cannotFindSequenceID=Cannot find the sequence ID for the sequenceID bean {0}. +notValidTerminate=Not a valid terminated sequence: ''InternalSequenceBean'' is not available for the sequence with interal ID {0} +notValidTimeOut= Not a valid timedOut sequence: ''InternalSequenceBean'' is not available for the sequence with internal ID {0} +cannotFindAcksTo=Could not find the stored ''acksTo'' property for the specified sequence. +droppingDuplicate=Dropping a duplicate RM message. +cannotAcceptMsgAsSequenceClosed=Cannot accept message as sequence {0} has been closed. +msgNumberMustBeLargerThanZero=Message number {0} is invalid: this value has to be larger than zero. +msgNumberNotLargerThanLastMsg=The message number {0} is not larger than the last message sent on this sequence {1}. +msgNumberLargerThanLastMsg=The message number {0} is larger than the value {1}, which was previously declared as the last message. +outMsgHasNoEnvelope=Out message does not have a envelope: {0} +msgNumberExceededLastMsgNo=The received message number {0} on sequence {1} exceeds the message number {1} which was declared as last in a previosly received application message. +ackInvalid=The SequenceAcknowledgement received is invalid as the lower value {1} is larger than upper value {2}. +highestMsgKeyNotStored=Key of the highest message number has not been stored for sequence {0} +cannotHaveFinalWithNack=The ''Final'' element cannot be present when there are Nack elements under the SequenceAcknowledgement. +accptButNoSequenceOffered=Error: An ''accept'' was received but there was no offered sequence entry. +relatesToNotAvailable: Invalid create sequence message: ''RelatesTo'' part is not available. +cannotDerriveAckInterval=Cannot derive the ''Acknowledgement Interval'' from the passed string {0} +cannotDerriveRetransInterval=Cannot derive the ''Retransmission Interval'' from the passed string {0} +cannotDerriveInactivityTimeout=Cannot derive the ''Inactivity Timeout'' from the passed string {0} +noCreateSeqParts=No ''CreateSequence'' part is present in the create sequence message +noAcceptPart=An ''Accept'' part has not been generated for the ''create sequence request'' with an offer part. +noAcksToPartInCreateSequence=No ''AcksTo'' part is present in the create sequence message. +tempSeqIdNotSet=Error: ''TempSequenceId'' is not set. +ackRandDoesNotHaveCorrectValues=The ack range {0} does not have correct values for Upper and Lower attributes. +cannotSetAckRangeNullElement=Cannot set Ack Range part since element is null. +completedMessagesNull=Completed messages bean is null for the sequence {0} +emptyLastMsg=Received empty body for LastMessage part. +acksToStrNotSet=acksToStr Seqeunce property is not set correctly +invalidSequenceID=invalid sequence ID: {0} + +noCreateSeqResponse=''CreateSequenceResponse'' part is not available. +noTerminateSeqPart=''Terminate Sequence'' part is not available. +noNackInSeqAckPart=Passed ''sequence ack'' element does not contain a ''nack'' part. {0} +nackDoesNotContainValidLongValue=''Nack'' element does not contain a valid long value {0}. +cannotSetNackElemnt=Cannot set the ''nack'' part since the ''sequence ack'' element is null. +seqAckPartIsNull=''Sequence acknowledgement'' part is null. +cannotAddSequencePartNullMsgNumber=Cannot add ''Sequence'' part since ''MessageNumber'' is null. +cannotSetSeqAck=Cannot set ''sequence acknowledgement'' since the element is null. +noneNotAllowedNamespace=The given namespace {0} does not allow the ''None'' part to be added to the ''sequenceAcknowledgement'' element. +noneNotAllowedAckRangesPresent=The ''None'' element cannot be present when there are acknowledgement range elements under the ''sequenceAcknowledgement'' element. +noneNotAllowedNackPresent=The ''None'' element cannot be present when there are Nack elements under the ''sequenceAcknowledgement'' element. +finalNotAllowedNamespace=The given namespace {0} does not allow the 'Final' part to be added to the ''sequenceAcknowledgement'' element. +noFaultCodeNullElement=Cannot add ''Fault Code'' part since the passed element is null +noSeqFaultInElement=The passed element {0} does not contain a ''Sequence Fault'' element. +noSeqOfferInElement=The passed element {0} does not contain a ''SequenceOffer'' part. +noCreateSeqInElement=The passed message {0} does not have a ''CreateSequence'' part. +noTerminateSeqInElement=The passed element {0} does not contain a ''terminate sequence'' part. +noTerminateSeqResponseInElement=The passed element {0} does not contain a ''terminate sequence response'' part. +noAcceptPartInElement=The passed element {0} does not contain an ''Accept'' part. +noUpperOrLowerAttributesInElement=The passed element {0} does not contain upper or lower attributes. +noSequencePartInElement=The passed element {0} does not contain a ''Sequence'' part. +noLastMessagePartInElement=The passed element {0} does not contain a ''Last Message'' part. +noFinalPartInElement=The passed element {0} does not contain a ''Final'' part. +noNonePartInElement=The passed element {0} does not contain a ''None'' part. +noCloseSequencePartInElement=The passed element {0} does not contain a ''close sequence'' part. +noMessageNumberPartInElement=The passed sequnce element {0} does not contain a ''message number'' part. +noCloseSeqResponsePartInElement=The passed element {0} does not contain a ''close sequence response'' part. +noExpiresPartInElement=The passed elemenet {0} does not contain an ''Expires'' part. +noCreateSeqPartInElement=The passed element {0} does not contain a ''create sequence'' part. +noAckRequestedPartInElement=The passed element {0} does not contain an ''ack requested'' part. +noCreateSeqResponsePartInElement=The passed element {0} does not contain a ''create seqence response'' part. +noFaultCodePart=The passed element {0} does not contain a ''Fault Code'' part. +cannotFindAddressElement=Cannot find an ''Address'' part in the given element {0} +cannotFindAddressText=The passed element {0} does not have a valid address text. +nullPassedElement=The passed element is null. +noAckRequestedElement=Message identified as of type ''AckRequested'' but it does not have an ''AckRequeted'' element. +invalidAckMessageEntry=Invalid ack message entry: {0} +seqPartIsNull=Sequence part is null. +incomingSequenceNotValidID="The ID for the incoming sequence is not valid: {0}" + +seqFaultCannotBeExtractedToNonHeader=Cannot extract ''Sequence Fault'' part from a non-header element. +seqElementCannotBeAddedToNonHeader=''Sequence'' element cannot be added to non-header element. +ackRequestedCannotBeAddedToNonHeader=''Ack Requested'' part cannot be added to a non-header element. +terminateSeqCannotBeAddedToNonBody=Cannot add ''terminate sequence'' to a non-body element. +terminateSeqResponseCannotBeAddedToNonBody=Cannot add ''terminate sequence response'' to a non-body element. +closeSeqCannotBeAddedToNonBody=Cannot add ''close sequence'' to a non-body element. +closeSeqCannotBeExtractedFromNonBody=Cannot extract ''close sequence'' from a non-body element. +closeSeqResponseCannotBeAddedToNonBody=Cannot add ''close sequence response'' to a non-body element. +createSeqCannotBeAddedToNonBody=Cannot add ''create sequence'' part to a non-body element. +createSeqResponseCannotBeAddedToNonBody=Cannot get ''create sequnce response'' from a non-body element. +seqOfferNullID=Cannot add ''SequnceOffer'' parts since identifier is not set. +terminateSequence=Cannot add ''terminate sequence'' part since identifier is not set. +terminateSeqResponseNullID=Cannot add ''terminate sequence response'' part since identifier is not set. +sequencePartNullID=Cannot add ''Sequence'' part since identifier is not set. +closeSeqPartNullID=Cannot add ''close sequence'' part since identifier is not set +closeSeqResponsePartNullID=Cannot add ''close sequence response'' part since identifier is not set +invalidIdentifier=The passed element {0} does not contain a valid identifier part. +ackRequestNullID=Cannot add ''ack request'' part since the identifier is not set. +createSeqNullAcksTo=Cannot add a ''create seqeunce part'' since ''acksTo'' is not set. +acceptNullAcksTo=Cannot add ''Accept'' part since ''acksTo'' is not set. +noAcksToPart=The passed element {0} does not contain an ''acksTo'' part. +cannotProcessExpires=Cannot process ''Expires'' since the duration value is not valid. +noFaultCode=Cannot add ''Fault Code'' since the the value is not set correctly. +seqAckNonHeader=Cannot get sequence acknowlegement from a non-header element + +cannotSetACksTo=Cannot set the address as the value is not valid {0} +setAValidMsgNumber=Set A Valid Message Number {0}. +addressNotValid=Cannot set the address - the address value is not valid + +#------------------------------------- +# +# Client messages +# +#------------------------------------- + +incommingSequenceReportNotFound=An incoming sequence report is not present for the given sequenceID {0} +cannotGenerateReport=Cannot generate the sequence report for the given ''internalSequenceID'' {0} +cannotFindReportForGivenData=Cannnot find a sequence report for the given data {0}. +cannotGenerateReportNonUniqueSequence=Sequence data {0} is not unique. Cannot generate report. + +outSeqIDIsNull=''OutSequenceId'' is null +requestMsgNotPresent=Request message is not present +requestSeqIsNull=Error: ''RequestSequence'' is null +newSeqIdIsNull=New sequence Id is null +unavailableAppMsg=Error: unavailable application message +terminateAddedPreviously=Terminate was added previously. +maximumRetransmissionCountProcessor=MaximumRetransmissionCountProcessor:doAcknowledgementInterval +nullMsgId=Key (MessageId) is null. Cannot insert. +storageMapNotPresent=Error: storage Map not present +entryNotPresentForUpdating=Entry is not present for updating +appMsgIsNull=Application message is null +terminateOpperationIsNull=Terminate Operation was null +invalidMsgNumberList=Invalid msg number list +cannotFindReqMsgFromOpContext=Cannot find the request message from the operation context + +
Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java?rev=423350&r1=423349&r2=423350&view=diff ============================================================================== --- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java (original) +++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java Tue Jul 18 19:58:31 2006 @@ -39,6 +39,8 @@ import org.apache.sandesha2.RMMsgContext; import org.apache.sandesha2.Sandesha2Constants; import org.apache.sandesha2.SandeshaException; +import org.apache.sandesha2.i18n.SandeshaMessageHelper; +import org.apache.sandesha2.i18n.SandeshaMessageKeys; import org.apache.sandesha2.storage.StorageManager; import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr; import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr; @@ -60,31 +62,32 @@ public class AckRequestedProcessor implements MsgProcessor { private static final Log log = LogFactory.getLog(AckRequestedProcessor.class); - + public void processInMessage(RMMsgContext rmMsgCtx) throws SandeshaException { - if (log.isDebugEnabled()) - log.debug("Enter: AckRequestedProcessor::processInMessage"); + if (log.isDebugEnabled()) + log.debug("Enter: AckRequestedProcessor::processInMessage"); AckRequested ackRequested = (AckRequested) rmMsgCtx.getMessagePart(Sandesha2Constants.MessageParts.ACK_REQUEST); - if (ackRequested==null) { - throw new SandeshaException ("Message identified as of type ackRequested does not have an AckRequeted element"); + if (ackRequested == null) { + throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.noAckRequestedElement)); } - - //settting must understand to false. + + // settting must understand to false. ackRequested.setMustUnderstand(false); rmMsgCtx.addSOAPEnvelope(); - + MessageContext msgContext = rmMsgCtx.getMessageContext(); - + String sequenceID = ackRequested.getIdentifier().getIdentifier(); - + ConfigurationContext configurationContext = rmMsgCtx.getMessageContext().getConfigurationContext(); - - StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext,configurationContext.getAxisConfiguration()); - + + StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configurationContext, + configurationContext.getAxisConfiguration()); + SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropertyBeanMgr(); - - //Setting the ack depending on AcksTo. + + // Setting the ack depending on AcksTo. SequencePropertyBean acksToBean = seqPropMgr.retrieve(sequenceID, Sandesha2Constants.SequenceProperties.ACKS_TO_EPR); @@ -92,19 +95,18 @@ String acksToStr = acksTo.getAddress(); if (acksToStr == null) - throw new SandeshaException( - "acksToStr Seqeunce property is not set correctly"); - + throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.acksToStrNotSet)); + AxisOperation ackOperation = null; try { ackOperation = AxisOperationFactory.getOperationDescription(WSDL20_2004Constants.MEP_URI_IN_ONLY); } catch (AxisFault e) { - throw new SandeshaException("Could not create the Operation"); + throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.axisOperationError, e + .toString())); } - AxisOperation rmMsgOperation = rmMsgCtx.getMessageContext() - .getAxisOperation(); + AxisOperation rmMsgOperation = rmMsgCtx.getMessageContext().getAxisOperation(); if (rmMsgOperation != null) { ArrayList outFlow = rmMsgOperation.getPhasesOutFlow(); if (outFlow != null) { @@ -113,20 +115,18 @@ } } - MessageContext ackMsgCtx = SandeshaUtil.createNewRelatedMessageContext( - rmMsgCtx, ackOperation); - - ackMsgCtx.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE,"true"); - + MessageContext ackMsgCtx = SandeshaUtil.createNewRelatedMessageContext(rmMsgCtx, ackOperation); + + ackMsgCtx.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true"); + RMMsgContext ackRMMsgCtx = MsgInitializer.initializeMessage(ackMsgCtx); ackRMMsgCtx.setRMNamespaceValue(rmMsgCtx.getRMNamespaceValue()); - + ackMsgCtx.setMessageID(SandeshaUtil.getUUID()); - SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil - .getSOAPVersion(msgContext.getEnvelope())); - - //Setting new envelope + SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgContext.getEnvelope())); + + // Setting new envelope SOAPEnvelope envelope = factory.getDefaultEnvelope(); try { ackMsgCtx.setEnvelope(envelope); @@ -136,26 +136,30 @@ ackMsgCtx.setTo(acksTo); ackMsgCtx.setReplyTo(msgContext.getTo()); - RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceID,storageManager); + RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceID, storageManager); ackRMMsgCtx.getMessageContext().setServerSide(true); - ackMsgCtx.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, - msgContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION)); //TODO do this in the RMMsgCreator - - String addressingNamespaceURI = SandeshaUtil.getSequenceProperty(sequenceID,Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE,storageManager); + ackMsgCtx.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, msgContext + .getProperty(AddressingConstants.WS_ADDRESSING_VERSION)); // TODO + // do + // this + // in + // the + // RMMsgCreator + + String addressingNamespaceURI = SandeshaUtil.getSequenceProperty(sequenceID, + Sandesha2Constants.SequenceProperties.ADDRESSING_NAMESPACE_VALUE, storageManager); String anonymousURI = SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespaceURI); - + if (anonymousURI.equals(acksTo.getAddress())) { - AxisEngine engine = new AxisEngine(ackRMMsgCtx.getMessageContext() - .getConfigurationContext()); + AxisEngine engine = new AxisEngine(ackRMMsgCtx.getMessageContext().getConfigurationContext()); - //setting CONTEXT_WRITTEN since acksto is anonymous + // setting CONTEXT_WRITTEN since acksto is anonymous if (rmMsgCtx.getMessageContext().getOperationContext() == null) { - //operation context will be null when doing in a GLOBAL + // operation context will be null when doing in a GLOBAL // handler. try { - AxisOperation op = AxisOperationFactory - .getAxisOperation(WSDL20_2004Constants.MEP_CONSTANT_IN_OUT); + AxisOperation op = AxisOperationFactory.getAxisOperation(WSDL20_2004Constants.MEP_CONSTANT_IN_OUT); OperationContext opCtx = new OperationContext(op); rmMsgCtx.getMessageContext().setAxisOperation(op); rmMsgCtx.getMessageContext().setOperationContext(opCtx); @@ -164,62 +168,57 @@ } } - rmMsgCtx.getMessageContext().getOperationContext().setProperty( - org.apache.axis2.Constants.RESPONSE_WRITTEN, + rmMsgCtx.getMessageContext().getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE); - rmMsgCtx.getMessageContext().setProperty( - Sandesha2Constants.ACK_WRITTEN, "true"); - + rmMsgCtx.getMessageContext().setProperty(Sandesha2Constants.ACK_WRITTEN, "true"); + try { engine.send(ackRMMsgCtx.getMessageContext()); } catch (AxisFault e1) { throw new SandeshaException(e1.getMessage()); } - + } else { - SenderBeanMgr retransmitterBeanMgr = storageManager - .getRetransmitterBeanMgr(); + SenderBeanMgr retransmitterBeanMgr = storageManager.getRetransmitterBeanMgr(); String key = SandeshaUtil.getUUID(); - - //dumping to the storage will be done be Sandesha2 Transport Sender - //storageManager.storeMessageContext(key,ackMsgCtx); - + + // dumping to the storage will be done be Sandesha2 Transport Sender + // storageManager.storeMessageContext(key,ackMsgCtx); + SenderBean ackBean = new SenderBean(); ackBean.setMessageContextRefKey(key); ackBean.setMessageID(ackMsgCtx.getMessageID()); ackBean.setReSend(false); ackBean.setSequenceID(sequenceID); - - //this will be set to true in the sender. + + // this will be set to true in the sender. ackBean.setSend(true); - - ackMsgCtx.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, - Sandesha2Constants.VALUE_FALSE); - + + ackMsgCtx.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING, Sandesha2Constants.VALUE_FALSE); + ackBean.setMessageType(Sandesha2Constants.MessageTypes.ACK); - - //the internalSequenceId value of the retransmitter Table for the + + // the internalSequenceId value of the retransmitter Table for the // messages related to an incoming - //sequence is the actual sequence ID + // sequence is the actual sequence ID - //operation is the lowest level, Sandesha2 can be engaged. + // operation is the lowest level, Sandesha2 can be engaged. SandeshaPropertyBean propertyBean = SandeshaUtil.getPropertyBean(msgContext.getAxisOperation()); - - + long ackInterval = propertyBean.getAcknowledgementInaterval(); - - //Ack will be sent as stand alone, only after the retransmitter + + // Ack will be sent as stand alone, only after the retransmitter // interval. long timeToSend = System.currentTimeMillis() + ackInterval; - //removing old acks. + // removing old acks. SenderBean findBean = new SenderBean(); findBean.setMessageType(Sandesha2Constants.MessageTypes.ACK); - - //this will be set to true in the sandesha2TransportSender. + + // this will be set to true in the sandesha2TransportSender. findBean.setSend(true); findBean.setReSend(false); Collection coll = retransmitterBeanMgr.find(findBean); @@ -227,50 +226,52 @@ if (it.hasNext()) { SenderBean oldAckBean = (SenderBean) it.next(); - timeToSend = oldAckBean.getTimeToSend(); //If there is an old ack. This ack will be sent in the old timeToSend. + timeToSend = oldAckBean.getTimeToSend(); // If there is an + // old ack. This ack + // will be sent in + // the old + // timeToSend. retransmitterBeanMgr.delete(oldAckBean.getMessageID()); } - + ackBean.setTimeToSend(timeToSend); - storageManager.storeMessageContext(key,ackMsgCtx); - - //inserting the new ack. + storageManager.storeMessageContext(key, ackMsgCtx); + + // inserting the new ack. retransmitterBeanMgr.insert(ackBean); - //passing the message through sandesha2sender + // passing the message through sandesha2sender - ackMsgCtx.setProperty(Sandesha2Constants.ORIGINAL_TRANSPORT_OUT_DESC,ackMsgCtx.getTransportOut()); - ackMsgCtx.setProperty(Sandesha2Constants.SET_SEND_TO_TRUE,Sandesha2Constants.VALUE_TRUE); - - ackMsgCtx.setProperty(Sandesha2Constants.MESSAGE_STORE_KEY,key); - - ackMsgCtx.setTransportOut(new Sandesha2TransportOutDesc ()); - - AxisEngine engine = new AxisEngine (configurationContext); + ackMsgCtx.setProperty(Sandesha2Constants.ORIGINAL_TRANSPORT_OUT_DESC, ackMsgCtx.getTransportOut()); + ackMsgCtx.setProperty(Sandesha2Constants.SET_SEND_TO_TRUE, Sandesha2Constants.VALUE_TRUE); + + ackMsgCtx.setProperty(Sandesha2Constants.MESSAGE_STORE_KEY, key); + + ackMsgCtx.setTransportOut(new Sandesha2TransportOutDesc()); + + AxisEngine engine = new AxisEngine(configurationContext); try { engine.send(ackMsgCtx); } catch (AxisFault e) { - throw new SandeshaException (e.getMessage()); + throw new SandeshaException(e.getMessage()); } - - - SandeshaUtil.startSenderForTheSequence(configurationContext,sequenceID); - + + SandeshaUtil.startSenderForTheSequence(configurationContext, sequenceID); + msgContext.pause(); - - if (log.isDebugEnabled()) - log.debug("Exit: AckRequestedProcessor::processInMessage"); + + if (log.isDebugEnabled()) + log.debug("Exit: AckRequestedProcessor::processInMessage"); } } - + public void processOutMessage(RMMsgContext rmMsgCtx) throws SandeshaException { - if (log.isDebugEnabled()) - { - log.debug("Enter: AckRequestedProcessor::processOutMessage"); - log.debug("Exit: AckRequestedProcessor::processOutMessage"); - } + if (log.isDebugEnabled()) { + log.debug("Enter: AckRequestedProcessor::processOutMessage"); + log.debug("Exit: AckRequestedProcessor::processOutMessage"); + } } - + } Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java?rev=423350&r1=423349&r2=423350&view=diff ============================================================================== --- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java (original) +++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java Tue Jul 18 19:58:31 2006 @@ -30,6 +30,8 @@ import org.apache.sandesha2.RMMsgContext; import org.apache.sandesha2.Sandesha2Constants; import org.apache.sandesha2.SandeshaException; +import org.apache.sandesha2.i18n.SandeshaMessageHelper; +import org.apache.sandesha2.i18n.SandeshaMessageKeys; import org.apache.sandesha2.storage.StorageManager; import org.apache.sandesha2.storage.beanmanagers.SenderBeanMgr; import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr; @@ -51,130 +53,130 @@ public class AcknowledgementProcessor implements MsgProcessor { private static final Log log = LogFactory.getLog(AcknowledgementProcessor.class); - + public void processInMessage(RMMsgContext rmMsgCtx) throws SandeshaException { - if (log.isDebugEnabled()) - log.debug("Enter: AcknowledgementProcessor::processInMessage"); - + if (log.isDebugEnabled()) + log.debug("Enter: AcknowledgementProcessor::processInMessage"); + SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx .getMessagePart(Sandesha2Constants.MessageParts.SEQ_ACKNOWLEDGEMENT); if (sequenceAck == null) { - String message = "Sequence acknowledgement part is null"; + String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.seqAckPartIsNull); log.debug(message); throw new SandeshaException(message); } - + MessageContext msgCtx = rmMsgCtx.getMessageContext(); ConfigurationContext configCtx = msgCtx.getConfigurationContext(); - - StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx,configCtx.getAxisConfiguration()); - - //setting mustUnderstand to false. + + StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configCtx, configCtx + .getAxisConfiguration()); + + // setting mustUnderstand to false. sequenceAck.setMustUnderstand(false); rmMsgCtx.addSOAPEnvelope(); + SenderBeanMgr retransmitterMgr = storageManager.getRetransmitterBeanMgr(); + SequencePropertyBeanMgr seqPropMgr = storageManager.getSequencePropertyBeanMgr(); - SenderBeanMgr retransmitterMgr = storageManager - .getRetransmitterBeanMgr(); - SequencePropertyBeanMgr seqPropMgr = storageManager - .getSequencePropertyBeanMgr(); - - Iterator ackRangeIterator = sequenceAck.getAcknowledgementRanges() - .iterator(); + Iterator ackRangeIterator = sequenceAck.getAcknowledgementRanges().iterator(); Iterator nackIterator = sequenceAck.getNackList().iterator(); String outSequenceId = sequenceAck.getIdentifier().getIdentifier(); if (outSequenceId == null || "".equals(outSequenceId)) { - String message = "OutSequenceId is null"; + String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.outSeqIDIsNull); log.debug(message); throw new SandeshaException(message); } FaultManager faultManager = new FaultManager(); - RMMsgContext faultMessageContext = faultManager.checkForUnknownSequence(rmMsgCtx,outSequenceId,storageManager); + RMMsgContext faultMessageContext = faultManager + .checkForUnknownSequence(rmMsgCtx, outSequenceId, storageManager); if (faultMessageContext != null) { - + ConfigurationContext configurationContext = msgCtx.getConfigurationContext(); AxisEngine engine = new AxisEngine(configurationContext); - + try { engine.sendFault(faultMessageContext.getMessageContext()); } catch (AxisFault e) { - throw new SandeshaException ("Could not send the fault message",e); + throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotSendFault, e + .toString())); } - + msgCtx.pause(); return; } - - faultMessageContext = faultManager.checkForInvalidAcknowledgement(rmMsgCtx,storageManager); + + faultMessageContext = faultManager.checkForInvalidAcknowledgement(rmMsgCtx, storageManager); if (faultMessageContext != null) { - + ConfigurationContext configurationContext = msgCtx.getConfigurationContext(); AxisEngine engine = new AxisEngine(configurationContext); - + try { engine.sendFault(faultMessageContext.getMessageContext()); } catch (AxisFault e) { - throw new SandeshaException ("Could not send the fault message",e); + throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.couldNotSendFault, e + .toString())); } - + msgCtx.pause(); return; } - - String internalSequenceID = SandeshaUtil.getSequenceProperty(outSequenceId,Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID,storageManager); - - //updating the last activated time of the sequence. - SequenceManager.updateLastActivatedTime(internalSequenceID,storageManager); - - SequencePropertyBean internalSequenceBean = seqPropMgr.retrieve( - outSequenceId, Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID); + + String internalSequenceID = SandeshaUtil.getSequenceProperty(outSequenceId, + Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID, storageManager); + + // updating the last activated time of the sequence. + SequenceManager.updateLastActivatedTime(internalSequenceID, storageManager); + + SequencePropertyBean internalSequenceBean = seqPropMgr.retrieve(outSequenceId, + Sandesha2Constants.SequenceProperties.INTERNAL_SEQUENCE_ID); if (internalSequenceBean == null || internalSequenceBean.getValue() == null) { - String message = "TempSequenceId is not set correctly"; + String message = SandeshaMessageHelper.getMessage(SandeshaMessageKeys.tempSeqIdNotSet); log.debug(message); - + throw new SandeshaException(message); } String internalSequenceId = (String) internalSequenceBean.getValue(); - //Following happens in the SandeshaGlobal handler - rmMsgCtx.getMessageContext() - .setProperty(Sandesha2Constants.ACK_PROCSSED, "true"); - - //Removing relatesTo - Some v1_0 endpoints tend to set relatesTo value for ack messages. - //Because of this dispatching may go wrong. So we set relatesTo value to null for ackMessages. - //(this happens in the SandeshaGlobal handler). Do this only if this is a standalone ACK. -// if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.ACK) -// rmMsgCtx.setRelatesTo(null); + // Following happens in the SandeshaGlobal handler + rmMsgCtx.getMessageContext().setProperty(Sandesha2Constants.ACK_PROCSSED, "true"); + + // Removing relatesTo - Some v1_0 endpoints tend to set relatesTo value + // for ack messages. + // Because of this dispatching may go wrong. So we set relatesTo value + // to null for ackMessages. + // (this happens in the SandeshaGlobal handler). Do this only if this is + // a standalone ACK. + // if (rmMsgCtx.getMessageType() == Sandesha2Constants.MessageTypes.ACK) + // rmMsgCtx.setRelatesTo(null); SenderBean input = new SenderBean(); input.setSend(true); input.setReSend(true); - Collection retransmitterEntriesOfSequence = retransmitterMgr - .find(input); + Collection retransmitterEntriesOfSequence = retransmitterMgr.find(input); - ArrayList ackedMessagesList = new ArrayList (); + ArrayList ackedMessagesList = new ArrayList(); while (ackRangeIterator.hasNext()) { - AcknowledgementRange ackRange = (AcknowledgementRange) ackRangeIterator - .next(); + AcknowledgementRange ackRange = (AcknowledgementRange) ackRangeIterator.next(); long lower = ackRange.getLowerValue(); long upper = ackRange.getUpperValue(); for (long messageNo = lower; messageNo <= upper; messageNo++) { - SenderBean retransmitterBean = getRetransmitterEntry( - retransmitterEntriesOfSequence, messageNo); + SenderBean retransmitterBean = getRetransmitterEntry(retransmitterEntriesOfSequence, messageNo); if (retransmitterBean != null) { retransmitterMgr.delete(retransmitterBean.getMessageID()); - - //removing the application message from the storage. + + // removing the application message from the storage. String storageKey = retransmitterBean.getMessageContextRefKey(); storageManager.removeMessageContext(storageKey); } - - ackedMessagesList.add(new Long (messageNo)); + + ackedMessagesList.add(new Long(messageNo)); } } @@ -182,71 +184,73 @@ Nack nack = (Nack) nackIterator.next(); long msgNo = nack.getNackNumber(); - //TODO - Process Nack + // TODO - Process Nack } - - //setting acked message date. - //TODO add details specific to each message. + + // setting acked message date. + // TODO add details specific to each message. long noOfMsgsAcked = getNoOfMessagesAcked(sequenceAck.getAcknowledgementRanges().iterator()); - SequencePropertyBean noOfMsgsAckedBean = seqPropMgr.retrieve(outSequenceId,Sandesha2Constants.SequenceProperties.NO_OF_OUTGOING_MSGS_ACKED); + SequencePropertyBean noOfMsgsAckedBean = seqPropMgr.retrieve(outSequenceId, + Sandesha2Constants.SequenceProperties.NO_OF_OUTGOING_MSGS_ACKED); boolean added = false; - - if (noOfMsgsAckedBean==null) { + + if (noOfMsgsAckedBean == null) { added = true; - noOfMsgsAckedBean = new SequencePropertyBean (); + noOfMsgsAckedBean = new SequencePropertyBean(); noOfMsgsAckedBean.setSequenceID(outSequenceId); noOfMsgsAckedBean.setName(Sandesha2Constants.SequenceProperties.NO_OF_OUTGOING_MSGS_ACKED); } - + noOfMsgsAckedBean.setValue(Long.toString(noOfMsgsAcked)); - - if (added) + + if (added) seqPropMgr.insert(noOfMsgsAckedBean); else seqPropMgr.update(noOfMsgsAckedBean); - - - //setting the completed_messages list. This gives all the messages of the sequence that were acked. - SequencePropertyBean allCompletedMsgsBean = seqPropMgr.retrieve(internalSequenceId,Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES); - if (allCompletedMsgsBean==null) { - allCompletedMsgsBean = new SequencePropertyBean (); + + // setting the completed_messages list. This gives all the messages of + // the sequence that were acked. + SequencePropertyBean allCompletedMsgsBean = seqPropMgr.retrieve(internalSequenceId, + Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES); + if (allCompletedMsgsBean == null) { + allCompletedMsgsBean = new SequencePropertyBean(); allCompletedMsgsBean.setSequenceID(internalSequenceId); allCompletedMsgsBean.setName(Sandesha2Constants.SequenceProperties.CLIENT_COMPLETED_MESSAGES); - + seqPropMgr.insert(allCompletedMsgsBean); } - + String str = ackedMessagesList.toString(); allCompletedMsgsBean.setValue(str); - - seqPropMgr.update(allCompletedMsgsBean); - - String lastOutMsgNoStr = SandeshaUtil.getSequenceProperty(internalSequenceId,Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE_NO,storageManager); - if (lastOutMsgNoStr!=null ) { + + seqPropMgr.update(allCompletedMsgsBean); + + String lastOutMsgNoStr = SandeshaUtil.getSequenceProperty(internalSequenceId, + Sandesha2Constants.SequenceProperties.LAST_OUT_MESSAGE_NO, storageManager); + if (lastOutMsgNoStr != null) { long highestOutMsgNo = 0; - if (lastOutMsgNoStr!=null) { + if (lastOutMsgNoStr != null) { highestOutMsgNo = Long.parseLong(lastOutMsgNoStr); } - - if (highestOutMsgNo>0) { - boolean complete = AcknowledgementManager.verifySequenceCompletion ( - sequenceAck.getAcknowledgementRanges().iterator(),highestOutMsgNo); - - if (complete) - TerminateManager.addTerminateSequenceMessage(rmMsgCtx, outSequenceId,internalSequenceId,storageManager); + + if (highestOutMsgNo > 0) { + boolean complete = AcknowledgementManager.verifySequenceCompletion(sequenceAck + .getAcknowledgementRanges().iterator(), highestOutMsgNo); + + if (complete) + TerminateManager.addTerminateSequenceMessage(rmMsgCtx, outSequenceId, internalSequenceId, + storageManager); } } - - //stopping the progress of the message further. - rmMsgCtx.pause(); - - if (log.isDebugEnabled()) - log.debug("Exit: AcknowledgementProcessor::processInMessage"); + + // stopping the progress of the message further. + rmMsgCtx.pause(); + + if (log.isDebugEnabled()) + log.debug("Exit: AcknowledgementProcessor::processInMessage"); } - - private SenderBean getRetransmitterEntry(Collection collection, - long msgNo) { + private SenderBean getRetransmitterEntry(Collection collection, long msgNo) { Iterator it = collection.iterator(); while (it.hasNext()) { SenderBean bean = (SenderBean) it.next(); @@ -257,29 +261,26 @@ return null; } - - - private static long getNoOfMessagesAcked (Iterator ackRangeIterator) { + private static long getNoOfMessagesAcked(Iterator ackRangeIterator) { long noOfMsgs = 0; while (ackRangeIterator.hasNext()) { AcknowledgementRange acknowledgementRange = (AcknowledgementRange) ackRangeIterator.next(); long lower = acknowledgementRange.getLowerValue(); long upper = acknowledgementRange.getUpperValue(); - - for (long i=lower;i<=upper;i++) { + + for (long i = lower; i <= upper; i++) { noOfMsgs++; } } - + return noOfMsgs; } - + public void processOutMessage(RMMsgContext rmMsgCtx) throws SandeshaException { - if (log.isDebugEnabled()) - { - log.debug("Enter: AcknowledgementProcessor::processOutMessage"); - log.debug("Exit: AcknowledgementProcessor::processOutMessage"); - } + if (log.isDebugEnabled()) { + log.debug("Enter: AcknowledgementProcessor::processOutMessage"); + log.debug("Exit: AcknowledgementProcessor::processOutMessage"); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
