use of com.swiftmq.mgmt.EntityAddException in project swiftmq-ce by iitsoftware.
the class MQTTSession method createRegistryUsage.
private void createRegistryUsage(Subscription subscription) {
try {
Entity subUsage = ((EntityList) registryUsage.getEntity("subscriptions")).createEntity();
subUsage.setName(subscription.getTopicName());
subscription.fillRegistryUsage(subUsage);
subUsage.createCommands();
registryUsage.getEntity("subscriptions").addEntity(subUsage);
} catch (EntityAddException e) {
}
}
use of com.swiftmq.mgmt.EntityAddException in project swiftmq-ce by iitsoftware.
the class BackupProcessor method scanSaveSet.
private void scanSaveSet(File dir) {
File completed = new File(dir, COMPLETED_FILE);
if (completed.exists()) {
// Create Usage Entry
Entity entity = ctx.backupList.createEntity();
entity.setName(dir.getName());
entity.createCommands();
try {
ctx.backupList.addEntity(entity);
} catch (EntityAddException e) {
}
EntityList fileList = (EntityList) entity.getEntity("files");
File[] files = dir.listFiles(new FilenameFilter() {
public boolean accept(File d, String name) {
return !name.equals(COMPLETED_FILE);
}
});
if (files != null) {
for (int i = 0; i < files.length; i++) {
Entity fileEntity = fileList.createEntity();
fileEntity.setName(files[i].getName());
fileEntity.createCommands();
try {
fileEntity.getProperty("filesize").setValue(Long.valueOf(files[i].length()));
fileList.addEntity(fileEntity);
} catch (Exception e) {
}
}
}
} else {
// Delete Folder
deleteSaveSet(dir);
}
}
use of com.swiftmq.mgmt.EntityAddException in project swiftmq-ce by iitsoftware.
the class MQTTSession method createConnectionUsage.
private void createConnectionUsage(Subscription subscription) {
try {
Entity subUsage = ((EntityList) connectionUsage.getEntity("subscriptions")).createEntity();
subUsage.setName(subscription.getTopicName());
subscription.fillConnectionUsage(subUsage);
subUsage.createCommands();
connectionUsage.getEntity("subscriptions").addEntity(subUsage);
} catch (EntityAddException e) {
}
}
use of com.swiftmq.mgmt.EntityAddException in project swiftmq-ce by iitsoftware.
the class XARecoveryContextImpl method _addTransaction.
synchronized void _addTransaction(AbstractQueue queue, Object transactionId) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.xaSwiftlet.getName(), toString() + "/_addTransaction, queue=" + queue + ", transactionId: " + transactionId);
try {
if (transactions.size() == 0) {
Entity entity = ctx.preparedUsageList.createEntity();
entity.setName(Integer.toString(incCount()));
entity.setDynamicObject(xid);
entity.createCommands();
ctx.preparedUsageList.addEntity(entity);
try {
entity.getProperty("xid").setValue(signature);
} catch (Exception e) {
}
EntityList queues = (EntityList) entity.getEntity("queues");
Entity queueEntity = queues.createEntity();
queueEntity.setName(queue.getQueueName());
queueEntity.createCommands();
queues.addEntity(queueEntity);
} else {
Map entities = ctx.preparedUsageList.getEntities();
for (Iterator iter = entities.entrySet().iterator(); iter.hasNext(); ) {
Entity xidEntity = (Entity) ((Map.Entry) iter.next()).getValue();
EntityList queueList = (EntityList) xidEntity.getEntity("queues");
if ((xidEntity.getProperty("xid").getValue()).equals(signature) && queueList.getEntity(queue.getQueueName()) == null) {
Entity queueEntity = queueList.createEntity();
queueEntity.setName(queue.getQueueName());
queueEntity.createCommands();
queueList.addEntity(queueEntity);
break;
}
}
}
} catch (EntityAddException e) {
}
transactions.add(new Object[] { queue, transactionId });
}
use of com.swiftmq.mgmt.EntityAddException in project swiftmq-ce by iitsoftware.
the class TransformerFactory method createDefaultTransformer.
private void createDefaultTransformer(String key, EntityList list) {
Map entities = list.getEntities();
if (entities == null || entities.size() == 0) {
Entity newEntity = list.createEntity();
newEntity.setName(key);
newEntity.createCommands();
try {
list.addEntity(newEntity);
} catch (EntityAddException e) {
e.printStackTrace();
}
}
}
Aggregations