Class Model
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Deprecated.Model
(Revisions.Factory revisions, Type<?>... types) Model
(Revisions.Factory revisions, TypeSet[] typeSets, Type<?>... types) Model
(RevisionsFuture revisions, Type<?>... types) Deprecated.UseModel(Revisions.Factory, Type...)
instead.Model
(RevisionsFuture revisions, TypeSet[] typeSets, Type<?>... types) Deprecated.UseModel(Revisions.Factory, TypeSet[], Type...)
instead.Deprecated.UseModel(Revisions.Factory, Type...)
orDirectRevisionsFactory
instead.Deprecated.UseModel(Revisions.Factory, TypeSet[], Type...)
orDirectRevisionsFactory
instead. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(ChangeListener listener) Adds a change listener to the model.void
addCommitHook
(Runnable hook) Deprecated.UseaddPostCommitHookIfAbsent(Runnable)
insteadvoid
addModificationListener
(ModificationListener listener) Deprecated.ModificationListener is no longer supported.void
addPostCommitHook
(Runnable hook) Deprecated.UseaddPostCommitHookIfAbsent(Runnable)
instead<R extends Runnable>
RaddPostCommitHookIfAbsent
(R hook) Adds a hook to the current transaction.<R extends Runnable>
RaddPreCommitHookIfAbsent
(R hook) Adds a hook to the current transaction.static ModelBuilder
builder()
void
Deprecated.UsecheckSchema()
insteadvoid
Deprecated.UsecheckEmptySchema()
insteadvoid
void
Deprecated.This functionality is no longer supported.void
void
void
void
commit()
void
connect
(ConnectProperties properties) Connects this model to the database described in the properties.boolean
boolean
containsTypeSet
(Type<?>... typeSet) void
Deprecated.UsecreateSchema()
insteadvoid
Deprecated.UsecreateSchemaConstraints(EnumSet)
insteadvoid
void
Returns the transaction for this model, that is bound to the currently running thread.void
void
Use for tests only.void
void
Deprecated.UsedropSchema()
insteadvoid
Deprecated.UsedropSchemaConstraints(EnumSet)
insteadvoid
void
void
enableSerialization
(Class<?> type, String name) Deprecated.UsegetItem(String)
insteadDeprecated.UsegetFeature(String)
insteadType<?>
findTypeByID
(String id) Deprecated.UsegetType(String)
insteadvoid
void
Deprecated.Not supported anymore.Deprecated.renamed togetItemCacheInfo()
.Deprecated.renamed togetQueryCacheHistogram()
.Deprecated.renamed togetQueryCacheInfo()
.ReturnsObject.toString()
of theChangeHook
registered for this model.int
Deprecated.usegetChangeListenersInfo()
.ChangeListenerInfo.getCleared()
instead.Deprecated.UsecurrentTransaction()
insteadDeprecated.UsegetEnvironmentInfo()
andEnvironmentInfo.asProperties()
instead.getFeature
(String id) Deprecated.UseHiddenFeatures.get(Model)
instead.Returns the item with the given ID.Deprecated.Deprecated.UsegetRevisionLogs()
insteadDeprecated.ModificationListener is no longer supported.int
Deprecated.ModificationListener is no longer supported.int
Deprecated.UsegetModificationListenersCleared()
insteadlong
Returns the collection of openTransaction
s on this model.Deprecated.UsegetConnectProperties()
insteadReturns a string that may help you resetting the schema to the current contents.Type<?>
Finds a type by itsid
.getTypes()
boolean
boolean
boolean
Deprecated.UseisClusterEnabled()
insteadboolean
static boolean
Deprecated.UseConnectProperties.isLoggingEnabled()
instead, always returns false.boolean
void
void
migrate()
Deprecated.Userevise()
insteadvoid
Deprecated.UsereviseIfSupportedAndAutoEnabled()
insteadboolean
Deprecated.Is not supported any longer.void
void
pingClusterNetwork
(int count) void
purgeSchema
(JobContext ctx) Gives this cope model the chance to purge / cleanup whatever it needs to.void
void
removeChangeListener
(ChangeListener listener) void
Deprecated.ModificationListener is no longer supported.void
revise()
void
Deprecated.usereviseIfSupportedAndAutoEnabled()
insteadvoid
If this method returns successfully, the model's revisions (if any) have been executed.void
rollback()
void
void
setDatabaseListener
(DatabaseListener listener) void
setPropertiesInitially
(ConnectProperties properties) Deprecated.renamed toconnect(ConnectProperties)
.Deprecated.UsestartTransaction(String)
instead and provide a useful name.startTransaction
(String name) startTransactionTry
(String name) boolean
Deprecated.UseSchemaInfo.supportsCheckConstraints(Model)
insteadboolean
Returns, whether the database can store empty strings.boolean
boolean
Deprecated.UseSchemaInfo.supportsSequences(Model)
insteadboolean
https://dev.mysql.com/doc/refman/5.6/en/charset-unicode-utf8mb4.htmlvoid
Deprecated.UsetearDownSchema()
insteadvoid
Deprecated.UsetearDownSchemaConstraints(EnumSet)
insteadvoid
void
toString()
-
Constructor Details
-
Model
-
Model
-
Model
-
Model
Deprecated.UseModel(Revisions, Type...)
andRevisions(int)
. -
Model
Deprecated. -
Model
Deprecated.UseModel(Revisions.Factory, Type...)
orDirectRevisionsFactory
instead. -
Model
Deprecated.UseModel(Revisions.Factory, TypeSet[], Type...)
orDirectRevisionsFactory
instead. -
Model
Deprecated.UseModel(Revisions.Factory, Type...)
instead. -
Model
Deprecated.UseModel(Revisions.Factory, TypeSet[], Type...)
instead.
-
-
Method Details
-
builder
-
contains
-
containsTypeSet
-
connect
Connects this model to the database described in the properties.- Throws:
IllegalStateException
- if this model has already been connected.
-
disconnect
public void disconnect() -
getRevisions
-
revise
public void revise() -
reviseIfSupportedAndAutoEnabled
public void reviseIfSupportedAndAutoEnabled()If this method returns successfully, the model's revisions (if any) have been executed. Automatic execution of revisions is controlled by connect property revise.auto.enabled. This method will throw an exception if auto-revisions are not enabled and revisions are pending. -
getRevisionLogs
- See Also:
-
getRevisionLogsAndMutex
- See Also:
-
isConnected
public boolean isConnected() -
getConnectProperties
-
getConnectDate
-
getTypes
-
getTypesSortedByHierarchy
-
getConcreteTypes
-
getType
Finds a type by itsid
. Returns null, if there is no such type. -
getFeature
- See Also:
-
getInitializeDate
-
supportsEmptyStrings
public boolean supportsEmptyStrings()Returns, whether the database can store empty strings.If true, an empty string can be stored into a
StringField
like any other string viaFunctionField.set(Item,Object)
. A subsequent retrieval of that string viaFunctionField.get(Item)
returns an empty string. If false, an empty string stored into aStringField
is converted to null, thus a subsequent retrieval of that string returns null.Up to now, only Oracle does not support empty strings.
-
supportsUTF8mb4
public boolean supportsUTF8mb4()https://dev.mysql.com/doc/refman/5.6/en/charset-unicode-utf8mb4.html -
getSupportedDataHashAlgorithms
-
supportsRandom
public boolean supportsRandom()- See Also:
-
getDatabaseListener
-
setDatabaseListener
-
createSchema
public void createSchema() -
createSchemaConstraints
-
checkEmptySchema
public void checkEmptySchema() -
deleteSchema
public void deleteSchema()- Throws:
IllegalStateException
- is a transaction is bound to the current thread- See Also:
-
deleteSchemaForTest
public void deleteSchemaForTest()Use for tests only. Does some optimizations for faster execution, that are valid under certain conditions only:- Changes to the database are done via this cope model only. This also means that there is no cluster.
- No transactions running concurrently to
deleteSchemaForTest
connect property
.- Throws:
IllegalStateException
- is a transaction is bound to the current thread- See Also:
-
dropSchema
public void dropSchema() -
dropSchemaConstraints
-
tearDownSchema
public void tearDownSchema() -
tearDownSchemaConstraints
-
getVerifiedSchema
-
getSchema
-
purgeSchema
Gives this cope model the chance to purge / cleanup whatever it needs to. Should be called once a day. -
getSchemaSavepoint
Returns a string that may help you resetting the schema to the current contents. This may or may not be supported by the database. The meaning of the result heavily depends on the database. Never returns null.- Throws:
SQLException
- if not supported by the database
-
getItem
Returns the item with the given ID. Always returnsactive
objects.- Throws:
NoSuchIDException
- if there is no item with the given id.- See Also:
-
getThreadControllers
-
getChangeHookString
ReturnsObject.toString()
of theChangeHook
registered for this model. -
getChangeListeners
- See Also:
-
getChangeListenersInfo
-
getChangeListenerDispatcherInfo
-
addChangeListener
Adds a change listener to the model. The listener is called for eachcommit()
, even on other nodes of the cluster. When the listener is called, there is no transaction present, you may create one if needed. Multiple listeners are called in order of addition.Note, this is something completely different than
commit hooks
.- See Also:
-
removeChangeListener
-
removeAllChangeListeners
public void removeAllChangeListeners() -
getSequenceInfo
-
getItemCacheStatistics
-
getQueryCacheInfo
-
getQueryCacheHistogram
-
getConnectionPoolInfo
-
flushConnectionPool
public void flushConnectionPool() -
getEnvironmentInfo
-
isClusterEnabled
public boolean isClusterEnabled() -
getClusterProperties
-
getClusterSenderInfo
-
getClusterListenerInfo
-
pingClusterNetwork
public void pingClusterNetwork() -
pingClusterNetwork
public void pingClusterNetwork(int count) -
startTransaction
- Parameters:
name
- a name for the transaction, useful for debugging. This name is used inTransaction.toString()
.- Throws:
IllegalStateException
- if there is already a transaction bound to the current thread for this model- See Also:
-
getNextTransactionId
public long getNextTransactionId() -
getLastTransactionStartDate
-
leaveTransaction
-
joinTransaction
-
hasCurrentTransaction
public boolean hasCurrentTransaction() -
currentTransaction
Returns the transaction for this model, that is bound to the currently running thread.- Throws:
IllegalStateException
- if there is no cope transaction bound to current thread- See Also:
-
rollback
public void rollback() -
rollbackIfNotCommitted
public void rollbackIfNotCommitted() -
commit
public void commit() -
getOpenTransactions
Returns the collection of openTransaction
s on this model.Returns an unmodifiable snapshot of the actual data, so iterating over the collection on a live server cannot cause
ConcurrentModificationException
s. -
addPreCommitHookIfAbsent
Adds a hook to the current transaction. The hook is called withincommit()
. When the hook is called, the transaction is not yet committed and still available for use. If you don't want this, use apost-commit
hook instead.Multiple hooks are called in order of addition.
If a hook
equal
tohook
has been added before, this method does nothing and returns the hook previously added. Otherwisehook
is returned. Note: this is different fromMap.putIfAbsent
.Note, this is something completely different than
Change Listeners
.- Returns:
- the hook that is present after methods returns.
- See Also:
-
addPostCommitHookIfAbsent
Adds a hook to the current transaction. The hook is called withincommit()
. When the hook is called, the transaction is already committed and not available for use anymore. If you don't want this, use apre-commit
hook instead.Multiple hooks are called in order of addition.
If a hook
equal
tohook
has been added before, this method does nothing and returns the hook previously added. Otherwisehook
is returned. Note: this is different fromMap.putIfAbsent
.Note, this is something completely different than
Change Listeners
.- Returns:
- the hook that is present after methods returns.
- See Also:
-
startTransactionTry
- See Also:
-
getTransactionCounters
-
clearCache
public void clearCache() -
checkTypeColumns
public void checkTypeColumns()- See Also:
-
checkUnsupportedConstraints
public void checkUnsupportedConstraints() -
isSerializationEnabled
public boolean isSerializationEnabled() -
enableSerialization
-
toString
-
getItemCacheInfo
Deprecated. -
addPostCommitHook
Deprecated.UseaddPostCommitHookIfAbsent(Runnable)
instead -
addCommitHook
Deprecated.UseaddPostCommitHookIfAbsent(Runnable)
instead -
isClusterNetworkEnabled
Deprecated.UseisClusterEnabled()
instead -
getHiddenFeatures
Deprecated.UseHiddenFeatures.get(Model)
instead. -
reviseIfSupported
Deprecated.usereviseIfSupportedAndAutoEnabled()
instead -
nullsAreSortedLow
Deprecated.Is not supported any longer. Always returns true. -
startTransaction
Deprecated.UsestartTransaction(String)
instead and provide a useful name. -
getModificationListeners
Deprecated.ModificationListener is no longer supported. Always returns an empty list. -
getModificationListenersCleared
Deprecated.ModificationListener is no longer supported. Always returns zero. -
addModificationListener
Deprecated.ModificationListener is no longer supported. Always throws aNoSuchMethodError
. -
removeModificationListener
Deprecated.ModificationListener is no longer supported. -
getCacheInfo
Deprecated.renamed togetItemCacheInfo()
. -
getCacheQueryHistogram
Deprecated.renamed togetQueryCacheHistogram()
. -
getCacheQueryInfo
Deprecated.renamed togetQueryCacheInfo()
. -
migrate
Deprecated.Userevise()
instead -
migrateIfSupported
Deprecated.UsereviseIfSupportedAndAutoEnabled()
instead -
getMigrationLogs
Deprecated.UsegetRevisionLogs()
instead -
getModificationListenersRemoved
Deprecated.UsegetModificationListenersCleared()
instead -
setPropertiesInitially
Deprecated.renamed toconnect(ConnectProperties)
. -
findByID
Deprecated.UsegetItem(String)
instead- Throws:
NoSuchIDException
-
findTypeByID
Deprecated.UsegetType(String)
instead -
findFeatureByID
Deprecated.UsegetFeature(String)
instead -
createDatabase
Deprecated.UsecreateSchema()
instead -
createDatabaseConstraints
Deprecated.UsecreateSchemaConstraints(EnumSet)
instead -
checkSchema
Deprecated.This functionality is no longer supported. This method does nothing.Checks the schema, whether the tables representing the types do exist. -
checkDatabase
Deprecated.UsecheckSchema()
instead -
checkEmptyDatabase
Deprecated.UsecheckEmptySchema()
instead -
dropDatabase
Deprecated.UsedropSchema()
instead -
dropDatabaseConstraints
Deprecated.UsedropSchemaConstraints(EnumSet)
instead -
tearDownDatabase
Deprecated.UsetearDownSchema()
instead -
tearDownDatabaseConstraints
Deprecated.UsetearDownSchemaConstraints(EnumSet)
instead -
flushSequences
Deprecated.Not supported anymore. This method does nothing. -
getProperties
Deprecated.UsegetConnectProperties()
instead -
getDatabaseInfo
Deprecated.UsegetEnvironmentInfo()
andEnvironmentInfo.asProperties()
instead. -
getCurrentTransaction
Deprecated.UsecurrentTransaction()
instead -
supportsCheckConstraints
Deprecated.UseSchemaInfo.supportsCheckConstraints(Model)
instead -
supportsSequences
Deprecated.UseSchemaInfo.supportsSequences(Model)
instead -
isLoggingEnabled
Deprecated.UseConnectProperties.isLoggingEnabled()
instead, always returns false. -
getChangeListenersCleared
Deprecated.usegetChangeListenersInfo()
.ChangeListenerInfo.getCleared()
instead.
-
Model(Revisions, Type...)
andRevisions(int)
.