/**
* Handle JMS specific configuration.
*/
private void jms(ConfigMap properties)
{
ConfigMap jms = properties.getPropertyAsMap(JMS, null);
if (jms != null)
{
String destType = jms.getPropertyAsString(DESTINATION_TYPE, defaultDestinationType);
settings.setDestinationType(destType);
String msgType = jms.getPropertyAsString(MESSAGE_TYPE, null);
settings.setMessageType(msgType);
String factory = jms.getPropertyAsString(CONNECTION_FACTORY, null);
settings.setConnectionFactory(factory);
ConfigMap connectionCredentials = jms.getPropertyAsMap(CONNECTION_CREDENTIALS, null);
if (connectionCredentials != null)
{
String username = connectionCredentials.getPropertyAsString(USERNAME, null);
settings.setConnectionUsername(username);
String password = connectionCredentials.getPropertyAsString(PASSWORD, null);
settings.setConnectionPassword(password);
}
ConfigMap deliverySettings = jms.getPropertyAsMap(DELIVERY_SETTINGS, null);
if (deliverySettings != null)
{
// Get the default delivery settings.
DeliverySettings ds = settings.getDeliverySettings();
String mode = deliverySettings.getPropertyAsString(MODE, JMSConfigConstants.defaultMode);
ds.setMode(mode);
long receiveIntervalMillis = deliverySettings.getPropertyAsLong(SYNC_RECEIVE_INTERVAL_MILLIS, defaultSyncReceiveIntervalMillis);
ds.setSyncReceiveIntervalMillis(receiveIntervalMillis);
long receiveWaitMillis = deliverySettings.getPropertyAsLong(SYNC_RECEIVE_WAIT_MILLIS, defaultSyncReceiveWaitMillis);
ds.setSyncReceiveWaitMillis(receiveWaitMillis);
}
String destJNDI = jms.getPropertyAsString(DESTINATION_JNDI_NAME, null);
settings.setDestinationJNDIName(destJNDI);
String dest = jms.getPropertyAsString(DESTINATION_NAME, null);
if (dest != null && Log.isWarn())
Log.getLogger(LOG_CATEGORY).warn("The <destination-name> configuration option is deprecated and non-functional. Please remove this from your configuration file.");
boolean durable = getDestination() instanceof MessageDestination ?
((MessageDestination) getDestination()).getServerSettings().isDurable() : false;
settings.setDurableConsumers(durable);
String deliveryMode = jms.getPropertyAsString(DELIVERY_MODE, null);
settings.setDeliveryMode(deliveryMode);
boolean preserveJMSHeaders = jms.getPropertyAsBoolean(PRESERVE_JMS_HEADERS, settings.isPreserveJMSHeaders());
settings.setPreserveJMSHeaders(preserveJMSHeaders);
String defPriority = jms.getPropertyAsString(MESSAGE_PRIORITY, null);
if (defPriority != null && !defPriority.equalsIgnoreCase(DEFAULT_PRIORITY))
{
int priority = jms.getPropertyAsInt(MESSAGE_PRIORITY, settings.getMessagePriority());
settings.setMessagePriority(priority);
}
String ackMode = jms.getPropertyAsString(ACKNOWLEDGE_MODE, defaultAcknowledgeMode);
settings.setAcknowledgeMode(ackMode);
boolean transMode = jms.getPropertyAsBoolean(TRANSACTION_MODE, false);
if (transMode && Log.isWarn())
Log.getLogger(LOG_CATEGORY).warn("The <transacted-sessions> configuration option is deprecated and non-functional. Please remove this from your configuration file.");
int maxProducers = jms.getPropertyAsInt(MAX_PRODUCERS, defaultMaxProducers);
settings.setMaxProducers(maxProducers);
// Retrieve any JNDI initial context environment properties.
ConfigMap env = jms.getPropertyAsMap(INITIAL_CONTEXT_ENVIRONMENT, null);
if (env != null)
{
List props = env.getPropertyAsList(PROPERTY, null);
if (props != null)
{
Class contextClass = Context.class;
Hashtable envProps = new Hashtable();
for (Iterator iter = props.iterator(); iter.hasNext();)
{
Object prop = iter.next();
if (prop instanceof ConfigMap)
{
ConfigMap pair = (ConfigMap)prop;
String name = pair.getProperty(NAME);
String value = pair.getProperty(VALUE);
if (name == null || value == null)
{
// A <property> element for the <initial-context-environment> settings for the ''{0}'' destination does not specify both <name> and <value> subelements.
MessageException messageEx = new MessageException();
messageEx.setMessage(MISSING_NAME_OR_VALUE, new Object[] {getDestination().getId()});