Package com.uc4.communication.requests
Class UploadBinary
java.lang.Object
com.uc4.communication.requests.XMLRequest
com.uc4.communication.requests.UploadBinary
Adds or replaces a file in a STORE object.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Content-type of the file (BINARY, TEXT,...). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Max file size in bytes for uploads. -
Constructor Summary
ConstructorsConstructorDescriptionUploadBinary
(UC4ObjectName storeObject, String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, File inputFile) Creates a new request to upload a file to a STORE object.UploadBinary
(UC4ObjectName storeObject, String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, ByteBuffer buffer) Creates a new request to upload a file to a STORE object. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.automic.protocol.Message
createNATRequest
(ConnectionAttributes sessionInfo) Sub classes may override this method send messages in NAT protocol to the AE.protected void
createRequest
(com.uc4.util.XMLDocument doc, Element request, ConnectionAttributes sessionInfo) Creates the XML Document for the request.long
Returns the length of the upload-content.Return the entryName used for the Data to transfer.Returns theException
that occured during the reading of the inputFile ornull
if it was successful.protected String
getSrc()
Returns the request source.protected void
handleContent
(com.uc4.util.XMLDocument doc, ConnectionAttributes session) Sub classes extract the values from the XML document and provide public getter methods.protected boolean
protected boolean
This method is used internally.boolean
Returnstrue
if the inputFile was uploaded successfully.void
setContentType
(UploadBinary.ContentType contentType) Sets the content type.void
setFileName
(String fileName) Set the resource file name.void
setVersion
(String version) Set the resource version.Methods inherited from class com.uc4.communication.requests.XMLRequest
assertClientZero, assertServerVersion, checkClient, checkID, checkLnr, checkNull, checkSelStatisticsPrivilege, checkSystemOverviewPrivilege, checkUC4ObjectEmptyName, checkUC4ObjectName, createNATFor, emptyAttributes, getAllMessageBoxes, getMessageBox, getRequestID, handleResponse, send, setMessageBox, showQuarantineNotification
-
Field Details
-
MAX_UPLOAD_SIZE
public static final int MAX_UPLOAD_SIZEMax file size in bytes for uploads. The maximum would be 99999999 but some bytes are needed for the header and other fields of the BIN_PUT message- See Also:
-
-
Constructor Details
-
UploadBinary
public UploadBinary(UC4ObjectName storeObject, String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, File inputFile) Creates a new request to upload a file to a STORE object.- Parameters:
storeObject
- Name of the STORE object.entryName
- Name of the entry in the STORE objectosPlatformHw
- Combined type of OS, Platform, HW of the entry.isUpdate
- Must be set to true if a resource should be updated.inputFile
- File which should be uploaded
-
UploadBinary
public UploadBinary(UC4ObjectName storeObject, String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, ByteBuffer buffer) Creates a new request to upload a file to a STORE object.- Parameters:
storeObject
- Name of the STORE objectentryName
- Name of the entry which is used to identify the file.osPlatformHw
- Combined type of OS, Platform, HW of the entry.isUpdate
- Must be set to true if a resource should be updated.buffer
- File content
-
-
Method Details
-
createNATRequest
Description copied from class:XMLRequest
Sub classes may override this method send messages in NAT protocol to the AE.- Overrides:
createNATRequest
in classXMLRequest
- Parameters:
sessionInfo
- Session infos- Returns:
- Message or null if not used
-
isAllowedInClientZero
protected boolean isAllowedInClientZero()Description copied from class:XMLRequest
This method is used internally. Tests if thisXMLRequest
is allowed in client 0. The default implementation returnsfalse
, subclasses may override.- Overrides:
isAllowedInClientZero
in classXMLRequest
- Returns:
true
if this request is allowed in client 0,false
otherwise
-
getSrc
Description copied from class:XMLRequest
Returns the request source. This method is used internally.- Specified by:
getSrc
in classXMLRequest
- Returns:
- Source
-
createRequest
protected void createRequest(com.uc4.util.XMLDocument doc, Element request, ConnectionAttributes sessionInfo) Description copied from class:XMLRequest
Creates the XML Document for the request. This method is used internally.- Specified by:
createRequest
in classXMLRequest
- Parameters:
doc
- Document, used to create new Elementsrequest
- Request Element - classes append information to this request elementsessionInfo
- Information about the session
-
setVersion
Set the resource version.- Parameters:
version
- Version
-
setFileName
Set the resource file name.- Parameters:
fileName
- Name of the file
-
setContentType
Sets the content type.- Parameters:
contentType
- content-type of the file
-
getEntryName
Return the entryName used for the Data to transfer.- Returns:
- The entryName as
String
-
isFileUploadOK
public boolean isFileUploadOK()Returnstrue
if the inputFile was uploaded successfully. If this method returnsfalse
there are two possible error-sources:- FileError: check getFileException()
- UploadError: check getMessageBox()
- Returns:
- True if the inputFile was uploaded successfully.
-
getFileException
Returns theException
that occured during the reading of the inputFile ornull
if it was successful.- Returns:
- Exception or null
-
getContentLen
public long getContentLen()Returns the length of the upload-content.- Returns:
- binary data length
-
ignoreMessageBox
protected boolean ignoreMessageBox()- Overrides:
ignoreMessageBox
in classXMLRequest
-
handleContent
Description copied from class:XMLRequest
Sub classes extract the values from the XML document and provide public getter methods.- Overrides:
handleContent
in classXMLRequest
- Parameters:
doc
- XML Documentsession
- Info about the user session
-