Class DataManager
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.DataManager
-
public class DataManager extends java.lang.Object
Central entry point for the clients to make use of the API provided storage functionality.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>>
DEFAULT_PERMISSIONS
Constant map with all initial default permissions.static java.lang.String
TEST_DATA_STRING
-
Constructor Summary
Constructors Constructor Description DataManager()
-
Method Summary
Modifier and Type Method Description static java.lang.Long
getAvailableStorageSpace()
Getter for the available space in the mount path of eDAL.static EdalConfiguration
getConfiguration()
Getter for theEdalConfiguration
.static java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>>
getDefaultPermissions()
static EdalHttpServer
getHttpServer()
static ImplementationProvider
getImplProv()
Getter for the currentImplementationProvider
.static java.util.concurrent.ExecutorService
getJettyExecutorService()
Getter for theThreadPool
forEdalHttpServer
.static java.util.concurrent.ExecutorService
getListExecutorService()
Getter for theThreadPool
forListThread
static PrimaryDataDirectory
getRootDirectory(ImplementationProvider implementationProvider, javax.security.auth.Subject subject)
Static function to get the rootPrimaryDataDirectory
of the eDAL-System.static javax.security.auth.Subject
getSubject()
In order to know, who is working with an eDAL data structure instance.static java.util.List<java.lang.Class<? extends java.security.Principal>>
getSupportedPrincipals()
Getter all supportedPrincipal
s of the current eDAL system.static java.lang.Long
getUsedStorageSpace()
Getter for the used space in the mount path of eDAL.static java.util.concurrent.ExecutorService
getVelocityExecutorService()
Getter for theThreadPool
forEdalHttpServer
.static void
receiveTestData(java.io.OutputStream outputStream)
Send anOutputStream
containing a shortString
to test server connectivitystatic void
resetDefaultPermissions()
Reload all initial default permission inDEFAULT_PERMISSIONS
.static void
sendEmail(java.lang.String message, java.lang.String subject, java.lang.String emailAddress)
Function to send an eMail to the given recipient.static void
sendEmail(java.lang.String message, java.lang.String subject, java.lang.String emailAddress, java.net.URL attachment)
Function to send an eMail with attachment to the given recipient.static void
setDefaultPermissions(java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>> newUserPermissions)
Overrides the current default permissions of the current user with the new permissions.static void
setSubject(javax.security.auth.Subject subject)
Setter for the currentSubject
.static void
shutdown()
Convenience function to shutdown the eDAL system.static void
waitForShutDown()
-
-
-
Field Detail
-
TEST_DATA_STRING
public static final java.lang.String TEST_DATA_STRING
- See Also:
- Constant Field Values
-
DEFAULT_PERMISSIONS
public static final java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>> DEFAULT_PERMISSIONS
Constant map with all initial default permissions.Methods.listPrimaryDataEntities
Methods.listPrimaryDataEntitiesByDate
Methods.getPrimaryDataEntity
Methods.read
Methods.exist
Methods.getParentDirectory
Methods.getVersions
Methods.getCurrentVersion
Methods.searchByDublinCoreElement
Methods.searchByMetaData
-
-
Method Detail
-
getAvailableStorageSpace
public static java.lang.Long getAvailableStorageSpace() throws EdalException
Getter for the available space in the mount path of eDAL.- Returns:
- available space
- Throws:
EdalException
- if no path is specified.
-
getConfiguration
public static EdalConfiguration getConfiguration()
Getter for theEdalConfiguration
.- Returns:
- the current
EdalConfiguration
.
-
getDefaultPermissions
public static java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>> getDefaultPermissions()
- Returns:
- the current set default permissions.
-
getImplProv
public static ImplementationProvider getImplProv()
Getter for the currentImplementationProvider
.- Returns:
- ImplementationProvider with all implementing classes
-
getRootDirectory
public static PrimaryDataDirectory getRootDirectory(ImplementationProvider implementationProvider, javax.security.auth.Subject subject) throws PrimaryDataDirectoryException
Static function to get the rootPrimaryDataDirectory
of the eDAL-System.- Parameters:
implementationProvider
- must provide the implementing classes the implementation, which will be used. The call pass the current logged in JAAS subject.For exampleImplementationProvider myImpl = new MyEDALImplementation(); LoginContext CTX = new LoginContext(...); CTX(); Subject mySubject = CTX.getSubject(); PrimaryDataDirectory root_dir = DataManager.getRootDirectory(myImpl, mySubject);
subject
- the authenticated subject- Returns:
- the root
PrimaryDataDirectory
for the passed implementation - Throws:
PrimaryDataDirectoryException
- if unable to createMetaData
instance or if unable to initialize security system.
-
getSubject
public static javax.security.auth.Subject getSubject()
In order to know, who is working with an eDAL data structure instance. We bind in thegetRootDirectory(ImplementationProvider, Subject)
function the subject as ThreadLocal object to the current thread- Returns:
- Subject the subject working in its Thread with a eDAL mount
-
getHttpServer
public static EdalHttpServer getHttpServer()
- Returns:
- the cuurent
EdalHttpServer
-
getSupportedPrincipals
public static java.util.List<java.lang.Class<? extends java.security.Principal>> getSupportedPrincipals() throws EdalException
Getter all supportedPrincipal
s of the current eDAL system.- Returns:
- the list of supported
Principal
s - Throws:
EdalException
- if unable to loadPrincipal
s.
-
getUsedStorageSpace
public static java.lang.Long getUsedStorageSpace() throws EdalException
Getter for the used space in the mount path of eDAL.- Returns:
- used space
- Throws:
EdalException
- if no path is specified.
-
resetDefaultPermissions
public static void resetDefaultPermissions()
Reload all initial default permission inDEFAULT_PERMISSIONS
.
-
sendEmail
public static void sendEmail(java.lang.String message, java.lang.String subject, java.lang.String emailAddress)
Function to send an eMail to the given recipient.- Parameters:
message
- the message to sendsubject
- the subject of the eMailemailAddress
- the eMail address of the recipient.
-
sendEmail
public static void sendEmail(java.lang.String message, java.lang.String subject, java.lang.String emailAddress, java.net.URL attachment)
Function to send an eMail with attachment to the given recipient.- Parameters:
message
- the message to sendsubject
- the subject of the eMailemailAddress
- the eMail address of the recipient.attachment
- the attachedFile
-
setDefaultPermissions
public static void setDefaultPermissions(java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>> newUserPermissions)
Overrides the current default permissions of the current user with the new permissions.- Parameters:
newUserPermissions
- the user permissions to set to the default permissions.
-
setSubject
public static void setSubject(javax.security.auth.Subject subject)
Setter for the currentSubject
.- Parameters:
subject
- aSubject
object.
-
shutdown
public static void shutdown()
Convenience function to shutdown the eDAL system.
-
waitForShutDown
public static void waitForShutDown()
-
getJettyExecutorService
public static java.util.concurrent.ExecutorService getJettyExecutorService()
Getter for theThreadPool
forEdalHttpServer
.- Returns:
- ExecutorService
-
getVelocityExecutorService
public static java.util.concurrent.ExecutorService getVelocityExecutorService()
Getter for theThreadPool
forEdalHttpServer
.- Returns:
- ExecutorService
-
getListExecutorService
public static java.util.concurrent.ExecutorService getListExecutorService()
Getter for theThreadPool
forListThread
- Returns:
- ExecutorService
-
receiveTestData
public static void receiveTestData(java.io.OutputStream outputStream) throws java.io.IOException
Send anOutputStream
containing a shortString
to test server connectivity- Parameters:
outputStream
- theOutputStream
to fill in theString
- Throws:
java.io.IOException
- if unable to send
-
-