use of com.swiftmq.tools.versioning.Versioned in project swiftmq-client by iitsoftware.
the class ContextImpl method createVersioned.
private Versioned createVersioned(int version, JNDIRequest request) throws Exception {
DataByteArrayOutputStream dos = new DataByteArrayOutputStream();
Dumpalizer.dump(dos, request);
return new Versioned(version, dos.getBuffer(), dos.getCount());
}
use of com.swiftmq.tools.versioning.Versioned in project swiftmq-ce by iitsoftware.
the class TopicManagerImpl method registerJNDI.
private void registerJNDI(String name, TopicImpl topic) {
try {
DataByteArrayOutputStream dos = new DataByteArrayOutputStream();
DestinationFactory.dumpDestination(topic, dos);
Versionable versionable = new Versionable();
versionable.addVersioned(-1, new Versioned(-1, dos.getBuffer(), dos.getCount()), "com.swiftmq.jms.DestinationFactory");
ctx.jndiSwiftlet.registerJNDIObject(name, versionable);
} catch (IOException e) {
e.printStackTrace();
}
}
use of com.swiftmq.tools.versioning.Versioned in project swiftmq-ce by iitsoftware.
the class RequestVisitor method createVersioned.
private Versioned createVersioned(int version, JNDIRequest request) throws Exception {
DataByteArrayOutputStream dos = new DataByteArrayOutputStream();
Dumpalizer.dump(dos, request);
return new Versioned(version, dos.getBuffer(), dos.getCount());
}
use of com.swiftmq.tools.versioning.Versioned in project swiftmq-ce by iitsoftware.
the class JNDISwiftletImpl method createStatics.
private void createStatics(EntityList staticList) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(getName(), "create static objects ...");
String[] s = staticList.getEntityNames();
if (s != null) {
for (int i = 0; i < s.length; i++) {
try {
DataByteArrayOutputStream dos = new DataByteArrayOutputStream();
DestinationFactory.dumpDestination(getStaticQueue(s[i]), dos);
Versionable versionable = new Versionable();
versionable.addVersioned(-1, new Versioned(-1, dos.getBuffer(), dos.getCount()), "com.swiftmq.jms.DestinationFactory");
registerJNDIObject(s[i], versionable);
} catch (Exception e) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(getName(), "create static objects for '" + s[i] + "', exception=" + e);
}
}
} else if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(getName(), "no static objects defined");
staticList.setEntityAddListener(new EntityChangeAdapter(null) {
public void onEntityAdd(Entity parent, Entity newEntity) throws EntityAddException {
String name = newEntity.getName();
try {
DataByteArrayOutputStream dos = new DataByteArrayOutputStream();
DestinationFactory.dumpDestination(getStaticQueue(name), dos);
Versionable versionable = new Versionable();
versionable.addVersioned(-1, new Versioned(-1, dos.getBuffer(), dos.getCount()), "com.swiftmq.jms.DestinationFactory");
registerJNDIObject(name, versionable);
} catch (Exception e) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(getName(), "onEntityAdd (statics) for '" + name + "', exception=" + e);
throw new EntityAddException(e.getMessage());
}
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(getName(), "onEntityAdd (statics): static object=" + name);
}
});
staticList.setEntityRemoveListener(new EntityChangeAdapter(null) {
public void onEntityRemove(Entity parent, Entity delEntity) throws EntityRemoveException {
String name = delEntity.getName();
deregisterJNDIObject(name);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(getName(), "onEntityRemove (statics): static=" + name);
}
});
}
use of com.swiftmq.tools.versioning.Versioned in project swiftmq-ce by iitsoftware.
the class QueueManagerImpl method registerJNDI.
private void registerJNDI(String name, QueueImpl queue) {
try {
String localName = stripLocalName(name);
DataByteArrayOutputStream dos = new DataByteArrayOutputStream();
DestinationFactory.dumpDestination(queue, dos);
Versionable versionable = new Versionable();
versionable.addVersioned(-1, new Versioned(-1, dos.getBuffer(), dos.getCount()), "com.swiftmq.jms.DestinationFactory");
ctx.jndiSwiftlet.registerJNDIObject(name, versionable);
registerJNDIAlias(localName, name);
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations