org.modeshape.web.jcr.rest.client.domain

## Class Server

- java.lang.Object
- - org.modeshape.web.jcr.rest.client.domain.Server

- All Implemented Interfaces:
    IModeShapeObject

      @Immutable
      public class Server
      extends Object
      implements IModeShapeObject

  The `Server` class is the business object for a server that is hosting one or more ModeShape repositories.

  The server requires a url, user name, and a password in order to connect. The `url` that is used has a format of http://hostname:port/context root. Where

- hostname is the name of the server
- port is the port to connect to, generally its 8080
- context root is the deployed war context

The deployed war context root is based on what the deployed war file is called. If the ModeShape deployed war is called resources.war (which is the default build name), then the context root would be resources.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `Server(String url, String user, String password)` Constructs on new `Server`.
    `protected` | `Server(String originalUrl, String validatedUrl, String user, String password)` Constructs on new `Server`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Server` | `asValidated(String validatedUrl)` Create a copy of this object that represents a validated URL to a server.
    `boolean` | `equals(Object obj)`
    `String` | `getName()`
    `String` | `getOriginalUrl()` Get the original URL that the user supplied.
    `String` | `getPassword()`
    `String` | `getShortDescription()`
    `String` | `getUrl()`
    `String` | `getUser()`
    `int` | `hashCode()`
    `boolean` | `hasSameKey(Server otherServer)` A server has the same identifying properties if their URL and user matches.
    `boolean` | `isValidated()` Determine whether this server has been `validated`.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Server

          public Server(String url,
                String user,
                String password)

      Constructs on new `Server`.
      Parameters:
        `url` - the server URL, which must contain the deployed war file context (never `null`)
        `user` - the server user (may be `null`)
        `password` - the server password (may be `null`)
      Throws:
        `IllegalArgumentException` - if the URL or user arguments are `null`

    - #### Server

          protected Server(String originalUrl,
                String validatedUrl,
                String user,
                String password)

      Constructs on new `Server`.
      Parameters:
        `originalUrl` - the original, user-supplied server URL (may not be `null`)
        `validatedUrl` - the validated server URL to which the server can connect, which must contain the deployed war file context (never `null`)
        `user` - the server user (may be `null`)
        `password` - the server password (may be `null`)
      Throws:
        `IllegalArgumentException` - if the URL or user arguments are `null`

  - ### Method Detail

    - #### asValidated

          public Server asValidated(String validatedUrl)

      Create a copy of this object that represents a validated URL to a server.
      Parameters:
        `validatedUrl` - the validated URL; may not be null
      Returns:
        the new, validated Server object; never null

    - #### getOriginalUrl

          public String getOriginalUrl()

      Get the original URL that the user supplied. If this object has been validated, then this URL may not be the actual URL used to communicate with the REST service.
      Returns:
        the original URL; never null

    - #### isValidated

          public boolean isValidated()

      Determine whether this server has been `validated`.
      Returns:
        true if validated, or false otherwise

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`
      See Also:
        `Object.equals(java.lang.Object)`

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `IModeShapeObject`
      Returns:
        the object name (never `null`)
      See Also:
        `IModeShapeObject.getName()`

    - #### getPassword

          public String getPassword()

      Returns:
        the server authentication password

    - #### getShortDescription

          public String getShortDescription()

      Specified by:
        `getShortDescription` in interface `IModeShapeObject`
      Returns:
        a description suitable for use in a tooltip (never `null`)
      See Also:
        `IModeShapeObject.getShortDescription()`

    - #### getUrl

          public String getUrl()

      Returns:
        the server URL (never `null`)

    - #### getUser

          public String getUser()

      Returns:
        the server authentication user (never `null`)

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`
      See Also:
        `Object.hashCode()`

    - #### hasSameKey

          public boolean hasSameKey(Server otherServer)

      A server has the same identifying properties if their URL and user matches.
      Parameters:
        `otherServer` - the server whose key is being compared (never `null`)
      Returns:
        `true` if the servers have the same key
      Throws:
        `IllegalArgumentException` - if the argument is `null`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`
      See Also:
        `Object.toString()`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.