Class DomibusConnectorClientFSStorageImpl
- java.lang.Object
-
- eu.domibus.connector.client.filesystem.DomibusConnectorClientFSStorageImpl
-
- All Implemented Interfaces:
DomibusConnectorClientFSStorage
,DomibusConnectorClientStorage
public class DomibusConnectorClientFSStorageImpl extends Object implements DomibusConnectorClientFSStorage
-
-
Constructor Summary
Constructors Constructor Description DomibusConnectorClientFSStorageImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,DomibusConnectorMessageType>
checkStorageForNewMessages()
Checks the storage for new messages that should be submitted to the connector.DomibusConnectorClientStorageStatus
checkStorageStatus(String storageLocation)
Checks, if the storage location path still exists.void
deleteFileFromStorage(String storageLocation, String fileName, DomibusConnectorClientStorageFileType fileType)
Deletes a certain file from the storage location.void
deleteMessageFromStorage(String storageLocation)
Complete removes everything contained at the given storage location.Map<String,DomibusConnectorMessageType>
getAllStoredMessages()
Loads all messages from the storage.File
getMessagesDir()
DomibusConnectorMessageType
getStoredMessage(String storageLocation)
Loads the complete message from the given storage location.Map<String,DomibusConnectorClientStorageFileType>
listContentAtStorageLocation(String storageLocation)
Browses a storage location path and lists all files contained at the storage location.byte[]
loadFileContentFromStorageLocation(String storageLocation, String fileName)
Load the content of a file at a storage location.void
setMessagesDir(File messagesDir)
void
storeConfirmationToMessage(DomibusConnectorMessageType message, String storageLocation)
Stores a confirmation received from the connector.void
storeFileIntoStorage(String storageLocation, String fileName, DomibusConnectorClientStorageFileType fileType, byte[] content)
Adds a file to the message's storage location.String
storeMessage(DomibusConnectorMessageType message)
Stores a message into the storage.String
updateStoredMessageToSent(String storageLocation)
Updates a message stored and successfully submitted.
-
-
-
Method Detail
-
storeMessage
public String storeMessage(DomibusConnectorMessageType message) throws DomibusConnectorClientStorageException
Description copied from interface:DomibusConnectorClientStorage
Stores a message into the storage.- Specified by:
storeMessage
in interfaceDomibusConnectorClientStorage
- Parameters:
message
- - The message to be stored- Returns:
- The location path where the message has been stored.
- Throws:
DomibusConnectorClientStorageException
-
storeConfirmationToMessage
public void storeConfirmationToMessage(DomibusConnectorMessageType message, String storageLocation) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Stores a confirmation received from the connector. Stores the confirmation as XML file at the storage location of the original message.- Specified by:
storeConfirmationToMessage
in interfaceDomibusConnectorClientStorage
- Parameters:
message
- - The confirmation message received from the connector.storageLocation
- - The storage location path where the original message is stored.- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
checkStorageForNewMessages
public Map<String,DomibusConnectorMessageType> checkStorageForNewMessages()
Description copied from interface:DomibusConnectorClientStorage
Checks the storage for new messages that should be submitted to the connector.- Specified by:
checkStorageForNewMessages
in interfaceDomibusConnectorClientStorage
- Returns:
- a Map with a key/value pair where the key is the storage location path of the message, and the value is the message.
-
checkStorageStatus
public DomibusConnectorClientStorageStatus checkStorageStatus(String storageLocation)
Description copied from interface:DomibusConnectorClientStorage
Checks, if the storage location path still exists.- Specified by:
checkStorageStatus
in interfaceDomibusConnectorClientStorage
- Returns:
-
getAllStoredMessages
public Map<String,DomibusConnectorMessageType> getAllStoredMessages()
Description copied from interface:DomibusConnectorClientStorage
Loads all messages from the storage.- Specified by:
getAllStoredMessages
in interfaceDomibusConnectorClientStorage
- Returns:
- a Map with a key/value pair where the key is the storage location path of the message, and the value is the message.
-
loadFileContentFromStorageLocation
public byte[] loadFileContentFromStorageLocation(String storageLocation, String fileName) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Load the content of a file at a storage location.- Specified by:
loadFileContentFromStorageLocation
in interfaceDomibusConnectorClientStorage
- Parameters:
storageLocation
- - The storage location path where to search for the file.fileName
- - The name of the file as stored inside the storage location.- Returns:
- The bytes of the file.
- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
listContentAtStorageLocation
public Map<String,DomibusConnectorClientStorageFileType> listContentAtStorageLocation(String storageLocation) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Browses a storage location path and lists all files contained at the storage location. Only used by the connectorClient's rest API!- Specified by:
listContentAtStorageLocation
in interfaceDomibusConnectorClientStorage
- Parameters:
storageLocation
- - The storage location path where to search for files.- Returns:
- A Map where the key is the fileName found and the value the type of file.
- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
storeFileIntoStorage
public void storeFileIntoStorage(String storageLocation, String fileName, DomibusConnectorClientStorageFileType fileType, byte[] content) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Adds a file to the message's storage location.- Specified by:
storeFileIntoStorage
in interfaceDomibusConnectorClientStorage
- Parameters:
storageLocation
- - The storage location path where the submitted message is stored.fileName
- - The name of the file to be stored including filetype suffix.fileType
- - The type of file to be stored.content
- - The content of the file to be stored as bytes.- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
deleteFileFromStorage
public void deleteFileFromStorage(String storageLocation, String fileName, DomibusConnectorClientStorageFileType fileType) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Deletes a certain file from the storage location.- Specified by:
deleteFileFromStorage
in interfaceDomibusConnectorClientStorage
- Parameters:
storageLocation
- - The storage location path the given file should be removed from.fileName
- - The name of the file that should be removed.fileType
- - The type of the file. May result in changes of contents of the message details.- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
getStoredMessage
public DomibusConnectorMessageType getStoredMessage(String storageLocation) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Loads the complete message from the given storage location.- Specified by:
getStoredMessage
in interfaceDomibusConnectorClientStorage
- Parameters:
storageLocation
- - The storage location path.- Returns:
- The message loaded from the storage containing all contents found there.
- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
updateStoredMessageToSent
public String updateStoredMessageToSent(String storageLocation) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Updates a message stored and successfully submitted. Changes parts of the contents stored and renames storage location so the message does not get submitted again.- Specified by:
updateStoredMessageToSent
in interfaceDomibusConnectorClientStorage
- Parameters:
storageLocation
- - The storage location path where the submitted message is stored.- Returns:
- The new storage location path after renaming.
- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
deleteMessageFromStorage
public void deleteMessageFromStorage(String storageLocation) throws DomibusConnectorClientStorageException, IllegalArgumentException
Description copied from interface:DomibusConnectorClientStorage
Complete removes everything contained at the given storage location.- Specified by:
deleteMessageFromStorage
in interfaceDomibusConnectorClientStorage
- Parameters:
storageLocation
- - The storage location path that should be removed.- Throws:
DomibusConnectorClientStorageException
IllegalArgumentException
-
getMessagesDir
public File getMessagesDir()
-
setMessagesDir
public void setMessagesDir(File messagesDir)
- Specified by:
setMessagesDir
in interfaceDomibusConnectorClientFSStorage
-
-