Class DataManager
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.DataManager
-
public class DataManager extends java.lang.ObjectCentral 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_PERMISSIONSConstant map with all initial default permissions.static java.lang.StringTEST_DATA_STRING
-
Constructor Summary
Constructors Constructor Description DataManager()
-
Method Summary
Modifier and Type Method Description static java.lang.LonggetAvailableStorageSpace()Getter for the available space in the mount path of eDAL.static EdalConfigurationgetConfiguration()Getter for theEdalConfiguration.static java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>>getDefaultPermissions()static EdalHttpServergetHttpServer()static ImplementationProvidergetImplProv()Getter for the currentImplementationProvider.static java.util.concurrent.ExecutorServicegetJettyExecutorService()Getter for theThreadPoolforEdalHttpServer.static java.util.concurrent.ExecutorServicegetListExecutorService()Getter for theThreadPoolforListThreadstatic PrimaryDataDirectorygetRootDirectory(ImplementationProvider implementationProvider, javax.security.auth.Subject subject)Static function to get the rootPrimaryDataDirectoryof the eDAL-System.static javax.security.auth.SubjectgetSubject()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 supportedPrincipals of the current eDAL system.static java.lang.LonggetUsedStorageSpace()Getter for the used space in the mount path of eDAL.static java.util.concurrent.ExecutorServicegetVelocityExecutorService()Getter for theThreadPoolforEdalHttpServer.static voidreceiveTestData(java.io.OutputStream outputStream)Send anOutputStreamcontaining a shortStringto test server connectivitystatic voidresetDefaultPermissions()Reload all initial default permission inDEFAULT_PERMISSIONS.static voidsendEmail(java.lang.String message, java.lang.String subject, java.lang.String emailAddress)Function to send an eMail to the given recipient.static voidsendEmail(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 voidsetDefaultPermissions(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 voidsetSubject(javax.security.auth.Subject subject)Setter for the currentSubject.static voidshutdown()Convenience function to shutdown the eDAL system.static voidwaitForShutDown()
-
-
-
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 EdalExceptionGetter 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 rootPrimaryDataDirectoryof 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
PrimaryDataDirectoryfor the passed implementation - Throws:
PrimaryDataDirectoryException- if unable to createMetaDatainstance 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 EdalExceptionGetter all supportedPrincipals of the current eDAL system.- Returns:
- the list of supported
Principals - Throws:
EdalException- if unable to loadPrincipals.
-
getUsedStorageSpace
public static java.lang.Long getUsedStorageSpace() throws EdalExceptionGetter 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- aSubjectobject.
-
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 theThreadPoolforEdalHttpServer.- Returns:
- ExecutorService
-
getVelocityExecutorService
public static java.util.concurrent.ExecutorService getVelocityExecutorService()
Getter for theThreadPoolforEdalHttpServer.- Returns:
- ExecutorService
-
getListExecutorService
public static java.util.concurrent.ExecutorService getListExecutorService()
Getter for theThreadPoolforListThread- Returns:
- ExecutorService
-
receiveTestData
public static void receiveTestData(java.io.OutputStream outputStream) throws java.io.IOExceptionSend anOutputStreamcontaining a shortStringto test server connectivity- Parameters:
outputStream- theOutputStreamto fill in theString- Throws:
java.io.IOException- if unable to send
-
-