com.buildforge.services.client.dbo
Class Server

java.lang.Object
  extended by com.buildforge.services.client.dbo.Server

public class Server
extends java.lang.Object

Servers are the execution platforms for the Builds of a Project. Servers expose their specific properties via Collectors, and are queried by Selectors in order to match their exposed properties against the required properties to determine suitability as an execution platform for a specific Build of a certain Project.


Field Summary
static java.lang.Class<Server> CLASS
           
static int DEFAULT_TEST_INTERVAL
          Default interval to wait between polls while blocking for a server test to complete.
static int DEFAULT_TEST_TIMEOUT
          Default maximum time to wait for a server test to complete.
 
Constructor Summary
Server(APIClientConnection conn)
           
 
Method Summary
 void activate()
          Activates a server.
 void activate(boolean active)
          Activates or deactivates a server.
 boolean canGet()
          Returns whether (true) or not (false) files may be retrieved from this Server via the dot command .get
 boolean canPut()
          Returns whether (true) or not (false) files may be placed onto this Server via the dot command .put
 Server create()
          Creates this new Server in the database
 void delete()
          Removes this Server from the database
static java.util.List<Server> findAll(APIClientConnection conn)
          Retrieves all defined Server objects in the database
static Server findById(APIClientConnection conn, int serverId)
          Retrieves a particular Server by identifier
static Server findByName(APIClientConnection conn, java.lang.String serverName)
          Retrives a particular Server by name
 boolean getActive()
          Returns whether this Server is active (true) or inactive (false)
 java.lang.String getAuthId()
          Returns the identifier of the ServerAuth authentication object associated with this Server
 java.lang.String getCollectorId()
          Returns the identifier of the Collector associated with this Server
 int getEnvironmentId()
          Returns the identifier of the Environment associated with this Server
 ServerDBO.Error getError()
          Returns the error state of this Server, see ServerDBO.Error for more details
 java.lang.String getHost()
          Returns the hostname of this Server, i.e.: "myhost.domain.tld"
 int getLevel()
          Returns the security level that must be possessed in order to access this Server object
 Manifest getManifest()
          Retrieves the Manifest for this Server.
 java.lang.String getName()
          Returns the friendly name of the Server, i.e.: "myFirstBuildServer"
 java.lang.String getPath()
          Returns the Server-local path on which build information will be generated, i.e.: "/builds"
 ServerDBO.Publish getPublish()
          Returns whether gets (.get) and puts (.put) are allowed on this server
 int getServerId()
          Returns the unique identifier of this Server
 java.lang.String getTestText()
          Returns the literal text of the results of the last connection test
 ServerDBO.Upstate getUpstate()
          Returns the current state of the server with respect to availability - currently one of either updating or ready
 void refreshManifest()
          Requests that the server's manifest be refreshed
 Manifest refreshManifest(int timeout)
          Requests that the server's manifest be refreshed and waits the specified time period for the refresh to complete.
 Manifest refreshManifest(int timeout, int interval)
          Requests that the server's manifest be refreshed and waits the specified time period for the refresh to complete.
 void setActive(boolean active)
          Sets whether this Server is active (true) or inactive (false)
 void setAuthId(java.lang.String authId)
          Sets the identifier of the ServerAuth authentication object associated with this Server
 void setCollectorId(java.lang.String collectorId)
          Sets he identifier of the Collector associated with this Server
 void setEnvironmentId(int environmentId)
          Sets the identifier of the Environment associated with this Server
 void setError(ServerDBO.Error error)
          Sets the error state of this Server, see ServerDBO.Error for more details
 void setHost(java.lang.String host)
          Sets the hostname of this Server, i.e.: "myhost.domain.tld"
 void setLevel(int level)
          Sets the security level that must be possessed in order to access this Server object
 void setName(java.lang.String name)
          Sets the friendly name of the Server, i.e.: "myFirstBuildServer"
 void setPath(java.lang.String path)
          Sets the Server-local path on which build information will be generated, i.e.: "/builds"
 void setPublish(ServerDBO.Publish publish)
          sets whether gets (.get) and puts (.put) are allowed on this server
 void setTestText(java.lang.String testText)
          Sets the literal text of the results of the last connection test
 void setUpstate(ServerDBO.Upstate upstate)
          Sets the current state of the server with respect to availability - currently one of either updating or ready
 void test()
          Requests that the server test be run.
 ServerDBO.Error test(int timeout)
          Requests that the server test be run and waits the specified time period for the test to complete.
 ServerDBO.Error test(int timeout, int interval)
          Requests that the server test be run and waits the specified time period for the test to complete.
 java.lang.String toString()
           
 Server update()
          Commits all changes to this Server to the database
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TEST_TIMEOUT

public static final int DEFAULT_TEST_TIMEOUT
Default maximum time to wait for a server test to complete. This constant is set to 30000 millis.

See Also:
Constant Field Values

DEFAULT_TEST_INTERVAL

public static final int DEFAULT_TEST_INTERVAL
Default interval to wait between polls while blocking for a server test to complete. This constant is set to 3000 millis.

See Also:
Constant Field Values

CLASS

public static final java.lang.Class<Server> CLASS
Constructor Detail

Server

public Server(APIClientConnection conn)
Method Detail

canGet

public boolean canGet()
Returns whether (true) or not (false) files may be retrieved from this Server via the dot command .get

Returns:

canPut

public boolean canPut()
Returns whether (true) or not (false) files may be placed onto this Server via the dot command .put

Returns:

findAll

public static java.util.List<Server> findAll(APIClientConnection conn)
                                      throws java.io.IOException,
                                             ServiceException
Retrieves all defined Server objects in the database

Parameters:
conn -
Returns:
Throws:
java.io.IOException
ServiceException

findById

public static Server findById(APIClientConnection conn,
                              int serverId)
                       throws java.io.IOException,
                              ServiceException
Retrieves a particular Server by identifier

Parameters:
conn -
serverId -
Returns:
Throws:
java.io.IOException
ServiceException

findByName

public static Server findByName(APIClientConnection conn,
                                java.lang.String serverName)
                         throws java.io.IOException,
                                ServiceException
Retrives a particular Server by name

Parameters:
conn -
serverName -
Returns:
Throws:
java.io.IOException
ServiceException

activate

public void activate()
              throws java.io.IOException,
                     ServiceException
Activates a server.

This convenience method is exactly equivalent to calling activate(true).

Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails

activate

public void activate(boolean active)
              throws java.io.IOException,
                     ServiceException
Activates or deactivates a server. Note that while the setActive(boolean) method requires an explicit call to update(), this method takes effect immediately.

Parameters:
active - true to activate the server, or false to deactivate it.
Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails

create

public Server create()
              throws java.io.IOException,
                     ServiceException
Creates this new Server in the database

Returns:
Throws:
java.io.IOException
ServiceException

update

public Server update()
              throws java.io.IOException,
                     ServiceException
Commits all changes to this Server to the database

Returns:
Throws:
java.io.IOException
ServiceException

delete

public void delete()
            throws java.io.IOException,
                   ServiceException
Removes this Server from the database

Throws:
java.io.IOException
ServiceException

getManifest

public Manifest getManifest()
                     throws java.io.IOException,
                            ServiceException
Retrieves the Manifest for this Server. The Manifest will include all information collected by the Collector associated with this Server.

Returns:
Throws:
java.io.IOException
ServiceException

test

public void test()
          throws java.io.IOException,
                 ServiceException
Requests that the server test be run. This is equivalent to clicking "Test Connection" in the UI.

Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails

test

public ServerDBO.Error test(int timeout)
                     throws java.io.IOException,
                            ServiceException
Requests that the server test be run and waits the specified time period for the test to complete.

This convenience method is exactly equivalent to test(timeout,DEFAULT_TEST_INTERVAL).

Parameters:
timeout - as for test(int,int)
Returns:
the new error state of the server
Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails

test

public ServerDBO.Error test(int timeout,
                            int interval)
                     throws java.io.IOException,
                            ServiceException
Requests that the server test be run and waits the specified time period for the test to complete. to clicking "Test Connection" in the UI.

Parameters:
timeout - the maximum time to wait for the server test to complete. If the specified value is not positive, then DEFAULT_TEST_TIMEOUT is used. If the test has not completed before the timeout expires, then an exception is thrown.
interval - the minimum time to wait between polls. The server test executes asynchronously, and this method must poll to detect when it has finished. The minimum allowed value is 250, and smaller values are treated as if 250 had been specified.
Returns:
the new error state of the server
Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails
APIException - if the timeout limit is reached

refreshManifest

public void refreshManifest()
                     throws java.io.IOException,
                            ServiceException
Requests that the server's manifest be refreshed

Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails

refreshManifest

public Manifest refreshManifest(int timeout)
                         throws java.io.IOException,
                                ServiceException
Requests that the server's manifest be refreshed and waits the specified time period for the refresh to complete.

This convenience method is exactly equivalent to refreshManifest(timeout,DEFAULT_TEST_INTERVAL).

Parameters:
timeout - as for refreshManifest(int,int)
Returns:
the latest Manifest of the Server
Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails
APIException - if the timeout limit is reached

refreshManifest

public Manifest refreshManifest(int timeout,
                                int interval)
                         throws java.io.IOException,
                                ServiceException
Requests that the server's manifest be refreshed and waits the specified time period for the refresh to complete.

Parameters:
timeout - the maximum time to wait for the server test to complete. If the specified value is not positive, then DEFAULT_TEST_TIMEOUT is used. If the test has not completed before the timeout expires, then an exception is thrown.
interval - the minimum time to wait between polls. The server test executes asynchronously, and this method must poll to detect when it has finished. The minimum allowed value is 250, and smaller values are treated as if 250 had been specified.
Returns:
the latest Manifest of the Server
Throws:
java.io.IOException - if an I/O error occurs
ServiceException - if the request fails
APIException - if the timeout limit is reached

getActive

public boolean getActive()
Returns whether this Server is active (true) or inactive (false)


getAuthId

public java.lang.String getAuthId()
Returns the identifier of the ServerAuth authentication object associated with this Server


getCollectorId

public java.lang.String getCollectorId()
Returns the identifier of the Collector associated with this Server


getEnvironmentId

public int getEnvironmentId()
Returns the identifier of the Environment associated with this Server


getError

public ServerDBO.Error getError()
Returns the error state of this Server, see ServerDBO.Error for more details


getHost

public java.lang.String getHost()
Returns the hostname of this Server, i.e.: "myhost.domain.tld"


getLevel

public int getLevel()
Returns the security level that must be possessed in order to access this Server object


getName

public java.lang.String getName()
Returns the friendly name of the Server, i.e.: "myFirstBuildServer"


getPath

public java.lang.String getPath()
Returns the Server-local path on which build information will be generated, i.e.: "/builds"


getPublish

public ServerDBO.Publish getPublish()
Returns whether gets (.get) and puts (.put) are allowed on this server


getServerId

public int getServerId()
Returns the unique identifier of this Server


getTestText

public java.lang.String getTestText()
Returns the literal text of the results of the last connection test


getUpstate

public ServerDBO.Upstate getUpstate()
Returns the current state of the server with respect to availability - currently one of either updating or ready


setActive

public void setActive(boolean active)
Sets whether this Server is active (true) or inactive (false)

Parameters:
active -

setAuthId

public void setAuthId(java.lang.String authId)
Sets the identifier of the ServerAuth authentication object associated with this Server

Parameters:
authId -

setCollectorId

public void setCollectorId(java.lang.String collectorId)
Sets he identifier of the Collector associated with this Server

Parameters:
collectorId -

setEnvironmentId

public void setEnvironmentId(int environmentId)
Sets the identifier of the Environment associated with this Server

Parameters:
environmentId -

setError

public void setError(ServerDBO.Error error)
Sets the error state of this Server, see ServerDBO.Error for more details

Parameters:
error -

setHost

public void setHost(java.lang.String host)
Sets the hostname of this Server, i.e.: "myhost.domain.tld"

Parameters:
host -

setLevel

public void setLevel(int level)
Sets the security level that must be possessed in order to access this Server object

Parameters:
level -

setName

public void setName(java.lang.String name)
Sets the friendly name of the Server, i.e.: "myFirstBuildServer"

Parameters:
name -

setPath

public void setPath(java.lang.String path)
Sets the Server-local path on which build information will be generated, i.e.: "/builds"

Parameters:
path -

setPublish

public void setPublish(ServerDBO.Publish publish)
sets whether gets (.get) and puts (.put) are allowed on this server

Parameters:
publish -

setTestText

public void setTestText(java.lang.String testText)
Sets the literal text of the results of the last connection test

Parameters:
testText -

setUpstate

public void setUpstate(ServerDBO.Upstate upstate)
Sets the current state of the server with respect to availability - currently one of either updating or ready

Parameters:
upstate -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object