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
Class MavenUrl

    java.lang.Object
      org.modeshape.maven.MavenUrl

    public class MavenUrl

extends Object

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

### NO_PORT

    public static final int NO_PORT

See Also:
  Constant Field Values

### JCR_PROTOCOL

    public static final String JCR_PROTOCOL

See Also:
  Constant Field Values

### URL_PATH_DELIMITER

    protected static final String URL_PATH_DELIMITER

See Also:
  Constant Field Values

Constructor Detail

### MavenUrl

    public MavenUrl()

Method Detail

### getHostname

    public String getHostname()

  Get the host name

  Returns:
    the host name

### setHostname

    public void setHostname(String hostname)

  Parameters:
    `hostname` - the new host name

### getPort

    public int getPort()

  Get the port. This method returns `NO_PORT` if the port has not been specified.

  Returns:
    the port

### setPort

    public void setPort(int port)

  Parameters:
    `port` - the new port, or `NO_PORT` if there is no port

### getHostnameAndPort

    public String getHostnameAndPort()

### getWorkspaceName

    public String getWorkspaceName()

  Returns:
    workspaceName

### setWorkspaceName

    public void setWorkspaceName(String workspaceName)

  Set the name of the workspace.

  Parameters:
    `workspaceName` - the name of the workspace

### trimDelimiters

    protected String trimDelimiters(String string,
                                    boolean removeLeading,
                                    boolean removeTrailing)

### getPath

    public String getPath()

  Returns:
    path

### setPath

    public void setPath(String path)

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

### getUrl

    public URL getUrl(URLStreamHandler handler,
                      TextEncoder encoder)
               throws MalformedURLException

  Get a URL that corresponds to the information in this object.

  Parameters:
    `handler` - the URL stream handler that will be used to handle obtaining an input stream or an output stream on the resulting URL
    `encoder` - 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
  Returns:
    the URL
  Throws:
    `MalformedURLException` - if the resulting URL would be malformed

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### parse

    public static MavenUrl parse(String url,
                                 TextDecoder decoder)

  Parse the supplied URL and determine if the URL fits the JCR URL format. If it does, return a `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/node

  where
  - hostname is the name of the repository's host; typically, this is unspecified to refer to a repository in the same VM
  - port is the port on the host. If the hostname is unspecified, the port should be excluded.
  - workspaceName is the name of the workspace in the repository
  - path/to/node is the path of the node or property that is to be referenced

  Parameters:
    `url` - the URL to be parsed
    `decoder` - the text encoder that should be used to decode the URL; may be null if no decoding should be done
  Returns:
    the object representing the JCR information contained in the URL
  See Also:
    `parse(URL, TextDecoder)`

### parse

    public static MavenUrl parse(URL url,
                                 TextDecoder decoder)

  Parse the supplied URL and determine if the URL fits the JCR URL format. If it does, return a `MavenUrl` instance; otherwise return null. If the URL is malformed or otherwise invalid, this method also returns null.

  Parameters:
    `url` - the URL to be parsed
    `decoder` - the text encoder that should be used to decode the URL; may be null if no decoding should be done
  Returns:
    the object representing the JCR information contained in the URL
  See Also:
    `parse(String,TextDecoder)`

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.