Search in sources :

Example 16 with EntityList

use of com.swiftmq.mgmt.EntityList in project swiftmq-ce by iitsoftware.

the class TransformerFactory method createOutboundTransformer.

public OutboundTransformer createOutboundTransformer(long messageFormat, String destination) throws Exception {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", createOutboundTransformer, messageFormat=" + messageFormat + ", destination=" + destination + " ...");
    Entity result = null;
    Entity dest = destinationTransformerList.getEntity(destination);
    if (dest != null) {
        EntityList outboundList = (EntityList) dest.getEntity("outbound-transformers");
        if (outboundList != null)
            result = outboundList.getEntity(String.valueOf(messageFormat));
    }
    if (result == null) {
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", createOutboundTransformer, messageFormat=" + messageFormat + ", destination=" + destination + ", no destination transformer found, using default");
        result = defaultOutboundTransformerList.getEntity(String.valueOf(messageFormat));
    }
    OutboundTransformer outboundTransformer = null;
    if (result != null) {
        outboundTransformer = (OutboundTransformer) Class.forName((String) result.getProperty("class-name").getValue()).newInstance();
        outboundTransformer.setConfiguration(toMap((EntityList) result.getEntity("properties")));
    }
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", createOutboundTransformer, messageFormat=" + messageFormat + ", destination=" + destination + " returns " + outboundTransformer);
    return outboundTransformer;
}
Also used : Entity(com.swiftmq.mgmt.Entity) EntityList(com.swiftmq.mgmt.EntityList)

Example 17 with EntityList

use of com.swiftmq.mgmt.EntityList in project swiftmq-ce by iitsoftware.

the class RouteTable method removeUsageEntity.

private void removeUsageEntity(Route route) {
    try {
        Entity destEntity = dynRoutes.getEntity(route.getDestinationRouter());
        if (destEntity != null) {
            EntityList routes = (EntityList) destEntity.getEntity("dynamic-routes");
            Entity re = routes.getEntity(route.getKey());
            if (re != null) {
                routes.removeEntity(re);
            }
            Map map = routes.getEntities();
            if (map == null || map.size() == 0)
                dynRoutes.removeEntity(destEntity);
        }
    } catch (EntityRemoveException e) {
        e.printStackTrace();
    }
}
Also used : Entity(com.swiftmq.mgmt.Entity) EntityList(com.swiftmq.mgmt.EntityList) EntityRemoveException(com.swiftmq.mgmt.EntityRemoveException)

Aggregations

EntityList (com.swiftmq.mgmt.EntityList)17 Entity (com.swiftmq.mgmt.Entity)15 EntityRemoveException (com.swiftmq.mgmt.EntityRemoveException)8 Iterator (java.util.Iterator)5 Map (java.util.Map)5 EntityAddException (com.swiftmq.mgmt.EntityAddException)4 QueueException (com.swiftmq.swiftlet.queue.QueueException)2 QueueTransactionClosedException (com.swiftmq.swiftlet.queue.QueueTransactionClosedException)2 JMSException (javax.jms.JMSException)2 JobFactoryAdded (com.swiftmq.impl.scheduler.standard.po.JobFactoryAdded)1 ManagementProcessor (com.swiftmq.impl.streams.processor.ManagementProcessor)1 Property (com.swiftmq.mgmt.Property)1 JobParameter (com.swiftmq.swiftlet.scheduler.JobParameter)1 XAContextException (com.swiftmq.swiftlet.xa.XAContextException)1 File (java.io.File)1 FilenameFilter (java.io.FilenameFilter)1 Properties (java.util.Properties)1 XAException (javax.transaction.xa.XAException)1