org.tmatesoft.svn.core.io

## Class SVNRepositoryFactory

- java.lang.Object
- - org.tmatesoft.svn.core.io.SVNRepositoryFactory

-     public abstract class SVNRepositoryFactory
      extends java.lang.Object

  SVNRepositoryFactory is an abstract factory that is responsible for creating an appropriate SVNRepository driver specific for the protocol to use.

  Depending on what protocol a user exactly would like to use to access the repository he should first of all set up an appropriate extension of this factory. So, if the user is going to work with the repository via the custom svn-protocol (or svn+xxx) he initially calls:

       ...
       import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl;
       ...
           //do it once in your application prior to using the library
           //enables working with a repository via the svn-protocol (over svn and svn+ssh)
           SVNRepositoryFactoryImpl.setup();
       ...

  From this point the SVNRepositoryFactory knows how to create SVNRepository instances specific for the svn-protocol. And further on the user can create an SVNRepository instance:

           ...
           //creating a new SVNRepository instance
           String url = "svn://host/path";
           SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
           ...

  Supported Protocols | Factory to setup
  svn://, svn+xxx:// | SVNRepositoryFactoryImpl (org.tmatesoft.svn.core.internal.io.svn)
  http://, https:// | DAVRepositoryFactory (org.tmatesoft.svn.core.internal.io.dav)
  file:/// (FSFS only) | FSRepositoryFactory (org.tmatesoft.svn.core.internal.io.fs)

  Also SVNRepositoryFactory may be used to create local FSFS-type repositories.

  Since:
    1.2
  Version:
    1.3
  Author:
    TMate Software Ltd.
  See Also:
    `SVNRepository`, Examples

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SVNRepositoryFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SVNRepository` | `create(SVNURL url)` Creates an SVNRepository driver according to the protocol that is to be used to access a repository.
    `static SVNRepository` | `create(SVNURL url, ISVNSession options)` Creates an SVNRepository driver according to the protocol that is to be used to access a repository.
    `static SVNURL` | `createLocalRepository(java.io.File path, boolean enableRevisionProperties, boolean force)` Creates a local blank FSFS-type repository.
    `static SVNURL` | `createLocalRepository(java.io.File path, java.lang.String uuid, boolean enableRevisionProperties, boolean force)` Creates a local blank FSFS-type repository.
    `static SVNURL` | `createLocalRepository(java.io.File path, java.lang.String uuid, boolean enableRevisionProperties, boolean force, boolean pre14Compatible)` Creates a local blank FSFS-type repository.
    `static SVNURL` | `createLocalRepository(java.io.File path, java.lang.String uuid, boolean enableRevisionProperties, boolean force, boolean pre14Compatible, boolean pre15Compatible)` Creates a local blank FSFS-type repository.
    `static SVNURL` | `createLocalRepository(java.io.File path, java.lang.String uuid, boolean enableRevisionProperties, boolean force, boolean pre14Compatible, boolean pre15Compatible, boolean pre16Compatible)` Creates a local blank FSFS-type repository.
    `protected abstract SVNRepository` | `createRepositoryImpl(SVNURL url, ISVNSession session)`
    `protected static boolean` | `hasRepositoryFactory(java.lang.String protocol)`
    `protected static void` | `registerRepositoryFactory(java.lang.String protocol, SVNRepositoryFactory factory)`

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

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

- - ### Constructor Detail

    - #### SVNRepositoryFactory

          public SVNRepositoryFactory()

  - ### Method Detail

    - #### registerRepositoryFactory

          protected static void registerRepositoryFactory(java.lang.String protocol,
                                       SVNRepositoryFactory factory)

    - #### hasRepositoryFactory

          protected static boolean hasRepositoryFactory(java.lang.String protocol)

    - #### create

          public static SVNRepository create(SVNURL url)
                                      throws SVNException

      Creates an SVNRepository driver according to the protocol that is to be used to access a repository.

      The protocol is defined as the beginning part of the URL schema. Currently SVNKit supports only svn:// (svn+ssh://) and http:// (https://) schemas.

      The created SVNRepository driver can later be "reused" for another location - that is you can switch it to another repository url not to create yet one more SVNRepository object. Use the `SVNRepository.setLocation()` method for this purpose.

      An SVNRepository driver created by this method uses a default session options driver (`ISVNSession.DEFAULT`) which does not allow to keep a single socket connection opened and commit log messages caching.

      Parameters:
        `url` - a repository location URL
      Returns:
        a protocol specific SVNRepository driver
      Throws:
        `SVNException` - if there's no implementation for the specified protocol (the user may have forgotten to register a specific factory that creates SVNRepository instances for that protocol or the SVNKit library does not support that protocol at all)
      See Also:
        `create(SVNURL, ISVNSession)`, `SVNRepository`

    - #### create

          public static SVNRepository create(SVNURL url,
                             ISVNSession options)
                                      throws SVNException

      Creates an SVNRepository driver according to the protocol that is to be used to access a repository.

      The protocol is defined as the beginning part of the URL schema. Currently SVNKit supports only svn:// (svn+ssh://) and http:// (https://) schemas.

      The created SVNRepository driver can later be "reused" for another location - that is you can switch it to another repository url not to create yet one more SVNRepository object. Use the `SVNRepository.setLocation()` method for this purpose.

      This method allows to customize a session options driver for an SVNRepository driver. A session options driver must implement the ISVNSession interface. It manages socket connections - says whether an SVNRepository driver may use a single socket connection during the runtime, or it should open a new connection per each repository access operation. And also a session options driver may cache and provide commit log messages during the runtime.

      Parameters:
        `url` - a repository location URL
        `options` - a session options driver
      Returns:
        a protocol specific SVNRepository driver
      Throws:
        `SVNException` - if there's no implementation for the specified protocol (the user may have forgotten to register a specific factory that creates SVNRepository instances for that protocol or the SVNKit library does not support that protocol at all)
      See Also:
        `create(SVNURL)`, `SVNRepository`

    - #### createLocalRepository

          public static SVNURL createLocalRepository(java.io.File path,
                                     boolean enableRevisionProperties,
                                     boolean force)
                                              throws SVNException

      Creates a local blank FSFS-type repository. A call to this routine is equivalent to `createLocalRepository(path, null, enableRevisionProperties, force)`.
      Parameters:
        `path` - a repository root location
        `enableRevisionProperties` - enables or not revision property modifications
        `force` - forces operation to run
      Returns:
        a local URL (file:///) of a newly created repository
      Throws:
        `SVNException`
      Since:
        1.1
      See Also:
        `createLocalRepository(File, String, boolean, boolean)`

    - #### createLocalRepository

          public static SVNURL createLocalRepository(java.io.File path,
                                     java.lang.String uuid,
                                     boolean enableRevisionProperties,
                                     boolean force)
                                              throws SVNException

      Creates a local blank FSFS-type repository. This is just similar to the Subversion's command: `svnadmin create --fs-type=fsfs REPOS_PATH`. The resultant repository is absolutely format-compatible with Subversion.

      If `uuid` is null or not 36 chars wide, the method generates a new UUID for the repository. This UUID would have the same format as if it's generated by Subversion itself.

      If `enableRevisionProperties` is true then the method creates a `pre-revprop-change` executable file inside the `"hooks"` subdir of the repository tree. This executable file simply returns 0 thus allowing revision property modifications, which are not permitted, unless one puts such a hook into that very directory.

      If `force` is true and `path` already exists, deletes that path and creates a repository in its place.

      A call to this routine is equivalent to `createLocalRepository(path, uuid, enableRevisionProperties, force, false)`.

      Parameters:
        `path` - a repository root location
        `uuid` - a repository's uuid
        `enableRevisionProperties` - enables or not revision property modifications
        `force` - forces operation to run
      Returns:
        a local URL (file:///) of a newly created repository
      Throws:
        `SVNException`
      Since:
        1.1
      See Also:
        `createLocalRepository(File, String, boolean, boolean, boolean)`

    - #### createLocalRepository

          public static SVNURL createLocalRepository(java.io.File path,
                                     java.lang.String uuid,
                                     boolean enableRevisionProperties,
                                     boolean force,
                                     boolean pre14Compatible)
                                              throws SVNException

      Creates a local blank FSFS-type repository. This is just similar to the Subversion's command: `svnadmin create --fs-type=fsfs REPOS_PATH`. The resultant repository is absolutely format-compatible with Subversion.

      If `uuid` is null or not 36 chars wide, the method generates a new UUID for the repository. This UUID would have the same format as if it's generated by Subversion itself.

      If `enableRevisionProperties` is true then the method creates a `pre-revprop-change` executable file inside the `"hooks"` subdir of the repository tree. This executable file simply returns 0 thus allowing revision property modifications, which are not permitted, unless one puts such a hook into that very directory.

      If `force` is true and `path` already exists, deletes that path and creates a repository in its place.

      Set `pre14Compatible` to true if you want a new repository to be compatible with pre-1.4 servers.

      Note: this method is identical to `createLocalRepository(path, uuid, enableRevisionProperties, force, pre14Compatible, false)`.

      Parameters:
        `path` - a repository root location
        `uuid` - a repository's uuid
        `enableRevisionProperties` - enables or not revision property modifications
        `force` - forces operation to run
        `pre14Compatible` - true to create a repository with pre-1.4 format
      Returns:
        a local URL (file:///) of a newly created repository
      Throws:
        `SVNException`
      Since:
        1.1.1
      See Also:
        `createLocalRepository(File, String, boolean, boolean, boolean, boolean)`

    - #### createLocalRepository

          public static SVNURL createLocalRepository(java.io.File path,
                                     java.lang.String uuid,
                                     boolean enableRevisionProperties,
                                     boolean force,
                                     boolean pre14Compatible,
                                     boolean pre15Compatible)
                                              throws SVNException

      Creates a local blank FSFS-type repository. This is just similar to the Subversion's command: `svnadmin create --fs-type=fsfs REPOS_PATH`. The resultant repository is absolutely format-compatible with Subversion.

      If `uuid` is null or not 36 chars wide, the method generates a new UUID for the repository. This UUID would have the same format as if it's generated by Subversion itself.

      If `enableRevisionProperties` is true then the method creates a `pre-revprop-change` executable file inside the `"hooks"` subdir of the repository tree. This executable file simply returns 0 thus allowing revision property modifications, which are not permitted, unless one puts such a hook into that very directory.

      If `force` is true and `path` already exists, deletes that path and creates a repository in its place.

      Set `pre14Compatible` to true if you want a new repository to be compatible with pre-1.4 servers.

      Set `pre15Compatible` to true if you want a new repository to be compatible with pre-1.5 servers.

      There must be only one option (either `pre14Compatible` or `pre15Compatible`) set to true at a time.

      Parameters:
        `path` - a repository root location
        `uuid` - a repository's uuid
        `enableRevisionProperties` - enables or not revision property modifications
        `force` - forces operation to run
        `pre14Compatible` - true to create a repository with pre-1.4 format
        `pre15Compatible` - true to create a repository with pre-1.5 format
      Returns:
        a local URL (file:///) of a newly created repository
      Throws:
        `SVNException`
      Since:
        1.2

    - #### createLocalRepository

          public static SVNURL createLocalRepository(java.io.File path,
                                     java.lang.String uuid,
                                     boolean enableRevisionProperties,
                                     boolean force,
                                     boolean pre14Compatible,
                                     boolean pre15Compatible,
                                     boolean pre16Compatible)
                                              throws SVNException

      Creates a local blank FSFS-type repository. This is just similar to the Subversion's command: `svnadmin create --fs-type=fsfs REPOS_PATH`. The resultant repository is absolutely format-compatible with Subversion.

      If `uuid` is null or not 36 chars wide, the method generates a new UUID for the repository. This UUID would have the same format as if it's generated by Subversion itself.

      If `enableRevisionProperties` is true then the method creates a `pre-revprop-change` executable file inside the `"hooks"` subdir of the repository tree. This executable file simply returns 0 thus allowing revision property modifications, which are not permitted, unless one puts such a hook into that very directory.

      If `force` is true and `path` already exists, deletes that path and creates a repository in its place.

      Set `pre14Compatible` to true if you want a new repository to be compatible with pre-1.4 servers.

      Set `pre15Compatible` to true if you want a new repository to be compatible with pre-1.5 servers.

      Set `pre16Compatible` to true if you want a new repository to be compatible with pre-1.6 servers.

      There must be only one option (either `pre14Compatible` or `pre15Compatible` or `pre16Compatible`) set to true at a time.

      Parameters:
        `path` - a repository root location
        `uuid` - a repository's uuid
        `enableRevisionProperties` - enables or not revision property modifications
        `force` - forces operation to run
        `pre14Compatible` - true to create a repository with pre-1.4 format
        `pre15Compatible` - true to create a repository with pre-1.5 format
        `pre16Compatible` - true to create a repository with pre-1.6 format
      Returns:
        a local URL (file:///) of a newly created repository
      Throws:
        `SVNException`
      Since:
        1.3

    - #### createRepositoryImpl

          protected abstract SVNRepository createRepositoryImpl(SVNURL url,
                                           ISVNSession session)

Copyright © 2004-2009 TMate Software Ltd. All Rights Reserved.