@Override
public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target,
final Set<ValueRequirement> desiredValues) throws AsynchronousExecution {
final ViewEvaluationTarget viewEvaluation = (ViewEvaluationTarget) target.getValue();
final UniqueId viewId = storeViewDefinition(executionContext, target.getUniqueId(), viewEvaluation.getViewDefinition());
final ViewProcessor viewProcessor = OpenGammaExecutionContext.getViewProcessor(executionContext);
if (viewProcessor == null) {
throw new IllegalStateException("Execution context does not contain a " + OpenGammaExecutionContext.VIEW_PROCESSOR_NAME);
}
final ViewClient viewClient = viewProcessor.createViewClient(viewEvaluation.getViewDefinition().getMarketDataUser());
final UniqueId viewClientId = viewClient.getUniqueId();
s_logger.info("Created view client {}, connecting to {}", viewClientId, viewId);
viewClient.attachToViewProcess(viewId,
ExecutionOptions.of(viewEvaluation.getExecutionSequence().createSequence(executionContext), getDefaultCycleOptions(executionContext), getViewExecutionFlags(desiredValues)), true);
final TResultBuilder resultBuilder = createResultBuilder(viewEvaluation, desiredValues);