if (className == null)
className = "org.objectweb.joram.mom.dest.Topic";
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG,
"Topic.create(" + serverId + "," + name + "," + className + "," + properties + ")");
Topic topic = (Topic) getWrapper().createTopic(serverId, name, className, properties);
properties = null;
configureDestination(topic);
if (isSet(parent)) {
// TODO (AF): may be we should search the parent topic: JNDI? Joram?
if (topics.containsKey(parent)) {
topic.setParent((Topic) topics.get(parent));
} else {
logger.log(BasicLevel.ERROR,
"Topic.create(): Unknown parent: " + parent);
}
}
// Bind the topic in JNDI.
// Be Careful, currently only one binding is handled.
if (isSet(jndiName))
toBind.put(jndiName, topic);
jndiName = null;
// Register the topic in order to handle it later (cluster, etc.)
String name = topic.getAdminName();
if (! isSet(name)) name = topic.getName();
topics.put(name, topic);
// Fix DMQ if any
setDestinationDMQ(topic, dmq);
} else if (rawName.equals(ELT_DMQUEUE)) {
className = "org.objectweb.joram.mom.dest.Queue";
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG,
"DeadMQueue.create(" + serverId + "," + name + ")");
DeadMQueue dmq = (DeadMQueue) getWrapper().createDeadMQueue(serverId, name);
configureDestination(dmq);
// Bind the destination in JNDI.
// Be Careful, currently only one binding is handled.
if (isSet(jndiName))
toBind.put(jndiName, dmq);
jndiName = null;
// Register the DMQ in order to handle it later.
if (isSet(name))
dmqs.put(name, dmq);
} else if (rawName.equals(ELT_PROPERTY)) {
} else if (rawName.equals(ELT_READER)) {
readers.add(user);
} else if (rawName.equals(ELT_WRITER)) {
writers.add(user);
} else if (rawName.equals(ELT_FREEREADER)) {
} else if (rawName.equals(ELT_FREEWRITER)) {
} else if (rawName.equals(ELT_INITIALCONTEXT)) {
try {
jndiCtx = new javax.naming.InitialContext(properties);
} catch (NamingException exc) {
logger.log(BasicLevel.ERROR,"",exc);
}
} else if (rawName.equals(ELT_CLUSTER_ELEMENT)) {
} else if (rawName.equals(ELT_CLUSTER_CF)) {
Map.Entry entries[] = new Map.Entry [cluster.size()];
cluster.entrySet().toArray(entries);
ClusterConnectionFactory clusterCF = new ClusterConnectionFactory();
for (int i=0; i<entries.length; i++) {
ConnectionFactory cf = (ConnectionFactory) cfs.get(entries[i].getKey());
clusterCF.addConnectionFactory((String) entries[i].getValue(), cf);
}
cluster.clear();
// Bind the destination in JNDI.
// Be Careful, currently only one binding is handled.
if (isSet(jndiName))
toBind.put(jndiName, clusterCF);
jndiName = null;
} else if (rawName.equals(ELT_CLUSTER_QUEUE)) {
Map.Entry entries[] = new Map.Entry [cluster.size()];
cluster.entrySet().toArray(entries);
ClusterQueue clusterQueue = new ClusterQueue();
clusterQueue.setWrapper(getWrapper());
Queue root = null;
for (int i=0; i<entries.length; i++) {
Queue queue = (Queue) queues.get(entries[i].getKey());
clusterQueue.addDestination((String) entries[i].getValue(), queue);
if (i == 0)
root = queue;
else
root.addClusteredQueue(queue);
}
cluster.clear();
configureDestination(clusterQueue);
// Bind the destination in JNDI.
// Be Careful, currently only one binding is handled.
if (isSet(jndiName))
toBind.put(jndiName, clusterQueue);
jndiName = null;
} else if (rawName.equals(ELT_CLUSTER_TOPIC)) {
Map.Entry entries[] = new Map.Entry [cluster.size()];
cluster.entrySet().toArray(entries);
ClusterTopic clusterTopic = new ClusterTopic();
clusterTopic.setWrapper(getWrapper());
Topic root = null;
for (int i=0; i<entries.length; i++) {
Topic topic = (Topic) topics.get(entries[i].getKey());
clusterTopic.addDestination((String) entries[i].getValue(), topic);
if (i == 0)
root = topic;
else
root.addClusteredTopic(topic);