Package org.nuxeo.ecm.core.storage.sql
Class RepositoryImpl
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.sql.RepositoryImpl
-
- All Implemented Interfaces:
Repository
,Repository
,RepositoryManagement
public class RepositoryImpl extends Object implements Repository, Repository
Repository
implementation, to be extended by backend-specific initialization code.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RepositoryImpl.SessionPathResolver
-
Field Summary
Fields Modifier and Type Field Description protected VCSClusterInvalidator
clusterInvalidator
VCSInvalidationsPropagator
invalidationsPropagator
Propagator of invalidations to all mappers' caches.protected io.dropwizard.metrics5.MetricRegistry
registry
protected RepositoryDescriptor
repositoryDescriptor
boolean
requiresClusterSQL
protected boolean
selfRegisteredLockManager
protected io.dropwizard.metrics5.Counter
sessionCount
protected SQLInfo
sqlInfo
static String
TEST_UPGRADE
static String
TEST_UPGRADE_LAST_CONTRIBUTOR
static String
TEST_UPGRADE_LOCKS
static String
TEST_UPGRADE_SYS_CHANGE_TOKEN
static String
TEST_UPGRADE_VERSIONS
static Map<String,Serializable>
testProps
-
Constructor Summary
Constructors Constructor Description RepositoryImpl(RepositoryDescriptor repositoryDescriptor)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
cleanupDeletedDocuments(int max, Calendar beforeTime)
Cleans up (hard-deletes) any documents that have been soft-deleted in the database.int
clearCaches()
Clears all the caches.void
close()
Closes the repository and release all resources.protected void
closeAllSessions()
protected void
closeSession(SessionImpl session)
protected Mapper
createCachingMapper(Model model, Mapper mapper)
protected VCSClusterInvalidator
createClusterInvalidator()
protected void
createDatabase(String ddlMode)
Creates the necessary structures in the database.protected void
createDatabaseNoTx(String ddlMode)
protected void
createMetricsGauges()
protected void
createTables(Connection connection, String ddlMode)
protected TableUpgrader
createTableUpgrader(Connection connection, JDBCLogger logger)
protected static Set<String>
findTableNames(DatabaseMetaData metadata, String schemaName)
Finds uppercase table names.long
getCacheMapperSize()
long
getCachePristineSize()
Evaluate number of elements in hier cachelong
getCacheSelectionSize()
Evaluate number of elements in selection cachelong
getCacheSize()
Evaluate number of elements in all cachesprotected Class<? extends CachingMapper>
getCachingMapperClass()
SessionImpl
getConnection()
Gets a new connection.FulltextConfiguration
getFulltextConfiguration()
Gets the fulltext configuration.VCSInvalidationsPropagator
getInvalidationsPropagator()
LockManager
getLockManager()
protected String
getLockManagerName()
Model
getModel()
String
getName()
Gets the repository name.RepositoryDescriptor
getRepositoryDescriptor()
SQLSession
getSession()
SQLInfo
getSQLInfo()
protected String
getTableName(String origName)
protected void
initClusterInvalidator()
protected void
initLockManager()
protected void
initRepository()
protected void
initRootNode()
boolean
isChangeTokenEnabled()
void
markReferencedBinaries()
Marks the binaries in use by passing them to the binary manager(s)'s GC mark() method.protected void
prepareClusterInvalidator()
void
processClusterInvalidationsNext()
Makes sure that the next transaction will process cluster invalidations.protected static void
runWithoutTransaction(Runnable runnable)
void
shutdown()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.model.Repository
getActiveSessionsCount
-
-
-
-
Field Detail
-
TEST_UPGRADE
public static final String TEST_UPGRADE
- See Also:
- Constant Field Values
-
TEST_UPGRADE_VERSIONS
public static final String TEST_UPGRADE_VERSIONS
- See Also:
- Constant Field Values
-
TEST_UPGRADE_LAST_CONTRIBUTOR
public static final String TEST_UPGRADE_LAST_CONTRIBUTOR
- See Also:
- Constant Field Values
-
TEST_UPGRADE_LOCKS
public static final String TEST_UPGRADE_LOCKS
- See Also:
- Constant Field Values
-
TEST_UPGRADE_SYS_CHANGE_TOKEN
public static final String TEST_UPGRADE_SYS_CHANGE_TOKEN
- See Also:
- Constant Field Values
-
testProps
public static Map<String,Serializable> testProps
-
repositoryDescriptor
protected final RepositoryDescriptor repositoryDescriptor
-
registry
protected final io.dropwizard.metrics5.MetricRegistry registry
-
sessionCount
protected final io.dropwizard.metrics5.Counter sessionCount
-
selfRegisteredLockManager
protected boolean selfRegisteredLockManager
- Since:
- 7.4 : used to know if the LockManager was provided by this repository or externally
-
invalidationsPropagator
public final VCSInvalidationsPropagator invalidationsPropagator
Propagator of invalidations to all mappers' caches.
-
clusterInvalidator
protected VCSClusterInvalidator clusterInvalidator
-
requiresClusterSQL
public boolean requiresClusterSQL
-
-
Constructor Detail
-
RepositoryImpl
public RepositoryImpl(RepositoryDescriptor repositoryDescriptor)
-
-
Method Detail
-
createMetricsGauges
protected void createMetricsGauges()
-
createCachingMapper
protected Mapper createCachingMapper(Model model, Mapper mapper)
-
getCachingMapperClass
protected Class<? extends CachingMapper> getCachingMapperClass()
-
getRepositoryDescriptor
public RepositoryDescriptor getRepositoryDescriptor()
-
getLockManager
public LockManager getLockManager()
-
getSQLInfo
public SQLInfo getSQLInfo()
- Since:
- 11.1
-
getInvalidationsPropagator
public VCSInvalidationsPropagator getInvalidationsPropagator()
-
isChangeTokenEnabled
public boolean isChangeTokenEnabled()
-
getSession
public SQLSession getSession()
- Specified by:
getSession
in interfaceRepository
-
getConnection
public SessionImpl getConnection()
Gets a new connection.- Specified by:
getConnection
in interfaceRepository
- Returns:
- the session
-
closeSession
protected void closeSession(SessionImpl session)
-
initRepository
protected void initRepository()
-
initRootNode
protected void initRootNode()
-
getLockManagerName
protected String getLockManagerName()
-
initLockManager
protected void initLockManager()
-
prepareClusterInvalidator
protected void prepareClusterInvalidator()
-
createClusterInvalidator
protected VCSClusterInvalidator createClusterInvalidator()
-
initClusterInvalidator
protected void initClusterInvalidator()
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfaceRepository
-
close
public void close()
Description copied from interface:Repository
Closes the repository and release all resources.- Specified by:
close
in interfaceRepository
-
closeAllSessions
protected void closeAllSessions()
-
getName
public String getName()
Description copied from interface:RepositoryManagement
Gets the repository name.- Specified by:
getName
in interfaceRepository
- Specified by:
getName
in interfaceRepositoryManagement
-
clearCaches
public int clearCaches()
Description copied from interface:RepositoryManagement
Clears all the caches.- Specified by:
clearCaches
in interfaceRepositoryManagement
- Returns:
- an indicative count of objects removed
-
getCacheSize
public long getCacheSize()
Description copied from interface:RepositoryManagement
Evaluate number of elements in all caches- Specified by:
getCacheSize
in interfaceRepositoryManagement
-
getCacheMapperSize
public long getCacheMapperSize()
-
getCachePristineSize
public long getCachePristineSize()
Description copied from interface:RepositoryManagement
Evaluate number of elements in hier cache- Specified by:
getCachePristineSize
in interfaceRepositoryManagement
-
getCacheSelectionSize
public long getCacheSelectionSize()
Description copied from interface:RepositoryManagement
Evaluate number of elements in selection cache- Specified by:
getCacheSelectionSize
in interfaceRepositoryManagement
-
processClusterInvalidationsNext
public void processClusterInvalidationsNext()
Description copied from interface:RepositoryManagement
Makes sure that the next transaction will process cluster invalidations.- Specified by:
processClusterInvalidationsNext
in interfaceRepositoryManagement
-
markReferencedBinaries
public void markReferencedBinaries()
Description copied from interface:RepositoryManagement
Marks the binaries in use by passing them to the binary manager(s)'s GC mark() method.- Specified by:
markReferencedBinaries
in interfaceRepository
- Specified by:
markReferencedBinaries
in interfaceRepositoryManagement
-
cleanupDeletedDocuments
public int cleanupDeletedDocuments(int max, Calendar beforeTime)
Description copied from interface:RepositoryManagement
Cleans up (hard-deletes) any documents that have been soft-deleted in the database.- Specified by:
cleanupDeletedDocuments
in interfaceRepositoryManagement
- Parameters:
max
- the maximum number of documents to delete at a timebeforeTime
- the maximum deletion time of the documents to delete- Returns:
- the number of documents deleted
-
getFulltextConfiguration
public FulltextConfiguration getFulltextConfiguration()
Description copied from interface:RepositoryManagement
Gets the fulltext configuration.- Specified by:
getFulltextConfiguration
in interfaceRepository
- Specified by:
getFulltextConfiguration
in interfaceRepositoryManagement
-
createDatabase
protected void createDatabase(String ddlMode)
Creates the necessary structures in the database.- Parameters:
ddlMode
- the DDL execution mode
-
createDatabaseNoTx
protected void createDatabaseNoTx(String ddlMode)
-
getTableName
protected String getTableName(String origName)
-
createTables
protected void createTables(Connection connection, String ddlMode) throws SQLException
- Throws:
SQLException
-
createTableUpgrader
protected TableUpgrader createTableUpgrader(Connection connection, JDBCLogger logger)
-
findTableNames
protected static Set<String> findTableNames(DatabaseMetaData metadata, String schemaName) throws SQLException
Finds uppercase table names.- Throws:
SQLException
-
runWithoutTransaction
protected static void runWithoutTransaction(Runnable runnable)
-
-