public KeelResponse execute(KeelRequest request) throws ModelException
{
if (getContainer() == null)
{
throw new ModelException("Initialization failed - container is null");
}
ModelRequest req = null;
try
{
Object o = getContainer().getService(ModelRequest.ROLE);
if (o == null)
{
getLogger().error("Service returned was null");
}
req = (ModelRequest) o;
}
catch (Exception se)
{
getLogger().error("Service Exception:", se);
throw new ModelException("Service Exception getting request", se);
}
try
{
req.copyFrom(request);
}
catch (Exception ee)
{
getLogger().error("Error copying ModelRequestMessage to ModelRequest", ee);
}
// Set the context to that provided in the original request
if (req instanceof KeelContextualizable)
{
try
{
((KeelContextualizable) req).setKeelContext(getContext(req));
}
catch (ContextException e)
{
throw new ModelException("Unable to set keel context on ModelRequest", e);
}
}
getLogger().debug("Executing model " + req.getModel());