org.jboss.dna.maven.spi
Class JcrMavenUrlProvider
java.lang.Object
org.jboss.dna.maven.spi.AbstractMavenUrlProvider
org.jboss.dna.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);
}
}
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
JcrMavenUrlProvider
public JcrMavenUrlProvider()
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 javax.jcr.Credentials getCredentials()
- Returns:
- credentials
setCredentials
public void setCredentials(javax.jcr.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 javax.jcr.Repository getRepository()
- Get the JCR repository used by this provider
- Returns:
- the repository instance
setRepository
public void setRepository(javax.jcr.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 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.
- 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
setContent
public void setContent(MavenUrl mavenUrl,
InputStream content)
throws IOException
- Throws:
IOException
Copyright © 2008-2009 JBoss, a division of Red Hat. All Rights Reserved.