Skip navigation links
Thingworx Platform API
8.5.0
com.thingworx.things.repository

Class FileRepositoryThing

    • Field Detail

      • DIRECTORY_DATASHAPE

        public static final java.lang.String DIRECTORY_DATASHAPE
        See Also:
        Constant Field Values
      • FILE_DATASHAPE_WITH_LINKS

        public static final java.lang.String FILE_DATASHAPE_WITH_LINKS
        See Also:
        Constant Field Values
      • DEFAULT_TRANSFER_BLOCK_SIZE

        public static final double DEFAULT_TRANSFER_BLOCK_SIZE
        See Also:
        Constant Field Values
      • DEFAULT_MAX_FILE_SIZE

        public static final double DEFAULT_MAX_FILE_SIZE
        See Also:
        Constant Field Values
    • Constructor Detail

      • FileRepositoryThing

        public FileRepositoryThing()
    • Method Detail

      • GetDirectoryStructure

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetDirectoryStructure()
                                                                                  throws java.lang.Exception
        Service Category:
        Directories
        Service Description:
        Get directory structure.
        Returns:
        result Directory Results - INFOTABLE - Aspects {dataShape:FileSystemDirectory}
        Throws:
        java.lang.Exception - If an error occurs
      • GetTransferInfo

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetTransferInfo()
                                                                            throws java.lang.Exception
        Returns:
        result File Results - INFOTABLE - Aspects {dataShape:GetTransferInfoResult}
        Throws:
        java.lang.Exception - If an error occurs
      • GetFileInfo

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetFileInfo(java.lang.String path)
                                                                        throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Get file info.
        Parameters:
        path - File path - STRING
        Returns:
        result File Results - INFOTABLE - Aspects {dataShape:FileSystemFile}
        Throws:
        java.lang.Exception - If an error occurs
      • GetFileChecksum

        @Deprecated
         @ThingworxExtensionApiMethod(since={6,6},
                                     deprecatedSince={8,4,0})
        public java.lang.String GetFileChecksum(java.lang.String path)
                                                                                                                                                      throws java.lang.Exception
        Deprecated. 
        Throws:
        java.lang.Exception - If an error occurs
      • GetFileChecksum

        @ThingworxExtensionApiMethod(since={8,4})
        public java.lang.String GetFileChecksum(java.lang.String path,
                                                                                          java.lang.String checksumAlgorithm)
                                                                                   throws java.lang.Exception


        Gets the checksum of a file in this repository, using the cryptographic algorithm whose name was passed into the service as an argument. Supported checksum algorithms can be gotten using the GetSupportedChecksumAlgorithms service.
        Parameters:
        path - The path to the file to conduct a checksum on
        checksumAlgorithm - The name of the checksum algorithm to use
        Returns:
        The checksum of the indicated file
        Throws:
        java.lang.Exception - Thrown if the cryptographic algorithm provided is invalid or is not recognized by the server
      • GetSupportedFileChecksumAlgorithms

        @ThingworxExtensionApiMethod(since={8,4})
        public InfoTable GetSupportedFileChecksumAlgorithms()
                                                                                               throws java.lang.Exception
        Returns:
        result The checksum of the file using the given algorithm - INFOTABLE - Aspects {dataShape:ChecksumAlgorithmList}
        Throws:
        java.lang.Exception - If an error occurs
      • GetFileListing

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetFileListing(java.lang.String path,
                                                                                  java.lang.String nameMask)
                                                                           throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Get file system listing.
        Parameters:
        path - Directory path - STRING
        nameMask - Name mask - STRING
        Returns:
        result File Results - INFOTABLE - Aspects {dataShape:FileSystemFile}
        Throws:
        java.lang.Exception - If an error occurs
      • ListFiles

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable ListFiles(java.lang.String path,
                                                                             java.lang.String nameMask)
                                                                      throws java.lang.Exception
        Service Category:
        Transfers
        Service Description:
        Get file system listing.
        Parameters:
        path - Directory path - STRING
        nameMask - Name mask - STRING
        Returns:
        result File Results - INFOTABLE - Aspects {dataShape:FileSystemFile}
        Throws:
        java.lang.Exception - If an error occurs
      • ListDirectories

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable ListDirectories(java.lang.String path,
                                                                                   java.lang.String nameMask)
                                                                            throws java.lang.Exception
        Service Category:
        Transfers
        Service Description:
        Get list of directories.
        Parameters:
        path - Directory path - STRING
        nameMask - Name mask - STRING
        Returns:
        result Directory Results - INFOTABLE - Aspects {dataShape:FileSystemDirectory}
        Throws:
        java.lang.Exception - If an error occurs
      • BrowseFileSystem

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable BrowseFileSystem(java.lang.String path)
                                                                             throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Browse file system for directories and files.
        Parameters:
        path - Directory path - STRING
        Returns:
        result File Results - INFOTABLE - Aspects {dataShape:FileSystemFile}
        Throws:
        java.lang.Exception - If an error occurs
      • BrowseDirectory

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable BrowseDirectory(java.lang.String path)
                                                                            throws java.lang.Exception
        Service Category:
        Transfers
        Service Description:
        Get a list of files and/or directories on the Edge Thing.
        Parameters:
        path - Directory path - STRING
        Returns:
        result Browse Results - INFOTABLE - Aspects {dataShape:FileSystemFile}
        Throws:
        java.lang.Exception - If an error occurs
      • GetFileListingWithLinks

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetFileListingWithLinks(java.lang.String path,
                                                                                           java.lang.String nameMask)
                                                                                    throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Get file system listing with download links.
        Parameters:
        path - Directory path - STRING
        nameMask - Name mask - STRING
        Returns:
        result File Results - INFOTABLE - Aspects {dataShape:FileSystemFileWithLinks}
        Throws:
        java.lang.Exception - If an error occurs
      • StartFileTransfer

        @ThingworxExtensionApiMethod(since={6,6})
        public void StartFileTransfer(java.lang.String tid,
                                                                                java.lang.String path,
                                                                                java.lang.String mode)
                                                                         throws java.lang.Exception
        Parameters:
        tid - Transfer Id - STRING
        path - File path - STRING
        mode - Indicates if the file will be open in 'read' or 'write' mode - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • CompleteFileTransfer

        @ThingworxExtensionApiMethod(since={6,6})
        public void CompleteFileTransfer(InfoTable job)
                                                                            throws java.lang.Exception
        Parameters:
        job - The transfer job being completed - INFOTABLE
        Throws:
        java.lang.Exception - If an error occurs
      • CancelFileTransfer

        @ThingworxExtensionApiMethod(since={6,6})
        public void CancelFileTransfer(InfoTable job)
                                                                          throws java.lang.Exception
        Parameters:
        job - The transfer job being completed - INFOTABLE
        Throws:
        java.lang.Exception - If an error occurs
      • CreateBinaryFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void CreateBinaryFile(java.lang.String path,
                                                                               byte[] data,
                                                                               java.lang.Boolean overwrite)
                                                                        throws java.lang.Exception
        Parameters:
        path - File path - STRING
        data - Initial data - BLOB
        overwrite - Overwrite existing file - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • CreateTextFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void CreateTextFile(java.lang.String path,
                                                                             java.lang.String data,
                                                                             java.lang.Boolean overwrite)
                                                                      throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Create a text file.
        Parameters:
        path - File path - STRING
        data - Initial data - STRING
        overwrite - Overwrite existing file - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • ReadFromBinaryFile

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable ReadFromBinaryFile(java.lang.String path,
                                                                                      java.lang.Double offset,
                                                                                      java.lang.Integer count)
                                                                               throws java.lang.Exception
        Parameters:
        path - File path - STRING
        offset - File offset in bytes - NUMBER
        count - Number of bytes to read - INTEGER
        Returns:
        result File Read Results - INFOTABLE - Aspects {dataShape:ReadFromBinaryFileResult}
        Throws:
        java.lang.Exception - If an error occurs
      • AppendToBinaryFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void AppendToBinaryFile(java.lang.String path,
                                                                                 byte[] data)
                                                                          throws java.lang.Exception
        Parameters:
        path - File path - STRING
        data - Initial data - BLOB
        Throws:
        java.lang.Exception - If an error occurs
      • WriteToBinaryFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void WriteToBinaryFile(java.lang.String path,
                                                                                java.lang.Double offset,
                                                                                byte[] data)
                                                                         throws java.lang.Exception
        Parameters:
        path - File path - STRING
        offset - File offset in bytes - NUMBER
        data - Initial data - BLOB
        Throws:
        java.lang.Exception - If an error occurs
      • WriteToTextFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void WriteToTextFile(java.lang.String path,
                                                                              java.lang.Double offset,
                                                                              java.lang.String data)
                                                                       throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Write to a text file.
        Parameters:
        path - File path - STRING
        offset - File offset in bytes - NUMBER
        data - Initial data - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • AppendToTextFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void AppendToTextFile(java.lang.String path,
                                                                               java.lang.String data)
                                                                        throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Append to a text file.
        Parameters:
        path - File path - STRING
        data - Initial data - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • RenameFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void RenameFile(java.lang.String path,
                                                                         java.lang.String name,
                                                                         java.lang.Boolean overwrite)
                                                                  throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Rename a file.
        Parameters:
        path - File path - STRING
        name - New file name - STRING
        overwrite - Overwrite existing file - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • MoveFile

        @ThingworxExtensionApiMethod(since={6,6})
        public void MoveFile(java.lang.String sourcePath,
                                                                       java.lang.String targetPath,
                                                                       java.lang.Boolean overwrite)
                                                                throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Move a file.
        Parameters:
        sourcePath - Path of file to move - STRING
        targetPath - Path of target file - STRING
        overwrite - Overwrite existing file - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • DeleteFile

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean DeleteFile(java.lang.String path)
                                                                               throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Delete a file.
        Parameters:
        path - File path - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • CreateFolderInParent

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean CreateFolderInParent(java.lang.String parentFolderPath,
                                                                                                java.lang.String folderName)
                                                                                         throws java.lang.Exception
        Service Category:
        Directories
        Service Description:
        Create a folder in a specific location.
        Parameters:
        parentFolderPath - Parent folder full path - STRING
        folderName - New Folder to be created - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • CreateFolder

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean CreateFolder(java.lang.String path)
                                                                                 throws java.lang.Exception
        Service Category:
        Directories
        Service Description:
        Create a folder.
        Parameters:
        path - Folder path - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • DeleteFolder

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean DeleteFolder(java.lang.String path)
                                                                                 throws java.lang.Exception
        Service Category:
        Directories
        Service Description:
        Delete a folder.
        Parameters:
        path - Folder path - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • SaveJSON

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean SaveJSON(java.lang.String path,
                                                                                    org.json.JSONObject content)
                                                                             throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Save JSON to a file.
        Parameters:
        path - File path - STRING
        content - JSON content - JSON
        Throws:
        java.lang.Exception - If an error occurs
      • LoadJSON

        @ThingworxExtensionApiMethod(since={6,6})
        public org.json.JSONObject LoadJSON(java.lang.String path)
                                                                               throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Load JSON from a file.
        Parameters:
        path - File path - STRING
        Returns:
        Content Content - JSON
        Throws:
        java.lang.Exception - If an error occurs
      • SaveXML

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean SaveXML(java.lang.String path,
                                                                                   org.w3c.dom.Document content)
                                                                            throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Save XML to a file.
        Parameters:
        path - File path - STRING
        content - XML content - XML
        Throws:
        java.lang.Exception - If an error occurs
      • LoadXML

        @ThingworxExtensionApiMethod(since={6,6})
        public org.w3c.dom.Document LoadXML(java.lang.String path)
                                                                               throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Load XML from a file.
        Parameters:
        path - File path - STRING
        Returns:
        Content Content - XML
        Throws:
        java.lang.Exception - If an error occurs
      • SaveText

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean SaveText(java.lang.String path,
                                                                                    java.lang.String content)
                                                                             throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Save text to a file.
        Parameters:
        path - File path - STRING
        content - Text content - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • LoadText

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.String LoadText(java.lang.String path)
                                                                            throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Load Text from a file.
        Parameters:
        path - File path - STRING
        Returns:
        Content Content - STRING
        Throws:
        java.lang.Exception - If an error occurs
      • SaveBinary

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean SaveBinary(java.lang.String path,
                                                                                      byte[] content)
                                                                               throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Save binary data to a file.
        Parameters:
        path - File path - STRING
        content - Binary content - BLOB
        Throws:
        java.lang.Exception - If an error occurs
      • LoadBinary

        @ThingworxExtensionApiMethod(since={6,6})
        public byte[] LoadBinary(java.lang.String path)
                                                                    throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Load binary content from a file.
        Parameters:
        path - File path - STRING
        Returns:
        Content Content - BLOB
        Throws:
        java.lang.Exception - If an error occurs
      • SaveImage

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean SaveImage(java.lang.String path,
                                                                                     byte[] content)
                                                                              throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Save image data to a file.
        Parameters:
        path - File path - STRING
        content - Binary content - IMAGE
        Throws:
        java.lang.Exception - If an error occurs
      • LoadImage

        @ThingworxExtensionApiMethod(since={6,6})
        public byte[] LoadImage(java.lang.String path)
                                                                   throws java.lang.Exception
        Service Category:
        Files
        Service Description:
        Load image content from a file.
        Parameters:
        path - File path - STRING
        Returns:
        Content Content - IMAGE
        Throws:
        java.lang.Exception - If an error occurs
      • CreateZipArchive

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean CreateZipArchive(java.lang.String newFileName,
                                                                                            java.lang.String path,
                                                                                            java.lang.String files)
                                                                                     throws java.lang.Exception
        Service Category:
        Compression
        Service Description:
        Create a zip file archive within this File Repository. If specified path does not exist, it will be created inside the File Repository.
        Parameters:
        newFileName - Name of zip file to be created - STRING
        path - Path within the File Repository to create the zip file - STRING
        files - Comma separated list of full path names for files in the repository to add to the archive - STRING
        Returns:
        result success or failure of the archive creation - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • CreateArchive

        @ThingworxExtensionApiMethod(since={7,3})
        public java.lang.Boolean CreateArchive(java.lang.String newFileName,
                                                                                         java.lang.String path,
                                                                                         java.lang.String compressionType,
                                                                                         java.lang.String files)
                                                                                  throws java.lang.Exception
        Service Category:
        Compression
        Service Description:
        Create an archive/compressed file within this File Repository. If specified path does not exist, it will be created inside the File Repository.
        Parameters:
        newFileName - Name of file to be created - STRING
        path - Path within the File Repository to create the file - STRING
        compressionType - Compression type of archive file (valid types are zip and targz). If not provided, it will default to 'zip' - STRING
        files - Comma separated list of full path names for files in the repository to add to the archive - STRING
        Returns:
        result success or failure of the archive creation - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • ExtractZipArchive

        @ThingworxExtensionApiMethod(since={6,6})
        public java.lang.Boolean ExtractZipArchive(java.lang.String zipFileName,
                                                                                             java.lang.String path)
                                                                                      throws java.lang.Exception
        Service Category:
        Compression
        Service Description:
        Extract the contents of a zip file archive within this File Repository. If specified path does not exist, it will be created.
        Parameters:
        zipFileName - Full path of zip file within the File Repository - STRING
        path - Path within the File Repository to extract the zip file contents to - STRING
        Returns:
        result success or failure of the extraction - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • ExtractArchive

        @ThingworxExtensionApiMethod(since={7,3})
        public java.lang.Boolean ExtractArchive(java.lang.String archiveFileName,
                                                                                          java.lang.String path,
                                                                                          java.lang.String compressionType)
                                                                                   throws java.lang.Exception
        Service Category:
        Compression
        Service Description:
        Extract the contents of an archive within this File Repository. If specified path does not exist, it will be created.
        Parameters:
        archiveFileName - Full path of archive file within the File Repository - STRING
        path - Path within the File Repository to extract the archive file contents to - STRING
        compressionType - Compression type of archive file (valid types are zip and targz). If not provided, it will be derived from newFileName if possible - STRING
        Returns:
        result success or failure of the extraction - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • FlatExtractArchive

        @ThingworxExtensionApiMethod(since={8,4})
        public java.lang.Boolean FlatExtractArchive(java.lang.String archiveFileName,
                                                                                              java.lang.String path,
                                                                                              java.lang.String compressionType)
                                                                                       throws java.lang.Exception
        Service Category:
        Services
        Service Description:
        Extract all contents of an archive into the specified path within this File Repository. If the specified path does not exist, it will be created.
        Parameters:
        archiveFileName - Full path of archive file within the File Repository - STRING
        path - Path within the File Repository to extract the archive file contents to - STRING
        compressionType - Compression type of archive file (valid types are zip and targz). If not provided, it will be derived from newFileName if possible - STRING
        Returns:
        result success or failure of the extraction - BOOLEAN
        Throws:
        java.lang.Exception - If an error occurs
      • computeChecksum

        @Deprecated
         @ThingworxExtensionApiMethod(since={6,6},
                                     deprecatedSince={8,4,0})
        public java.lang.String computeChecksum(java.lang.String path)
                                                                                                                                                      throws java.lang.Exception
        Deprecated. 
        Throws:
        java.lang.Exception - If an error occurs
      • computeChecksum

        @ThingworxExtensionApiMethod(since={8,4})
        public java.lang.String computeChecksum(java.lang.String path,
                                                                                          java.lang.String checksumAlgorithm)
                                                                                   throws java.lang.Exception
        Throws:
        java.lang.Exception - If an error occurs
      • openFileForRead

        @ThingworxExtensionApiMethod(since={6,6})
        public java.io.FileInputStream openFileForRead(java.lang.String path)
                                                                                          throws java.lang.Exception
        Throws:
        java.lang.Exception - If an error occurs
      • GetDataExportListing

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetDataExportListing(java.lang.String path)
                                                                                 throws java.lang.Exception
        Service Category:
        Exports
        Service Description:
        Lists exported data directories on the given path.
        Parameters:
        path - File Repository Relative Path - STRING
        Returns:
        result Returns lists of exported data directories on the given path - INFOTABLE - Aspects {dataShape:ExportFile}
        Throws:
        java.lang.Exception - If an error occurs
      • GetEntityExportListing

        @ThingworxExtensionApiMethod(since={6,6})
        public InfoTable GetEntityExportListing(java.lang.String path)
                                                                                   throws java.lang.Exception
        Service Category:
        Exports
        Service Description:
        Lists exported entity files on the given path.
        Parameters:
        path - File Repository Relative Path - STRING
        Returns:
        result Returns list of exported entity files on the given path - INFOTABLE - Aspects {dataShape:ExportFile}
        Throws:
        java.lang.Exception - If an error occurs