public DatabasePlatform getDatabasePlatform() { return serverConfig.getDatabasePlatform(); }
public DatabasePlatform getDatabasePlatform() { return serverConfig.getDatabasePlatform(); }
public DatabasePlatform getDatabasePlatform() { return serverConfig.getDatabasePlatform(); }
/** * Set the DatabasePlatform if it has not already been set. */ private void setDatabasePlatform(ServerConfig config) { DatabasePlatform dbPlatform = config.getDatabasePlatform(); if (dbPlatform == null) { DatabasePlatformFactory factory = new DatabasePlatformFactory(); DatabasePlatform db = factory.create(config); config.setDatabasePlatform(db); logger.info("DatabasePlatform name:" + config.getName() + " platform:" + db.getName()); } }
/** * Set the DatabasePlatform if it has not already been set. */ private void setDatabasePlatform(ServerConfig config) { DatabasePlatform dbPlatform = config.getDatabasePlatform(); if (dbPlatform == null) { DatabasePlatformFactory factory = new DatabasePlatformFactory(); DatabasePlatform db = factory.create(config); config.setDatabasePlatform(db); logger.info("DatabasePlatform name:" + config.getName() + " platform:" + db.getName()); } }
/** * Helper method that generates the required evolution to properly run Ebean. */ public static String generateEvolutionScript(EbeanServer server, ServerConfig config) { DdlGenerator ddl = new DdlGenerator(); ddl.setup((SpiEbeanServer)server, config.getDatabasePlatform(), config); String ups = ddl.generateCreateDdl(); String downs = ddl.generateDropDdl(); if(ups == null || ups.trim().isEmpty()) { return null; } return ( "# --- Created by Ebean DDL\r\n" + "# To stop Ebean DDL generation, remove this comment and start using Evolutions\r\n" + "\r\n" + "# --- !Ups\r\n" + "\r\n" + ups + "\r\n" + "# --- !Downs\r\n" + "\r\n" + downs ); }
/** * Create the DefaultTypeManager. */ public DefaultTypeManager(ServerConfig config, BootupClasses bootupClasses) { int clobType = config == null ? Types.CLOB : config.getDatabasePlatform().getClobDbType(); int blobType = config == null ? Types.BLOB : config.getDatabasePlatform().getBlobDbType(); this.checkImmutable = new CheckImmutable(this); this.reflectScalarBuilder = new ReflectionBasedTypeBuilder(this); this.compoundTypeMap = new ConcurrentHashMap<Class<?>, CtCompoundType<?>>(); this.typeMap = new ConcurrentHashMap<Class<?>, ScalarType<?>>(); this.nativeMap = new ConcurrentHashMap<Integer, ScalarType<?>>(); this.extraTypeFactory = new DefaultTypeFactory(config); initialiseStandard(clobType, blobType); initialiseJodaTypes(); if (bootupClasses != null) { initialiseCustomScalarTypes(bootupClasses); initialiseScalarConverters(bootupClasses); initialiseCompoundTypes(bootupClasses); } }
/** * Add support for Jackson's JsonNode mapping to Clob, Blob, Varchar, JSON and JSONB. */ private void initialiseJacksonTypes(ServerConfig config) { if (objectMapper != null) { logger.trace("Registering JsonNode type support"); ObjectMapper mapper = (ObjectMapper) objectMapper; jsonNodeClob = new ScalarTypeJsonNode.Clob(mapper); jsonNodeBlob = new ScalarTypeJsonNode.Blob(mapper); jsonNodeVarchar = new ScalarTypeJsonNode.Varchar(mapper); jsonNodeJson = jsonNodeClob; // Default for non-Postgres databases jsonNodeJsonb = jsonNodeClob; // Default for non-Postgres databases if (isPostgres(config.getDatabasePlatform())) { jsonNodeJson = new ScalarTypeJsonNodePostgres.JSON(mapper); jsonNodeJsonb = new ScalarTypeJsonNodePostgres.JSONB(mapper); } // add as default mapping for JsonNode (when not annotated with @DbJson etc) typeMap.put(JsonNode.class, jsonNodeJson); } }
/** * Create the DefaultTypeManager. */ public DefaultTypeManager(ServerConfig config, BootupClasses bootupClasses) { int clobType = config == null ? Types.CLOB : config.getDatabasePlatform().getClobDbType(); int blobType = config == null ? Types.BLOB : config.getDatabasePlatform().getBlobDbType(); this.checkImmutable = new CheckImmutable(this); this.reflectScalarBuilder = new ReflectionBasedTypeBuilder(this); this.compoundTypeMap = new ConcurrentHashMap<Class<?>, CtCompoundType<?>>(); this.typeMap = new ConcurrentHashMap<Class<?>, ScalarType<?>>(); this.nativeMap = new ConcurrentHashMap<Integer, ScalarType<?>>(); this.extraTypeFactory = new DefaultTypeFactory(config); initialiseStandard(clobType, blobType); initialiseJodaTypes(); if (bootupClasses != null) { initialiseCustomScalarTypes(bootupClasses); initialiseScalarConverters(bootupClasses); initialiseCompoundTypes(bootupClasses); } }
public DeployUtil(TypeManager typeMgr, ServerConfig serverConfig) { this.typeManager = typeMgr; this.namingConvention = serverConfig.getNamingConvention(); this.dbPlatform = serverConfig.getDatabasePlatform(); this.encryptDeployManager = serverConfig.getEncryptDeployManager(); this.encryptKeyManager = serverConfig.getEncryptKeyManager(); Encryptor be = serverConfig.getEncryptor(); this.bytesEncryptor = be != null ? be : new SimpleAesEncryptor(); }
public DeployUtil(TypeManager typeMgr, ServerConfig serverConfig) { this.typeManager = typeMgr; this.namingConvention = serverConfig.getNamingConvention(); this.dbPlatform = serverConfig.getDatabasePlatform(); this.encryptDeployManager = serverConfig.getEncryptDeployManager(); this.encryptKeyManager = serverConfig.getEncryptKeyManager(); Encryptor be = serverConfig.getEncryptor(); this.bytesEncryptor = be != null ? be : new SimpleAesEncryptor(); // this alias is used for ManyToMany lazy loading queries this.manyToManyAlias = "zzzzzz"; this.validatorFactoryManager = new ValidatorFactoryManager(); }
public DeployUtil(TypeManager typeMgr, ServerConfig serverConfig) { this.typeManager = typeMgr; this.namingConvention = serverConfig.getNamingConvention(); this.dbPlatform = serverConfig.getDatabasePlatform(); this.encryptDeployManager = serverConfig.getEncryptDeployManager(); this.encryptKeyManager = serverConfig.getEncryptKeyManager(); Encryptor be = serverConfig.getEncryptor(); this.bytesEncryptor = be != null ? be : new SimpleAesEncryptor(); // this alias is used for ManyToMany lazy loading queries this.manyToManyAlias = "zzzzzz"; this.validatorFactoryManager = new ValidatorFactoryManager(); }
/** * Set the DatabasePlatform if it has not already been set. */ private void setDatabasePlatform(ServerConfig config) { DatabasePlatform dbPlatform = config.getDatabasePlatform(); if (dbPlatform == null) { if (config.getTenantMode().isDynamicDataSource()) { throw new IllegalStateException("DatabasePlatform must be explicitly set on ServerConfig for TenantMode "+config.getTenantMode()); } DatabasePlatformFactory factory = new DatabasePlatformFactory(); DatabasePlatform db = factory.create(config); db.configure(config.getDbTypeConfig()); config.setDatabasePlatform(db); logger.info("DatabasePlatform name:{} platform:{}", config.getName(), db.getName()); } }
public void configureDbConfig(ServerConfig config) { Validate.notNull(config, "Config cannot be null"); DataSourceConfig ds = new DataSourceConfig(); ds.setDriver("org.sqlite.JDBC"); ds.setUrl("jdbc:sqlite:{DIR}{NAME}.db"); ds.setUsername("bukkit"); ds.setPassword("walrus"); ds.setIsolationLevel(TransactionIsolation.getLevel("SERIALIZABLE")); if (ds.getDriver().contains("sqlite")) { config.setDatabasePlatform(new SQLitePlatform()); config.getDatabasePlatform().getDbDdlSyntax().setIdentity(""); } config.setDataSourceConfig(ds); }
/** * Create the DefaultTypeManager. */ public DefaultTypeManager(ServerConfig config, BootupClasses bootupClasses) { this.java7Present = config.getClassLoadConfig().isJava7Present(); this.jsonDateTime = config.getJsonDateTime(); this.typeMap = new ConcurrentHashMap<>(); this.nativeMap = new ConcurrentHashMap<>(); boolean objectMapperPresent = config.getClassLoadConfig().isJacksonObjectMapperPresent(); this.objectMapper = (objectMapperPresent) ? initObjectMapper(config) : null; this.extraTypeFactory = new DefaultTypeFactory(config); this.postgres = isPostgres(config.getDatabasePlatform()); this.arrayTypeFactory = arrayTypeFactory(postgres, config.getDatabasePlatform()); this.offlineMigrationGeneration = DbOffline.isGenerateMigration(); initialiseStandard(jsonDateTime, config); initialiseJavaTimeTypes(jsonDateTime, config); initialiseJodaTypes(jsonDateTime, config); initialiseJacksonTypes(config); loadTypesFromProviders(config, objectMapper); if (bootupClasses != null) { initialiseCustomScalarTypes(jsonDateTime, bootupClasses); initialiseScalarConverters(bootupClasses); initialiseAttributeConverters(bootupClasses); } }
int booleanDbType = serverConfig.getDatabasePlatform().getBooleanDbType();
int booleanDbType = serverConfig.getDatabasePlatform().getBooleanDbType();
public InternalConfiguration(ClusterManager clusterManager, SpiCacheManager cacheManager, SpiBackgroundExecutor backgroundExecutor, ServerConfig serverConfig, BootupClasses bootupClasses) { this.docStoreFactory = initDocStoreFactory(serverConfig.service(DocStoreFactory.class)); this.jsonFactory = serverConfig.getJsonFactory(); this.clusterManager = clusterManager; this.backgroundExecutor = backgroundExecutor; this.cacheManager = cacheManager; this.serverConfig = serverConfig; this.bootupClasses = bootupClasses; DatabasePlatform databasePlatform = serverConfig.getDatabasePlatform(); this.expressionFactory = initExpressionFactory(serverConfig, databasePlatform); this.typeManager = new DefaultTypeManager(serverConfig, bootupClasses); this.deployInherit = new DeployInherit(bootupClasses); this.deployCreateProperties = new DeployCreateProperties(typeManager); this.deployUtil = new DeployUtil(typeManager, serverConfig); this.beanDescriptorManager = new BeanDescriptorManager(this); Map<String, String> asOfTableMapping = beanDescriptorManager.deploy(); Map<String, String> draftTableMap = beanDescriptorManager.getDraftTableMap(); this.dataTimeZone = initDataTimeZone(); this.binder = getBinder(typeManager, databasePlatform, dataTimeZone); this.cQueryEngine = new CQueryEngine(serverConfig, databasePlatform, binder, asOfTableMapping, draftTableMap); }
/** * Create the TransactionManager */ public TransactionManager(TransactionManagerOptions options) { this.skipCacheAfterWrite = options.config.isSkipCacheAfterWrite(); this.localL2Caching = options.localL2Caching; this.persistBatch = options.config.getPersistBatch(); this.persistBatchOnCascade = options.config.appliedPersistBatchOnCascade(); this.beanDescriptorManager = options.descMgr; this.viewInvalidation = options.descMgr.requiresViewEntityCacheInvalidation(); this.changeLogPrepare = options.descMgr.getChangeLogPrepare(); this.changeLogListener = options.descMgr.getChangeLogListener(); this.clusterManager = options.clusterManager; this.serverName = options.config.getName(); this.backgroundExecutor = options.backgroundExecutor; this.dataSourceSupplier = options.dataSourceSupplier; this.docStoreActive = options.config.getDocStoreConfig().isActive(); this.docStoreUpdateProcessor = options.docStoreUpdateProcessor; this.bulkEventListenerMap = new BulkEventListenerMap(options.config.getBulkTableEventListeners()); this.prefix = ""; this.externalTransPrefix = "e"; this.onQueryOnly = initOnQueryOnly(options.config.getDatabasePlatform().getOnQueryOnly()); CurrentTenantProvider tenantProvider = options.config.getCurrentTenantProvider(); if (tenantProvider == null) { transactionFactory = new TransactionFactoryBasic(this, dataSourceSupplier); } else { transactionFactory = new TransactionFactoryTenant(this, dataSourceSupplier, tenantProvider); } }
this.dataSource = config.getServerConfig().getDataSource(); this.encryptKeyManager = config.getServerConfig().getEncryptKeyManager(); this.databasePlatform = config.getServerConfig().getDatabasePlatform(); this.idBinderFactory = new IdBinderFactory(databasePlatform.isIdInExpandedForm());