exedio cope

com.exedio.cope
Class Model

java.lang.Object
  extended by com.exedio.cope.Model

public final class Model
extends Object


Constructor Summary
Model(int revisionNumber, Type... types)
           
Model(Revision[] revisions, Type... types)
           
Model(Type... types)
           
 
Method Summary
 void addModificationListener(ModificationListener listener)
           
 void checkDatabase()
          Deprecated. Use checkSchema() instead
 void checkEmptyDatabase()
          Deprecated. Use checkEmptySchema() instead
 void checkEmptySchema()
           
 void checkSchema()
          Checks the schema, whether the tables representing the types do exist.
 void checkTypeColumns()
           
 void checkUnsupportedConstraints()
           
 void clearCache()
           
 void commit()
           
 void connect(ConnectProperties properties)
          Connects this model to the database described in the properties.
 void createDatabase()
          Deprecated. Use createSchema() instead
 void createDatabaseConstraints(EnumSet<Constraint.Type> types)
          Deprecated. Use createSchemaConstraints(EnumSet) instead
 void createSchema()
           
 void createSchemaConstraints(EnumSet<Constraint.Type> types)
           
 void disconnect()
           
 void dropDatabase()
          Deprecated. Use dropSchema() instead
 void dropDatabaseConstraints(EnumSet<Constraint.Type> types)
          Deprecated. Use dropSchemaConstraints(EnumSet) instead
 void dropSchema()
           
 void dropSchemaConstraints(EnumSet<Constraint.Type> types)
           
 Item findByID(String id)
          Deprecated. Use getItem(String) instead
 Feature findFeatureByID(String id)
          Deprecated. Use getFeature(String) instead
 Type findTypeByID(String id)
          Deprecated. Use getType(String) instead
 void flushSequences()
           
 ItemCacheInfo[] getCacheInfo()
          Deprecated. renamed to getItemCacheInfo().
 QueryCacheHistogram[] getCacheQueryHistogram()
          Deprecated. renamed to getQueryCacheHistogram().
 QueryCacheInfo getCacheQueryInfo()
          Deprecated. renamed to getQueryCacheInfo().
 ClusterListenerInfo getClusterListenerInfo()
           
 List<Type<?>> getConcreteTypes()
           
 Date getConnectDate()
           
 Pool.Info getConnectionPoolInfo()
           
 Transaction getCurrentTransaction()
          Returns the transaction for this model, that is bound to the currently running thread.
 Properties getDatabaseInfo()
           
 String getDatabaseLogSQL()
           
 int getDatabaseLogThreshold()
          Threshold time in milliseconds.
 Feature getFeature(String id)
           
 Map<Feature,Feature> getHiddenFeatures()
           
 Date getInitializeDate()
           
 Item getItem(String id)
          Returns the item with the given ID.
 ItemCacheInfo[] getItemCacheInfo()
           
 Date getLastTransactionStartDate()
           
 Map<Integer,byte[]> getMigrationLogs()
          Deprecated. Use getRevisionLogs() instead
 int getMigrationRevision()
          Deprecated. Use getRevisionNumber() instead
 List<Revision> getMigrations()
          Deprecated. Use getRevisions() instead
 int getMigrationVersion()
          Deprecated. Use getRevisionNumber() instead
 List<ModificationListener> getModificationListeners()
           
 int getModificationListenersCleared()
           
 int getModificationListenersRemoved()
          Deprecated. Use getModificationListenersCleared() instead
 long getNextTransactionId()
           
 Collection<Transaction> getOpenTransactions()
          Returns the collection of open Transactions on this model.
 ConnectProperties getProperties()
           
 QueryCacheHistogram[] getQueryCacheHistogram()
           
 QueryCacheInfo getQueryCacheInfo()
           
 Map<Integer,byte[]> getRevisionLogs()
           
 int getRevisionNumber()
           
 List<Revision> getRevisions()
           
 Schema getSchema()
           
 List<SequenceInfo> getSequenceInfo()
           
 TransactionCounters getTransactionCounters()
           
 Type getType(String id)
           
 List<Type<?>> getTypes()
           
 List<Type<?>> getTypesSortedByHierarchy()
           
 Schema getVerifiedSchema()
           
 boolean hasCurrentTransaction()
           
 boolean isClusterNetworkEnabled()
           
 boolean isDatabaseLogEnabled()
           
static boolean isLoggingEnabled()
           
 boolean isMigrationSupported()
          Deprecated. Use isRevisionEnabled() instead
 boolean isRevisionEnabled()
           
 void joinTransaction(Transaction tx)
           
 Transaction leaveTransaction()
           
 void migrate()
          Deprecated. Use revise() instead
 void migrateIfSupported()
          Deprecated. Use reviseIfSupported() instead
 void pingClusterNetwork()
           
 void pingClusterNetwork(int count)
           
 void removeModificationListener(ModificationListener listener)
           
 void revise()
           
 void reviseIfSupported()
           
 void rollback()
           
 void rollbackIfNotCommitted()
           
 void setDatabaseLog(boolean enable, int threshold, String sql, PrintStream out)
           
 void setPropertiesInitially(ConnectProperties properties)
          Deprecated. renamed to connect(ConnectProperties).
 Transaction startTransaction()
           
 Transaction startTransaction(String name)
           
 boolean supportsCheckConstraints()
           
 boolean supportsEmptyStrings()
          Returns, whether the database can store empty strings.
 boolean supportsSequences()
           
 void tearDownDatabase()
          Deprecated. Use tearDownSchema() instead
 void tearDownDatabaseConstraints(EnumSet<Constraint.Type> types)
          Deprecated. Use tearDownSchemaConstraints(EnumSet) instead
 void tearDownSchema()
           
 void tearDownSchemaConstraints(EnumSet<Constraint.Type> types)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Model

public Model(Type... types)

Model

public Model(int revisionNumber,
             Type... types)

Model

public Model(Revision[] revisions,
             Type... types)
Method Detail

getHiddenFeatures

public Map<Feature,Feature> getHiddenFeatures()

connect

public void connect(ConnectProperties properties)
Connects this model to the database described in the properties.

Throws:
IllegalStateException - if this model has already been connected.

disconnect

public void disconnect()

flushSequences

public void flushSequences()

isRevisionEnabled

public boolean isRevisionEnabled()

getRevisionNumber

public int getRevisionNumber()

getRevisions

public List<Revision> getRevisions()

revise

public void revise()

reviseIfSupported

public void reviseIfSupported()

getRevisionLogs

public Map<Integer,byte[]> getRevisionLogs()

getProperties

public ConnectProperties getProperties()

getConnectDate

public Date getConnectDate()

getTypes

public List<Type<?>> getTypes()

getTypesSortedByHierarchy

public List<Type<?>> getTypesSortedByHierarchy()

getConcreteTypes

public List<Type<?>> getConcreteTypes()

getType

public Type getType(String id)
See Also:
Type.getID()

getFeature

public Feature getFeature(String id)
See Also:
Feature.getID()

getInitializeDate

public Date getInitializeDate()

supportsCheckConstraints

public boolean supportsCheckConstraints()

supportsSequences

public boolean supportsSequences()

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 via FunctionField.set(Item,Object). A subsequent retrieval of that string via FunctionField.get(Item) returns an empty string. If false, an empty string stored into a StringField is converted to null, thus a subsequent retrieval of that string returns null.

Up to now, only Oracle does not support empty strings.


isDatabaseLogEnabled

public boolean isDatabaseLogEnabled()

getDatabaseLogThreshold

public int getDatabaseLogThreshold()
Threshold time in milliseconds.


getDatabaseLogSQL

public String getDatabaseLogSQL()

setDatabaseLog

public void setDatabaseLog(boolean enable,
                           int threshold,
                           String sql,
                           PrintStream out)

createSchema

public void createSchema()

createSchemaConstraints

public void createSchemaConstraints(EnumSet<Constraint.Type> types)

checkSchema

public void checkSchema()
Checks the schema, whether the tables representing the types do exist. Issues a single database statement, that touches all tables and columns, that would have been created by createSchema().

Throws:
RuntimeException - if something is wrong with the database. TODO: use a more specific exception.

checkEmptySchema

public void checkEmptySchema()

dropSchema

public void dropSchema()

dropSchemaConstraints

public void dropSchemaConstraints(EnumSet<Constraint.Type> types)

tearDownSchema

public void tearDownSchema()

tearDownSchemaConstraints

public void tearDownSchemaConstraints(EnumSet<Constraint.Type> types)

getVerifiedSchema

public Schema getVerifiedSchema()

getSchema

public Schema getSchema()

getItem

public Item getItem(String id)
             throws NoSuchIDException
Returns the item with the given ID. Always returns active objects.

Throws:
NoSuchIDException - if there is no item with the given id.
See Also:
Item.getCopeID()

getModificationListeners

public List<ModificationListener> getModificationListeners()

getModificationListenersCleared

public int getModificationListenersCleared()

addModificationListener

public void addModificationListener(ModificationListener listener)

removeModificationListener

public void removeModificationListener(ModificationListener listener)

getSequenceInfo

public List<SequenceInfo> getSequenceInfo()

getItemCacheInfo

public ItemCacheInfo[] getItemCacheInfo()

getQueryCacheInfo

public QueryCacheInfo getQueryCacheInfo()

getQueryCacheHistogram

public QueryCacheHistogram[] getQueryCacheHistogram()

getConnectionPoolInfo

public Pool.Info getConnectionPoolInfo()

getDatabaseInfo

public Properties getDatabaseInfo()

getClusterListenerInfo

public ClusterListenerInfo getClusterListenerInfo()

startTransaction

public Transaction startTransaction()
Throws:
IllegalStateException - if there is already a transaction bound to the current thread for this model
See Also:
startTransaction(String)

startTransaction

public Transaction startTransaction(String name)
Parameters:
name - a name for the transaction, useful for debugging. This name is used in Transaction.toString().
Throws:
IllegalStateException - if there is already a transaction bound to the current thread for this model
See Also:
startTransaction()

getNextTransactionId

public long getNextTransactionId()

getLastTransactionStartDate

public Date getLastTransactionStartDate()

leaveTransaction

public Transaction leaveTransaction()

joinTransaction

public void joinTransaction(Transaction tx)

hasCurrentTransaction

public boolean hasCurrentTransaction()

getCurrentTransaction

public Transaction getCurrentTransaction()
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:
Thread.currentThread()

rollback

public void rollback()

rollbackIfNotCommitted

public void rollbackIfNotCommitted()

commit

public void commit()

getOpenTransactions

public Collection<Transaction> getOpenTransactions()
Returns the collection of open Transactions on this model.

Returns an unmodifiable snapshot of the actual data, so iterating over the collection on a live server cannot cause ConcurrentModificationExceptions.


getTransactionCounters

public TransactionCounters getTransactionCounters()

clearCache

public void clearCache()

checkTypeColumns

public void checkTypeColumns()
See Also:
ItemFunction.checkTypeColumn()

checkUnsupportedConstraints

public void checkUnsupportedConstraints()

isClusterNetworkEnabled

public boolean isClusterNetworkEnabled()

pingClusterNetwork

public void pingClusterNetwork()

pingClusterNetwork

public void pingClusterNetwork(int count)

isLoggingEnabled

public static final boolean isLoggingEnabled()

getCacheInfo

@Deprecated
public ItemCacheInfo[] getCacheInfo()
Deprecated. renamed to getItemCacheInfo().


getCacheQueryHistogram

@Deprecated
public QueryCacheHistogram[] getCacheQueryHistogram()
Deprecated. renamed to getQueryCacheHistogram().


getCacheQueryInfo

@Deprecated
public QueryCacheInfo getCacheQueryInfo()
Deprecated. renamed to getQueryCacheInfo().


getMigrationVersion

@Deprecated
public int getMigrationVersion()
Deprecated. Use getRevisionNumber() instead


getMigrationRevision

@Deprecated
public int getMigrationRevision()
Deprecated. Use getRevisionNumber() instead


isMigrationSupported

@Deprecated
public boolean isMigrationSupported()
Deprecated. Use isRevisionEnabled() instead


getMigrations

@Deprecated
public List<Revision> getMigrations()
Deprecated. Use getRevisions() instead


migrate

@Deprecated
public void migrate()
Deprecated. Use revise() instead


migrateIfSupported

@Deprecated
public void migrateIfSupported()
Deprecated. Use reviseIfSupported() instead


getMigrationLogs

@Deprecated
public Map<Integer,byte[]> getMigrationLogs()
Deprecated. Use getRevisionLogs() instead


getModificationListenersRemoved

@Deprecated
public int getModificationListenersRemoved()
Deprecated. Use getModificationListenersCleared() instead


setPropertiesInitially

@Deprecated
public void setPropertiesInitially(ConnectProperties properties)
Deprecated. renamed to connect(ConnectProperties).


findByID

@Deprecated
public Item findByID(String id)
              throws NoSuchIDException
Deprecated. Use getItem(String) instead

Throws:
NoSuchIDException

findTypeByID

@Deprecated
public Type findTypeByID(String id)
Deprecated. Use getType(String) instead


findFeatureByID

@Deprecated
public Feature findFeatureByID(String id)
Deprecated. Use getFeature(String) instead


createDatabase

@Deprecated
public void createDatabase()
Deprecated. Use createSchema() instead


createDatabaseConstraints

@Deprecated
public void createDatabaseConstraints(EnumSet<Constraint.Type> types)
Deprecated. Use createSchemaConstraints(EnumSet) instead


checkDatabase

@Deprecated
public void checkDatabase()
Deprecated. Use checkSchema() instead


checkEmptyDatabase

@Deprecated
public void checkEmptyDatabase()
Deprecated. Use checkEmptySchema() instead


dropDatabase

@Deprecated
public void dropDatabase()
Deprecated. Use dropSchema() instead


dropDatabaseConstraints

@Deprecated
public void dropDatabaseConstraints(EnumSet<Constraint.Type> types)
Deprecated. Use dropSchemaConstraints(EnumSet) instead


tearDownDatabase

@Deprecated
public void tearDownDatabase()
Deprecated. Use tearDownSchema() instead


tearDownDatabaseConstraints

@Deprecated
public void tearDownDatabaseConstraints(EnumSet<Constraint.Type> types)
Deprecated. Use tearDownSchemaConstraints(EnumSet) instead


Cope with
Object
Persistence

SourceForge.net LogoCopyright © 2004-2008 exedio Gesellschaft für Softwareentwicklung mbH. All rights reserved.
svn.12752 build.5319 20090312135114