Examples of DbToolContext


Examples of com.opengamma.util.db.tool.DbToolContext

  private String _schemaNamesList;

  //-------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) {
    DbToolContext dbToolContext = new DbToolContext();
    Map<String, MetaProperty<?>> mapTarget = new HashMap<String, MetaProperty<?>>(dbToolContext.metaBean().metaPropertyMap());
    mapTarget.keySet().retainAll(this.metaBean().metaPropertyMap().keySet());
    for (MetaProperty<?> mp : mapTarget.values()) {
      mp.set(dbToolContext, mp.get(this));
    }
    final String catalog = getCatalog(getJdbcUrl());
    if (catalog != null) {
      dbToolContext.setCatalog(catalog);
    }
    if (getSchemaNamesList() != null) {
      Set<String> schemaGroups = new HashSet<String>();
      for (String schemaGroup : getSchemaNamesList().split(",")) {
        schemaGroups.add(schemaGroup.toLowerCase().trim());
      }
      dbToolContext.setSchemaNames(schemaGroups);
    }
    repo.registerComponent(DbToolContext.class, getClassifier(), dbToolContext);
  }
View Full Code Here

Examples of com.opengamma.util.db.tool.DbToolContext

    Integer expectedSchemaVersion = DbScriptUtils.getCurrentVersion(schemaName);
    if (expectedSchemaVersion == null) {
      throw new OpenGammaRuntimeException("Unable to find schema version information for " + schemaName + ". Database objects cannot be managed.");
    }
    // DbToolContext should not be closed as DbConnector needs to remain started
    DbToolContext dbToolContext = new DbToolContext();
    dbToolContext.setDbConnector(getDbConnector());
    dbToolContext.setDbManagement(dbManagement);
    dbToolContext.setCatalog(catalog);
    dbToolContext.setSchemaNames(ImmutableSet.of(schemaName));
    if (actualSchemaVersion == null) {
      // Assume empty database, so attempt to create tables
      DbCreateOperation createOperation = new DbCreateOperation(dbToolContext, true, null, false);
      createOperation.execute();
    } else if (actualSchemaVersion < expectedSchemaVersion) {
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.