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;
}
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();
}
}
Aggregations