Class FileRepositoryThing

All Implemented Interfaces:
ISupportsAccessModifier, IConfigurableObject, INotScriptFriendly, IRepository, ISupportsDeprecation, IDiffableObject, IAlertProvider, IAvatar, IEntityLifeCycleEvent, IEventMetadataProvider, IEventProvider, IPersistable, IPropertyProvider, IServiceMetadataProvider, IServiceProvider, IShapeProvider, ITaggableObject, IDependencyScannableObject, IImportDependencyHandler, IHierarchicalEntity, IEntityDefinition, IPersistableObject<String>, IDesignTimeSecurable, IDesignTimeSecurableEntity, IRunTimeSecurable, IRunTimeSecurableEntity, ISecurable, IVisibilitySecurable, IVisibilitySecurableEntity, IEventProcessor, IAspectContainer, INamedObject, Serializable

@ThingworxExtensionApiClass(since={6,6}, canInstantiate=true) public class FileRepositoryThing extends Thing implements IRepository
See Also:
  • Field Details

  • Constructor Details

    • FileRepositoryThing

      public FileRepositoryThing()
  • Method Details

    • GetDirectoryStructure

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

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

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

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

      @ThingworxExtensionApiMethod(since={8,4}) public String GetFileChecksum(String path, String checksumAlgorithm) throws 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:
      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 Exception
      Returns:
      result The checksum of the file using the given algorithm - INFOTABLE - Aspects {dataShape:ChecksumAlgorithmList}
      Throws:
      Exception - If an error occurs
    • GetFileListing

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable GetFileListing(String path, String nameMask) throws 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:
      Exception - If an error occurs
    • ListFiles

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable ListFiles(String path, String nameMask) throws 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:
      Exception - If an error occurs
    • ListDirectories

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable ListDirectories(String path, String nameMask) throws 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:
      Exception - If an error occurs
    • BrowseFileSystem

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable BrowseFileSystem(String path) throws 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:
      Exception - If an error occurs
    • BrowseDirectory

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable BrowseDirectory(String path) throws 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:
      Exception - If an error occurs
    • GetFileListingWithLinks

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable GetFileListingWithLinks(String path, String nameMask) throws 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:
      Exception - If an error occurs
    • StartFileTransfer

      @ThingworxExtensionApiMethod(since={6,6}) public void StartFileTransfer(String tid, String path, String mode) throws 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:
      Exception - If an error occurs
    • CompleteFileTransfer

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

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

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

      @ThingworxExtensionApiMethod(since={6,6}) public void CreateTextFile(String path, String data, Boolean overwrite) throws 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:
      Exception - If an error occurs
    • ReadFromBinaryFile

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable ReadFromBinaryFile(String path, Double offset, Integer count) throws 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:
      Exception - If an error occurs
    • AppendToBinaryFile

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

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

      @ThingworxExtensionApiMethod(since={6,6}) public void WriteToTextFile(String path, Double offset, String data) throws 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:
      Exception - If an error occurs
    • AppendToTextFile

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

      @ThingworxExtensionApiMethod(since={6,6}) public void RenameFile(String path, String name, Boolean overwrite) throws 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:
      Exception - If an error occurs
    • MoveFile

      @ThingworxExtensionApiMethod(since={6,6}) public void MoveFile(String sourcePath, String targetPath, Boolean overwrite) throws 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:
      Exception - If an error occurs
    • DeleteFile

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

      @ThingworxExtensionApiMethod(since={6,6}) public Boolean CreateFolderInParent(String parentFolderPath, String folderName) throws 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:
      Exception - If an error occurs
    • CreateFolder

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

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

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

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

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

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

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

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

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

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

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

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

      @ThingworxExtensionApiMethod(since={6,6}) public Boolean CreateZipArchive(String newFileName, String path, String files) throws 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:
      Exception - If an error occurs
    • CreateArchive

      @ThingworxExtensionApiMethod(since={7,3}) public Boolean CreateArchive(String newFileName, String path, String compressionType, String files) throws 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:
      Exception - If an error occurs
    • ExtractZipArchive

      @ThingworxExtensionApiMethod(since={6,6}) public Boolean ExtractZipArchive(String zipFileName, String path) throws 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:
      Exception - If an error occurs
    • ExtractArchive

      @ThingworxExtensionApiMethod(since={7,3}) public Boolean ExtractArchive(String archiveFileName, String path, String compressionType) throws 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:
      Exception - If an error occurs
    • FlatExtractArchive

      @ThingworxExtensionApiMethod(since={8,5}) public Boolean FlatExtractArchive(String archiveFileName, String path, String compressionType) throws 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:
      Exception - If an error occurs
    • getRootPath

      @ThingworxExtensionApiMethod(since={6,6}) public String getRootPath()
      Specified by:
      getRootPath in interface IRepository
    • getFileSize

      @ThingworxExtensionApiMethod(since={6,6}) public Long getFileSize(String path)
    • computeChecksum

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

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

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

      Throws:
      Exception - If an error occurs
    • GetDataExportListing

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable GetDataExportListing(String path) throws 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:
      Exception - If an error occurs
    • GetEntityExportListing

      @ThingworxExtensionApiMethod(since={6,6}) public InfoTable GetEntityExportListing(String path) throws 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:
      Exception - If an error occurs