use of com.swiftmq.mgmt.Property in project swiftmq-ce by iitsoftware.
the class BrowserManager method createBrowser.
public void createBrowser(CreateBrowserRequest request) {
CreateBrowserReply reply = (CreateBrowserReply) request.createReply();
QueueImpl queue = request.getQueue();
String messageSelector = request.getMessageSelector();
MessageSelector msel = null;
String queueName = null;
try {
queueName = queue.getQueueName();
} catch (JMSException ignored) {
}
try {
if (messageSelector != null) {
msel = new MessageSelector(messageSelector);
msel.compile();
}
if (!ctx.queueManager.isQueueRunning(queueName)) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": Invalid destination: " + queueName);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Invalid destination: " + queue);
reply.setOk(false);
reply.setException(new InvalidDestinationException("Invalid destination: " + queueName));
} else {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Creating browser with selector: " + msel);
com.swiftmq.swiftlet.queue.QueueBrowser queueBrowser = ctx.queueManager.createQueueBrowser(queueName, ctx.activeLogin, msel);
int idx = ArrayListTool.setFirstFreeOrExpand(queueBrowsers, queueBrowser);
reply.setOk(true);
reply.setQueueBrowserId(idx);
if (browserEntityList != null) {
Entity browserEntity = browserEntityList.createEntity();
browserEntity.setName(queueName + "-" + idx);
browserEntity.setDynamicObject(queueBrowser);
browserEntity.createCommands();
Property prop = browserEntity.getProperty("queue");
prop.setValue(queueName);
prop.setReadOnly(true);
prop = browserEntity.getProperty("selector");
if (msel != null) {
prop.setValue(msel.getConditionString());
}
prop.setReadOnly(true);
browserEntityList.addEntity(browserEntity);
}
}
} catch (InvalidSelectorException e) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": CreateBrowser has invalid Selector: " + e);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": CreateBrowser has invalid Selector: " + e);
reply.setOk(false);
reply.setException(e);
} catch (Exception e) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": Exception during createQueueBrowser: " + e);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Exception during createQueueBrowser: " + e);
reply.setOk(false);
reply.setException(e);
}
reply.send();
}
use of com.swiftmq.mgmt.Property in project swiftmq-ce by iitsoftware.
the class TransactedUnifiedSession method visitCreatePublisherRequest.
public void visitCreatePublisherRequest(CreatePublisherRequest req) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitCreatePublisherRequest");
CreatePublisherReply reply = (CreatePublisherReply) req.createReply();
try {
ctx.activeLogin.getResourceLimitGroup().incProducers();
} catch (ResourceLimitException e) {
reply.setOk(false);
reply.setException(new JMSException(e.toString()));
reply.send();
return;
}
TopicImpl topic = req.getTopic();
try {
if (topic.getType() != DestinationFactory.TYPE_TEMPTOPIC)
ctx.authSwiftlet.verifyTopicSenderSubscription(topic.getTopicName(), ctx.activeLogin.getLoginId());
int producerId;
TopicProducer producer;
producerId = ArrayListTool.setFirstFreeOrExpand(producerList, null);
producer = new TopicProducer(ctx, topic);
producerList.set(producerId, producer);
reply.setTopicPublisherId(producerId);
reply.setOk(true);
if (publisherEntityList != null) {
Entity publisherEntity = publisherEntityList.createEntity();
publisherEntity.setName(topic.getTopicName() + "-" + producerId);
publisherEntity.setDynamicObject(producer);
publisherEntity.createCommands();
Property prop = publisherEntity.getProperty("topic");
prop.setReadOnly(false);
prop.setValue(topic.getTopicName());
prop.setReadOnly(true);
publisherEntityList.addEntity(publisherEntity);
}
// enlist it at the transaction manager
transactionManager.addTransactionFactory(producer);
} catch (Exception e) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/exception creating publisher: " + e.getMessage());
ctx.logSwiftlet.logError("sys$jms", ctx.tracePrefix + "/exception creating publisher: " + e.getMessage());
reply.setOk(false);
reply.setException((e instanceof JMSException) ? e : new javax.jms.JMSException(e.toString()));
ctx.activeLogin.getResourceLimitGroup().decProducers();
}
reply.send();
}
use of com.swiftmq.mgmt.Property in project swiftmq-ce by iitsoftware.
the class BrowserManager method createBrowser.
public void createBrowser(CreateBrowserRequest request) {
CreateBrowserReply reply = (CreateBrowserReply) request.createReply();
QueueImpl queue = request.getQueue();
String messageSelector = request.getMessageSelector();
MessageSelector msel = null;
String queueName = null;
try {
queueName = queue.getQueueName();
} catch (JMSException ignored) {
}
try {
if (messageSelector != null) {
msel = new MessageSelector(messageSelector);
msel.compile();
}
if (!ctx.queueManager.isQueueRunning(queueName)) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": Invalid destination: " + queueName);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Invalid destination: " + queue);
reply.setOk(false);
reply.setException(new InvalidDestinationException("Invalid destination: " + queueName));
} else {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Creating browser with selector: " + msel);
com.swiftmq.swiftlet.queue.QueueBrowser queueBrowser = ctx.queueManager.createQueueBrowser(queueName, ctx.activeLogin, msel);
int idx = ArrayListTool.setFirstFreeOrExpand(queueBrowsers, queueBrowser);
reply.setOk(true);
reply.setQueueBrowserId(idx);
if (browserEntityList != null) {
Entity browserEntity = browserEntityList.createEntity();
browserEntity.setName(queueName + "-" + idx);
browserEntity.setDynamicObject(queueBrowser);
browserEntity.createCommands();
Property prop = browserEntity.getProperty("queue");
prop.setValue(queueName);
prop.setReadOnly(true);
prop = browserEntity.getProperty("selector");
if (msel != null) {
prop.setValue(msel.getConditionString());
}
prop.setReadOnly(true);
browserEntityList.addEntity(browserEntity);
}
}
} catch (InvalidSelectorException e) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": CreateBrowser has invalid Selector: " + e);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": CreateBrowser has invalid Selector: " + e);
reply.setOk(false);
reply.setException(e);
} catch (Exception e) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": Exception during createQueueBrowser: " + e);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Exception during createQueueBrowser: " + e);
reply.setOk(false);
reply.setException(new javax.jms.JMSException(e.toString()));
}
reply.send();
}
use of com.swiftmq.mgmt.Property in project swiftmq-ce by iitsoftware.
the class BrowserManager method createBrowser.
public void createBrowser(CreateBrowserRequest request) {
CreateBrowserReply reply = (CreateBrowserReply) request.createReply();
QueueImpl queue = request.getQueue();
String messageSelector = request.getMessageSelector();
MessageSelector msel = null;
String queueName = null;
try {
queueName = queue.getQueueName();
} catch (JMSException ignored) {
}
try {
if (messageSelector != null) {
msel = new MessageSelector(messageSelector);
msel.compile();
}
if (!ctx.queueManager.isQueueRunning(queueName)) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": Invalid destination: " + queueName);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Invalid destination: " + queue);
reply.setOk(false);
reply.setException(new InvalidDestinationException("Invalid destination: " + queueName));
} else {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Creating browser with selector: " + msel);
com.swiftmq.swiftlet.queue.QueueBrowser queueBrowser = ctx.queueManager.createQueueBrowser(queueName, ctx.activeLogin, msel);
int idx = ArrayListTool.setFirstFreeOrExpand(queueBrowsers, queueBrowser);
reply.setOk(true);
reply.setQueueBrowserId(idx);
if (browserEntityList != null) {
Entity browserEntity = browserEntityList.createEntity();
browserEntity.setName(queueName + "-" + idx);
browserEntity.setDynamicObject(queueBrowser);
browserEntity.createCommands();
Property prop = browserEntity.getProperty("queue");
prop.setValue(queueName);
prop.setReadOnly(true);
prop = browserEntity.getProperty("selector");
if (msel != null) {
prop.setValue(msel.getConditionString());
}
prop.setReadOnly(true);
browserEntityList.addEntity(browserEntity);
}
}
} catch (InvalidSelectorException e) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": CreateBrowser has invalid Selector: " + e);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": CreateBrowser has invalid Selector: " + e);
reply.setOk(false);
reply.setException(e);
} catch (Exception e) {
ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/" + toString() + ": Exception during createQueueBrowser: " + e);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/" + toString() + ": Exception during createQueueBrowser: " + e);
reply.setOk(false);
reply.setException(new javax.jms.JMSException(e.toString()));
}
reply.send();
}
use of com.swiftmq.mgmt.Property in project swiftmq-ce by iitsoftware.
the class Output method collect.
/**
* Internal use.
*/
public void collect(long interval) {
if (usage == null)
return;
try {
Property msgSent = usage.getProperty("messages-sent");
msgSent.setValue(sent);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations