Class ClientDataManager
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.rmi.client.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<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, Authentication authentication)
Constructor forClientDataManager
.
-
Method Summary
Modifier and Type Method Description MetaData
createMetadataInstance()
Create a newMetaData
instance with default values.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<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 currentSubject
.java.util.List<java.lang.Class<? extends java.security.Principal>>
getSupportedPrincipals()
Getter all supportedPrincipal
s 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<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)
-
-
-
Field Detail
-
logger
public static org.apache.logging.log4j.Logger logger
-
DEFAULT_PERMISSIONS
public static java.util.Map<java.security.Principal,java.util.List<GrantableMethods.Methods>> DEFAULT_PERMISSIONS
Constant map with all initial default permissions.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, Authentication authentication) throws EdalAuthenticateException
Constructor forClientDataManager
.- Parameters:
authentication
- theAuthentication
object.registryPort
- the port to the eDAL server.serverAddress
- the path of the eDAL server.- Throws:
EdalAuthenticateException
- if theSubject
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 MetaData createMetadataInstance()
Create a newMetaData
instance with default values.- Returns:
- a new
MetaData
object.
-
getAuthentication
public Authentication getAuthentication()
-
getAvailableStorageSpace
public java.lang.Long getAvailableStorageSpace() throws java.rmi.RemoteException, 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.EdalException
- if no mount path is set.
-
getDefaultPermissions
public java.util.Map<java.security.Principal,java.util.List<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, PrimaryDataDirectoryException, EdalException, EdalAuthenticateException
Central entry point. Connect the client to the eDAL system and provide the rootClientPrimaryDataDirectory
.- Returns:
- the root
ClientPrimaryDataDirectory
object. - Throws:
java.rmi.RemoteException
- if unable to call remote function.java.rmi.NotBoundException
- if noDataManagerRmiInterface
is bound.PrimaryDataDirectoryException
- if unable to load the rootDirectory.EdalException
- if failedEdalAuthenticateException
- if authentication failed
-
getServerAddress
public java.lang.String getServerAddress()
- Returns:
- the serverAddress
-
getSubject
protected javax.security.auth.Subject getSubject()
Getter for the currentSubject
.- Returns:
- the subject
-
getSupportedPrincipals
public java.util.List<java.lang.Class<? extends java.security.Principal>> getSupportedPrincipals() throws java.rmi.RemoteException, EdalException
Getter all supportedPrincipal
s of the current eDAL system.- Returns:
- the list of supported
Principal
s - Throws:
java.rmi.RemoteException
- if unable to call remote function.EdalException
- if unable to loadPrincipal
s.
-
getUsedStorageSpace
public java.lang.Long getUsedStorageSpace() throws java.rmi.RemoteException, 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.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<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
-
-