Package com.opengamma.master.config

Examples of com.opengamma.master.config.ConfigMaster


    return false;
  }

  private void removeViewDefinition(ViewDefinition viewDefinition) {
    s_logger.debug("Removing ViewDefintion with id: {}", viewDefinition.getUniqueId());
    ConfigMaster configMaster = _toolContext.getConfigMaster();
    configMaster.remove(viewDefinition.getUniqueId().getObjectId());
    s_logger.debug("ViewDefinition {} removed", viewDefinition.getUniqueId());
  }
View Full Code Here


  @Override
  protected void doRun() throws Exception {
    String scriptLocation = getCommandLine().getOptionValue('s');
    ConfigSource configSource = getToolContext().getConfigSource();
    ConfigMaster configMaster = getToolContext().getConfigMaster();

    Scenario scenario = SimulationUtils.createScenarioFromDsl(scriptLocation, null);
    ConfigItem<ScenarioDefinition> configItem = ConfigItem.of(scenario.createDefinition(), scenario.getName());
    if (getCommandLine().hasOption('i')) {
      ObjectId scenarioId = ObjectId.parse(getCommandLine().getOptionValue('i'));
      UniqueId latestScenarioId = configSource.get(scenarioId, VersionCorrection.LATEST).getUniqueId();
      configItem.setUniqueId(latestScenarioId);
      configMaster.update(new ConfigDocument(configItem));
    } else {
      configMaster.add(new ConfigDocument(configItem));
    }
  }
View Full Code Here

 
  @Override
  protected void doRun() throws Exception {
    CommandLine commandLine = getCommandLine();
    ToolContext toolContext = getToolContext();
    ConfigMaster configMaster = toolContext.getConfigMaster();

    MultiFileConfigSaver saver = new MultiFileConfigSaver();
    saver.setDestinationDirectory(commandLine.getOptionValue("d"));
    saver.setConfigMaster(configMaster);
    saver.run();
View Full Code Here

    return Collections.emptySet();
  }

  protected UniqueId storeViewDefinition(final FunctionExecutionContext executionContext, final UniqueId targetId, final ViewDefinition viewDefinition) {
    final String name = targetId.toString(); // Use the tempTarget identifier as a name to reuse an existing config item
    final ConfigMaster master = OpenGammaExecutionContext.getConfigMaster(executionContext);
    if (master == null) {
      throw new IllegalStateException("Execution context does not contain a " + OpenGammaExecutionContext.CONFIG_MASTER_NAME);
    }
    final ConfigSearchRequest<ViewDefinition> request = new ConfigSearchRequest<ViewDefinition>(ViewDefinition.class);
    request.setName(name);
    final ConfigSearchResult<ViewDefinition> result = master.search(request);
    if (result.getDocuments() != null) {
      for (final ConfigDocument document : result.getDocuments()) {
        if (viewDefinition.equals(document.getValue().getValue())) {
          // Found a matching one
          s_logger.debug("Using previous view definition {}", document.getUniqueId());
          return document.getUniqueId();
        } else {
          // Found a dead one; either our temp target unique identifiers are not unique (different repositories MUST have different schemes) or the identifier
          // sequence has been restarted/repeated and is colliding with old or dead configuration documents.
          s_logger.info("Deleting expired view definition {}", document.getUniqueId());
          master.removeVersion(document.getUniqueId());
        }
      }
    }
    final ConfigItem<ViewDefinition> item = ConfigItem.of(viewDefinition);
    item.setName(name);
    final UniqueId uid = master.add(new ConfigDocument(item)).getUniqueId();
    s_logger.info("Created new view definition {} for {}", uid, name);
    return uid;
  }
View Full Code Here

    s_logger.info("loading configs");
    AbstractTool<ToolContext> remoteServerTool = new AbstractTool<ToolContext>() {

      @Override
      protected void doRun() throws Exception {
        final ConfigMaster remoteConfigMaster = getToolContext().getConfigMaster();
        final PortfolioMaster remotePortfolioMaster = getToolContext().getPortfolioMaster();
        ConfigSaver configSaver = new ConfigSaver(remoteConfigMaster, remotePortfolioMaster, new ArrayList<String>(), new ArrayList<String>(), true, true);
        ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
        PrintStream outputStream = new PrintStream(byteArrayOutput);
        configSaver.saveConfigs(outputStream);
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  protected void doRun() {
    ToolContext toolContext = getToolContext();
    ConfigMaster configMaster = toolContext.getConfigMaster();

    CommandLine commandLine = getCommandLine();
    final String name = commandLine.getOptionValue("name", WILDCARD_SEARCH);
    final boolean dryRun = commandLine.hasOption("do-not-persist");
    final boolean skipExisting = commandLine.hasOption("skip");
View Full Code Here

   *
   * @param name the pattern to match securities
   * @param dryRun set to true to not write to the database
   */
  private void createSurfaces(String name, boolean dryRun) {
    ConfigMaster configMaster = getToolContext().getConfigMaster();
    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    ReferenceDataProvider bbgRefData = getToolContext().getBloombergReferenceDataProvider();

    SecuritySearchRequest securityRequest = new SecuritySearchRequest();
    securityRequest.setName(name);
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  protected void doRun() {
    ToolContext toolContext = getToolContext();
    ConfigMaster configMaster = toolContext.getConfigMaster();
    PortfolioMaster portfolioMaster = toolContext.getPortfolioMaster();
    CommandLine commandLine = getCommandLine();
    @SuppressWarnings("unchecked")
    List<String> fileList = commandLine.getArgList();
    boolean portPortfolioRefs = commandLine.hasOption("portable-portfolios");
View Full Code Here

    Set<ExternalId> curveNodesExternalIds;

    Set<ExternalId> initialRateExternalIds;

    final ConfigSource configSource = getToolContext().getConfigSource();
    final ConfigMaster configMaster = getToolContext().getConfigMaster();

    // Find all matching curves
    final List<YieldCurveDefinition> curves = getCurveDefinitionNames(configMaster, getCommandLine().getOptionValue(CURVE_NAME_OPT));

    // Get initial rate hts external ids for curves
View Full Code Here

  public void iterateError() throws Exception {
    ConfigSearchRequest<ExternalId> request = new ConfigSearchRequest<ExternalId>();
    request.setType(ExternalId.class);
    request.setSortOrder(ConfigSearchSortOrder.NAME_ASC);
   
    ConfigMaster mockMaster = mock(ConfigMaster.class);
    when(mockMaster.search(any(ConfigSearchRequest.class))).thenThrow(new IllegalStateException());
   
    ConfigSearchIterator<ExternalId> iterator = new ConfigSearchIterator<ExternalId>(mockMaster, request);
    iterator.hasNext();
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.config.ConfigMaster

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.