Class ClientDataManager


  • public class ClientDataManager
    extends java.lang.Object
    Class that provides the connection to an eDAL RMI server.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Map<java.security.Principal,​java.util.List<de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods>> DEFAULT_PERMISSIONS
      Constant map with all initial default permissions.
      static org.apache.logging.log4j.Logger logger  
    • Constructor Summary

      Constructors 
      Constructor Description
      ClientDataManager​(java.lang.String serverAddress, int registryPort, de.ipk_gatersleben.bit.bi.edal.rmi.server.Authentication authentication)
      Constructor for ClientDataManager.
    • Method Summary

      Modifier and Type Method Description
      de.ipk_gatersleben.bit.bi.edal.primary_data.metadata.MetaData createMetadataInstance()
      Create a new MetaData instance with default values.
      de.ipk_gatersleben.bit.bi.edal.rmi.server.Authentication getAuthentication()  
      java.lang.Long getAvailableStorageSpace()
      Getter for the available space in the mount path of eDAL.
      java.util.Map<java.security.Principal,​java.util.List<de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods>> getDefaultPermissions()
      Get the local stored default permissions for the current client user.
      int getRegistryPort()  
      ClientPrimaryDataDirectory getRootDirectory()
      Central entry point.
      java.lang.String getServerAddress()  
      protected javax.security.auth.Subject getSubject()
      Getter for the current Subject.
      java.util.List<java.lang.Class<? extends java.security.Principal>> getSupportedPrincipals()
      Getter all supported Principals of the current eDAL system.
      java.lang.Long getUsedStorageSpace()
      Getter for the used space in the mount path of eDAL.
      static void init()
      Do nothing.
      void resetDefaultPermissions()
      Reset the initial default permissions.
      void sendEmail​(java.lang.String emailMessage, java.lang.String emailSubject)  
      void sendEmail​(java.lang.String emailMessage, java.lang.String emailSubject, java.net.URL attachment)  
      void setDefaultPermissions​(java.util.Map<java.security.Principal,​java.util.List<de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods>> permissions)
      Overrides the current default permissions of the current user with the new permissions.
      void testReadingFromServer​(java.lang.String fileName, java.io.OutputStream outputStream)  
      void testStoringOnServer​(java.lang.String fileName, java.io.InputStream inputStream)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        public static org.apache.logging.log4j.Logger logger
      • DEFAULT_PERMISSIONS

        public static java.util.Map<java.security.Principal,​java.util.List<de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods>> DEFAULT_PERMISSIONS
        Constant map with all initial default permissions.

        ALLPrincipal:

        Methods.listPrimaryDataEntities

        Methods.getPrimaryDataEntity

        Methods.read

        Methods.exist

        Methods.getParentDirectory

        Methods.getVersions

        Methods.getCurrentVersion

        Methods.searchByDublinCoreElement

        Methods.searchByMetaData

    • Constructor Detail

      • ClientDataManager

        public ClientDataManager​(java.lang.String serverAddress,
                                 int registryPort,
                                 de.ipk_gatersleben.bit.bi.edal.rmi.server.Authentication authentication)
                          throws de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalAuthenticateException
        Constructor for ClientDataManager.
        Parameters:
        authentication - the Authentication object.
        registryPort - the port to the eDAL server.
        serverAddress - the path of the eDAL server.
        Throws:
        de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalAuthenticateException - if the Subject is null.
    • Method Detail

      • init

        public static void init()
        Do nothing. Just to force the Java Class loader to load the class and run the static block to initialize the logging system.
      • createMetadataInstance

        public de.ipk_gatersleben.bit.bi.edal.primary_data.metadata.MetaData createMetadataInstance()
        Create a new MetaData instance with default values.
        Returns:
        a new MetaData object.
      • getAuthentication

        public de.ipk_gatersleben.bit.bi.edal.rmi.server.Authentication getAuthentication()
      • getAvailableStorageSpace

        public java.lang.Long getAvailableStorageSpace()
                                                throws java.rmi.RemoteException,
                                                       de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException
        Getter for the available space in the mount path of eDAL.
        Returns:
        available space
        Throws:
        java.rmi.RemoteException - if unable to call remote function.
        de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException - if no mount path is set.
      • getDefaultPermissions

        public java.util.Map<java.security.Principal,​java.util.List<de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods>> getDefaultPermissions()
        Get the local stored default permissions for the current client user.
        Returns:
        the Map with the default permissions.
      • getRegistryPort

        public int getRegistryPort()
        Returns:
        the registryPort
      • getRootDirectory

        public ClientPrimaryDataDirectory getRootDirectory()
                                                    throws java.rmi.RemoteException,
                                                           java.rmi.NotBoundException,
                                                           de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataDirectoryException,
                                                           de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException,
                                                           de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalAuthenticateException
        Central entry point. Connect the client to the eDAL system and provide the root ClientPrimaryDataDirectory.
        Returns:
        the root ClientPrimaryDataDirectory object.
        Throws:
        java.rmi.RemoteException - if unable to call remote function.
        java.rmi.NotBoundException - if no DataManagerRmiInterface is bound.
        de.ipk_gatersleben.bit.bi.edal.primary_data.file.PrimaryDataDirectoryException - if unable to load the rootDirectory.
        de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException - if failed
        de.ipk_gatersleben.bit.bi.edal.primary_data.security.EdalAuthenticateException - if authentication failed
      • getServerAddress

        public java.lang.String getServerAddress()
        Returns:
        the serverAddress
      • getSubject

        protected javax.security.auth.Subject getSubject()
        Getter for the current Subject.
        Returns:
        the subject
      • getSupportedPrincipals

        public java.util.List<java.lang.Class<? extends java.security.Principal>> getSupportedPrincipals()
                                                                                                  throws java.rmi.RemoteException,
                                                                                                         de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException
        Getter all supported Principals of the current eDAL system.
        Returns:
        the list of supported Principals
        Throws:
        java.rmi.RemoteException - if unable to call remote function.
        de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException - if unable to load Principals.
      • getUsedStorageSpace

        public java.lang.Long getUsedStorageSpace()
                                           throws java.rmi.RemoteException,
                                                  de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException
        Getter for the used space in the mount path of eDAL.
        Returns:
        used space
        Throws:
        java.rmi.RemoteException - if unable to call remote function.
        de.ipk_gatersleben.bit.bi.edal.primary_data.file.EdalException - if no mount path is set.
      • resetDefaultPermissions

        public void resetDefaultPermissions()
        Reset the initial default permissions.
      • setDefaultPermissions

        public void setDefaultPermissions​(java.util.Map<java.security.Principal,​java.util.List<de.ipk_gatersleben.bit.bi.edal.aspectj.security.GrantableMethods.Methods>> permissions)
        Overrides the current default permissions of the current user with the new permissions.
        Parameters:
        permissions - the permissions to store.
      • testReadingFromServer

        public void testReadingFromServer​(java.lang.String fileName,
                                          java.io.OutputStream outputStream)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • testStoringOnServer

        public void testStoringOnServer​(java.lang.String fileName,
                                        java.io.InputStream inputStream)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • sendEmail

        public void sendEmail​(java.lang.String emailMessage,
                              java.lang.String emailSubject)
                       throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException
      • sendEmail

        public void sendEmail​(java.lang.String emailMessage,
                              java.lang.String emailSubject,
                              java.net.URL attachment)
                       throws java.rmi.RemoteException
        Throws:
        java.rmi.RemoteException