Class FileSystemComponentRepositoryResource

  • All Implemented Interfaces:
    com.zfabrik.components.IDependencyComponent

    public class FileSystemComponentRepositoryResource
    extends com.zfabrik.resources.provider.Resource
    implements com.zfabrik.components.IDependencyComponent
    Implementation of a simple File System based repository. As there is not really a wealth of information provided and since there is no defined versioning to make use of this repository is really simple:
    1. During a synchronization, a full scan (with configurable depth) will determine the latest version. A full scan is computed at startup as well.
    2. Resources will be downloaded at time of need. Changes on the back end will be effective, independently on when the last synchronization was run.
    Configuration properties:
    fscr.checkDepthComponent folder traversal depth when determining the latest time stamp. Set to less than zero for infinite depth. Default is -1.
    fscr.priorityComponent repository priority. See IComponentsRepository. Default is 250.
    fscr.folderStore folder, i.e. the file system folder that holds the actual resources to run the repository over.
    fscr.baseSymbolic name of folder the fscr.folder value is evaluated in relation to, if it is a relative folder specification. Legal values are home (default) and here. When set to home the z2 home folder will be considered, if set to here the repository component resource folder will be considered.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T as​(java.lang.Class<T> clz)
      Retrieve a typed representation of the resource.
      void invalidate()
      This method gets called whenever a dependency resource has been invalidated or this resource needs to be invalidated.
      void prepare()
      Prepare for use.
      • Methods inherited from class com.zfabrik.resources.provider.Resource

        as, handle, init, init
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileSystemComponentRepositoryResource

        public FileSystemComponentRepositoryResource​(java.lang.String name)
    • Method Detail

      • as

        public <T> T as​(java.lang.Class<T> clz)
        Description copied from class: com.zfabrik.resources.provider.Resource
        Retrieve a typed representation of the resource.

        Overrides:
        as in class com.zfabrik.resources.provider.Resource
        Parameters:
        clz - expected return type
        Returns:
        the expected return type instance represented by the resource or null if the type facade is not supported.
      • invalidate

        public void invalidate()
                        throws com.zfabrik.resources.ResourceBusyException
        Description copied from class: com.zfabrik.resources.provider.Resource
        This method gets called whenever a dependency resource has been invalidated or this resource needs to be invalidated.

        This code should be executed in a life cycle code block of this resource instance, i.e. where dependencies are effectively managed, so that race conditions can be avoided.

        State changing methods of a resource should always be synchronized (e.g. on this). This is in particular true for cross-resource dependencies. In order to assure consistency under race conditions, a dependent resource should first declare its dependency and then retrieve the resource implementation. In case of failures, resources should clean up by calling handle().invalidate(true);

        Overrides:
        invalidate in class com.zfabrik.resources.provider.Resource
        Throws:
        com.zfabrik.resources.ResourceBusyException
      • prepare

        public void prepare()
        Description copied from interface: com.zfabrik.components.IDependencyComponent
        Prepare for use.
        Specified by:
        prepare in interface com.zfabrik.components.IDependencyComponent