Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.maven.spi
Class JcrMavenUrlProvider

    java.lang.Object
      org.modeshape.maven.spi.AbstractMavenUrlProvider
          org.modeshape.maven.spi.JcrMavenUrlProvider

All Implemented Interfaces:
  MavenUrlProvider

    public class JcrMavenUrlProvider

extends AbstractMavenUrlProvider

Base class for providers that work against a JCR repository. This class implements all functionality except for creating the `repository` instance, and it relies upon some other component or subclass to `set the repository instance`. Typically, this is done by a subclass in it's `configure(Properties)` method:

     public class MyCustomJcrMavenUrlProvider extends JcrMavenUrlProvider {
         @Override
         public void configure(Properties properties) {
              super.configure(properties);
              properties = super.getProperties();     // always non-null
              Repository repo = ...                   // Construct and configure
              super.setRepository(repo);
          }
     }

Nested Class Summary
`protected class` | `JcrMavenUrlProvider.JcrUrlStreamHandler` This `URLStreamHandler` specialization understands `URLs` that point to content in the JCR repository used by this Maven repository.
`protected class` | `JcrMavenUrlProvider.MavenInputStream`
`protected class` | `JcrMavenUrlProvider.MavenOutputStream`
`protected class` | `JcrMavenUrlProvider.MavenUrlConnection` A URLConnection with support for obtaining content from a node in a JCR repository.

Field Summary
`static String` | `CONTENT_NODE_NAME`
`static String` | `CONTENT_PROPERTY_NAME`
`static String` | `DEFAULT_CREATE_REPOSITORY_PATH`
`static String` | `DEFAULT_PATH_TO_TOP_OF_MAVEN_REPOSITORY`
`static String` | `PASSWORD`
`static String` | `REPOSITORY_PATH`
`static String` | `USERNAME`
`static String` | `WORKSPACE_NAME`

Constructor Summary
`JcrMavenUrlProvider()`

Method Summary
`void` | `configure(Properties properties)` Configure this provider given the configuration properties.
`protected Session` | `createSession()`
`protected Node` | `getContentNodeForMavenResource(Session session, MavenUrl mavenUrl)`
`Credentials` | `getCredentials()`
`protected InputStream` | `getInputStream(MavenUrl mavenUrl)` Obtain an input stream to the existing content at the location given by the supplied `MavenUrl`.
`protected Node` | `getOrCreatePath(Node root, String relPath, String nodeType)`
`protected OutputStream` | `getOutputStream(MavenUrl mavenUrl)` Obtain an output stream to the existing content at the location given by the supplied `MavenUrl`.
`String` | `getPathToTopOfRepository()`
`Repository` | `getRepository()` Get the JCR repository used by this provider
`URL` | `getUrl(MavenId mavenId, ArtifactType artifactType, SignatureType signatureType, boolean createIfRequired)` Get the URL for the artifact with the specified type in the given Maven project.
`protected TextDecoder` | `getUrlDecoder()`
`protected TextEncoder` | `getUrlEncoder()`
`protected String` | `getUrlPath(MavenId mavenId, ArtifactType artifactType, SignatureType signatureType)` Get the JRC path to the node in this repository and it's workspace that represents the artifact with the given type in the supplied Maven project.
`String` | `getWorkspaceName()`
`void` | `setContent(MavenUrl mavenUrl, InputStream content)`
`void` | `setCredentials(Credentials credentials)`
`void` | `setPathToTopOfRepository(String pathToTopOfRepository)`
`void` | `setRepository(Repository repository)`
`void` | `setWorkspaceName(String workspaceName)`

Methods inherited from class org.modeshape.maven.spi.AbstractMavenUrlProvider
`getProperties, setProperties`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### USERNAME

    public static final String USERNAME

See Also:
  Constant Field Values

### PASSWORD

    public static final String PASSWORD

See Also:
  Constant Field Values

### WORKSPACE_NAME

    public static final String WORKSPACE_NAME

See Also:
  Constant Field Values

### REPOSITORY_PATH

    public static final String REPOSITORY_PATH

See Also:
  Constant Field Values

### DEFAULT_PATH_TO_TOP_OF_MAVEN_REPOSITORY

    public static final String DEFAULT_PATH_TO_TOP_OF_MAVEN_REPOSITORY

See Also:
  Constant Field Values

### DEFAULT_CREATE_REPOSITORY_PATH

    public static final String DEFAULT_CREATE_REPOSITORY_PATH

### CONTENT_NODE_NAME

    public static final String CONTENT_NODE_NAME

See Also:
  Constant Field Values

### CONTENT_PROPERTY_NAME

    public static final String CONTENT_PROPERTY_NAME

See Also:
  Constant Field Values

Constructor Detail

### JcrMavenUrlProvider

    public JcrMavenUrlProvider()

Method Detail

### configure

    public void configure(Properties properties)

  Configure this provider given the configuration properties. This method is intended to be called by the `MavenRepository` that instantiates this provider, and only once immediately after instantiation and before any calls to `MavenUrlProvider.getUrl(MavenId, ArtifactType, SignatureType, boolean)`.

  Specified by:
    `configure` in interface `MavenUrlProvider`
  Overrides:
    `configure` in class `AbstractMavenUrlProvider`
  Parameters:
    `properties` - the configuration properties

### getCredentials

    public Credentials getCredentials()

  Returns:
    credentials

### setCredentials

    public void setCredentials(Credentials credentials)

  Parameters:
    `credentials` - Sets credentials to the specified value.

### getWorkspaceName

    public String getWorkspaceName()

  Returns:
    workspaceName

### setWorkspaceName

    public void setWorkspaceName(String workspaceName)

  Parameters:
    `workspaceName` - Sets workspaceName to the specified value.

### getPathToTopOfRepository

    public String getPathToTopOfRepository()

  Returns:
    pathToTopOfRepository

### setPathToTopOfRepository

    public void setPathToTopOfRepository(String pathToTopOfRepository)

  Parameters:
    `pathToTopOfRepository` - Sets pathToTopOfRepository to the specified value.

### getRepository

    public Repository getRepository()

  Get the JCR repository used by this provider

  Returns:
    the repository instance

### setRepository

    public void setRepository(Repository repository)

  Parameters:
    `repository` - Sets repository to the specified value.

### getUrl

    public URL getUrl(MavenId mavenId,
                      ArtifactType artifactType,
                      SignatureType signatureType,
                      boolean createIfRequired)
               throws MalformedURLException,
                      MavenRepositoryException

  Get the URL for the artifact with the specified type in the given Maven project. The resulting URL can be used to `connect` to the repository to `read` or `write` the artifact's content.

  Parameters:
    `mavenId` - the ID of the Maven project; may not be null
    `artifactType` - the type of artifact; may be null, but the URL will not be able to be read or written to
    `signatureType` - the type of signature; may be null if the signature file is not desired
    `createIfRequired` - true if the node structure should be created if any part of it does not exist; this always expects that the path to the top of the repository tree exists.
  Returns:
    the URL to this artifact, or null if the artifact does not exist
  Throws:
    `MalformedURLException` - if the supplied information cannot be turned into a valid URL
    `MavenRepositoryException` - if there is a problem connecting to or using the Maven repository, as configured

### getOrCreatePath

    protected Node getOrCreatePath(Node root,
                                   String relPath,
                                   String nodeType)
                            throws PathNotFoundException,
                                   ItemExistsException,
                                   NoSuchNodeTypeException,
                                   LockException,
                                   VersionException,
                                   ConstraintViolationException,
                                   RepositoryException

  Throws:
    `PathNotFoundException`
    `ItemExistsException`
    `NoSuchNodeTypeException`
    `LockException`
    `VersionException`
    `ConstraintViolationException`
    `RepositoryException`

### getContentNodeForMavenResource

    protected Node getContentNodeForMavenResource(Session session,
                                                  MavenUrl mavenUrl)
                                           throws RepositoryException

  Throws:
    `RepositoryException`

### getUrlPath

    protected String getUrlPath(MavenId mavenId,
                                ArtifactType artifactType,
                                SignatureType signatureType)

  Get the JRC path to the node in this repository and it's workspace that represents the artifact with the given type in the supplied Maven project.

  Parameters:
    `mavenId` - the ID of the Maven project; may not be null
    `artifactType` - the type of artifact; may be null
    `signatureType` - the type of signature; may be null if the signature file is not desired
  Returns:
    the path

### getUrlEncoder

    protected TextEncoder getUrlEncoder()

### getUrlDecoder

    protected TextDecoder getUrlDecoder()

### createSession

    protected Session createSession()
                             throws LoginException,
                                    NoSuchWorkspaceException,
                                    RepositoryException

  Throws:
    `LoginException`
    `NoSuchWorkspaceException`
    `RepositoryException`

### getInputStream

    protected InputStream getInputStream(MavenUrl mavenUrl)
                                  throws IOException

  Obtain an input stream to the existing content at the location given by the supplied `MavenUrl`. The Maven URL should have a path that points to the node where the content is stored in the `content property`.

  Parameters:
    `mavenUrl` - the Maven URL to the content; may not be null
  Returns:
    the input stream to the content, or null if there is no existing content
  Throws:
    `IOException`

### getOutputStream

    protected OutputStream getOutputStream(MavenUrl mavenUrl)
                                    throws IOException

  Obtain an output stream to the existing content at the location given by the supplied `MavenUrl`. The Maven URL should have a path that points to the property or to the node where the content is stored in the `content property`.

  Parameters:
    `mavenUrl` - the Maven URL to the content; may not be null
  Returns:
    the input stream to the content, or null if there is no existing content
  Throws:
    `IOException`

### setContent

    public void setContent(MavenUrl mavenUrl,
                           InputStream content)
                    throws IOException

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.