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 class
UploadBinary.ContentType
Content-type of the file (BINARY, TEXT,...).
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_UPLOAD_SIZE
Max 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.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, org.w3c.dom.Element request, ConnectionAttributes sessionInfo)
Creates the XML Document for the request.long
getContentLen()
Returns the length of the upload-content.java.lang.String
getEntryName()
Return the entryName used for the Data to transfer.java.lang.Exception
getFileException()
Returns theException
that occured during the reading of the inputFile ornull
if it was successful.protected java.lang.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
ignoreMessageBox()
protected boolean
isAllowedInClientZero()
This method is used internally.boolean
isFileUploadOK()
Returnstrue
if the inputFile was uploaded successfully.void
setContentType(UploadBinary.ContentType contentType)
Sets the content type.void
setFileName(java.lang.String fileName)
Set the resource file name.void
setVersion(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: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
protected java.lang.String 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, org.w3c.dom.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
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()
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
public java.lang.Exception 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
protected void handleContent(com.uc4.util.XMLDocument doc, ConnectionAttributes session)
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
-
-