Package com.uc4.communication.requests
Class DownloadBinary
- java.lang.Object
-
- com.uc4.communication.requests.XMLRequest
-
- com.uc4.communication.requests.DownloadBinary
-
public class DownloadBinary extends XMLRequest
Downloads a file from a STORE object.
-
-
Constructor Summary
Constructors Constructor Description DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw)
Creates a new request to download a file from a STORE object.DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw, java.io.File outputFile)
Creates a new request to download a file from a STORE object.DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw, java.io.File outputFile, java.lang.String resname)
Creates a new request to download a file from a STORE object.DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw, java.lang.String resname)
Creates a new request to download a file from 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.java.nio.ByteBuffer
getBinaryContent()
Returns the file as ByteBuffer.java.lang.String
getContentAsText()
Returns the content of a text file.java.lang.String
getContentAsText(java.lang.String lineSeparator)
Returns the content of a text file using a specified line line seperator.java.io.IOException
getFileIOException()
Returns theException
that occured during the writing of the outputfile ornull
if it was successful.java.lang.String
getResourceName()
Returns the resource name which was set, or null if it was not set.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.boolean
isBinary()
Returns true if the file is a binary and not a text file.boolean
isOutputFileOK()
Returnstrue
if the outputfile was saved successfully.boolean
isText()
Returns true if the resource is a text.-
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, ignoreMessageBox, isAllowedInClientZero, send, setMessageBox, showQuarantineNotification
-
-
-
-
Constructor Detail
-
DownloadBinary
public DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw)
Creates a new request to download a file from a STORE object.- Parameters:
storeObject
- Name of the STORE objectentryName
- Name of the entry which is used to identify the file.platformSwHw
- Combined type of Platform, SW, HW of the entry.
-
DownloadBinary
public DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw, java.io.File outputFile)
Creates a new request to download a file from a STORE object.- Parameters:
storeObject
- Name of the STORE objectentryName
- Name of the entry which is used to identify the file.platformSwHw
- Combined type of Platform, SW, HW of the entry.outputFile
- Outputfile, where the content will be automatically be stored.
-
DownloadBinary
public DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw, java.lang.String resname)
Creates a new request to download a file from STORE object.- Parameters:
storeObject
- Name of the STORE objectentryName
- Name of the entry which is used to identify the file.platformSwHw
- Combined type of Platform, SW, HW of the entry.resname
- resource name of the entry which is used to identify the file.
-
DownloadBinary
public DownloadBinary(UC4ObjectName storeObject, java.lang.String entryName, PlatformSwHwType platformSwHw, java.io.File outputFile, java.lang.String resname)
Creates a new request to download a file from a STORE object.- Parameters:
storeObject
- Name of the STORE objectentryName
- Name of the entry which is used to identify the file.platformSwHw
- Combined type of Platform, SW, HW of the entry.outputFile
- Outputfile, where the content will be automatically be stored.resname
- Resource name of the entry which is used to identify the file.
-
-
Method Detail
-
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
-
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
-
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
-
isText
public boolean isText()
Returns true if the resource is a text. The method getContentAsText() can be used.- Returns:
- true if the file is a text file, false in case of binaries.
-
isBinary
public boolean isBinary()
Returns true if the file is a binary and not a text file.- Returns:
- true if the file is not a text file.
-
getBinaryContent
public java.nio.ByteBuffer getBinaryContent()
Returns the file as ByteBuffer.- Returns:
- file content
-
getContentAsText
public java.lang.String getContentAsText()
Returns the content of a text file. This method should only be called ifisText()
returnstrue
. The default line seperator is used.- Returns:
- String containing the file content
-
getContentAsText
public java.lang.String getContentAsText(java.lang.String lineSeparator)
Returns the content of a text file using a specified line line seperator.- Parameters:
lineSeparator
- Characters used as line seperator.- Returns:
- Content of the text file
-
isOutputFileOK
public boolean isOutputFileOK()
Returnstrue
if the outputfile was saved successfully. If this method returnsfalse
the methodgetFileIOException
can be used to get the exception which occured during the writing of the outputfile.- Returns:
- True if the outputfile was saved successfully.
-
getFileIOException
public java.io.IOException getFileIOException()
Returns theException
that occured during the writing of the outputfile ornull
if it was successful.- Returns:
- IOException or null
-
getResourceName
public java.lang.String getResourceName()
Returns the resource name which was set, or null if it was not set.- Returns:
- resname or null;
-
-