Class WebResource

java.lang.Object
overit.geocall.servlet.WebResource
All Implemented Interfaces:
DataSource, Serializable, Cloneable, overit.geocall.clipboard.ClipboardObject, overit.geocall.marks.NameExposer
Direct Known Subclasses:
S3WebResource

public abstract class WebResource extends Object implements overit.geocall.clipboard.ClipboardObject, DataSource, Cloneable
This abstract class defines a web resources as for example a folder
See Also:
  • Field Details

  • Constructor Details

    • WebResource

      public WebResource()
  • Method Details

    • locateFolder

      public static WebResource locateFolder(String fullname, boolean create)
      Locate the folder of a WebResource
      Parameters:
      fullname - String containing the fullname of the folder
      create - Boolean indicating if the folder should be created or not
      Returns:
      The WebResource if present, null otherwise
    • locateFolder

      @Deprecated public static WebResource locateFolder(String fullname, overit.geocall.servlet.WebResourceFactory wrf, boolean create)
      Deprecated.
      use directly the correct WebResourceFactory.locateFolder(java.lang.String, boolean)
      Locate the folder of a WebResource
      Parameters:
      fullname - String containing the fullname of the folder
      wrf - the factory for biulding the web resource
      create - Boolean indicating if the folder should be created or not
      Returns:
      The WebResource if present, null otherwise
    • getFolder

      @Deprecated public static WebResource getFolder(Identity id, String fullname, overit.geocall.servlet.WebResourceFactory wrf, boolean create)
      Deprecated.
      the identity is not useful, so use directly the correct WebResourceFactory.locateFolder(java.lang.String, boolean)
      Parameters:
      id - The Identity
      fullname - String containing the fullname of the folder
      wrf - the factory for biulding the web resource
      create - Boolean indicating if the folder should be created or not
      Returns:
      The WebResource if present, null otherwise
    • getFolder

      @Deprecated public static WebResource getFolder(Identity id, String fullname, boolean create)
      Deprecated.
      use locateFolder instead
      Parameters:
      id - The Identity
      fullname - String containing the fullname of the folder
      create - Boolean indicating if the folder should be created or not
      Returns:
      The WebResource if present, null otherwise
    • locateResource

      public static WebResource locateResource(String fullname, Long id)
      Parameters:
      fullname - String containing the fullname of the resource
      id - The id of the resource
      Returns:
      The WebResource if present, null otherwise
    • getResource

      @Deprecated public static WebResource getResource(Identity identity, String fullname, Long id)
      Deprecated.
      use locateResource instead
      Parameters:
      identity - The Identity
      fullname - String containing the fullname of the resource
      id - The id of the resource
      Returns:
      The WebResource if present, null otherwise
    • getResource

      @Deprecated public static WebResource getResource(Identity id, String fullname)
      Deprecated.
      use locateResource instead
      Parameters:
      id - The Identity
      fullname - String containing the fullname of the resource
      Returns:
      The WebResource if present, null otherwise
    • exists

      public abstract boolean exists()
      Return true if exist, false otherwise
      Returns:
      true if exist, false otherwise
    • isFile

      public abstract boolean isFile()
      Return true if is a file, false otherwise
      Returns:
      true if is a file, false otherwise
    • isFolder

      public abstract boolean isFolder()
      Return true if is a folder, false otherwise
      Returns:
      true if is a folder, false otherwise
    • isFolderEmpty

      public abstract boolean isFolderEmpty()
      Return true if the folder is empty, false otherwise
      Returns:
      true if the folder is empty, false otherwise
    • isRoot

      public abstract boolean isRoot()
      Return true if is the root, false otherwise
      Returns:
      true if is the root, false otherwise
    • getContainer

      public abstract WebResource getContainer()
      Returns the container
      Returns:
      The container
    • getResource

      public abstract WebResource getResource(String resource)
      Returns a resource with a given name
      Parameters:
      resource - The name of the resource
      Returns:
      The WebResource
    • getFolder

      public abstract WebResource getFolder(String folder, boolean create)
      Returns the folder
      Parameters:
      folder - The name of the folder
      create - Boolean indicating if the folder should be created or not
      Returns:
      The WebResource
    • anotherFile

      public abstract WebResource anotherFile(String name)
      Creates another file
      Parameters:
      name - Name of the file
      Returns:
      The WebResource
    • delete

      public abstract String delete()
      Delete a file
      Returns:
      A string indicating why is failing
    • save

      public abstract String save(UpFile rf)
      Saves an UpFile
      Parameters:
      rf - The UpFile to save
      Returns:
      A string indicating why is failing
    • renameTo

      public abstract String renameTo(String newname)
      Renames a file
      Parameters:
      newname - The new name
      Returns:
      A string indicating why is failing
    • copyTo

      public abstract String copyTo(WebResource wr)
      Copy a file
      Parameters:
      wr - The WebResource
      Returns:
      A string indicating why is failing
    • getDBView

      public abstract DBView getDBView(String s)
      Returns a DBView
      Parameters:
      s - String containing the regular expression
      Returns:
      A string indicating why is failing
    • getBasename

      public abstract String getBasename()
      Returns the base name
      Returns:
      Returns the base name
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object
    • clone

      public abstract Object clone()
      Overrides:
      clone in class Object
    • getOutputStream

      public abstract OutputStream getOutputStream(boolean append)
      Returns the OutputStream
      Parameters:
      append - Boolean indicating if append should be enabled or not
      Returns:
      The OutpurStream
    • getInputStream

      public abstract InputStream getInputStream()
      Specified by:
      getInputStream in interface DataSource
    • toFile

      public abstract boolean toFile(String file)
      Copies the input File in the output File
      Parameters:
      file - String containing the path of the file
      Returns:
      true if the copy was successful, false otherwise
    • fromFile

      public abstract boolean fromFile(String file)
      Copies the input File in the output File
      Parameters:
      file - String containing the path of the file
      Returns:
      true if the copy was successful, false otherwise
    • encodePart

      protected static String encodePart(String s)
    • getIcon

      protected static String getIcon(String name, boolean folder)
    • getMimeType

      public static overit.geocall.servlet.MimeType getMimeType(String name, boolean folder)
    • getContentType

      public String getContentType()
      Specified by:
      getContentType in interface DataSource
    • length

      public abstract long length()
      Gets the length of the path
      Returns:
      The lenght of the path
    • date

      public abstract Date date()
      Returns the Date
      Returns:
      The Date
    • getOutputStream

      public OutputStream getOutputStream()
      Specified by:
      getOutputStream in interface DataSource
    • getSource

      public abstract Source getSource()
      Returns the Source
      Returns:
      The Source
    • getDirectDownloadUrl

      public abstract String getDirectDownloadUrl(overit.geocall.servlet.WebResourceUrl wru)
      returns a direct resource download url or null if not possible
      Parameters:
      wru - the webresource for which the direct download URL is requested
      Returns:
      a pre-signed url for downloading the resource if supported by the implementation, or null if not supported
    • getDirectUploadUrl

      public abstract String getDirectUploadUrl(overit.geocall.servlet.WebResourceUrl wru)
      returns a direct resource upload url or null if not possible
      Parameters:
      wru - the webresource for which the direct upload URL is requested
      Returns:
      a pre-signed url for uploading the resource if supported by the implementation, or null if not supported