Class UploadBinary


  • public class UploadBinary
    extends XMLRequest
    Adds or replaces a file in a STORE object.
    • 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 object
        osPlatformHw - 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 object
        entryName - 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 class XMLRequest
        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 this XMLRequest is allowed in client 0. The default implementation returns false, subclasses may override.
        Overrides:
        isAllowedInClientZero in class XMLRequest
        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 class XMLRequest
        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 class XMLRequest
        Parameters:
        doc - Document, used to create new Elements
        request - Request Element - classes append information to this request element
        sessionInfo - 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()
        Returns true if the inputFile was uploaded successfully. If this method returns false 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 the Exception that occured during the reading of the inputFile or null if it was successful.
        Returns:
        Exception or null
      • getContentLen

        public long getContentLen()
        Returns the length of the upload-content.
        Returns:
        binary data length
      • 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 class XMLRequest
        Parameters:
        doc - XML Document
        session - Info about the user session