Package com.uc4.communication.requests
Class UploadBinary
- java.lang.Object
-
- com.uc4.communication.requests.XMLRequest
-
- com.uc4.communication.requests.UploadBinary
-
public class UploadBinary extends XMLRequest
Adds or replaces a file in a STORE object.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUploadBinary.ContentTypeContent-type of the file (BINARY, TEXT,...).
-
Field Summary
Fields Modifier and Type Field Description static intMAX_UPLOAD_SIZEMax file size in bytes for uploads.
-
Constructor Summary
Constructors Constructor Description UploadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, java.io.File inputFile)Creates a new request to upload a file to a STORE object.UploadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, java.nio.ByteBuffer buffer)Creates a new request to upload a file to a STORE object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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, org.w3c.dom.Element request, ConnectionAttributes sessionInfo)Creates the XML Document for the request.longgetContentLen()Returns the length of the upload-content.java.lang.StringgetEntryName()Return the entryName used for the Data to transfer.java.lang.ExceptiongetFileException()Returns theExceptionthat occured during the reading of the inputFile ornullif it was successful.protected java.lang.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 booleanignoreMessageBox()protected booleanisAllowedInClientZero()This method is used internally.booleanisFileUploadOK()Returnstrueif the inputFile was uploaded successfully.voidsetContentType(UploadBinary.ContentType contentType)Sets the content type.voidsetFileName(java.lang.String fileName)Set the resource file name.voidsetVersion(java.lang.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 Detail
-
MAX_UPLOAD_SIZE
public static final int MAX_UPLOAD_SIZE
Max 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:
- Constant Field Values
-
-
Constructor Detail
-
UploadBinary
public UploadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, java.io.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, java.lang.String entryName, PlatformSwHwType osPlatformHw, boolean isUpdate, java.nio.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 Detail
-
createNATRequest
protected com.automic.protocol.Message createNATRequest(ConnectionAttributes sessionInfo)
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
protected java.lang.String 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, org.w3c.dom.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
public void setVersion(java.lang.String version)
Set the resource version.- Parameters:
version- Version
-
setFileName
public void setFileName(java.lang.String fileName)
Set the resource file name.- Parameters:
fileName- Name of the file
-
setContentType
public void setContentType(UploadBinary.ContentType contentType)
Sets the content type.- Parameters:
contentType- content-type of the file
-
getEntryName
public java.lang.String 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
public java.lang.Exception 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
protected void handleContent(com.uc4.util.XMLDocument doc, ConnectionAttributes session)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
-
-