public class ManagedRepositoryI extends PublicRepositoryI implements _ManagedRepositoryOperations
PublicRepositoryI.AMD_submit
Modifier and Type | Field and Description |
---|---|
protected FsFile |
templateRoot |
checksumAlgorithms, checksumProviderFactory, context, DIRECTORY_MIMETYPE, filePathRestrictions, IMPORT_LOG_MIMETYPE, repositoryDao, serverPaths
Constructor and Description |
---|
ManagedRepositoryI(java.lang.String template,
RepositoryDao dao)
Creates a
ProcessContainer internally that will not be managed
by background threads. |
ManagedRepositoryI(java.lang.String template,
RepositoryDao dao,
ProcessContainer processes,
ome.security.SecuritySystem securitySystem,
ome.util.checksum.ChecksumProviderFactory checksumProviderFactory,
java.lang.String checksumAlgorithmSupported,
java.lang.String pathRules,
java.lang.String rootSessionUuid,
ome.system.Roles roles,
java.util.Set<java.lang.String> managedRepoUuids) |
Modifier and Type | Method and Description |
---|---|
protected CheckedPath |
checkPath(java.lang.String path,
ChecksumAlgorithm checksumAlgorithm) |
protected CheckedPath |
checkPath(java.lang.String path,
ChecksumAlgorithm checksumAlgorithm,
Ice.Current curr)
Create a new
CheckedPath object based on the given user input. |
void |
clearFileCreationListener()
Clear the file creation listener for this thread.
|
protected FsFile |
commonRoot(java.util.List<FsFile> paths)
From a list of paths, calculate the common root path that all share.
|
protected ImportProcessPrx |
createImportProcess(Fileset fs,
ImportLocation location,
ImportSettings settings,
Ice.Current __current)
Creating the process will register itself in an appropriate
container (i.e.
|
protected FsFile |
createTemplatePath(java.lang.Object consistentData,
Ice.Current __current)
Expand the template path and create its directories with the correct ownership.
|
FsFile |
createTemplatePath(java.lang.Object consistentData,
ome.system.EventContext ctx,
ome.system.ServiceFactory sf,
org.hibernate.Session session,
ome.util.SqlAction sql)
Expand the template path and create its directories with the correct ownership.
|
protected ImportProcessPrx |
createUploadProcess(Fileset fs,
ImportLocation location,
ImportSettings settings,
Ice.Current __current,
boolean uploadOnly)
Creating the process will register itself in an appropriate
container (i.e.
|
protected FsFile |
expandTemplateRootOwnedPath(EventContext ctx,
ome.system.ServiceFactory sf)
Expand the root-owned segment of the template path.
|
protected java.lang.Class<? extends loci.formats.FormatReader> |
getReaderClass(Fileset fs,
Ice.Current __current)
Get the suggested BioFormats Reader for the given Fileset.
|
ImportProcessPrx |
importFileset(Fileset fs,
ImportSettings settings,
Ice.Current __current)
Return a template based directory path.
|
ImportProcessPrx |
importPaths(java.util.List<java.lang.String> paths,
Ice.Current __current)
For clients without access to Bio-Formats, the simplified
importPaths method allows passing solely the absolute
path of the files to be uploaded (no directories) and all
configuration happens server-side. |
void |
initialize(FileMaker fileMaker,
java.lang.Long id,
java.lang.String repoUuid)
Called by the internal repository once initialization has taken place.
|
java.util.List<ChecksumAlgorithm> |
listChecksumAlgorithms(Ice.Current __current)
Return the list of checksum algorithms supported by this repository
for verifying the integrity of uploaded files.
|
java.util.List<ImportProcessPrx> |
listImports(Ice.Current __current)
List imports that are currently running in this importer.
|
protected void |
makeCheckedDirs(java.util.LinkedList<CheckedPath> paths,
boolean parents,
org.hibernate.Session s,
ome.system.ServiceFactory sf,
ome.util.SqlAction sql,
ome.system.EventContext effectiveEventContext)
Checks for the top-level user directory restriction before calling
PublicRepositoryI.makeCheckedDirs(LinkedList, boolean, Session, ServiceFactory, SqlAction, EventContext) |
void |
makeDir(java.lang.String path,
boolean parents,
org.hibernate.Session session,
ome.system.ServiceFactory sf,
ome.util.SqlAction sql,
ome.system.EventContext effectiveEventContext) |
java.util.List<java.lang.Long> |
setChecksumAlgorithm(ChecksumAlgorithm toHasherWrapped,
java.util.List<java.lang.Long> ids,
Ice.Current __current)
Set the checksum algorithm for the original files identified
by the given IDs and calculate their checksum accordingly.
|
void |
setFileCreationListener(java.util.function.Consumer<CheckedPath> fileCreationListener)
Set the file creation listener for this thread that is notified of new files being created.
|
ChecksumAlgorithm |
suggestChecksumAlgorithm(java.util.List<ChecksumAlgorithm> supported,
Ice.Current __current)
Suggest a checksum algorithm to use for
ImportSettings.checksumAlgorithm according to the
preferences set by the server administrator. |
protected ImportLocation |
suggestImportPaths(FsFile relPath,
FsFile basePath,
java.util.List<FsFile> paths,
java.lang.Class<? extends loci.formats.FormatReader> reader,
ChecksumAlgorithm checksumAlgorithm,
Ice.Current __current)
Take a relative path that the user would like to see in his or her
upload area, and provide an import location instance whose paths
correspond to existing directories corresponding to the sanitized
file paths.
|
Ice.Object |
tie()
Wrap the current instance with an
TieBase so that it
can be turned into a proxy. |
protected ome.services.blitz.repo.ManagedRepositoryI.Paths |
trimPaths(FsFile basePath,
java.util.List<FsFile> fullPaths,
java.lang.Class<? extends loci.formats.FormatReader> readerClass)
Trim off the start of long client-side paths.
|
ImportProcessPrx |
uploadFileset(Fileset fs,
ImportSettings settings,
Ice.Current __current)
Return a template based directory path.
|
java.util.List<java.lang.Long> |
verifyChecksums(java.util.List<java.lang.Long> ids,
Ice.Current __current)
Verify the checksum for the original files identified by
the given IDs.
|
createRepoRFS, deletePaths, file, fileById, fileExists, findInDb, findOrCreateInDb, findOrCreateInDb, getFactory, getRepoUuid, list, listFiles, makeAdjustedCurrent, makeCheckedDirs, makeDir, makeDir, mimetype, persistLogFile, publishMessage, register, root, rootPath, setApplicationContext, stackTraceAsString, submitRequest, submitRequest, sudo, treeList
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deletePaths, file, fileById, fileExists, list, listFiles, makeDir, mimetype, register, root, treeList
protected FsFile templateRoot
public ManagedRepositoryI(java.lang.String template, RepositoryDao dao) throws java.lang.Exception
ProcessContainer
internally that will not be managed
by background threads. Used primarily during testing.template
- dao
- java.lang.Exception
public ManagedRepositoryI(java.lang.String template, RepositoryDao dao, ProcessContainer processes, ome.security.SecuritySystem securitySystem, ome.util.checksum.ChecksumProviderFactory checksumProviderFactory, java.lang.String checksumAlgorithmSupported, java.lang.String pathRules, java.lang.String rootSessionUuid, ome.system.Roles roles, java.util.Set<java.lang.String> managedRepoUuids) throws ServerError
ServerError
public Ice.Object tie()
PublicRepositoryI
TieBase
so that it
can be turned into a proxy. This is required due to the subclassing
between public repo instances.tie
in class PublicRepositoryI
public void initialize(FileMaker fileMaker, java.lang.Long id, java.lang.String repoUuid) throws ValidationException
PublicRepositoryI
initialize
in class PublicRepositoryI
ValidationException
public void setFileCreationListener(java.util.function.Consumer<CheckedPath> fileCreationListener)
makeCheckedDirs(LinkedList, boolean, Session, ServiceFactory, SqlAction, EventContext)
by this thread.fileCreationListener
- a file creation listenerpublic void clearFileCreationListener()
setFileCreationListener(Consumer)
public ImportProcessPrx uploadFileset(Fileset fs, ImportSettings settings, Ice.Current __current) throws ServerError
PublicRepositoryI.makeDir(String, boolean, Ice.Current)
.ServerError
public ImportProcessPrx importFileset(Fileset fs, ImportSettings settings, Ice.Current __current) throws ServerError
PublicRepositoryI.makeDir(String, boolean, Ice.Current)
.importFileset
in interface _ManagedRepositoryOperations
__current
- The Current object for the invocation.ServerError
public ImportProcessPrx importPaths(java.util.List<java.lang.String> paths, Ice.Current __current) throws ServerError
_ManagedRepositoryOperations
importPaths
method allows passing solely the absolute
path of the files to be uploaded (no directories) and all
configuration happens server-side. Much of the functionality
provided via Fileset
and
ImportSettings
is of course lost.importPaths
in interface _ManagedRepositoryOperations
__current
- The Current object for the invocation.ServerError
public java.util.List<ImportProcessPrx> listImports(Ice.Current __current) throws ServerError
_ManagedRepositoryOperations
Fileset
object which is being created
by the import. If the user has write permissions for the
fileset, then the import will be included.listImports
in interface _ManagedRepositoryOperations
__current
- The Current object for the invocation.ServerError
public java.util.List<ChecksumAlgorithm> listChecksumAlgorithms(Ice.Current __current)
_ManagedRepositoryOperations
ImportSettings.checksumAlgorithm
.listChecksumAlgorithms
in interface _ManagedRepositoryOperations
__current
- The Current object for the invocation.public ChecksumAlgorithm suggestChecksumAlgorithm(java.util.List<ChecksumAlgorithm> supported, Ice.Current __current)
_ManagedRepositoryOperations
ImportSettings.checksumAlgorithm
according to the
preferences set by the server administrator. Provide a
list of the algorithms supported by the client, and the
server will report which of them is most preferred by
the server, or return null if none of them are supported.suggestChecksumAlgorithm
in interface _ManagedRepositoryOperations
__current
- The Current object for the invocation.public java.util.List<java.lang.Long> verifyChecksums(java.util.List<java.lang.Long> ids, Ice.Current __current) throws ServerError
_ManagedRepositoryOperations
verifyChecksums
in interface _ManagedRepositoryOperations
__current
- The Current object for the invocation.ServerError
public java.util.List<java.lang.Long> setChecksumAlgorithm(ChecksumAlgorithm toHasherWrapped, java.util.List<java.lang.Long> ids, Ice.Current __current) throws ServerError
_ManagedRepositoryOperations
setChecksumAlgorithm
in interface _ManagedRepositoryOperations
__current
- The Current object for the invocation.ServerError
protected ImportProcessPrx createImportProcess(Fileset fs, ImportLocation location, ImportSettings settings, Ice.Current __current) throws ServerError
ServerError
protected ImportProcessPrx createUploadProcess(Fileset fs, ImportLocation location, ImportSettings settings, Ice.Current __current, boolean uploadOnly) throws ServerError
ServerError
protected java.lang.Class<? extends loci.formats.FormatReader> getReaderClass(Fileset fs, Ice.Current __current)
fs
- a fileset__current
- the current ICE contextprotected FsFile commonRoot(java.util.List<FsFile> paths)
paths
- some pathsprotected FsFile expandTemplateRootOwnedPath(EventContext ctx, ome.system.ServiceFactory sf) throws ServerError
ctx
- the event context to apply in expanding termssf
- the service factoryServerError
- if the path could not be expandedprotected FsFile createTemplatePath(java.lang.Object consistentData, Ice.Current __current) throws ServerError
consistentData
- the object to hash in expanding %hash%
__current
- the method invocation contextServerError
- if the new path could not be createdpublic FsFile createTemplatePath(java.lang.Object consistentData, ome.system.EventContext ctx, ome.system.ServiceFactory sf, org.hibernate.Session session, ome.util.SqlAction sql) throws ServerError
createTemplatePath(Object, Current)
except from within an existing transaction.consistentData
- the object to hash in expanding %hash%
ctx
- the event context to apply in expanding termssf
- the service factorysession
- the Hibernate sessionsql
- the JDBC convenience wrapperServerError
- if the new path could not be createdprotected ome.services.blitz.repo.ManagedRepositoryI.Paths trimPaths(FsFile basePath, java.util.List<FsFile> fullPaths, java.lang.Class<? extends loci.formats.FormatReader> readerClass)
basePath
- the common rootfullPaths
- the full paths from the common root down to the filenamereaderClass
- BioFormats reader for data, may be nullprotected ImportLocation suggestImportPaths(FsFile relPath, FsFile basePath, java.util.List<FsFile> paths, java.lang.Class<? extends loci.formats.FormatReader> reader, ChecksumAlgorithm checksumAlgorithm, Ice.Current __current) throws ServerError
relPath
- Path parsed from the templatebasePath
- Common base of all the listed paths ("/my/path")reader
- BioFormats reader for data, may be nullchecksumAlgorithm
- the checksum algorithm to use in verifying the integrity of uploaded filesImportLocation
instanceServerError
protected void makeCheckedDirs(java.util.LinkedList<CheckedPath> paths, boolean parents, org.hibernate.Session s, ome.system.ServiceFactory sf, ome.util.SqlAction sql, ome.system.EventContext effectiveEventContext) throws ServerError
PublicRepositoryI.makeCheckedDirs(LinkedList, boolean, Session, ServiceFactory, SqlAction, EventContext)
makeCheckedDirs
in class PublicRepositoryI
paths
- Not null, not empty. (Will be emptied by this method.)parents
- "mkdir -p" like flag.s
- the Hibernate sessionsf
- the service factorysql
- the JDBC convenience wrappereffectiveEventContext
- the event context to applyServerError
protected final CheckedPath checkPath(java.lang.String path, ChecksumAlgorithm checksumAlgorithm, Ice.Current curr) throws ValidationException
PublicRepositoryI
CheckedPath
object based on the given user input.
This method is included to allow subclasses a chance to introduce their
own CheckedPath
implementations.checkPath
in class PublicRepositoryI
path
- A path on a repository.ValidationException
protected final CheckedPath checkPath(java.lang.String path, ChecksumAlgorithm checksumAlgorithm) throws ValidationException
public void makeDir(java.lang.String path, boolean parents, org.hibernate.Session session, ome.system.ServiceFactory sf, ome.util.SqlAction sql, ome.system.EventContext effectiveEventContext) throws ServerError