Package com.zfabrik.impl.svncr

## Class ComponentRepositoryImpl

- java.lang.Object
- - com.zfabrik.components.provider.util.AbstractExtComponentRepository<com.zfabrik.components.provider.util.FSCRDBComponent,​DB>
  - - com.zfabrik.components.provider.util.AbstractComponentRepository<ComponentRepositoryDB>
    - - com.zfabrik.impl.svncr.ComponentRepositoryImpl

- All Implemented Interfaces:
    `com.zfabrik.components.provider.IComponentsRepository`, `com.zfabrik.util.sync.ISynchronizer`

      public class ComponentRepositoryImpl
      extends com.zfabrik.components.provider.util.AbstractComponentRepository<ComponentRepositoryDB>

  Subversion based components repository based on `AbstractComponentRepository`

  Revision determination is a little tricky and essentially based on max(package rev, component rev) an approx of the pegrevision (http://svnbook.red-bean.com/nightly/en/svn.advanced.pegrevs.html) with a non-trivial scheme for delta updates. The reason for doing this is subversions preservation of revisions of nested objects in case of moves (renames) and branch copies.

  Repository configuration (i.e. component level) properties:

  svncr.url | URL of the subversion root folder of the repository. E.g. something like `svn://z2-environment.net/z2_base/trunk/l1`
  svncr.user | User name for Subversion authentication (optional)
  svncr.password | Password for Subversion authentication (optional)
  svncr.priority | Priority of the repository with the repository chain. See `IComponentsRepository`.

  System properties that have a meaning:

  `com.zfabrik.svncr.mode` | (DEPRECATED) If set to "relaxed" will only issue a warning when repository access fails during sync revision lookup (e.g. on startup) - i.e. if the repo revision cannot be determined via a repository request. This means that a given system may continue to run although a repository may not be accessible, as long no requests have to made because resources are not (yet) available in the repository cache. Defaults to `strict`

  Author:
    hb

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.zfabrik.components.provider.util.AbstractExtComponentRepository

      `com.zfabrik.components.provider.util.AbstractExtComponentRepository.Repo, com.zfabrik.components.provider.util.AbstractExtComponentRepository.RepoMBean`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `MODE` | If set to "relaxed" will only issue a warning when repository access fails during sync revision lookup (e.g.
    `static java.lang.String` | `MODE_RELAXED` | Permissable value of `MODE`
    `static java.lang.String` | `MODE_STRICT` | Permissable value of `MODE`
    `static java.lang.String` | `SVNCR_PRIO` | priority of the repository with the repository chain.
    `static java.lang.String` | `SVNCR_PWD` | Password for authentication at the repository
    `static java.lang.String` | `SVNCR_ROOT` | Folder name in cache.
    `static java.lang.String` | `SVNCR_URL` | URL of the subversion root folder for this repository.
    `static java.lang.String` | `SVNCR_USER` | User name for authentication at the repository

    - ### Fields inherited from class com.zfabrik.components.provider.util.AbstractExtComponentRepository

      `ALL`

    - ### Fields inherited from interface com.zfabrik.components.provider.IComponentsRepository

      `COMPONENT_REPO_IMPLEMENTATION, COMPONENT_REPO_MODE, COMPONENT_REPO_MODE_RELAXED, COMPONENT_REPO_MODE_STRICT`

    - ### Fields inherited from interface com.zfabrik.util.sync.ISynchronizer

      `PRIO, TYPE`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ComponentRepositoryImpl​(java.lang.String name, java.util.Properties props)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `download​(com.zfabrik.components.provider.util.FSCRDBComponent c, java.io.File destFolder)` | Download resources of a single component into the given folder
    `protected java.util.Properties` | `getExpectedConfiguration()` | provided expected repository configuration.
    `SvnWorkResource` | `getRepoSession()` |
    `protected long` | `getRevision()` | Overall revision of the repository - if available
    `protected java.lang.String` | `getURL()` | Some URL style information on the external data source the repository implementation relies on
    `ComponentRepositoryDB` | `scan​(ComponentRepositoryDB current)` | Provide an updated DB.
    `static ComponentRepositoryImpl` | `test_create​(java.lang.String name, java.io.File root, java.util.Properties props, com.zfabrik.svnaccess.ISvnRepository svnRepository)` |
    `ComponentRepositoryDB` | `test_deltaScan​(ComponentRepositoryDB db, long rev)` |
    `ComponentRepositoryDB` | `test_fullScan​(long rev)` |
    `com.zfabrik.svnaccess.ISvnRepository` | `test_getRepo()` |
    `void` | `test_setRepository​(com.zfabrik.svnaccess.ISvnRepository accessor)` |
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class com.zfabrik.components.provider.util.AbstractExtComponentRepository

      `as, checkOfflineMode, complete, configure, configure, configure, findComponents, getCacheRoot, getComponent, getContext, getDB, getModules, getName, getRevision, has, isRelaxedMode, preInvalidation, preInvalidation, retrieve, setEvictionDelay, start, stop, test_setContext, test_setDb, test_setInited`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.zfabrik.components.provider.IComponentsRepository

      `findComponents, getComponent, getModules, getRevision, retrieve`

- - ### Field Detail

    - #### MODE

          public static final java.lang.String MODE

      If set to "relaxed" will only issue a warning when repository access fails during sync revision lookup (e.g. on startup) - i.e. if the repo revision cannot be determined via a repository request. This means that a given system may continue to run although a repository may not be accessible, as long no requests have to made because resources are not (yet) available in the repository cache. Defaults to `strict`
      See Also:
        Constant Field Values

    - #### MODE_RELAXED

          public static final java.lang.String MODE_RELAXED

      Permissable value of `MODE`
      See Also:
        Constant Field Values

    - #### MODE_STRICT

          public static final java.lang.String MODE_STRICT

      Permissable value of `MODE`
      See Also:
        Constant Field Values

    - #### SVNCR_URL

          public static final java.lang.String SVNCR_URL

      URL of the subversion root folder for this repository.
      See Also:
        Constant Field Values

    - #### SVNCR_USER

          public static final java.lang.String SVNCR_USER

      User name for authentication at the repository
      See Also:
        Constant Field Values

    - #### SVNCR_PWD

          public static final java.lang.String SVNCR_PWD

      Password for authentication at the repository
      See Also:
        Constant Field Values

    - #### SVNCR_PRIO

          public static final java.lang.String SVNCR_PRIO

      priority of the repository with the repository chain. See `IComponentsRepository`.
      See Also:
        Constant Field Values

    - #### SVNCR_ROOT

          public static final java.lang.String SVNCR_ROOT

      Folder name in cache. Can and should be omitted in most cases. If omitted, will be computed.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ComponentRepositoryImpl

          public ComponentRepositoryImpl​(java.lang.String name,
                                         java.util.Properties props)

  - ### Method Detail

    - #### getExpectedConfiguration

          protected java.util.Properties getExpectedConfiguration()

      Description copied from class: `com.zfabrik.components.provider.util.AbstractExtComponentRepository`
      provided expected repository configuration. This property set is used by the `FSComponentRepositoryHelper` to make a decision on whether the repository cache is still valid. Any change in repository configuration between repository initialization will be taken as reason to completely purge the local repository. By default this method returns the complete repository configuration.
      Overrides:
        `getExpectedConfiguration` in class `com.zfabrik.components.provider.util.AbstractExtComponentRepository<com.zfabrik.components.provider.util.FSCRDBComponent,​ComponentRepositoryDB>`

    - #### scan

          public ComponentRepositoryDB scan​(ComponentRepositoryDB current)

      Description copied from class: `com.zfabrik.components.provider.util.AbstractExtComponentRepository`
      Provide an updated DB. This DB will be used to compute invalidations on synchronization and it will be used to serve component meta-data. If the repository implementation needs to attach additional meta-data to the DB, it should overwrite the DB class to do so, as the result of a scan potentially will be discarded.
      Specified by:
        `scan` in class `com.zfabrik.components.provider.util.AbstractExtComponentRepository<com.zfabrik.components.provider.util.FSCRDBComponent,​ComponentRepositoryDB>`

    - #### download

          public void download​(com.zfabrik.components.provider.util.FSCRDBComponent c,
                               java.io.File destFolder)

      Description copied from class: `com.zfabrik.components.provider.util.AbstractExtComponentRepository`
      Download resources of a single component into the given folder
      Specified by:
        `download` in class `com.zfabrik.components.provider.util.AbstractExtComponentRepository<com.zfabrik.components.provider.util.FSCRDBComponent,​ComponentRepositoryDB>`

    - #### getURL

          protected java.lang.String getURL()

      Description copied from class: `com.zfabrik.components.provider.util.AbstractExtComponentRepository`
      Some URL style information on the external data source the repository implementation relies on
      Overrides:
        `getURL` in class `com.zfabrik.components.provider.util.AbstractExtComponentRepository<com.zfabrik.components.provider.util.FSCRDBComponent,​ComponentRepositoryDB>`

    - #### getRevision

          protected long getRevision()

      Description copied from class: `com.zfabrik.components.provider.util.AbstractExtComponentRepository`
      Overall revision of the repository - if available
      Overrides:
        `getRevision` in class `com.zfabrik.components.provider.util.AbstractExtComponentRepository<com.zfabrik.components.provider.util.FSCRDBComponent,​ComponentRepositoryDB>`

    - #### getRepoSession

          public SvnWorkResource getRepoSession()

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `com.zfabrik.components.provider.util.AbstractExtComponentRepository<com.zfabrik.components.provider.util.FSCRDBComponent,​ComponentRepositoryDB>`

    - #### test_create

          public static ComponentRepositoryImpl test_create​(java.lang.String name,
                                                            java.io.File root,
                                                            java.util.Properties props,
                                                            com.zfabrik.svnaccess.ISvnRepository svnRepository)

    - #### test_setRepository

          public void test_setRepository​(com.zfabrik.svnaccess.ISvnRepository accessor)

    - #### test_getRepo

          public com.zfabrik.svnaccess.ISvnRepository test_getRepo()
                                                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### test_fullScan

          public ComponentRepositoryDB test_fullScan​(long rev)
                                              throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### test_deltaScan

          public ComponentRepositoryDB test_deltaScan​(ComponentRepositoryDB db,
                                                      long rev)
                                               throws java.lang.Exception

      Throws:
        `java.lang.Exception`