|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jboss.dna.maven.spi.AbstractMavenUrlProvider
org.jboss.dna.maven.spi.JcrMavenUrlProvider
public class JcrMavenUrlProvider
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. 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). |
protected javax.jcr.Session |
createSession()
|
protected javax.jcr.Node |
getContentNodeForMavenResource(javax.jcr.Session session,
MavenUrl mavenUrl)
|
javax.jcr.Credentials |
getCredentials()
|
protected InputStream |
getInputStream(MavenUrl mavenUrl)
Obtain an input stream to the existing content at the location given by the supplied MavenUrl. |
protected javax.jcr.Node |
getOrCreatePath(javax.jcr.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()
|
javax.jcr.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 org.jboss.dna.common.text.TextDecoder |
getUrlDecoder()
|
protected org.jboss.dna.common.text.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(javax.jcr.Credentials credentials)
|
void |
setPathToTopOfRepository(String pathToTopOfRepository)
|
void |
setRepository(javax.jcr.Repository repository)
|
void |
setWorkspaceName(String workspaceName)
|
| Methods inherited from class org.jboss.dna.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 |
|---|
public static final String USERNAME
public static final String PASSWORD
public static final String WORKSPACE_NAME
public static final String REPOSITORY_PATH
public static final String DEFAULT_PATH_TO_TOP_OF_MAVEN_REPOSITORY
public static final String DEFAULT_CREATE_REPOSITORY_PATH
public static final String CONTENT_NODE_NAME
public static final String CONTENT_PROPERTY_NAME
| Constructor Detail |
|---|
public JcrMavenUrlProvider()
| Method Detail |
|---|
public void configure(Properties properties)
MavenRepository that instantiates this provider, and only once immediately after instantiation and before any calls
to MavenUrlProvider.getUrl(MavenId, ArtifactType, SignatureType, boolean).
configure in interface MavenUrlProviderconfigure in class AbstractMavenUrlProviderproperties - the configuration propertiespublic javax.jcr.Credentials getCredentials()
public void setCredentials(javax.jcr.Credentials credentials)
credentials - Sets credentials to the specified value.public String getWorkspaceName()
public void setWorkspaceName(String workspaceName)
workspaceName - Sets workspaceName to the specified value.public String getPathToTopOfRepository()
public void setPathToTopOfRepository(String pathToTopOfRepository)
pathToTopOfRepository - Sets pathToTopOfRepository to the specified value.public javax.jcr.Repository getRepository()
public void setRepository(javax.jcr.Repository repository)
repository - Sets repository to the specified value.
public URL getUrl(MavenId mavenId,
ArtifactType artifactType,
SignatureType signatureType,
boolean createIfRequired)
throws MalformedURLException,
MavenRepositoryException
connect to the repository to read or
write the artifact's content.
mavenId - the ID of the Maven project; may not be nullartifactType - the type of artifact; may be null, but the URL will not be able to be read or written tosignatureType - the type of signature; may be null if the signature file is not desiredcreateIfRequired - 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.
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
protected javax.jcr.Node getOrCreatePath(javax.jcr.Node root,
String relPath,
String nodeType)
throws javax.jcr.PathNotFoundException,
javax.jcr.ItemExistsException,
javax.jcr.nodetype.NoSuchNodeTypeException,
javax.jcr.lock.LockException,
javax.jcr.version.VersionException,
javax.jcr.nodetype.ConstraintViolationException,
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.nodetype.NoSuchNodeTypeException
javax.jcr.lock.LockException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException
protected javax.jcr.Node getContentNodeForMavenResource(javax.jcr.Session session,
MavenUrl mavenUrl)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected String getUrlPath(MavenId mavenId,
ArtifactType artifactType,
SignatureType signatureType)
mavenId - the ID of the Maven project; may not be nullartifactType - the type of artifact; may be nullsignatureType - the type of signature; may be null if the signature file is not desired
protected org.jboss.dna.common.text.TextEncoder getUrlEncoder()
protected org.jboss.dna.common.text.TextDecoder getUrlDecoder()
protected javax.jcr.Session createSession()
throws javax.jcr.LoginException,
javax.jcr.NoSuchWorkspaceException,
javax.jcr.RepositoryException
javax.jcr.LoginException
javax.jcr.NoSuchWorkspaceException
javax.jcr.RepositoryException
protected InputStream getInputStream(MavenUrl mavenUrl)
throws IOException
MavenUrl. The Maven URL
should have a path that points to the node where the content is stored in the
content property.
mavenUrl - the Maven URL to the content; may not be null
IOException
protected OutputStream getOutputStream(MavenUrl mavenUrl)
throws IOException
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.
mavenUrl - the Maven URL to the content; may not be null
IOException
public void setContent(MavenUrl mavenUrl,
InputStream content)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||