String lookup = getLookup(cmd);
if (lookup==null || lookup.length()==0) {
LOG.error("Unable to get command lookup attribute: " + lookup);
throw new CheckedDroolsException("Unable to get command lookup attribute: " + lookup);
}
KnowledgeServiceConfiguration serviceConfiguration = configurations.get(lookup);
if (serviceConfiguration==null) {
LOG.error("Unable to lookup session: " + lookup);
throw new CheckedDroolsException("Unable to lookup session: " + lookup);
}
if ("JAXB".equals(serviceConfiguration.getMarshaller())) {
JAXBContext jaxbContext = serviceConfiguration.getContext();
return new String((byte[])template.requestBodyAndHeader("direct:with-session-jaxb", cmd, "jaxb-context", jaxbContext));
}
else if ("XSTREAM".equals(serviceConfiguration.getMarshaller())) {
return new String((byte[])template.requestBody("direct:with-session-xstream", cmd));
}
return null;
}