From 79efe006ec77668c3ab9e9f58fd945f2cf403cf5 Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Wed, 23 Nov 2016 22:05:05 +1300 Subject: [PATCH] #888 - Move annotations - remove types that are now in ebean-annotation --- .../java/com/avaje/ebean/TxIsolation.java | 100 ------------------ src/main/java/com/avaje/ebean/TxType.java | 50 --------- .../com/avaje/ebean/config/PersistBatch.java | 51 --------- .../java/com/avaje/ebean/config/Platform.java | 47 -------- 4 files changed, 248 deletions(-) delete mode 100644 src/main/java/com/avaje/ebean/TxIsolation.java delete mode 100644 src/main/java/com/avaje/ebean/TxType.java delete mode 100644 src/main/java/com/avaje/ebean/config/PersistBatch.java delete mode 100644 src/main/java/com/avaje/ebean/config/Platform.java diff --git a/src/main/java/com/avaje/ebean/TxIsolation.java b/src/main/java/com/avaje/ebean/TxIsolation.java deleted file mode 100644 index 754959bbf..000000000 --- a/src/main/java/com/avaje/ebean/TxIsolation.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.avaje.ebean; - -import java.sql.Connection; - -/** - * The Transaction Isolation levels. - *

- * These match those of java.sql.Connection with the addition of DEFAULT which - * implies the configured default of the DataSource. - *

- *

- * This can be used with TxScope to define transactional scopes to execute - * method within. - *

- * - * @see TxScope - */ -public enum TxIsolation { - - /** - * Read Committed Isolation level. This is typically the default for most - * configurations. - */ - READ_COMMITED(Connection.TRANSACTION_READ_COMMITTED), - - /** - * Read uncommitted Isolation level. - */ - READ_UNCOMMITTED(Connection.TRANSACTION_READ_UNCOMMITTED), - - /** - * Repeatable Read Isolation level. - */ - REPEATABLE_READ(Connection.TRANSACTION_REPEATABLE_READ), - - /** - * Serializable Isolation level. - */ - SERIALIZABLE(Connection.TRANSACTION_SERIALIZABLE), - - /** - * No Isolation level. - */ - NONE(Connection.TRANSACTION_NONE), - - /** - * The default isolation level. This typically means the default that the - * DataSource is using or configured to use. - */ - DEFAULT(-1); - - final int level; - - TxIsolation(int level) { - this.level = level; - } - - /** - * Return the level as per java.sql.Connection. - *

- * Note that -1 denotes the default isolation level. - *

- */ - public int getLevel() { - return level; - } - - /** - * Return the TxIsolation given the java.sql.Connection isolation level. - *

- * Note that -1 denotes the default isolation level. - *

- */ - public static TxIsolation fromLevel(int connectionIsolationLevel) { - - switch (connectionIsolationLevel) { - case Connection.TRANSACTION_READ_UNCOMMITTED: - return TxIsolation.READ_UNCOMMITTED; - - case Connection.TRANSACTION_READ_COMMITTED: - return TxIsolation.READ_COMMITED; - - case Connection.TRANSACTION_REPEATABLE_READ: - return TxIsolation.REPEATABLE_READ; - - case Connection.TRANSACTION_SERIALIZABLE: - return TxIsolation.SERIALIZABLE; - - case Connection.TRANSACTION_NONE: - return TxIsolation.NONE; - - case -1: - return TxIsolation.DEFAULT; - - default: - throw new RuntimeException("Unknown isolation level " + connectionIsolationLevel); - } - - } -} diff --git a/src/main/java/com/avaje/ebean/TxType.java b/src/main/java/com/avaje/ebean/TxType.java deleted file mode 100644 index 08d724d24..000000000 --- a/src/main/java/com/avaje/ebean/TxType.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.avaje.ebean; - -/** - * Used to define the transactional scope for executing a method. Matches the - * types defined in the EJB TransactionAttributeType. - *

- * Used with the Transactional annotation and the {@link TxScope} with - * {@link Ebean#execute(TxScope, TxCallable)} and - * {@link Ebean#execute(TxScope, TxRunnable)}. - *

- * - * @see TxScope - */ -public enum TxType { - - /** - * Uses an existing transaction and if none exists will starts a new - * Transaction. This is the default. - */ - REQUIRED, - - /** - * A transaction MUST already have been started. Throws - * TransactionRequiredException. - */ - MANDATORY, - - /** - * Uses the existing transaction if one exists, otherwise the method does not - * run with a transaction. Used this with caution. - */ - SUPPORTS, - - /** - * Always start a new transaction. Suspend an existing once if required. - */ - REQUIRES_NEW, - - /** - * Suspends an existing transaction if required. Method runs without a - * transaction. - */ - NOT_SUPPORTED, - - /** - * If there is an existing transaction throws an Exception. Method runs - * without a transaction. - */ - NEVER -} diff --git a/src/main/java/com/avaje/ebean/config/PersistBatch.java b/src/main/java/com/avaje/ebean/config/PersistBatch.java deleted file mode 100644 index b49e1d9b4..000000000 --- a/src/main/java/com/avaje/ebean/config/PersistBatch.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.avaje.ebean.config; - -/** - * Defines the mode for JDBC batch processing. - *

- * Used both at a per transaction basis and per request basis. - *

- * - * @see com.avaje.ebean.config.ServerConfig#setPersistBatch(PersistBatch) - * @see com.avaje.ebean.config.ServerConfig#setPersistBatchOnCascade(PersistBatch) - * @see com.avaje.ebean.Transaction#setBatch(PersistBatch) - * @see com.avaje.ebean.Transaction#setBatchOnCascade(PersistBatch) - */ -public enum PersistBatch { - - /** - * Do not use JDBC Batch mode. - */ - NONE(false), - - /** - * Use JDBC Batch mode on Inserts. - */ - INSERT(true), - - /** - * Use JDBC Batch mode on Inserts, Updates and Deletes. - */ - ALL(true), - - /** - * You should not use this value explicitly. It should only used on the Transactional annotation - * to indicate that the value should inherit from the ServerConfig setting. - */ - INHERIT(false); - - - final boolean forInsert; - - PersistBatch(boolean forInsert) { - this.forInsert = forInsert; - } - - /** - * Return true if persist cascade should use JDBC batch for inserts. - */ - public boolean forInsert() { - return forInsert; - } - -} diff --git a/src/main/java/com/avaje/ebean/config/Platform.java b/src/main/java/com/avaje/ebean/config/Platform.java deleted file mode 100644 index bba8d43e2..000000000 --- a/src/main/java/com/avaje/ebean/config/Platform.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.avaje.ebean.config; - -/** - * Built in supported platforms. - */ -public enum Platform { - - /** - * Generic base platform configured via properties or code. - */ - GENERIC, - - /** - * H2. - */ - H2, - - /** - * Postgres. - */ - POSTGRES, - - /** - * MySql. - */ - MYSQL, - - /** - * Oracle. - */ - ORACLE, - - /** - * Microsoft SQL Server. - */ - SQLSERVER, - - /** - * DB2. - */ - DB2, - - /** - * SQLite. - */ - SQLITE -}