Class WSFile


  • public class WSFile
    extends java.lang.Object
    Class used to hold a file for a file provider. The file has a unique name for access to the web server and can be published or unpublished.
    Author:
    Christopher Mindus
    See Also:
    URNResourceType
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean delete()
      Unpublishes and deletes the file, including a potential database backup of the file.
      java.lang.String getDescription()
      Gets the file description.
      java.io.File getFile()
      Gets the file, regardless of existence or published state.
      java.lang.String getFileName()
      Gets the file name.
      java.lang.String getFullTargetURL()
      Gets the URL, i.e.
      java.lang.Object getID()
      Gets the ID used for databases.
      java.io.File getPublishedFile()
      Returns the publish file for access from the web server.
      java.lang.String getURLName()
      Gets the unique name used for the external URL path assigned to the file.
      boolean isPublished()
      Returns whether the file is published or not.
      boolean publish()
      Starts publishing the file on the web server.
      java.lang.String toString()
      Gets the debug information string.
      boolean unpublish()
      Unpublishes the file from the web server.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getFile

        public java.io.File getFile()
        Gets the file, regardless of existence or published state.
        Returns:
        The file, never null.
      • getFileName

        public java.lang.String getFileName()
        Gets the file name.
        Returns:
        The file name with file extension of the file resource on disk, without path.
      • getURLName

        public java.lang.String getURLName()
        Gets the unique name used for the external URL path assigned to the file.
        Returns:
        The unique external URL name without path of the file with file extension.
      • getDescription

        public java.lang.String getDescription()
        Gets the file description.
      • getID

        public java.lang.Object getID()
        Gets the ID used for databases.
        Returns:
        The ID as a Long or String, or null when no database is present or an ID is not required.
      • getPublishedFile

        public java.io.File getPublishedFile()
        Returns the publish file for access from the web server.
        Returns:
        The file published, or null for unpublished or non-existent.
      • publish

        public boolean publish()
                        throws java.io.IOException
        Starts publishing the file on the web server. If the file already is published, nothing will happen.
        Returns:
        true for success, false if already published.
        Throws:
        java.io.IOException - If the file no longer exists.
      • unpublish

        public boolean unpublish()
        Unpublishes the file from the web server. If the file already is unpublished or never published, nothing will happen.
        Returns:
        true for success, false if already unpublished or publisher provides is disposed of.
      • isPublished

        public boolean isPublished()
        Returns whether the file is published or not.
        Returns:
        true if published to the web server, false otherwise.
      • delete

        public boolean delete()
                       throws java.io.IOException
        Unpublishes and deletes the file, including a potential database backup of the file.
        Returns:
        true for unpublish success, false if already unpublished.
        Throws:
        java.io.IOException - If the file failed to be deleted from disk and/or potential database.
      • getFullTargetURL

        public java.lang.String getFullTargetURL()
        Gets the URL, i.e. the path to the file in the web server for external use, without protocol and host.
        Returns:
        The path on the web server, null a file is not found or not published.
      • toString

        public java.lang.String toString()
        Gets the debug information string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        Used for logging, etc.