/*
Set the value of the SystemMessageSourceUuid field in the message header.

Javadoc description supplied by JsMessage interface.
513375
public void setSystemMessageSourceUuid(SIBUuid8 value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setSystemMessageSourceUuid", value);
        // Clear the cached MessageHandle
        cachedMessageHandle = null;
        // Set the value into the message itself
        if (value != null) {
            jmo.setField(JsHdrAccess.SYSTEMMESSAGESOURCEUUID, value.toByteArray());
        }
        else {
            jmo.setField(JsHdrAccess.SYSTEMMESSAGESOURCEUUID, null);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setSystemMessageSourceUuid");
    }
605647
public void setProducerConnectionUuid(SIBUuid12 producerConnectionUuid)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setProducerConnectionUuid", producerConnectionUuid);

        this.producerConnectionUuid = producerConnectionUuid;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setProducerConnectionUuid");
    }
103338
public void setRequestingMeUuid(SIBUuid8 value) {
    if (value != null)
      jmo.setField(TrmFirstContactAccess.BODY_MELINKREQUEST_REQUESTINGMEUUID, value.toByteArray());
    else
      jmo.setField(TrmFirstContactAccess.BODY_MELINKREQUEST_REQUESTINGMEUUID, null);
  }
755795
public void setDefaultMessageProcessor(Map<String,Object> mapHeaderMessageInfo)
    {
        if (mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS) == null)
        {
            String strMessageInfoTypeCode = (String)mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_INFO_TYPE);
            String strMessageProcessTypeCode = (String)mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESS_TYPE);
            if ((strMessageInfoTypeCode != null) && (strMessageProcessTypeCode != null))
            {
                String strProcessorClass = null;
                if ((MessageInfoType.REQUEST.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_OUT.equals(strMessageProcessTypeCode)))
                    strProcessorClass = BaseMessageOutProcessor.class.getName();
                else if ((MessageInfoType.REQUEST.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_IN.equals(strMessageProcessTypeCode)))
                    strProcessorClass = BaseMessageInProcessor.class.getName();
                else if ((MessageInfoType.REPLY.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_OUT.equals(strMessageProcessTypeCode)))
                    strProcessorClass = BaseMessageReplyOutProcessor.class.getName();
                if ((MessageInfoType.REPLY.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_IN.equals(strMessageProcessTypeCode)))
                    strProcessorClass = BaseMessageReplyInProcessor.class.getName();
                if (strProcessorClass != null)
                    mapHeaderMessageInfo.put(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS, strProcessorClass);
            }
        }
    }
821016
@Override
    public final void setObjectProperty(String name, Object value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setObjectProperty", new Object[] { name, value });

        /* If the property is either JMSXUserID or JMSXAppID, we set it into the */
        /* message regardless of whether it is null. We know the value is a */
        /* String as the JMS API layer has vetted it. Moved code under d325186.1 */
        if (SIProperties.JMSXAppID.equals(name)) {
            setJmsxAppId((String) value);
        }
        else if (SIProperties.JMSXUserID.equals(name)) {
            setUserid((String) value);
        }
        /* Ditto for JMS_IBM_ArmCorrelator & JMS_TOG_ARM_Correlator */
        else if (SIProperties.JMS_IBM_ArmCorrelator.equals(name)) {
            setARMCorrelator((String) value);
        }
        else if (SIProperties.JMS_TOG_ARM_Correlator.equals(name)) {
            setARMCorrelator((String) value);
        }

        /* else, if the value is not null, set the Property */
        else if (value != null) {
            setNonNullProperty(name, value);
        }

        /* Otherwise, remove it */
        else {

            /* Maelstrom's transportVersion has its own field - the rest are in the */
            /* JmsPropertyMap */
            if (!name.startsWith(JMS_PREFIX)) {
                if (name.equals(MfpConstants.PRP_TRANSVER)) {
                    clearTransportVersion();
                }
                else {
                    if (mayHaveJmsUserProperties()) {
                        getJmsUserPropertyMap().remove(name);
                    }
                }
            }
            else {
                if (name.startsWith(JMS_IBM_MQMD_PREFIX)) {
                    deleteMQMDProperty(name);
                }
                else {
                    if (mayHaveMappedJmsSystemProperties()) {
                        getJmsSystemPropertyMap().remove(name); // 234893
                    }
                    // JMS_IBM_Character_Set and JMS_IBM_Encoding need to be cleared in the
                    // message itself too.                                          d395685
                    if (name.equals(SIProperties.JMS_IBM_Character_Set)) {
                        setCcsid(null);
                    }
                    else if (name.equals(SIProperties.JMS_IBM_Encoding)) {
                        setEncoding(null);
                    }
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setObjectProperty");
    }
930115
public void setMessageText(SendableTextMessage.SendableTextMessageBuilder messageBuilder) {
        SendableTextMessage message = messageBuilder.build();
        baseMessage.getBotInstance().editMessageText(baseMessage, message.getMessage(), message.getParseMode(),
                message.isDisableWebPagePreview(), toKeyboard());
    }
518625
public void setRemoteMEUuid(SIBUuid8 remoteMEUuid)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setRemoteMEUuid", remoteMEUuid);
        this.remoteMEUuid = remoteMEUuid;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setRemoteMEUuid");
    }
902353
public void setIntField(String name, int value)
    {
        if (_state!=__MSG_EDITABLE)
            return;
        _header.put(name, TypeUtil.toString(value));
    }
288561
public final void setJmsType(String value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setJmsType", value);
        getHdr2().setField(JsHdr2Access.JMSTYPE_DATA, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setJmsType");
    }
810356
@Override
    public void setJmsDeliveryTime(long value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setJmsDeliveryTime", Long.valueOf(value));
        getHdr2().setField(JsHdr2Access.JMSDELIVERYTIME_DATA, Long.valueOf(value));
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setJmsDeliveryTime");

    }
951506
public boolean addMessage(SIMPMessage msgItem) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "addMessage", new Object[] { msgItem });
  
    // Get the JsMessage as we need to update the Guaranteed fields
    JsMessage jsMsg = msgItem.getMessage();
  
    StreamSet streamSet = getStreamSet();
  
    // Stamp the message with the stream ID
    msgItem.setGuaranteedStreamUuid(streamSet.getStreamID());
  
    //  NOTE: no synchronization with flush necessary here since startFlush
    // is not supposed to be called until all competing producer threads have
    // exited.
    Reliability reliability = msgItem.getReliability();
  
    if(reliability == Reliability.BEST_EFFORT_NONPERSISTENT)
    {
      addBestEffortMessage(msgItem);
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "addMessage", false);
      return false;
    }
    else
    {
      SourceStream sourceStream = null;
      int priority = msgItem.getPriority();
      synchronized(streamSet)
      {        
        sourceStream = (SourceStream) streamSet.getStream(priority, reliability);
    
        if(sourceStream == null)
        {
          sourceStream = createStream(streamSet,
                                      priority,
                                      reliability,
                                      streamSet.getPersistentData(priority, reliability),
                                      false );
        }
      }
    
      synchronized(sourceStream)
      {    
        long tick = this.messageProcessor.nextTick();
    
        //Set a unique id in the message if explicitly told to or
        //if one has not already been set
        if(msgItem.getRequiresNewId()  ||  jsMsg.getSystemMessageId()==null)
        {
          jsMsg.setSystemMessageSourceUuid(this.messageProcessor.getMessagingEngineUuid());
          jsMsg.setSystemMessageValue(tick);
          msgItem.setRequiresNewId(false);
        }
    
        jsMsg.setGuaranteedValueEndTick(tick);
        jsMsg.setGuaranteedValueValueTick(tick);
        jsMsg.setGuaranteedValueRequestedOnly(false);
    
        jsMsg.setGuaranteedValueStartTick(sourceStream.getLastMsgAdded() + 1);
        jsMsg.setGuaranteedValueCompletedPrefix(sourceStream.getCompletedPrefix());
    
        sourceStream.writeUncommitted(msgItem);
      } // end sync
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        SibTr.exit(tc, "addMessage", true);
    
      return true;
    }    
  }
953001
@Override
    public void sendNackMessage(SIBUuid8 sourceMEUuid,
                                SIBUuid12 destUuid,
                                SIBUuid8 busUuid,
                                long startTick,
                                long endTick,
                                int priority,
                                Reliability reliability,
                                SIBUuid12 stream)
                    throws SIResourceException
    {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "sendNackMessage",
                        new Object[] { new Long(startTick), new Long(endTick) });

        ControlNack nackMsg = createControlNackMessage();

        // As we are using the Guaranteed Header - set all the attributes as
        // well as the ones we want.
        SIMPUtils.setGuaranteedDeliveryProperties(nackMsg,
                                                  _messageProcessor.getMessagingEngineUuid(),
                                                  sourceMEUuid,
                                                  stream,
                                                  null,
                                                  destUuid,
                                                  ProtocolType.UNICASTOUTPUT,
                                                  GDConfig.PROTOCOL_VERSION);

        nackMsg.setPriority(priority);
        nackMsg.setReliability(reliability);

        nackMsg.setStartTick(startTick);
        nackMsg.setEndTick(endTick);

        //  Send Nack messages at original message priority +2
        sendToME(nackMsg, sourceMEUuid, busUuid, priority + 2);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "sendNackMessage ");
    }
835089
@Override
	public final void setObjectProperty(String name, Object value) throws JMSException
    {
        if (value == null)
            throw new MessageFormatException("A property value cannot be null");
            
        // Check type
        if (!(value instanceof Boolean ||
              value instanceof Byte ||
              value instanceof Short ||
              value instanceof Integer ||
              value instanceof Long ||
              value instanceof Float ||
              value instanceof Double ||
              value instanceof String))
            throw new MessageFormatException("Unsupported property value type : "+value.getClass().getName());
        
        setProperty(name,value);
    }
379701
private void initMessageSource() {
        if (contextBeanRegistry.containsBean(MESSAGE_SOURCE_BEAN_ID)) {
            messageSource = contextBeanRegistry.getBean(MESSAGE_SOURCE_BEAN_ID, MessageSource.class);
            if (log.isDebugEnabled()) {
                log.debug("Using MessageSource [" + messageSource + "]");
            }
        } else {
            // Use empty MessageSource to be able to accept getMessage calls.
            messageSource = new DelegatingMessageSource();
            if (log.isDebugEnabled()) {
                log.debug("Unable to locate MessageSource with name '" + MESSAGE_SOURCE_BEAN_ID +
                        "': using default [" + messageSource + "]");
            }
        }
    }
1208150
public final void setGuaranteedGatheringTargetUUID(SIBUuid12 value) {
    if (value != null)
      jmo.setField(ControlAccess.GATHERINGTARGETUUID_VALUE, value.toByteArray());
    else
      jmo.setField(ControlAccess.GATHERINGTARGETUUID, ControlAccess.IS_GATHERINGTARGETUUID_EMPTY);
  }
773982
public void setMessageControlClassification(String value) {
        if (value != null) {
            getHdr2().setField(JsHdr2Access.MESSAGECONTROLCLASSIFICATION_DATA, value);
        }
        else {
            getHdr2().setChoiceField(JsHdr2Access.MESSAGECONTROLCLASSIFICATION, JsHdr2Access.IS_MESSAGECONTROLCLASSIFICATION_EMPTY);
        }
    }
638850
public final void setGuaranteedStreamUUID(SIBUuid12 value) {
    if (value != null)
      jmo.setField(ControlAccess.STREAMUUID, value.toByteArray());
    else
      jmo.setField(ControlAccess.STREAMUUID, null);
  }