com.avaje.ebean.config
Class ServerConfig

java.lang.Object
  extended by com.avaje.ebean.config.ServerConfig

public class ServerConfig
extends Object

The configuration used for creating a EbeanServer.

Used to programmatically construct an EbeanServer and optionally register it with the Ebean singleton.

If you just use Ebean without this programmatic configuration Ebean will read the ebean.properties file and take the configuration from there. This usually includes searching the class path and automatically registering any entity classes and listeners etc.

 ServerConfig c = new ServerConfig();
 c.setName("ordh2");
 
 // read the ebean.properties and load 
 // those settings into this serverConfig object 
 c.loadFromProperties();
 
 // generate DDL and run it
 c.setDdlGenerate(true);
 c.setDdlRun(true);
 
 // add any classes found in the app.data package
 c.addPackage("app.data");
 
 // add the names of Jars that contain entities
 c.addJar("myJarContainingEntities.jar");
 c.addJar("someOtherJarContainingEntities.jar");
 
 // register as the 'Default' server
 c.setDefaultServer(true);
 
 EbeanServer server = EbeanServerFactory.create(c);
 
 

Author:
emcgreal, rbygrave
See Also:
EbeanServerFactory

Constructor Summary
ServerConfig()
          Construct a Server Configuration for programmatically creating an EbeanServer.
 
Method Summary
 void add(BeanPersistController beanPersistController)
          Register a BeanPersistController instance.
 void add(BeanPersistListener<?> beanPersistListener)
          Register a BeanPersistListener instance.
 void add(BeanQueryAdapter beanQueryAdapter)
          Register a BeanQueryAdapter instance.
 void addClass(Class<?> cls)
          Programmatically add classes (typically entities) that this server should use.
 void addJar(String jarName)
          Add the name of a Jar to search for entities via class path search.
 void addPackage(String packageName)
          Add a package to search for entities via class path search.
 AutofetchConfig getAutofetchConfig()
          Return the configuration for the Autofetch feature.
 List<Class<?>> getClasses()
          Return the classes registered for this server.
 String getDatabaseBooleanFalse()
          Return a value used to represent FALSE in the database.
 String getDatabaseBooleanTrue()
          Return a value used to represent TRUE in the database.
 DatabasePlatform getDatabasePlatform()
          Return the database platform to use for this server.
 String getDatabasePlatformName()
          Return the database platform name (can be null).
 int getDatabaseSequenceBatchSize()
          Return the number of DB sequence values that should be preallocated.
 DataSource getDataSource()
          Return the DataSource.
 DataSourceConfig getDataSourceConfig()
          Return the configuration to build a DataSource using Ebean's own DataSource implementation.
 String getDataSourceJndiName()
          Return the JNDI name of the DataSource to use.
 DbEncrypt getDbEncrypt()
          Return the DbEncrypt used to encrypt and decrypt properties.
 EncryptDeployManager getEncryptDeployManager()
          Return the EncryptDeployManager.
 EncryptKeyManager getEncryptKeyManager()
          Return the EncryptKeyManager.
 Encryptor getEncryptor()
          Return the Encryptor used to encrypt data on the java client side (as opposed to DB encryption functions).
 int getEnhanceLogLevel()
          Return the log level used for "subclassing" enhancement.
 ExternalTransactionManager getExternalTransactionManager()
          Return the external transaction manager.
 List<String> getJars()
          Return packages to search for entities via class path search.
 int getLazyLoadBatchSize()
          Return the default batch size for lazy loading of beans and collections.
 LdapConfig getLdapConfig()
          Return the LDAP configuration.
 String getLoggingDirectory()
          Return the directory where transaction logs go.
 String getLoggingDirectoryWithEval()
          Return the transaction log directory substituting any expressions such as ${catalina.base} etc.
 AdminLogging.LogLevel getLoggingLevel()
          Return the overall transaction logging level.
 AdminLogging.LogLevelStmt getLoggingLevelIud()
          Return the logging level on Insert Update and Delete statements.
 AdminLogging.LogLevelStmt getLoggingLevelQuery()
          Return the logging level for query statements.
 AdminLogging.LogLevelStmt getLoggingLevelSqlQuery()
          Return the logging level on SqlQuery statements.
 AdminLogging.LogLevelTxnCommit getLoggingLevelTxnCommit()
          Return the logging level for transaction begin, commit and rollback events.
 AdminLogging.LogFileSharing getLoggingLogFileSharing()
          Return how transaction logging should share log files.
 String getName()
          Return the name of the EbeanServer.
 NamingConvention getNamingConvention()
          Return the NamingConvention.
 List<String> getPackages()
          Return packages to search for entities via class path search.
 int getPersistBatchSize()
          Return the batch size used for JDBC batching.
 List<BeanPersistController> getPersistControllers()
          Return the BeanPersistController instances.
 List<BeanPersistListener<?>> getPersistListeners()
          Return the BeanPersistListener instances.
 String getProperty(String propertyName)
          Return a configuration property.
 String getProperty(String propertyName, String defaultValue)
          Return a configuration property using a default value.
 PstmtDelegate getPstmtDelegate()
          Return the PreparedStatementDelegate.
 List<BeanQueryAdapter> getQueryAdapters()
          Return the BeanQueryAdapter instances.
 String getResourceDirectory()
          Returns the resource directory.
 boolean isDdlGenerate()
          Return true if the DDL should be generated.
 boolean isDdlRun()
          Return true if the DDL should be run.
 boolean isDebugLazyLoad()
          Return true if there is debug logging on lazy loading events.
 boolean isDebugSql()
          Return true to get the generated SQL queries output to the console.
 boolean isDefaultServer()
          Return true if this server should be registered as the "default" server with the Ebean singleton.
 boolean isLoggingToJavaLogger()
          Return true if you want to use a java.util.logging.Logger to log transaction statements, bind values etc.
 boolean isPersistBatching()
          Returns true if by default JDBC batching is used for persisting or deleting beans.
 boolean isRegister()
          Return true if this server should be registered with the Ebean singleton when it is created.
 boolean isUpdateChangesOnly()
          Return true to only update changed properties.
 boolean isUseJtaTransactionManager()
          Return true if we are running in a JTA Transaction manager.
 boolean isUseJuliTransactionLogger()
          Deprecated.  
 boolean isUsePersistBatching()
          Deprecated.  
 boolean isValidateOnSave()
          Return true if a bean should be validated when it is saved.
 boolean isVanillaMode()
          Return true if by default queries should return 'vanilla' objects rather than dynamic subclasses.
 boolean isVanillaRefMode()
          Returns true if EbeanServer.getReference(Class, Object) should return vanilla objects or not.
 void loadFromProperties()
          Load the settings from the ebean.properties file.
 void setAutofetchConfig(AutofetchConfig autofetchConfig)
          Set the configuration for the Autofetch feature.
 void setClasses(List<Class<?>> classes)
          Set the list of classes (entities, listeners, scalarTypes etc) that should be used for this server.
 void setDatabaseBooleanFalse(String databaseFalse)
          Set the value to represent FALSE in the database.
 void setDatabaseBooleanTrue(String databaseTrue)
          Set the value to represent TRUE in the database.
 void setDatabasePlatform(DatabasePlatform databasePlatform)
          Explicitly set the database platform to use.
 void setDatabasePlatformName(String databasePlatformName)
          Explicitly set the database platform name
 void setDatabaseSequenceBatch(int databaseSequenceBatchSize)
          Set the number of DB sequence values that should be preallocated and cached by Ebean.
 void setDatabaseSequenceBatchSize(int databaseSequenceBatchSize)
          Set the number of sequences to fetch/preallocate when using DB sequences.
 void setDataSource(DataSource dataSource)
          Set a DataSource.
 void setDataSourceConfig(DataSourceConfig dataSourceConfig)
          Set the configuration required to build a DataSource using Ebean's own DataSource implementation.
 void setDataSourceJndiName(String dataSourceJndiName)
          Set the JNDI name of the DataSource to use.
 void setDbEncrypt(DbEncrypt dbEncrypt)
          Set the DbEncrypt used to encrypt and decrypt properties.
 void setDdlGenerate(boolean ddlGenerate)
          Set to true to run the DDL generation on startup.
 void setDdlRun(boolean ddlRun)
          Set to true to run the generated DDL on startup.
 void setDebugLazyLoad(boolean debugLazyLoad)
          Set to true to get debug logging on lazy loading events.
 void setDebugSql(boolean debugSql)
          Set to true to get the generated SQL queries output to the console.
 void setDefaultServer(boolean defaultServer)
          Set true if this EbeanServer should be registered as the "default" server with the Ebean singleton.
 void setEncryptDeployManager(EncryptDeployManager encryptDeployManager)
          Set the EncryptDeployManager.
 void setEncryptKeyManager(EncryptKeyManager encryptKeyManager)
          Set the EncryptKeyManager.
 void setEncryptor(Encryptor encryptor)
          Set the Encryptor used to encrypt data on the java client side (as opposed to DB encryption functions).
 void setEnhanceLogLevel(int enhanceLogLevel)
          Set the log level used for "subclassing" enhancement.
 void setExternalTransactionManager(ExternalTransactionManager externalTransactionManager)
          Set the external transaction manager.
 void setJars(List<String> searchJars)
          Set the names of Jars to search for entities via class path search.
 void setLazyLoadBatchSize(int lazyLoadBatchSize)
          Set the default batch size for lazy loading.
 void setLdapConfig(LdapConfig ldapConfig)
          Set the LDAP configuration.
 void setLoggingDirectory(String loggingDirectory)
          Set the directory that the transaction logs go in.
 void setLoggingLevel(AdminLogging.LogLevel logging)
          Set the overall transaction logging level.
 void setLoggingLevelIud(AdminLogging.LogLevelStmt iudLoglevel)
          Set the logging level on Insert Update and Delete statements.
 void setLoggingLevelQuery(AdminLogging.LogLevelStmt queryLogLevel)
          Set the logging level for query statements.
 void setLoggingLevelSqlQuery(AdminLogging.LogLevelStmt sqlQueryLogLevel)
          Set the logging level on SqlQuery statements.
 void setLoggingLevelTxnCommit(AdminLogging.LogLevelTxnCommit transactionDebugLevel)
          Set the logging level for transaction begin, commit and rollback events.
 void setLoggingLogFileSharing(AdminLogging.LogFileSharing logSharing)
          Set how the transaction logging should share log files.
 void setLoggingToJavaLogger(boolean transactionLogToJavaLogger)
          Set this to true if you want transaction logging to use a java.util.logging.Logger to log the statements and bind variables etc rather than the default one which creates separate transaction log files.
 void setName(String name)
          Set the name of the EbeanServer.
 void setNamingConvention(NamingConvention namingConvention)
          Set the NamingConvention.
 void setPackages(List<String> packages)
          Set packages to search for entities via class path search.
 void setPersistBatching(boolean persistBatching)
          Set to true if you what to use JDBC batching for persisting and deleting beans.
 void setPersistBatchSize(int persistBatchSize)
          Set the batch size used for JDBC batching.
 void setPersistControllers(List<BeanPersistController> persistControllers)
          Register all the BeanPersistController instances.
 void setPersistListeners(List<BeanPersistListener<?>> persistListeners)
          Register all the BeanPersistListener instances.
 void setPstmtDelegate(PstmtDelegate pstmtDelegate)
          Set the PstmtDelegate which can be used to support JDBC driver specific features.
 void setQueryAdapters(List<BeanQueryAdapter> queryAdapters)
          Register all the BeanQueryAdapter instances.
 void setRegister(boolean register)
          Set to false if you do not want this server to be registered with the Ebean singleton when it is created.
 void setResourceDirectory(String resourceDirectory)
          Sets the resource directory.
 void setUpdateChangesOnly(boolean updateChangesOnly)
          Set to true to only update changed properties.
 void setUseJtaTransactionManager(boolean useJtaTransactionManager)
          Set to true if we are running in a JTA Transaction manager.
 void setUseJuliTransactionLogger(boolean transactionLogToJavaLogger)
          Deprecated.  
 void setUsePersistBatching(boolean persistBatching)
          Deprecated.  
 void setValidateOnSave(boolean validateOnSave)
          Set whether validation should run when a bean is saved.
 void setVanillaMode(boolean vanillaMode)
          Set this to true if by default queries should return 'vanilla' objects rather than dynamic subclasses.
 void setVanillaRefMode(boolean vanillaRefMode)
          Set this to true if you want EbeanServer.getReference(Class, Object) to return vanilla objects.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerConfig

public ServerConfig()
Construct a Server Configuration for programmatically creating an EbeanServer.

Method Detail

getName

public String getName()
Return the name of the EbeanServer.


setName

public void setName(String name)
Set the name of the EbeanServer.


isRegister

public boolean isRegister()
Return true if this server should be registered with the Ebean singleton when it is created.

By default this is set to true.


setRegister

public void setRegister(boolean register)
Set to false if you do not want this server to be registered with the Ebean singleton when it is created.

By default this is set to true.


isDefaultServer

public boolean isDefaultServer()
Return true if this server should be registered as the "default" server with the Ebean singleton.

This is only used when setRegister(boolean) is also true.


setDefaultServer

public void setDefaultServer(boolean defaultServer)
Set true if this EbeanServer should be registered as the "default" server with the Ebean singleton.

This is only used when setRegister(boolean) is also true.


isPersistBatching

public boolean isPersistBatching()
Returns true if by default JDBC batching is used for persisting or deleting beans.

With this Ebean will batch up persist requests and use the JDBC batch api. This is a performance optimisation designed to reduce the network chatter.


isUsePersistBatching

public boolean isUsePersistBatching()
Deprecated. 

Use isPersistBatching() instead.


setPersistBatching

public void setPersistBatching(boolean persistBatching)
Set to true if you what to use JDBC batching for persisting and deleting beans.

With this Ebean will batch up persist requests and use the JDBC batch api. This is a performance optimisation designed to reduce the network chatter.


setUsePersistBatching

public void setUsePersistBatching(boolean persistBatching)
Deprecated. 

Use setPersistBatching() instead.


getPersistBatchSize

public int getPersistBatchSize()
Return the batch size used for JDBC batching. This defaults to 20.


setPersistBatchSize

public void setPersistBatchSize(int persistBatchSize)
Set the batch size used for JDBC batching. If unset this defaults to 20.


getLazyLoadBatchSize

public int getLazyLoadBatchSize()
Return the default batch size for lazy loading of beans and collections.


setLazyLoadBatchSize

public void setLazyLoadBatchSize(int lazyLoadBatchSize)
Set the default batch size for lazy loading.

This is the number of beans or collections loaded when lazy loading is invoked by default.

The default value is for this is 1 (load 1 bean or collection).

You can explicitly control the lazy loading batch size for a given join on a query using +lazy(batchSize) or JoinConfig.


setDatabaseSequenceBatchSize

public void setDatabaseSequenceBatchSize(int databaseSequenceBatchSize)
Set the number of sequences to fetch/preallocate when using DB sequences.

This is a performance optimisation to reduce the number times Ebean requests a sequence to be used as an Id for a bean (aka reduce network chatter).


isUseJtaTransactionManager

public boolean isUseJtaTransactionManager()
Return true if we are running in a JTA Transaction manager.


setUseJtaTransactionManager

public void setUseJtaTransactionManager(boolean useJtaTransactionManager)
Set to true if we are running in a JTA Transaction manager.


getExternalTransactionManager

public ExternalTransactionManager getExternalTransactionManager()
Return the external transaction manager.


setExternalTransactionManager

public void setExternalTransactionManager(ExternalTransactionManager externalTransactionManager)
Set the external transaction manager.


isVanillaMode

public boolean isVanillaMode()
Return true if by default queries should return 'vanilla' objects rather than dynamic subclasses.

This setting is not relevant when using enhancement (only when using dynamic subclasses).


setVanillaMode

public void setVanillaMode(boolean vanillaMode)
Set this to true if by default queries should return 'vanilla' objects rather than dynamic subclasses.

This setting is not relevant when using enhancement (only when using dynamic subclasses).

Alternatively you can set this on a specific query via Query.setVanillaMode(boolean).

See Also:
setVanillaRefMode(boolean), Query.setVanillaMode(boolean)

isVanillaRefMode

public boolean isVanillaRefMode()
Returns true if EbeanServer.getReference(Class, Object) should return vanilla objects or not.

See Also:
setVanillaMode(boolean), Query.setVanillaMode(boolean)

setVanillaRefMode

public void setVanillaRefMode(boolean vanillaRefMode)
Set this to true if you want EbeanServer.getReference(Class, Object) to return vanilla objects.


isValidateOnSave

public boolean isValidateOnSave()
Return true if a bean should be validated when it is saved.


setValidateOnSave

public void setValidateOnSave(boolean validateOnSave)
Set whether validation should run when a bean is saved.


getEnhanceLogLevel

public int getEnhanceLogLevel()
Return the log level used for "subclassing" enhancement.


setEnhanceLogLevel

public void setEnhanceLogLevel(int enhanceLogLevel)
Set the log level used for "subclassing" enhancement.


getNamingConvention

public NamingConvention getNamingConvention()
Return the NamingConvention.

If none has been set the default UnderscoreNamingConvention is used.


setNamingConvention

public void setNamingConvention(NamingConvention namingConvention)
Set the NamingConvention.

If none is set the default UnderscoreNamingConvention is used.


getAutofetchConfig

public AutofetchConfig getAutofetchConfig()
Return the configuration for the Autofetch feature.


setAutofetchConfig

public void setAutofetchConfig(AutofetchConfig autofetchConfig)
Set the configuration for the Autofetch feature.


getPstmtDelegate

public PstmtDelegate getPstmtDelegate()
Return the PreparedStatementDelegate.


setPstmtDelegate

public void setPstmtDelegate(PstmtDelegate pstmtDelegate)
Set the PstmtDelegate which can be used to support JDBC driver specific features.

Typically this means Oracle JDBC driver specific workarounds.


getDataSource

public DataSource getDataSource()
Return the DataSource.


setDataSource

public void setDataSource(DataSource dataSource)
Set a DataSource.


getDataSourceConfig

public DataSourceConfig getDataSourceConfig()
Return the configuration to build a DataSource using Ebean's own DataSource implementation.


setDataSourceConfig

public void setDataSourceConfig(DataSourceConfig dataSourceConfig)
Set the configuration required to build a DataSource using Ebean's own DataSource implementation.


getDataSourceJndiName

public String getDataSourceJndiName()
Return the JNDI name of the DataSource to use.


setDataSourceJndiName

public void setDataSourceJndiName(String dataSourceJndiName)
Set the JNDI name of the DataSource to use.

By default a prefix of "java:comp/env/jdbc/" is used to lookup the DataSource. This prefix is not used if dataSourceJndiName starts with "java:".


getDatabaseBooleanTrue

public String getDatabaseBooleanTrue()
Return a value used to represent TRUE in the database.

This is used for databases that do not support boolean natively.

The value returned is either a Integer or a String (e.g. "1", or "T").


setDatabaseBooleanTrue

public void setDatabaseBooleanTrue(String databaseTrue)
Set the value to represent TRUE in the database.

This is used for databases that do not support boolean natively.

The value set is either a Integer or a String (e.g. "1", or "T").


getDatabaseBooleanFalse

public String getDatabaseBooleanFalse()
Return a value used to represent FALSE in the database.

This is used for databases that do not support boolean natively.

The value returned is either a Integer or a String (e.g. "0", or "F").


setDatabaseBooleanFalse

public void setDatabaseBooleanFalse(String databaseFalse)
Set the value to represent FALSE in the database.

This is used for databases that do not support boolean natively.

The value set is either a Integer or a String (e.g. "0", or "F").


getDatabaseSequenceBatchSize

public int getDatabaseSequenceBatchSize()
Return the number of DB sequence values that should be preallocated.


setDatabaseSequenceBatch

public void setDatabaseSequenceBatch(int databaseSequenceBatchSize)
Set the number of DB sequence values that should be preallocated and cached by Ebean.

This is only used for DB's that use sequences and is a performance optimisation. This reduces the number of times Ebean needs to get a sequence value from the Database reducing network chatter.

By default this value is 10 so when we need another Id (and don't have one in our cache) Ebean will fetch 10 id's from the database. Note that when the cache drops to have full (which is 5 by default) Ebean will fetch another batch of Id's in a background thread.


getDatabasePlatformName

public String getDatabasePlatformName()
Return the database platform name (can be null).

If null then the platform is determined automatically via the JDBC driver information.


setDatabasePlatformName

public void setDatabasePlatformName(String databasePlatformName)
Explicitly set the database platform name

If none is set then the platform is determined automatically via the JDBC driver information.

This can be used when the Database Platform can not be automatically detected from the JDBC driver (possibly 3rd party JDBC driver). It is also useful when you want to do offline DDL generation for a database platform that you don't have access to.

Values are oracle, h2, postgres, mysql, mssqlserver2005.

See Also:
DataSourceConfig.setOffline(boolean)

getDatabasePlatform

public DatabasePlatform getDatabasePlatform()
Return the database platform to use for this server.


setDatabasePlatform

public void setDatabasePlatform(DatabasePlatform databasePlatform)
Explicitly set the database platform to use.

If none is set then the platform is determined via the databasePlatformName or automatically via the JDBC driver information.


getEncryptKeyManager

public EncryptKeyManager getEncryptKeyManager()
Return the EncryptKeyManager.


setEncryptKeyManager

public void setEncryptKeyManager(EncryptKeyManager encryptKeyManager)
Set the EncryptKeyManager.

This is required when you want to use encrypted properties.

You can also set this in ebean.proprerties:

 # set via ebean.properties
 
 ebean.encryptKeyManager=com.avaje.tests.basic.encrypt.BasicEncyptKeyManager
 


getEncryptDeployManager

public EncryptDeployManager getEncryptDeployManager()
Return the EncryptDeployManager.

This is optionally used to programmatically define which columns are encrypted instead of using the Encrypted Annotation.


setEncryptDeployManager

public void setEncryptDeployManager(EncryptDeployManager encryptDeployManager)
Set the EncryptDeployManager.

This is optionally used to programmatically define which columns are encrypted instead of using the Encrypted Annotation.


getEncryptor

public Encryptor getEncryptor()
Return the Encryptor used to encrypt data on the java client side (as opposed to DB encryption functions).


setEncryptor

public void setEncryptor(Encryptor encryptor)
Set the Encryptor used to encrypt data on the java client side (as opposed to DB encryption functions).

Ebean has a default implementation that it will use if you do not set your own Encryptor implementation.


getDbEncrypt

public DbEncrypt getDbEncrypt()
Return the DbEncrypt used to encrypt and decrypt properties.

Note that if this is not set then the DbPlatform may already have a DbEncrypt set and that will be used.


setDbEncrypt

public void setDbEncrypt(DbEncrypt dbEncrypt)
Set the DbEncrypt used to encrypt and decrypt properties.

Note that if this is not set then the DbPlatform may already have a DbEncrypt set (H2, MySql, Postgres and Oracle platforms have a DbEncrypt)


isDebugSql

public boolean isDebugSql()
Return true to get the generated SQL queries output to the console.

To get the SQL and bind variables for insert update delete statements you should use transaction logging.


setDebugSql

public void setDebugSql(boolean debugSql)
Set to true to get the generated SQL queries output to the console.

To get the SQL and bind variables for insert update delete statements you should use transaction logging.


isDebugLazyLoad

public boolean isDebugLazyLoad()
Return true if there is debug logging on lazy loading events.


setDebugLazyLoad

public void setDebugLazyLoad(boolean debugLazyLoad)
Set to true to get debug logging on lazy loading events.


getLoggingLevel

public AdminLogging.LogLevel getLoggingLevel()
Return the overall transaction logging level.


setLoggingLevel

public void setLoggingLevel(AdminLogging.LogLevel logging)
Set the overall transaction logging level.

Set this to LogLevel.NONE to turn off transaction logging. Alternatively you can change the log level for specific functions.

See also setLoggingLevelIud(...), setLoggingLevelQuery(...) and setLoggingLevelSqlQuery(...).


getLoggingLevelIud

public AdminLogging.LogLevelStmt getLoggingLevelIud()
Return the logging level on Insert Update and Delete statements.


setLoggingLevelIud

public void setLoggingLevelIud(AdminLogging.LogLevelStmt iudLoglevel)
Set the logging level on Insert Update and Delete statements.

Note this logging level can be changed at runtime via EbeanServer.getAdminLogging() and AdminLogging.setLoggingLevelIud(LogLevelStmt)


getLoggingLevelQuery

public AdminLogging.LogLevelStmt getLoggingLevelQuery()
Return the logging level for query statements.


setLoggingLevelQuery

public void setLoggingLevelQuery(AdminLogging.LogLevelStmt queryLogLevel)
Set the logging level for query statements.

Note this logging level can be changed at runtime via EbeanServer.getAdminLogging() and AdminLogging.setLoggingLevelQuery(LogLevelStmt)


getLoggingLevelSqlQuery

public AdminLogging.LogLevelStmt getLoggingLevelSqlQuery()
Return the logging level on SqlQuery statements.


setLoggingLevelSqlQuery

public void setLoggingLevelSqlQuery(AdminLogging.LogLevelStmt sqlQueryLogLevel)
Set the logging level on SqlQuery statements.


getLoggingLevelTxnCommit

public AdminLogging.LogLevelTxnCommit getLoggingLevelTxnCommit()
Return the logging level for transaction begin, commit and rollback events.


setLoggingLevelTxnCommit

public void setLoggingLevelTxnCommit(AdminLogging.LogLevelTxnCommit transactionDebugLevel)
Set the logging level for transaction begin, commit and rollback events.


getLoggingLogFileSharing

public AdminLogging.LogFileSharing getLoggingLogFileSharing()
Return how transaction logging should share log files.


setLoggingLogFileSharing

public void setLoggingLogFileSharing(AdminLogging.LogFileSharing logSharing)
Set how the transaction logging should share log files.

Transactions can each have a separate transaction log or they can share one single transaction log. Alternatively explicit transactions can have their own transaction log.


getLoggingDirectory

public String getLoggingDirectory()
Return the directory where transaction logs go.


getLoggingDirectoryWithEval

public String getLoggingDirectoryWithEval()
Return the transaction log directory substituting any expressions such as ${catalina.base} etc.


setLoggingDirectory

public void setLoggingDirectory(String loggingDirectory)
Set the directory that the transaction logs go in.

This will not be used if the transaction logging is going to java util logging (via setLoggingToJavaLogger(boolean)).

This can contain expressions like ${catalina.base} with environment variables, java system properties and entries in ebean.properties.

e.g. ${catalina.base}/logs/trans

Parameters:
loggingDirectory - the transaction log directory

isLoggingToJavaLogger

public boolean isLoggingToJavaLogger()
Return true if you want to use a java.util.logging.Logger to log transaction statements, bind values etc.

If this is false then the default transaction logger is used which logs the transaction details to separate transaction log files.


setLoggingToJavaLogger

public void setLoggingToJavaLogger(boolean transactionLogToJavaLogger)
Set this to true if you want transaction logging to use a java.util.logging.Logger to log the statements and bind variables etc rather than the default one which creates separate transaction log files.


isUseJuliTransactionLogger

public boolean isUseJuliTransactionLogger()
Deprecated. 

Deprecated - please use isTransactionLogToJavaLogger();


setUseJuliTransactionLogger

public void setUseJuliTransactionLogger(boolean transactionLogToJavaLogger)
Deprecated. 

Deprecated - please use setTransactionLogToJavaLogger();


setDdlGenerate

public void setDdlGenerate(boolean ddlGenerate)
Set to true to run the DDL generation on startup.


setDdlRun

public void setDdlRun(boolean ddlRun)
Set to true to run the generated DDL on startup.


isDdlGenerate

public boolean isDdlGenerate()
Return true if the DDL should be generated.


isDdlRun

public boolean isDdlRun()
Return true if the DDL should be run.


getLdapConfig

public LdapConfig getLdapConfig()
Return the LDAP configuration.


setLdapConfig

public void setLdapConfig(LdapConfig ldapConfig)
Set the LDAP configuration.


addClass

public void addClass(Class<?> cls)
Programmatically add classes (typically entities) that this server should use.

The class can be an Entity, Embedded type, ScalarType, BeanPersistListener, BeanFinder or BeanPersistController.

If no classes are specified then the classes are found automatically via searching the class path.

Alternatively the classes can be added via setClasses(List).

Parameters:
cls - the entity type (or other type) that should be registered by this server.

addPackage

public void addPackage(String packageName)
Add a package to search for entities via class path search.

This is only used if classes have not been explicitly specified.


getPackages

public List<String> getPackages()
Return packages to search for entities via class path search.

This is only used if classes have not been explicitly specified.


setPackages

public void setPackages(List<String> packages)
Set packages to search for entities via class path search.

This is only used if classes have not been explicitly specified.


addJar

public void addJar(String jarName)
Add the name of a Jar to search for entities via class path search.

This is only used if classes have not been explicitly specified.

If you are using ebean.properties you can specify jars to search by setting a ebean.search.jars property.

 # EBean will search through classes for entities, but will not search jar files 
 # unless you tell it to do so, for performance reasons.  Set this value to a 
 # comma-delimited list of jar files you want ebean to search.
 ebean.search.jars=example.jar
 


getJars

public List<String> getJars()
Return packages to search for entities via class path search.

This is only used if classes have not been explicitly specified.


setJars

public void setJars(List<String> searchJars)
Set the names of Jars to search for entities via class path search.

This is only used if classes have not been explicitly specified.


setClasses

public void setClasses(List<Class<?>> classes)
Set the list of classes (entities, listeners, scalarTypes etc) that should be used for this server.

If no classes are specified then the classes are found automatically via searching the class path.

Alternatively the classes can contain added via addClass(Class).


getClasses

public List<Class<?>> getClasses()
Return the classes registered for this server. Typically this includes entities and perhaps listeners.


isUpdateChangesOnly

public boolean isUpdateChangesOnly()
Return true to only update changed properties.


setUpdateChangesOnly

public void setUpdateChangesOnly(boolean updateChangesOnly)
Set to true to only update changed properties.


getResourceDirectory

public String getResourceDirectory()
Returns the resource directory.


setResourceDirectory

public void setResourceDirectory(String resourceDirectory)
Sets the resource directory.


add

public void add(BeanQueryAdapter beanQueryAdapter)
Register a BeanQueryAdapter instance.

Note alternatively you can use setQueryAdapters(List) to set all the BeanQueryAdapter instances.


getQueryAdapters

public List<BeanQueryAdapter> getQueryAdapters()
Return the BeanQueryAdapter instances.


setQueryAdapters

public void setQueryAdapters(List<BeanQueryAdapter> queryAdapters)
Register all the BeanQueryAdapter instances.

Note alternatively you can use add(BeanQueryAdapter) to add BeanQueryAdapter instances one at a time.


add

public void add(BeanPersistController beanPersistController)
Register a BeanPersistController instance.

Note alternatively you can use setPersistControllers(List) to set all the BeanPersistController instances.


getPersistControllers

public List<BeanPersistController> getPersistControllers()
Return the BeanPersistController instances.


setPersistControllers

public void setPersistControllers(List<BeanPersistController> persistControllers)
Register all the BeanPersistController instances.

Note alternatively you can use add(BeanPersistController) to add BeanPersistController instances one at a time.


add

public void add(BeanPersistListener<?> beanPersistListener)
Register a BeanPersistListener instance.

Note alternatively you can use setPersistListeners(List) to set all the BeanPersistListener instances.


getPersistListeners

public List<BeanPersistListener<?>> getPersistListeners()
Return the BeanPersistListener instances.


setPersistListeners

public void setPersistListeners(List<BeanPersistListener<?>> persistListeners)
Register all the BeanPersistListener instances.

Note alternatively you can use add(BeanPersistListener) to add BeanPersistListener instances one at a time.


loadFromProperties

public void loadFromProperties()
Load the settings from the ebean.properties file.


getProperty

public String getProperty(String propertyName,
                          String defaultValue)
Return a configuration property using a default value.


getProperty

public String getProperty(String propertyName)
Return a configuration property.



Copyright © 2010. All Rights Reserved.