Package com.opengamma.engine.view

Examples of com.opengamma.engine.view.ViewProcessorFactoryBean


  private FunctionResolver _functionResolver;
  private ConfigSource _configSource;
  private ViewResultListenerFactory _viewResultListenerFactory;

  public void init() {
    final ViewProcessorFactoryBean vpFactBean = new ViewProcessorFactoryBean();
    vpFactBean.setName("test");

    final FudgeContext fudgeContext = OpenGammaFudgeContext.getInstance();
    final SecuritySource securitySource = getSecuritySource() != null ? getSecuritySource() : generateSecuritySource();
    final FunctionCompilationContext functionCompilationContext = getFunctionCompilationContext() != null ? getFunctionCompilationContext() : generateFunctionCompilationContext();

    final ConfigSource configSource = getConfigSource() != null ? getConfigSource() : generateConfigSource();

    final InMemoryViewComputationCacheSource cacheSource = new InMemoryViewComputationCacheSource(fudgeContext);
    vpFactBean.setComputationCacheSource(cacheSource);

    final DependencyGraphExecutorFactory dependencyGraphExecutorFactory = getDependencyGraphExecutorFactory() != null ? getDependencyGraphExecutorFactory()
        : generateDependencyGraphExecutorFactory();
    vpFactBean.setDependencyGraphExecutorFactory(dependencyGraphExecutorFactory);

    final FunctionRepository functionRepository = getFunctionRepository() != null ? getFunctionRepository() : generateFunctionRepository();
    final CompiledFunctionService compiledFunctions = new CompiledFunctionService(functionRepository, new CachingFunctionRepositoryCompiler(), functionCompilationContext);
    compiledFunctions.initialize();
    vpFactBean.setFunctionCompilationService(compiledFunctions);

    final MarketDataProviderResolver marketDataProviderResolver = getMarketDataProviderResolver() != null ? getMarketDataProviderResolver() : generateMarketDataProviderResolver();
    vpFactBean.setMarketDataProviderResolver(marketDataProviderResolver);

    vpFactBean.setConfigSource(configSource);
    vpFactBean.setViewPermissionProvider(new DefaultViewPermissionProvider());
    vpFactBean.setNamedMarketDataSpecificationRepository(new InMemoryNamedMarketDataSpecificationRepository());
    _configSource = configSource;

    final FunctionExecutionContext functionExecutionContext = getFunctionExecutionContext() != null ? getFunctionExecutionContext() : generateFunctionExecutionContext();
    functionExecutionContext.setSecuritySource(securitySource);

    final ThreadLocalLogEventListener threadLocalLogListener = new ThreadLocalLogEventListener();
    LogBridge.getInstance().addListener(threadLocalLogListener);
    final SimpleCalculationNode localCalcNode = new SimpleCalculationNode(cacheSource, compiledFunctions, functionExecutionContext, "node", Executors.newCachedThreadPool(),
        new DiscardingInvocationStatisticsGatherer(), new CalculationNodeLogEventListener(threadLocalLogListener));
    final LocalNodeJobInvoker jobInvoker = new LocalNodeJobInvoker(localCalcNode);
    vpFactBean.setComputationJobDispatcher(new JobDispatcher(jobInvoker));
    vpFactBean.setFunctionResolver(generateFunctionResolver(compiledFunctions));
    vpFactBean.setViewResultListenerFactory(_viewResultListenerFactory);
    _viewProcessor = (ViewProcessorImpl) vpFactBean.createObject();
  }
View Full Code Here

TOP

Related Classes of com.opengamma.engine.view.ViewProcessorFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.