This static method is a factory for producing JmsMessageImpl objects from
Message objects.
It is called by JmsMsgProducerImpl.send(...).
359704
static JmsMessageImpl messageToJmsMessageImpl(Message message) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "messageToJmsMessageImpl", message);

        JmsMessageImpl jmsMessage = null;

        if (message instanceof BytesMessage) {
            jmsMessage = new JmsBytesMessageImpl((BytesMessage) message);
        }
        else if (message instanceof MapMessage) {
            jmsMessage = new JmsMapMessageImpl((MapMessage) message);
        }
        else if (message instanceof ObjectMessage) {
            jmsMessage = new JmsObjectMessageImpl((ObjectMessage) message);
        }
        else if (message instanceof StreamMessage) {
            jmsMessage = new JmsStreamMessageImpl((StreamMessage) message);
        }
        else if (message instanceof TextMessage) {
            jmsMessage = new JmsTextMessageImpl((TextMessage) message);
        }
        else if (message instanceof Message) {
            jmsMessage = new JmsMessageImpl(message);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "messageToJmsMessageImpl", jmsMessage);
        return jmsMessage;
    }
520009
public AbstractPubSubHub<ID, DATA> setMessageFactory(IMessageFactory<ID, DATA> messageFactory) {
        this.messageFactory = messageFactory;
        return this;
    }
209272
public static BaseMessage createMessage(String strMessageClassName, BaseMessageHeader messageHeader, Object data)
    {
       BaseMessage message = null;
       
       if ((strMessageClassName == null)
           && (messageHeader != null))
       {
           strMessageClassName = (String)messageHeader.get(BaseMessageHeader.INTERNAL_MESSAGE_CLASS);
           if ((strMessageClassName == null) || (strMessageClassName.length() == 0))
           {
//?               String strRequestType = (String)messageHeader.get(TrxMessageHeader.MESSAGE_REQUEST_TYPE);
//?               if ((strRequestType == null) || (strRequestType.length() == 0) || (RequestType.MANUAL.equalsIgnoreCase(strRequestType)))
//?                   strMessageClass = ManualMessage.class.getName();
           }
       }
       if ((strMessageClassName != null) && (strMessageClassName.length() > 0))
       {
           strMessageClassName = ClassServiceUtility.getFullClassName(strMessageClassName);
           Object obj = ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageClassName);
           if (obj instanceof BaseMessage)
           {
               message = (BaseMessage)obj;
               message.init(messageHeader, null);
           }
           else if  (obj instanceof MessageRecordDesc)
           {
               message = new TreeMessage(messageHeader, null);
               ((MessageRecordDesc)obj).init(message, null);
           }
       }
       return message;
   }
627515
protected javax.jms.Message convertToJMSMessage(Message message) throws JMSException {
        MessageAttributeValue messageTypeAttribute = message.getMessageAttributes().get(
                SQSMessage.JMS_SQS_MESSAGE_TYPE);
        javax.jms.Message jmsMessage = null;
        if (messageTypeAttribute == null) {
            jmsMessage = new SQSTextMessage(acknowledger, queueUrl, message);
        } else {
            String messageType = messageTypeAttribute.getStringValue();
            if (SQSMessage.BYTE_MESSAGE_TYPE.equals(messageType)) {
                try {
                    jmsMessage = new SQSBytesMessage(acknowledger, queueUrl, message);
                } catch (JMSException e) {
                    LOG.warn("MessageReceiptHandle - " + message.getReceiptHandle() +
                             "cannot be serialized to BytesMessage", e);
                    throw e;
                }
            } else if (SQSMessage.OBJECT_MESSAGE_TYPE.equals(messageType)) {
                jmsMessage = new SQSObjectMessage(acknowledger, queueUrl, message);
            } else if (SQSMessage.TEXT_MESSAGE_TYPE.equals(messageType)) {
                jmsMessage = new SQSTextMessage(acknowledger, queueUrl, message);
            } else {
                throw new JMSException("Not a supported JMS message type");
            }
        }
        
        jmsMessage.setJMSDestination(sqsDestination);
        
        MessageAttributeValue replyToQueueNameAttribute = message.getMessageAttributes().get(
                SQSMessage.JMS_SQS_REPLY_TO_QUEUE_NAME);
        MessageAttributeValue replyToQueueUrlAttribute = message.getMessageAttributes().get(
                SQSMessage.JMS_SQS_REPLY_TO_QUEUE_URL);
        if (replyToQueueNameAttribute != null && replyToQueueUrlAttribute != null) {
            String replyToQueueUrl = replyToQueueUrlAttribute.getStringValue();
            String replyToQueueName = replyToQueueNameAttribute.getStringValue();
            Destination replyToQueue = new SQSQueueDestination(replyToQueueName, replyToQueueUrl);
            jmsMessage.setJMSReplyTo(replyToQueue);
        }
        
        MessageAttributeValue correlationIdAttribute = message.getMessageAttributes().get(
                SQSMessage.JMS_SQS_CORRELATION_ID);
        if (correlationIdAttribute != null) {
                jmsMessage.setJMSCorrelationID(correlationIdAttribute.getStringValue());
        }
        
        return jmsMessage;
    }
562751
private ObjectJS jsonMessage(String message, StringifierFactory jsonStringifierFactory) {
		ObjectJS timelineJS = new ObjectJS();
		timelineJS.setSimpleAttribute("message", message, jsonStringifierFactory.getStringifier(String.class));
		return timelineJS;
	}
1306832
public MessageId send(ProducerConnectionContext context, BasicMessage basicMessage) throws JMSException {
        return send(context, basicMessage, null);
    }
425536
@Override
	public QueueSender createSender(Queue queue) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        LocalQueueSender sender = new LocalQueueSender(this,queue,idProvider.createID());
	        registerProducer(sender);
	        return sender;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
598702
public static void construct(BaseMessageEndpointFactory factory,
                                 MessageEndpointBase messageEndpointBase,
                                 int recoveryId,
                                 EJSContainer container,
                                 BeanMetaData beanMetaData,
                                 EJBPMICollaborator pmiBean,
                                 WrapperManager wrapperManager,
                                 boolean rrsTransactional) //d219252x
    {
        // Initialize superclass with the wrapper information.
        messageEndpointBase.container = container;
        messageEndpointBase.wrapperManager = wrapperManager;
        messageEndpointBase.beanId = new BeanId(factory, null, false);
        messageEndpointBase.bmd = beanMetaData;
        messageEndpointBase.ivPmiBean = pmiBean;
        messageEndpointBase.isolationAttrs = null;
        messageEndpointBase.ivCommon = null; // Not a cached wrapper.     d174057.2
        messageEndpointBase.isManagedWrapper = false; // Not a managed wrapper.    d174057.2
        messageEndpointBase.methodInfos = messageEndpointBase.bmd.localMethodInfos;
        messageEndpointBase.methodNames = messageEndpointBase.bmd.localMethodNames;
        messageEndpointBase.ivInterface = WrapperInterface.MESSAGE_LISTENER; // d366807

        // Initialize this objects instance variables.
        messageEndpointBase.ivRecoveryId = recoveryId;
        messageEndpointBase.ivMessageEndpointFactory = factory;
        messageEndpointBase.ivTransactionManager = EmbeddableTransactionManagerFactory.getTransactionManager();
        messageEndpointBase.ivRRSTransactional = rrsTransactional;

        //d456256 start
        // If there is only 1 method in the EJBMethodInfo for the
        // message listener interface, then set ivSingleMethodInterface
        // to true.
        if (messageEndpointBase.methodInfos.length == 1)
        {
            messageEndpointBase.ivSingleMethodInterface = true;
        }
        // d456256 end
    }
77031
public static JsMessageHandleFactory getJsMessageHandleFactory() {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "getJsMessageHandleFactory");

        if (_jsMessageHandleFactory == null)
            _jsMessageHandleFactory = (JsMessageHandleFactory) getSingletonInstance(SIMPConstants.JS_MESSAGE_HANDLE_FACTORY);

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "getJsMessageHandleFactory", _jsMessageHandleFactory);
        return _jsMessageHandleFactory;
    }
972769
public <T> TopicProducer<T> createTopicProducer(final String topic, final ProducerCallback<T> messageCallback)
    {
        Preconditions.checkState(connectionFactory != null, "connection factory was never injected!");
        return new TopicProducer<T>(connectionFactory, jmsConfig, topic, messageCallback);
    }
1309893
@Override
	public QueueSender createSender(Queue queue) throws JMSException
    {
    	externalAccessLock.readLock().lock();
    	try
		{
	        checkNotClosed();
	        
	        RemoteQueueSender sender =  new RemoteQueueSender(this,
	                                                          DestinationTools.asRef(queue),
	                                                          idProvider.createID());
	        registerProducer(sender);
	        return sender;
		}
    	finally
    	{
    		externalAccessLock.readLock().unlock();
    	}
    }
1226900
private static MessageBuffer newInstance(Constructor<?> constructor, Object... args)
    {
        try {
            // We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method. TypeProfile will be
            // generated to resolve one of the method references when two or more classes overrides the method.
            return (MessageBuffer) constructor.newInstance(args);
        }
        catch (InstantiationException e) {
            // should never happen
            throw new IllegalStateException(e);
        }
        catch (IllegalAccessException e) {
            // should never happen unless security manager restricts this reflection
            throw new IllegalStateException(e);
        }
        catch (InvocationTargetException e) {
            if (e.getCause() instanceof RuntimeException) {
                // underlying constructor may throw RuntimeException
                throw (RuntimeException) e.getCause();
            }
            else if (e.getCause() instanceof Error) {
                throw (Error) e.getCause();
            }
            // should never happen
            throw new IllegalStateException(e.getCause());
        }
    }
829418
@Override
    public Message newMessage(final String message, final Object... params) {
        if (params == null) {
            return new SimpleMessage(message);
        }
        final ParameterizedMessage msg = new ParameterizedMessage(message, params);
        return new StatusMessage(msg.getFormattedMessage(), msg.getThrowable());
    }
1213185
public MessagelistenerType<MessageadapterType<T>> getOrCreateMessagelistener()
   {
      List<Node> nodeList = childNode.get("messagelistener");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new MessagelistenerTypeImpl<MessageadapterType<T>>(this, "messagelistener", childNode, nodeList.get(0));
      }
      return createMessagelistener();
   }
1188486
MessageToClient _createMessageToClient(MessageFromClient message, T session) {
		MessageToClient messageToClient = new MessageToClient();
		messageToClient.setId(message.getId());
		try {
			Class cls = Class.forName(message.getDataService());
			Object dataService = this.getDataService(session, cls);
			logger.debug("Process message {}", message);
			List<Object> arguments = getArrayList();
			Method method = methodServices.getMethodFromDataService(cls, message, arguments);
			injectSession(method.getParameterTypes(), arguments, session);
			messageToClient.setResult(method.invoke(dataService, arguments.toArray()));
			if (method.isAnnotationPresent(JsonMarshaller.class)) {
				messageToClient.setJson(argumentServices.getJsonResultFromSpecificMarshaller(method.getAnnotation(JsonMarshaller.class), messageToClient.getResponse()));
			}
			try {
				Method nonProxiedMethod = methodServices.getNonProxiedMethod(cls, method.getName(), method.getParameterTypes());
				messageToClient.setDeadline(cacheManager.processCacheAnnotations(nonProxiedMethod, message.getParameters()));
			} catch (NoSuchMethodException ex) {
				logger.error("Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method.getName(), ex);
			}
			logger.debug("Method {} proceed messageToClient : {}.", method.getName(), messageToClient);
		} catch (InvocationTargetException ex) {
			Throwable cause = ex.getCause();
			if (ConstraintViolationException.class.isInstance(cause)) {
				messageToClient.setConstraints(constraintServices.extractViolations((ConstraintViolationException) cause));
			} else {
				messageToClient.setFault(faultServices.buildFault(cause));
			}
		} catch (Throwable ex) {
			messageToClient.setFault(faultServices.buildFault(ex));
		}
		return messageToClient;
	}
943706
final JsJmsMessage createInboundJmsMessage(JsMsgObject jmo, int messageType) {

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.entry(tc, "createInboundJmsMessage " + messageType );

    JsJmsMessage jmsMessage = null;

    switch (messageType) {

      case JmsBodyType.BYTES_INT:
        jmsMessage = new JsJmsBytesMessageImpl(jmo);
        break;

      case JmsBodyType.MAP_INT:
        jmsMessage = new JsJmsMapMessageImpl(jmo);
        break;

      case JmsBodyType.OBJECT_INT:
        jmsMessage = new JsJmsObjectMessageImpl(jmo);
        break;

      case JmsBodyType.STREAM_INT:
        jmsMessage = new JsJmsStreamMessageImpl(jmo);
        break;

      case JmsBodyType.TEXT_INT:
        jmsMessage = new JsJmsTextMessageImpl(jmo);
        break;

      default:
        jmsMessage = new JsJmsMessageImpl(jmo);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())SibTr.exit(tc, "createInboundJmsMessage");
    return jmsMessage;
  }
245349
public JmsDestinationType<WebFragmentDescriptor> getOrCreateJmsDestination()
   {
      List<Node> nodeList = model.get("jms-destination");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new JmsDestinationTypeImpl<WebFragmentDescriptor>(this, "jms-destination", model, nodeList.get(0));
      }
      return createJmsDestination();
   }