Class SingleFileRepository

  • All Implemented Interfaces:
    Repository

    public class SingleFileRepository
    extends java.lang.Object
    implements Repository
    • Constructor Summary

      Constructors 
      Constructor Description
      SingleFileRepository​(java.io.File file)
      Constructs a SingleFileRepository using the given argument
      SingleFileRepository​(java.io.File file, Repository parent)
      Constructs a SingleFileRepository using the given argument
      SingleFileRepository​(java.lang.String initArgs)
      Constructs a SingleFileRepository using the given argument
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void create()
      Creates the repository if does not exist yet
      boolean equals​(java.lang.Object obj)
      Indicates whether some other object is "equal to" this one.
      boolean exists()
      Checks wether the repository actually (or still) exists
      java.util.List getAllResources()
      Returns all direct and indirect resources
      long getChecksum()
      Checksum of the repository and all its content.
      java.lang.String getName()
      Returns the name of the repository; this is a full name including all parent repositories.
      Repository getParentRepository()
      Returns this repository's parent repository.
      Repository[] getRepositories()
      Returns this repository's direct child repositories
      protected Resource getResource()
      Return our single resource.
      Resource getResource​(java.lang.String resourceName)
      Returns a specific direct resource of the repository
      java.util.Iterator getResources()
      Returns all direct resources
      Repository getRootRepository()
      Get this repository's logical script root repository.
      java.lang.String getShortName()
      Returns the name of the repository.
      int hashCode()
      Returns a hash code value for the object.
      boolean isScriptRoot()
      Checks wether the repository is to be considered a top-level repository from a scripting point of view.
      long lastModified()
      Returns the date the repository was last modified.
      java.lang.String toString()
      Returns a string representation of the object.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SingleFileRepository

        public SingleFileRepository​(java.lang.String initArgs)
        Constructs a SingleFileRepository using the given argument
        Parameters:
        initArgs - absolute path to the script file
      • SingleFileRepository

        public SingleFileRepository​(java.io.File file)
        Constructs a SingleFileRepository using the given argument
        Parameters:
        file - the script file
      • SingleFileRepository

        public SingleFileRepository​(java.io.File file,
                                    Repository parent)
        Constructs a SingleFileRepository using the given argument
        Parameters:
        file - the script file
        parent - the parent repository, or null
    • Method Detail

      • getChecksum

        public long getChecksum()
                         throws java.io.IOException
        Checksum of the repository and all its content. Implementations should make sure
        Specified by:
        getChecksum in interface Repository
        Returns:
        checksum
        Throws:
        java.io.IOException
      • getShortName

        public java.lang.String getShortName()
        Returns the name of the repository.
        Specified by:
        getShortName in interface Repository
        Returns:
        name of the repository
      • getName

        public java.lang.String getName()
        Returns the name of the repository; this is a full name including all parent repositories.
        Specified by:
        getName in interface Repository
        Returns:
        full name of the repository
      • getRootRepository

        public Repository getRootRepository()
        Get this repository's logical script root repository.
        Specified by:
        getRootRepository in interface Repository
        Returns:
        top-level repository
      • getParentRepository

        public Repository getParentRepository()
        Returns this repository's parent repository. Returns null if this repository already is the top-level repository
        Specified by:
        getParentRepository in interface Repository
        Returns:
        the parent repository
      • isScriptRoot

        public boolean isScriptRoot()
        Checks wether the repository is to be considered a top-level repository from a scripting point of view. For example, a zip file within a file repository is not a root repository from a physical point of view, but from the scripting point of view it is.
        Specified by:
        isScriptRoot in interface Repository
        Returns:
        true if the repository is to be considered a top-level script repository
      • create

        public void create()
                    throws java.io.IOException
        Creates the repository if does not exist yet
        Specified by:
        create in interface Repository
        Throws:
        java.io.IOException
      • exists

        public boolean exists()
                       throws java.io.IOException
        Checks wether the repository actually (or still) exists
        Specified by:
        exists in interface Repository
        Returns:
        true if the repository exists
        Throws:
        java.io.IOException
      • getRepositories

        public Repository[] getRepositories()
                                     throws java.io.IOException
        Returns this repository's direct child repositories
        Specified by:
        getRepositories in interface Repository
        Returns:
        direct repositories
        Throws:
        java.io.IOException
      • getAllResources

        public java.util.List getAllResources()
                                       throws java.io.IOException
        Returns all direct and indirect resources
        Specified by:
        getAllResources in interface Repository
        Returns:
        resources recursive
        Throws:
        java.io.IOException
      • getResources

        public java.util.Iterator getResources()
                                        throws java.io.IOException
        Returns all direct resources
        Specified by:
        getResources in interface Repository
        Returns:
        direct resources
        Throws:
        java.io.IOException
      • getResource

        public Resource getResource​(java.lang.String resourceName)
        Returns a specific direct resource of the repository
        Specified by:
        getResource in interface Repository
        Parameters:
        resourceName - name of the child resource to return
        Returns:
        specified child resource
      • lastModified

        public long lastModified()
                          throws java.io.IOException
        Returns the date the repository was last modified.
        Specified by:
        lastModified in interface Repository
        Returns:
        last modified date
        Throws:
        java.io.IOException
      • getResource

        protected Resource getResource()
        Return our single resource.
        Returns:
        the wrapped resource
      • equals

        public boolean equals​(java.lang.Object obj)
        Indicates whether some other object is "equal to" this one.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Returns a hash code value for the object.
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class java.lang.Object