Search in sources :

Example 1 with Versioned

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());
}
Also used : DataByteArrayOutputStream(com.swiftmq.tools.util.DataByteArrayOutputStream) Versioned(com.swiftmq.tools.versioning.Versioned)

Example 2 with Versioned

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();
    }
}
Also used : Versionable(com.swiftmq.tools.versioning.Versionable) DataByteArrayOutputStream(com.swiftmq.tools.util.DataByteArrayOutputStream) Versioned(com.swiftmq.tools.versioning.Versioned) IOException(java.io.IOException)

Example 3 with Versioned

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());
}
Also used : DataByteArrayOutputStream(com.swiftmq.tools.util.DataByteArrayOutputStream) Versioned(com.swiftmq.tools.versioning.Versioned)

Example 4 with Versioned

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);
        }
    });
}
Also used : Versionable(com.swiftmq.tools.versioning.Versionable) DataByteArrayOutputStream(com.swiftmq.tools.util.DataByteArrayOutputStream) Versioned(com.swiftmq.tools.versioning.Versioned) SwiftletException(com.swiftmq.swiftlet.SwiftletException)

Example 5 with Versioned

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();
    }
}
Also used : Versionable(com.swiftmq.tools.versioning.Versionable) DataByteArrayOutputStream(com.swiftmq.tools.util.DataByteArrayOutputStream) Versioned(com.swiftmq.tools.versioning.Versioned) IOException(java.io.IOException)

Aggregations

DataByteArrayOutputStream (com.swiftmq.tools.util.DataByteArrayOutputStream)7 Versioned (com.swiftmq.tools.versioning.Versioned)7 Versionable (com.swiftmq.tools.versioning.Versionable)5 IOException (java.io.IOException)2 SwiftletException (com.swiftmq.swiftlet.SwiftletException)1 UnknownHostException (java.net.UnknownHostException)1