Initialize sharding transaction managers.

@param databaseType database type
@param dataSourceMap data source map
775384
public void init(final DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) {
        for (Entry<TransactionType, ShardingTransactionManager> entry : transactionManagerMap.entrySet()) {
            entry.getValue().init(databaseType, getResourceDataSources(dataSourceMap));
        }
    }
569740
public static AbstractDescribeParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) {
        switch (dbType) {
            case H2:
            case MySQL:
                return new MySQLDescribeParser(shardingRule, lexerEngine);
            default:
                throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType));
        }
    }
1207219
public void setDataSource(DataSource dataSource) {
        mDataSource = dataSource;
        mDriverClassName = null;
        mURL = null;
        mUsername = null;
        mPassword = null;
    }
704822
public static DataSource createDataSource(final byte[] yamlBytes) throws SQLException, IOException {
        YamlRootShardingConfiguration config = YamlEngine.unmarshal(yamlBytes, YamlRootShardingConfiguration.class);
        return ShardingDataSourceFactory.createDataSource(config.getDataSources(), new ShardingRuleConfigurationYamlSwapper().swap(config.getShardingRule()), config.getProps());
    }
898977
public void init(final Map<String, Map<String, YamlDataSourceParameter>> schemaDataSources, final Map<String, RuleConfiguration> schemaRules) {
        init(schemaRules.keySet(), schemaDataSources, schemaRules, false);
    }
1068192
public static SQLParser newInstance(final DatabaseType databaseType, final String sql) {
        for (ShardingParseEngine each : NewInstanceServiceLoader.newServiceInstances(ShardingParseEngine.class)) {
            if (DatabaseType.valueOf(each.getDatabaseType()) == databaseType) {
                return each.createSQLParser(sql);
            }
        }
        throw new UnsupportedOperationException(String.format("Cannot support database type '%s'", databaseType));
    }
268051
public void assignManagedTypes(Map<Class<?>, EntityType<?>> managedTypes)
    {
        if (this.entityTypes == null)
        {
            this.entityTypes = managedTypes;
        }
        else
        {
            this.entityTypes.putAll(managedTypes);
        }
    }
438038
private static synchronized void addDatabaseObject(String type,
            String path, Database db) {

        // A VoltDB extension to work around ENG-6044
        /* disable 15 lines ...
        Object  key = path;

        HashMap databaseMap;

        if (type == DatabaseURL.S_FILE) {
            databaseMap = fileDatabaseMap;
            key         = filePathToKey(path);
        } else if (type == DatabaseURL.S_RES) {
            databaseMap = resDatabaseMap;
        } else if (type == DatabaseURL.S_MEM) {
            databaseMap = memDatabaseMap;
        } else {
            throw Error.runtimeError(ErrorCode.U_S0500,
                                     "DatabaseManager.addDatabaseObject()");
        }
           ... disabled 15 lines */

        assert(type == DatabaseURL.S_MEM);
        java.util.HashMap<String, Database> databaseMap = memDatabaseMap;
        String key = path;
        // End of VoltDB extension

        databaseIDMap.put(db.databaseID, db);
        databaseMap.put(key, db);
    }
780528
public static void configureCacheStore(MappedParametrizedObjectEntry parameterEntry,
                                          String dataSourceParamName, String dataColumnParamName, String idColumnParamName, String timeColumnParamName, String dialectParamName)
      throws RepositoryException
   {
      String dataSourceName = parameterEntry.getParameterValue(dataSourceParamName, null);

      String dialect = parameterEntry.getParameterValue(dialectParamName, DBConstants.DB_DIALECT_AUTO).toUpperCase();

      // if data source is defined, then inject correct data-types.
      // Also it cans be not defined and nothing should be injected
      // (i.e. no cache loader is used (possibly pattern is changed, to used another cache loader))
      DataSource dataSource;
      try
      {
         dataSource = (DataSource)new InitialContext().lookup(dataSourceName);
      }
      catch (NamingException e)
      {
         throw new RepositoryException(e.getMessage(), e);
      }

      String blobType;
      String charType;
      String timeStampType;
      try
      {
         blobType = JDBCUtils.getAppropriateBlobType(dataSource);
         if (dialect.startsWith(DBConstants.DB_DIALECT_MYSQL) && dialect.endsWith("-UTF8"))
         {
            charType = "VARCHAR(255)";
         }
         else
         {
            charType = JDBCUtils.getAppropriateCharType(dataSource);
         }
         timeStampType = JDBCUtils.getAppropriateTimestamp(dataSource);
      }
      catch (SQLException e)
      {
         throw new RepositoryException(e.getMessage(), e);
      }

      // set parameters if not defined
      // if parameter is missing in configuration, then
      // getParameterValue(INFINISPAN_JDBC_CL_DATA_COLUMN, INFINISPAN_JDBC_CL_AUTO)
      // will return INFINISPAN_JDBC_CL_AUTO. If parameter is present in configuration and
      //equals to "auto", then it should be replaced
      // with correct value for given database
      if (parameterEntry.getParameterValue(dataColumnParamName, "auto").equalsIgnoreCase("auto"))
      {
         parameterEntry.putParameterValue(dataColumnParamName, blobType);
      }

      if (parameterEntry.getParameterValue(idColumnParamName, "auto").equalsIgnoreCase("auto"))
      {
         parameterEntry.putParameterValue(idColumnParamName, charType);
      }

      if (parameterEntry.getParameterValue(timeColumnParamName, "auto").equalsIgnoreCase("auto"))
      {
         parameterEntry.putParameterValue(timeColumnParamName, timeStampType);
      }
   }
37376
@Bean
    public DataSource dataSource() throws SQLException {
        Preconditions.checkState(isValidConfiguration(), "The orchestration configuration is invalid, please choose one from Sharding rule and Master-slave rule.");
        return isShardingRule() ? createShardingDataSource() : createMasterSlaveDataSource();
    }
788296
public void setDBClusterSnapshotAttributes(java.util.Collection<DBClusterSnapshotAttribute> dBClusterSnapshotAttributes) {
        if (dBClusterSnapshotAttributes == null) {
            this.dBClusterSnapshotAttributes = null;
            return;
        }

        this.dBClusterSnapshotAttributes = new com.amazonaws.internal.SdkInternalList<DBClusterSnapshotAttribute>(dBClusterSnapshotAttributes);
    }
11773
public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final MasterSlaveRuleConfiguration masterSlaveRuleConfig, final Properties props) throws SQLException {
        return new MasterSlaveDataSource(dataSourceMap, masterSlaveRuleConfig, props);
    }
846373
public final void setShardingKeys(Object shardingKey, Object superShardingKey) throws SQLException {
        if (mcf.beforeJDBCVersion(JDBCRuntimeVersion.VERSION_4_3))
            throw new SQLFeatureNotSupportedException();

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "Set sharding key/super sharding key to " + shardingKey + "/" + superShardingKey); 

        mcf.jdbcRuntime.doSetShardingKeys(sqlConn, shardingKey, superShardingKey);
        currentShardingKey = shardingKey;
        if (superShardingKey != JDBCRuntimeVersion.SUPER_SHARDING_KEY_UNCHANGED)
            currentSuperShardingKey = superShardingKey;
        connectionPropertyChanged = true;
    }
806144
def _init_map(self, record_types=None, **kwargs):
        """"""
        osid_objects.OsidRelationshipForm._init_map(self, record_types=record_types)
        self._my_map['assignedObjectiveBankIds'] = [str(kwargs['objective_bank_id'])]
        self._my_map['completion'] = self._completion_default
        self._my_map['objectiveId'] = str(kwargs['objective_id'])
        self._my_map['resourceId'] = str(kwargs['resource_id'])
        self._my_map['levelId'] = self._level_default
1041878
public void init(final Map<String, Map<String, DataSourceConfiguration>> dataSourceConfigurationMap,
                     final Map<String, RuleConfiguration> schemaRuleMap, final Authentication authentication, final Properties props) {
        for (Entry<String, Map<String, DataSourceConfiguration>> entry : dataSourceConfigurationMap.entrySet()) {
            configService.persistConfiguration(entry.getKey(), dataSourceConfigurationMap.get(entry.getKey()), schemaRuleMap.get(entry.getKey()), authentication, props, isOverwrite);
        }
        stateService.persistInstanceOnline();
        stateService.persistDataSourcesNode();
        listenerManager.initListeners();
    }
1269720
public static void initialize()
        throws CacheReloadException
    {
        Context.getDbType().initialize(AbstractDataModelObject.class);
        AttributeType.initialize(AbstractDataModelObject.class);
        SQLTable.initialize(AbstractDataModelObject.class);
        Type.initialize(AbstractDataModelObject.class);
        Dimension.initialize(AbstractDataModelObject.class);
        Attribute.initialize(AbstractDataModelObject.class);
        Status.initialize(AbstractDataModelObject.class);
    }
753409
public void setDataSourceConnectionSource(ConnectionSource<DataSource, DataSourceSettings> connectionSource) {
        this.dataSourceName = connectionSource.getName();
        DataSource source = connectionSource.getSource();
        getProperties().put(Environment.DATASOURCE, source);
        getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, GrailsSessionContext.class.getName());
        final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        if (contextClassLoader != null && contextClassLoader.getClass().getSimpleName().equalsIgnoreCase("RestartClassLoader")) {
            getProperties().put(AvailableSettings.CLASSLOADERS, contextClassLoader);
        } else {
            getProperties().put(AvailableSettings.CLASSLOADERS, connectionSource.getClass().getClassLoader());
        }
    }