|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.maven.spi.AbstractMavenUrlProvider org.modeshape.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. |
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 |
---|
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 MavenUrlProvider
configure
in class AbstractMavenUrlProvider
properties
- the configuration propertiespublic Credentials getCredentials()
public void setCredentials(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 Repository getRepository()
public void setRepository(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 configuredprotected Node getOrCreatePath(Node root, String relPath, String nodeType) throws PathNotFoundException, ItemExistsException, NoSuchNodeTypeException, LockException, VersionException, ConstraintViolationException, RepositoryException
PathNotFoundException
ItemExistsException
NoSuchNodeTypeException
LockException
VersionException
ConstraintViolationException
RepositoryException
protected Node getContentNodeForMavenResource(Session session, MavenUrl mavenUrl) throws RepositoryException
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 TextEncoder getUrlEncoder()
protected TextDecoder getUrlDecoder()
protected Session createSession() throws LoginException, NoSuchWorkspaceException, RepositoryException
LoginException
NoSuchWorkspaceException
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 |