Examples of DependencyGraphBuilder


Examples of com.opengamma.engine.depgraph.DependencyGraphBuilder

    assertEquals(res2.getProperty("FundingCurve"), "BarFunding");
    assertEquals(res2.getProperty("Currency"), "USD");
  }

  public void testTradeSpecific() {
    final DependencyGraphBuilder builder = createBuilder();
    final ViewCalculationConfiguration config = builder.getCompilationContext().getViewCalculationConfiguration();
    final PositionSource positions = builder.getCompilationContext().getPortfolioStructure().getPositionSource();
    final Trade trade1 = getTrade(positions, "TradeAttr");
    config.setDefaultProperties(ValueProperties.with("TRADE.*.DEFAULT_ForwardCurve." + trade1.getUniqueId(), "BarForward")
        .with("TRADE.Present Value.DEFAULT_FundingCurve." + trade1.getUniqueId(), "BarFunding").get());
    final ValueRequirement req1 = createValueRequirement(ComputationTargetSpecification.of(trade1), ValueProperties.none());
    final ValueRequirement req2 = createValueRequirement(ComputationTargetSpecification.of(getTrade(positions, "Trade")), ValueProperties.none());
    builder.addTarget(req1);
    builder.addTarget(req2);
    builder.getDependencyGraph();
    final ValueSpecification res1 = builder.getValueRequirementMapping().get(req1);
    final ValueSpecification res2 = builder.getValueRequirementMapping().get(req2);
    assertEquals(res1.getProperty("ForwardCurve"), "BarForward");
    assertEquals(res1.getProperty("FundingCurve"), "BarFunding");
    assertEquals(res1.getProperty("Currency"), "USD");
    assertEquals(res2.getProperty("ForwardCurve"), "DefaultForward");
    assertEquals(res2.getProperty("FundingCurve"), "DefaultFunding");
View Full Code Here

Examples of com.opengamma.engine.depgraph.DependencyGraphBuilder

    assertEquals(res2.getProperty("FundingCurve"), "DefaultFunding");
    assertEquals(res2.getProperty("Currency"), "USD");
  }

  public void testTradeSpecificOverride() {
    final DependencyGraphBuilder builder = createBuilder();
    final ViewCalculationConfiguration config = builder.getCompilationContext().getViewCalculationConfiguration();
    final PositionSource positions = builder.getCompilationContext().getPortfolioStructure().getPositionSource();
    final Trade trade1 = getTrade(positions, "TradeAttr");
    config.setDefaultProperties(ValueProperties.with("TRADE.Present Value.DEFAULT_ForwardCurve", "GenericForward").with("TRADE.*.DEFAULT_FundingCurve", "GenericFunding")
        .with("TRADE.*.DEFAULT_ForwardCurve." + trade1.getUniqueId(), "BarForward").with("TRADE.Present Value.DEFAULT_FundingCurve." + trade1.getUniqueId(), "BarFunding").get());
    final ValueRequirement req1 = createValueRequirement(ComputationTargetSpecification.of(trade1), ValueProperties.none());
    final ValueRequirement req2 = createValueRequirement(ComputationTargetSpecification.of(getTrade(positions, "Trade")), ValueProperties.none());
    builder.addTarget(req1);
    builder.addTarget(req2);
    builder.getDependencyGraph();
    final ValueSpecification res1 = builder.getValueRequirementMapping().get(req1);
    final ValueSpecification res2 = builder.getValueRequirementMapping().get(req2);
    assertEquals(res1.getProperty("ForwardCurve"), "BarForward");
    assertEquals(res1.getProperty("FundingCurve"), "BarFunding");
    assertEquals(res1.getProperty("Currency"), "USD");
    assertEquals(res2.getProperty("ForwardCurve"), "GenericForward");
    assertEquals(res2.getProperty("FundingCurve"), "GenericFunding");
View Full Code Here

Examples of com.opengamma.engine.depgraph.DependencyGraphBuilder

    assertEquals(res2.getProperty("FundingCurve"), "GenericFunding");
    assertEquals(res2.getProperty("Currency"), "USD");
  }

  public void testTradeAttribute() {
    final DependencyGraphBuilder builder = createBuilder();
    final PositionSource positions = builder.getCompilationContext().getPortfolioStructure().getPositionSource();
    final ValueRequirement req1 = createValueRequirement(ComputationTargetSpecification.of(getTrade(positions, "TradeAttr")), ValueProperties.none());
    builder.addTarget(req1);
    builder.getDependencyGraph();
    final ValueSpecification res1 = builder.getValueRequirementMapping().get(req1);
    assertEquals(res1.getProperty("ForwardCurve"), "FooForward");
    assertEquals(res1.getProperty("FundingCurve"), "FooFunding");
    assertEquals(res1.getProperty("Currency"), "USD");
  }
View Full Code Here

Examples of com.opengamma.engine.depgraph.DependencyGraphBuilder

    protected abstract void compile(DependencyGraphBuilder builder);

    protected void compile() {
      final Iterator<DependencyGraphBuilder> builders = getContext().getBuilders().iterator();
      while (builders.hasNext()) {
        final DependencyGraphBuilder builder = builders.next();
        compile(builder);
        // TODO: Use a heuristic to decide whether to let the graph builds run in parallel, or sequentially. We will force sequential builds for the time being.
        // Wait for the current config's dependency graph to be built before moving to the next view calc config
        final DependencyGraph graph = builder.getDependencyGraph();
        graph.removeUnnecessaryValues();
        getContext().getGraphs().add(graph);
        builders.remove();
        s_logger.debug("Built {}", graph);
      }
View Full Code Here

Examples of com.opengamma.engine.depgraph.DependencyGraphBuilder

            if (missing.isEmpty()) {
              // No requirements ejected from this graph - keep it
              getContext().getGraphs().add(graph);
            } else {
              s_logger.info("Late changes detected affecting {} requirements", missing.size());
              final DependencyGraphBuilder builder = getContext().createBuilder(getContext().getViewDefinition().getCalculationConfiguration(graph.getCalculationConfigurationName()));
              if (getPortfolio() != null) {
                builder.getCompilationContext().setPortfolio(getPortfolio());
              }
              builder.setDependencyGraph(filtered);
              builder.addTarget(missing);
              missing.clear();
              getContext().getGraphs().add(builder.getDependencyGraph());
            }
          }
        }
      }
    }
View Full Code Here

Examples of com.opengamma.engine.depgraph.DependencyGraphBuilder

    _graphs = new ArrayList<DependencyGraph>(_builders.size());
    _activeResolutions = resolutions;
  }

  public DependencyGraphBuilder createBuilder(final ViewCalculationConfiguration calcConfig) {
    final DependencyGraphBuilder builder = _services.getDependencyGraphBuilder().newInstance();
    builder.setCalculationConfigurationName(calcConfig.getName());
    builder.setMarketDataAvailabilityProvider(_services.getMarketDataAvailabilityProvider());
    final FunctionCompilationContext compilationContext = _services.getFunctionCompilationContext().clone();
    compilationContext.setViewCalculationConfiguration(calcConfig);
    compilationContext.setComputationTargetResolver(_targetResolver);
    final Collection<ResolutionRule> transformedRules = calcConfig.getResolutionRuleTransform().transform(_rules);
    compilationContext.setComputationTargetResults(new ComputationTargetResults(transformedRules));
    final DefaultCompiledFunctionResolver functionResolver = new DefaultCompiledFunctionResolver(compilationContext, transformedRules);
    functionResolver.compileRules();
    builder.setFunctionResolver(functionResolver);
    compilationContext.init();
    builder.setCompilationContext(compilationContext);
    return builder;
  }
View Full Code Here

Examples of org.apache.maven.shared.dependency.graph.DependencyGraphBuilder

  public final Collection<? extends URL> getChangeLogResources() throws ArtifactResolutionException, DependencyGraphBuilderException, IOException {
    final MavenProject project = this.getProject();
    if (project == null) {
      throw new IllegalStateException("this.getProject()", new NullPointerException("this.getProject()"));
    }
    final DependencyGraphBuilder dependencyGraphBuilder = this.getDependencyGraphBuilder();
    if (dependencyGraphBuilder == null) {
      throw new IllegalStateException("this.getDependencyGraphBuilder()", new NullPointerException("this.getDependencyGraphBuilder()"));
    }
    final ArtifactResolver resolver = this.getArtifactResolver();
    if (resolver == null) {
View Full Code Here

Examples of org.apache.maven.shared.dependency.graph.DependencyGraphBuilder

        try
        {
            String hint = isMaven31() ? "maven31" : isMaven2x() ? "maven2" : "maven3";
            getLogger().debug( "building " + hint + " dependency graph for " + project.getId() );

            DependencyGraphBuilder effectiveGraphBuilder =
                (DependencyGraphBuilder) container.lookup( DependencyGraphBuilder.class.getCanonicalName(), hint );

            return effectiveGraphBuilder.buildDependencyGraph( project, filter );
        }
        catch ( ComponentLookupException e )
        {
            throw new DependencyGraphBuilderException( e.getMessage(), e );
        }
View Full Code Here

Examples of org.apache.maven.shared.dependency.graph.DependencyGraphBuilder

    {
        try
        {
            String hint = isMaven31() ? "maven31" : isMaven2x() ? "maven2" : "maven3";

            DependencyGraphBuilder effectiveGraphBuilder =
                (DependencyGraphBuilder) container.lookup( DependencyGraphBuilder.class.getCanonicalName(), hint );
            getLogger().debug( "building " + hint + " dependency graph for " + project.getId() + " with "
                                   + effectiveGraphBuilder.getClass().getSimpleName() );

            return effectiveGraphBuilder.buildDependencyGraph( project, filter, reactorProjects );
        }
        catch ( ComponentLookupException e )
        {
            throw new DependencyGraphBuilderException( e.getMessage(), e );
        }
View Full Code Here

Examples of org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder

                    conflictResolver = new LatestModuleConflictResolver(versionComparator);
                }
                conflictResolver = new VersionSelectionReasonResolver(conflictResolver);
                ConflictHandler conflictHandler = new DefaultConflictHandler(conflictResolver, metadataHandler.getModuleMetadataProcessor().getModuleReplacements());

                DependencyGraphBuilder builder = new DependencyGraphBuilder(idResolver, metaDataResolver, projectDependencyResolver, artifactResolver, conflictHandler, new DefaultDependencyToConfigurationResolver());

                StoreSet stores = storeFactory.createStoreSet();

                BinaryStore newModelStore = stores.nextBinaryStore();
                Store<ResolvedComponentResult> newModelCache = stores.oldModelStore();
                ResolutionResultBuilder newModelBuilder = new StreamingResolutionResultBuilder(newModelStore, newModelCache);

                BinaryStore oldModelStore = stores.nextBinaryStore();
                Store<TransientConfigurationResults> oldModelCache = stores.newModelStore();
                TransientConfigurationResultsBuilder oldTransientModelBuilder = new TransientConfigurationResultsBuilder(oldModelStore, oldModelCache);
                DefaultResolvedConfigurationBuilder oldModelBuilder = new DefaultResolvedConfigurationBuilder(oldTransientModelBuilder);

                builder.resolve(configuration, newModelBuilder, oldModelBuilder);
                DefaultLenientConfiguration result = new DefaultLenientConfiguration(configuration, oldModelBuilder, cacheLockingManager);
                results.resolved(new DefaultResolvedConfiguration(result), newModelBuilder.complete());
            }
        });
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.