return new ExportResourceModel(tasks);
}
private void executeHandlers(ManagedResource resource, final OperationContext operationContext, PathAddress address, String operationName, StepResultHandler<ExportResourceModel> stepResultHandler)
{
OperationHandler handler = resource.getOperationHandler(address, operationName);
if (handler != null && handler != this)
{
List<String> filterAttributes = operationContext.getAttributes().getValues("filter");
PathTemplateFilter filter;
try
{
filter = PathTemplateFilter.parse(filterAttributes);
}
catch (ParseException e)
{
throw new OperationException(operationName, "Could not parse filter attributes.", e);
}
if (address.accepts(filter))
{
handler.execute(operationContext, stepResultHandler);
}
}
else
{
ManagedResource found = resource.getSubResource(address);
if (found == null)
{
throw new OperationException(operationName, "Could not locate resource at address " + address);
}
OperationHandler readResource = resource.getOperationHandler(address, OperationNames.READ_RESOURCE);
BasicResultHandler readResourceResult = new BasicResultHandler();
readResource.execute(operationContext, readResourceResult);
if (readResourceResult.getFailureDescription() != null)
{
throw new OperationException(operationName, "Failure '" + readResourceResult.getFailureDescription() + "' encountered executing " + OperationNames.READ_RESOURCE);
}