|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.maven.MavenUrl
public class MavenUrl
Wrapper for a URL that uses a format for referencing JCR nodes and content.
Field Summary | |
---|---|
static String |
JCR_PROTOCOL
|
static int |
NO_PORT
|
protected static String |
URL_PATH_DELIMITER
|
Constructor Summary | |
---|---|
MavenUrl()
|
Method Summary | |
---|---|
String |
getHostname()
Get the host name |
String |
getHostnameAndPort()
|
String |
getPath()
|
int |
getPort()
Get the port. |
URL |
getUrl(URLStreamHandler handler,
TextEncoder encoder)
Get a URL that corresponds to the information in this object. |
String |
getWorkspaceName()
|
static MavenUrl |
parse(String url,
TextDecoder decoder)
Parse the supplied URL and determine if the URL fits the JCR URL format. |
static MavenUrl |
parse(URL url,
TextDecoder decoder)
Parse the supplied URL and determine if the URL fits the JCR URL format. |
void |
setHostname(String hostname)
|
void |
setPath(String path)
|
void |
setPort(int port)
|
void |
setWorkspaceName(String workspaceName)
Set the name of the workspace. |
String |
toString()
|
protected String |
trimDelimiters(String string,
boolean removeLeading,
boolean removeTrailing)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NO_PORT
public static final String JCR_PROTOCOL
protected static final String URL_PATH_DELIMITER
Constructor Detail |
---|
public MavenUrl()
Method Detail |
---|
public String getHostname()
public void setHostname(String hostname)
hostname
- the new host namepublic int getPort()
NO_PORT
if the port has not been specified.
public void setPort(int port)
port
- the new port, or NO_PORT
if there is no portpublic String getHostnameAndPort()
public String getWorkspaceName()
public void setWorkspaceName(String workspaceName)
workspaceName
- the name of the workspaceprotected String trimDelimiters(String string, boolean removeLeading, boolean removeTrailing)
public String getPath()
public void setPath(String path)
path
- Sets path to the specified value.public URL getUrl(URLStreamHandler handler, TextEncoder encoder) throws MalformedURLException
handler
- the URL stream handler that will be used to handle obtaining an input stream or an output stream on the
resulting URLencoder
- an encoder that will be used to escape any characters that are not allowed in URLs; UrlEncoder
will
be used if no encoder is specified
MalformedURLException
- if the resulting URL would be malformedpublic String toString()
toString
in class Object
public static MavenUrl parse(String url, TextDecoder decoder)
MavenUrl
instance;
otherwise return null. If the URL is malformed or otherwise invalid, this method also returns null.
The URL format is expected to fit the following pattern:
jcr://hostname:port/workspaceName/path/to/nodewhere
url
- the URL to be parseddecoder
- the text encoder that should be used to decode the URL; may be null if no decoding should be done
parse(URL, TextDecoder)
public static MavenUrl parse(URL url, TextDecoder decoder)
MavenUrl
instance;
otherwise return null. If the URL is malformed or otherwise invalid, this method also returns null.
url
- the URL to be parseddecoder
- the text encoder that should be used to decode the URL; may be null if no decoding should be done
parse(String,TextDecoder)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |