Class DataManager


  • public class DataManager
    extends java.lang.Object
    Central entry point for the clients to make use of the API provided storage functionality.
    • 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.

        ALLPrincipal:

        Methods.listPrimaryDataEntities

        Methods.listPrimaryDataEntitiesByDate

        Methods.getPrimaryDataEntity

        Methods.read

        Methods.exist

        Methods.getParentDirectory

        Methods.getVersions

        Methods.getCurrentVersion

        Methods.searchByDublinCoreElement

        Methods.searchByMetaData

    • Constructor Detail

      • DataManager

        public DataManager()
    • 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.
      • getDefaultPermissions

        public static java.util.Map<java.security.Principal,​java.util.List<GrantableMethods.Methods>> getDefaultPermissions()
        Returns:
        the current set default permissions.
      • getRootDirectory

        public static PrimaryDataDirectory getRootDirectory​(ImplementationProvider implementationProvider,
                                                            javax.security.auth.Subject subject)
                                                     throws PrimaryDataDirectoryException
        Static function to get the root PrimaryDataDirectory 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 example
         ImplementationProvider 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 create MetaData 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 the getRootDirectory(ImplementationProvider, Subject) function the subject as ThreadLocal object to the current thread
        Returns:
        Subject the subject working in its Thread with a eDAL mount
      • getSupportedPrincipals

        public static java.util.List<java.lang.Class<? extends java.security.Principal>> getSupportedPrincipals()
                                                                                                         throws EdalException
        Getter all supported Principals of the current eDAL system.
        Returns:
        the list of supported Principals
        Throws:
        EdalException - if unable to load Principals.
      • 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 in DEFAULT_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 send
        subject - the subject of the eMail
        emailAddress - 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 send
        subject - the subject of the eMail
        emailAddress - the eMail address of the recipient.
        attachment - the attached File
      • 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 current Subject.
        Parameters:
        subject - a Subject 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 the ThreadPool for EdalHttpServer.
        Returns:
        ExecutorService
      • getVelocityExecutorService

        public static java.util.concurrent.ExecutorService getVelocityExecutorService()
        Getter for the ThreadPool for EdalHttpServer.
        Returns:
        ExecutorService
      • getListExecutorService

        public static java.util.concurrent.ExecutorService getListExecutorService()
        Getter for the ThreadPool for ListThread
        Returns:
        ExecutorService
      • receiveTestData

        public static void receiveTestData​(java.io.OutputStream outputStream)
                                    throws java.io.IOException
        Send an OutputStream containing a short String to test server connectivity
        Parameters:
        outputStream - the OutputStream to fill in the String
        Throws:
        java.io.IOException - if unable to send