Search in sources :

Example 1 with DumpableFactory

use of com.swiftmq.tools.dump.DumpableFactory in project swiftmq-client by iitsoftware.

the class Versionable method create.

private Object create(VEntry entry) throws Exception {
    DataByteArrayInputStream dis = new DataByteArrayInputStream();
    dis.setBuffer(entry.versioned.getPayload(), 0, entry.versioned.getLength());
    Object obj = null;
    if (entry.version == -1) {
        obj = DestinationFactory.createDestination(dis);
    } else {
        DumpableFactory factory = null;
        if (classLoader == null)
            factory = (DumpableFactory) Class.forName(entry.factoryClass).newInstance();
        else
            factory = (DumpableFactory) classLoader.loadClass(entry.factoryClass).newInstance();
        Dumpable d = factory.createDumpable(dis.readInt());
        d.readContent(dis);
        obj = d;
    }
    return obj;
}
Also used : DumpableFactory(com.swiftmq.tools.dump.DumpableFactory) DataByteArrayInputStream(com.swiftmq.tools.util.DataByteArrayInputStream) Dumpable(com.swiftmq.tools.dump.Dumpable)

Example 2 with DumpableFactory

use of com.swiftmq.tools.dump.DumpableFactory in project swiftmq-client by iitsoftware.

the class CommandRegistry method readContent.

public void readContent(DataInput in) throws IOException {
    DumpableFactory factory = new MgmtFactory();
    contextName = readDump(in);
    if (in.readByte() == 1)
        myEntity = (Entity) Dumpalizer.construct(in, factory);
    commands = new ArrayList();
    int size = in.readInt();
    for (int i = 0; i < size; i++) {
        commands.add(Dumpalizer.construct(in, factory));
    }
}
Also used : ArrayList(java.util.ArrayList) DumpableFactory(com.swiftmq.tools.dump.DumpableFactory)

Aggregations

DumpableFactory (com.swiftmq.tools.dump.DumpableFactory)2 Dumpable (com.swiftmq.tools.dump.Dumpable)1 DataByteArrayInputStream (com.swiftmq.tools.util.DataByteArrayInputStream)1 ArrayList (java.util.ArrayList)1