final void init(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) { this.loader = loader; this.server = server; this.file = file; this.description = description; this.dataFolder = dataFolder; this.classLoader = classLoader; this.configFile = new File(dataFolder, "config.yml"); this.logger = new PluginLogger(this); if (description.isDatabaseEnabled()) { ServerConfig db = new ServerConfig(); db.setDefaultServer(false); db.setRegister(false); db.setClasses(getDatabaseClasses()); db.setName(description.getName()); server.configureDbConfig(db); DataSourceConfig ds = db.getDataSourceConfig(); ds.setUrl(replaceDatabaseString(ds.getUrl())); dataFolder.mkdirs(); ClassLoader previous = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); ebean = EbeanServerFactory.create(db); Thread.currentThread().setContextClassLoader(previous); } }
/** * Set the naming convention to underscore if it has not already been set. */ private void setNamingConvention(ServerConfig config) { if (config.getNamingConvention() == null) { config.setNamingConvention(new UnderscoreNamingConvention()); } }
/** * Load the <code>test-ebean.properties</code>. */ public static PropertyMap loadTestProperties() { if (!PropertyMap.loadTestProperties()) { return new PropertyMap(); } return load(null, "test-ebean.properties"); }
public FileTransactionLoggerWrapper(ServerConfig serverConfig) { String evalDir = serverConfig.getLoggingDirectoryWithEval(); this.dir = evalDir != null ? evalDir : "logs"; this.maxFileSize = GlobalProperties.getInt("ebean.logging.maxFileSize", 100 * 1024 * 1024); this.serverName = serverConfig.getName(); }
/** * Return a String property with a default value. */ public static synchronized String get(String key, String defaultValue) { return getPropertyMap().get(key, defaultValue); }
public byte[] encrypt(byte[] data){ EncryptKey key = encryptKeyManager.getEncryptKey(table, column); return encryptor.encrypt(data, key); }
public byte[] decrypt(byte[] data){ EncryptKey key = encryptKeyManager.getEncryptKey(table, column); return encryptor.decrypt(data, key); }
public <T> byte[] encryptObject(String formattedValue) { EncryptKey key = encryptKeyManager.getEncryptKey(table, column); return encryptor.encryptString(formattedValue, key); }
public String decryptObject(byte[] data) { EncryptKey key = encryptKeyManager.getEncryptKey(table, column); return encryptor.decryptString(data, key); }
/** * Return a boolean property with a default value. */ public static synchronized boolean getBoolean(String key, boolean defaultValue) { return getPropertyMap().getBoolean(key, defaultValue); }
/** * Parse and evaluate any expressions that have not already been evaluated. */ public static synchronized void evaluateExpressions() { getPropertyMap().evaluateProperties(); }
/** * Parse the string replacing any expressions like ${catalina.base}. * <p> * This will evaluate expressions using first environment variables, than java * system variables and lastly properties in ebean.properties - in that order. * </p> * <p> * Expressions start with "${" and end with "}". * </p> */ public static String evaluateExpressions(String val) { return getPropertyMap().eval(val); }
/** * Construct with a prefix, serverName and properties. */ public PropertiesWrapper(String prefix, String serverName, Properties properties) { this.serverName = serverName; this.prefix = prefix; this.propertyMap = PropertyMapLoader.load(null, properties); this.properties = propertyMap.asProperties(); }
/** * Load the settings from the given properties */ public void loadFromProperties(Properties properties) { // keep the properties used for configuration so that these are available for plugins this.properties = properties; PropertiesWrapper p = new PropertiesWrapper("ebean", name, properties); loadSettings(p); }
/** * Return a int property with a default value. */ public static synchronized int getInt(String key, int defaultValue) { return getPropertyMap().getInt(key, defaultValue); }
/** * Run the DB migration against the DataSource. */ public DataSource runDbMigration(DataSource dataSource) { if (migrationConfig.isRunMigration()) { MigrationRunner runner = migrationConfig.createRunner(getClassLoadConfig().getClassLoader()); runner.run(dataSource); } return dataSource; }
@Override public DataSource getDataSource() { return dataSourceProvider.dataSource(tenantProvider.currentId()); }
/** * Return a String property with a default value. */ public static synchronized String get(String key, String defaultValue) { return getPropertyMap().get(key, defaultValue); }
/** * Return a boolean property with a default value. */ public static synchronized boolean getBoolean(String key, boolean defaultValue) { return getPropertyMap().getBoolean(key, defaultValue); }