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 enumContent-type of the file (BINARY, TEXT,...). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMax 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.MessagecreateNATRequest(ConnectionAttributes sessionInfo) Sub classes may override this method send messages in NAT protocol to the AE.protected voidcreateRequest(com.uc4.util.XMLDocument doc, Element request, ConnectionAttributes sessionInfo) Creates the XML Document for the request.longReturns the length of the upload-content.Return the entryName used for the Data to transfer.Returns theExceptionthat occured during the reading of the inputFile ornullif it was successful.protected StringgetSrc()Returns the request source.protected voidhandleContent(com.uc4.util.XMLDocument doc, ConnectionAttributes session) Sub classes extract the values from the XML document and provide public getter methods.protected booleanprotected booleanThis method is used internally.booleanReturnstrueif the inputFile was uploaded successfully.voidsetContentType(UploadBinary.ContentType contentType) Sets the content type.voidsetFileName(String fileName) Set the resource file name.voidsetVersion(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:XMLRequestSub classes may override this method send messages in NAT protocol to the AE.- Overrides:
createNATRequestin classXMLRequest- Parameters:
sessionInfo- Session infos- Returns:
- Message or null if not used
-
isAllowedInClientZero
protected boolean isAllowedInClientZero()Description copied from class:XMLRequestThis method is used internally. Tests if thisXMLRequestis allowed in client 0. The default implementation returnsfalse, subclasses may override.- Overrides:
isAllowedInClientZeroin classXMLRequest- Returns:
trueif this request is allowed in client 0,falseotherwise
-
getSrc
Description copied from class:XMLRequestReturns the request source. This method is used internally.- Specified by:
getSrcin classXMLRequest- Returns:
- Source
-
createRequest
protected void createRequest(com.uc4.util.XMLDocument doc, Element request, ConnectionAttributes sessionInfo) Description copied from class:XMLRequestCreates the XML Document for the request. This method is used internally.- Specified by:
createRequestin 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()Returnstrueif the inputFile was uploaded successfully. If this method returnsfalsethere are two possible error-sources:- FileError: check getFileException()
- UploadError: check getMessageBox()
- Returns:
- True if the inputFile was uploaded successfully.
-
getFileException
Returns theExceptionthat occured during the reading of the inputFile ornullif 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:
ignoreMessageBoxin classXMLRequest
-
handleContent
Description copied from class:XMLRequestSub classes extract the values from the XML document and provide public getter methods.- Overrides:
handleContentin classXMLRequest- Parameters:
doc- XML Documentsession- Info about the user session
-