com.pmease.quickbuild.grid
Class GridNode

java.lang.Object
  extended by com.pmease.quickbuild.grid.GridNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<GridNode>

public class GridNode
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<GridNode>

See Also:
Serialized Form

Field Summary
static java.lang.String SYSTEM_ATTRIBUTES
           
static java.lang.String USER_ATTRIBUTES
           
 
Constructor Summary
GridNode(java.util.UUID id, java.lang.String ip, int port, boolean overSSL)
           
 
Method Summary
 void cleanDir(java.lang.String dir)
           
 void clearResources()
           
 int compareTo(GridNode o)
           
 void createDir(java.lang.String dir)
           
 void deleteDir(java.lang.String dir)
           
 void deleteFile(java.lang.String file)
           
 boolean equals(java.lang.Object other)
           
 java.io.Serializable executeJob(java.lang.Class<? extends NodeJob> jobClass, java.io.Serializable... params)
          Execute specified job with specified parameters on this node.
 java.lang.String getAddress()
          Get address of this node
 java.lang.String getAttribute(java.lang.String name)
           
 java.lang.String getAttribute(java.lang.String name, java.lang.String defaultValue)
           
 long getBenchmark()
           
 NodeCharacteristics getCharacteristics()
           
 CloudProfile getCloudProfile()
           
 java.lang.String getFileTransferUrl()
           
 java.lang.String getHostName()
           
 java.util.UUID getId()
           
 java.lang.String getIp()
           
 java.util.Date getLastJobDate()
           
 java.util.Date getLastPulse()
           
 java.lang.String getLaunchId()
           
 NodeService getNodeService()
          Get node service with specified read timeout.
 int getPort()
           
 java.util.Map<java.lang.String,java.lang.Integer> getReservedResources()
          Should only be used in build engine
 java.lang.Object getResource(java.lang.String name)
           
 java.lang.Object getResource(java.lang.String name, java.lang.Object defaultResource)
           
 java.util.Map<java.lang.String,java.lang.Integer> getResources()
          Should only be used in build engine
 int getStepCount()
          Should only be used in build engine
 java.util.Map<java.lang.String,java.lang.String> getSystemAttributes()
          Get map of all system attributes.
 java.lang.String getToken()
           
 java.lang.String getUrl()
           
 User getUser()
           
 java.util.Map<java.lang.String,java.lang.String> getUserAttributes()
           
 java.lang.Long getUserId()
           
 WorkspaceBrowser getWorkspaceBrowser(Configuration configuration)
           
 java.lang.String getWorkspaceDir(java.lang.Long configurationId)
           
 java.util.Map<java.lang.Long,java.lang.String> getWorkspaceUsages()
          Should only be used in build engine
 boolean hasAttribute(java.lang.String name)
          Whether or not specified attribute is defined.
 int hashCode()
           
 boolean hasResource(java.lang.String resource)
          Should only be used in build engine
 boolean isAgent()
           
 boolean isAttributeEmpty(java.lang.String name)
           
 boolean isBuildAgent()
           
 boolean isFileExists(java.lang.String path)
           
 boolean isLocal()
          Whether or not this is local node.
 boolean isOverSSL()
           
 boolean isResourceChecked()
           
 boolean isServer()
           
 boolean isUserAgent()
           
 void loadUserAttributes()
           
 long predictLoad()
           
 void removeResource(java.lang.String name)
           
 void saveUserAttributes()
           
 void setBenchmark(long benchmark)
           
 void setCharacteristics(NodeCharacteristics characteristic)
           
 void setCloudProfile(CloudProfile cloudProfile)
           
 void setHostName(java.lang.String hostName)
           
 void setId(java.util.UUID id)
           
 void setIsServer(boolean isServer)
           
 void setLastJobDate(java.util.Date lastJobDate)
           
 void setLastPulse(java.util.Date lastPulse)
           
 void setLaunchId(java.lang.String launchId)
           
 void setOverSSL(boolean overSSL)
           
 void setResource(java.lang.String name, java.lang.Object resource)
           
 void setResourceChecked(boolean resourceChecked)
           
 void setStepCount(int stepCount)
           
 void setSystemAttributes(java.util.Map<java.lang.String,java.lang.String> systemAttributes)
           
 void setToken(java.lang.String token)
           
 void setUserAttributes(java.util.Map<java.lang.String,java.lang.String> userAttributes, boolean persist)
           
 void setUserId(java.lang.Long userId)
           
 void takeReservedResources()
          Should only be used in build engine
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM_ATTRIBUTES

public static final java.lang.String SYSTEM_ATTRIBUTES
See Also:
Constant Field Values

USER_ATTRIBUTES

public static final java.lang.String USER_ATTRIBUTES
See Also:
Constant Field Values
Constructor Detail

GridNode

public GridNode(java.util.UUID id,
                java.lang.String ip,
                int port,
                boolean overSSL)
Method Detail

setSystemAttributes

public void setSystemAttributes(java.util.Map<java.lang.String,java.lang.String> systemAttributes)

setUserAttributes

public void setUserAttributes(java.util.Map<java.lang.String,java.lang.String> userAttributes,
                              boolean persist)
Set user attributes via map. The second param indicates whether or not to save persist user attributes (save to file "attributes.properties"). Please note that this will only take effect when calling from server side.


getNodeService

public NodeService getNodeService()
Get node service with specified read timeout.

Returns:

getUrl

public java.lang.String getUrl()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

getId

public java.util.UUID getId()

setId

public void setId(java.util.UUID id)

getIp

public java.lang.String getIp()
Get IP address of this node.


getPort

public int getPort()
Get port number of this node.


isOverSSL

public boolean isOverSSL()
Is over SSL?


setOverSSL

public void setOverSSL(boolean overSSL)

getHostName

public java.lang.String getHostName()
Get host name of this node.


setHostName

public void setHostName(java.lang.String hostName)

getLastPulse

public java.util.Date getLastPulse()

setLastPulse

public void setLastPulse(java.util.Date lastPulse)

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Get attribute of specified name in user and system attributes. This method first examines the user attributes to see if specified attribute exists. If exists, the attribute value will be returned; otherwise, the system attributes will be examined. If both sources do not contain specified attribute, a null value will be returned.


getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String defaultValue)
The same as getAttribute(name), but the second param provides a default value if the attribute can not be found.


isAttributeEmpty

public boolean isAttributeEmpty(java.lang.String name)
Whether or not the attribute is empty. An attribute is empty if it is defined with an empty value.


hasAttribute

public boolean hasAttribute(java.lang.String name)
Whether or not specified attribute is defined.

Parameters:
name -

getSystemAttributes

public java.util.Map<java.lang.String,java.lang.String> getSystemAttributes()
Get map of all system attributes.


getUserAttributes

public java.util.Map<java.lang.String,java.lang.String> getUserAttributes()
Get all user attributes in map.


getResource

public java.lang.Object getResource(java.lang.String name)
Get node resource of specified name. Null will returned if resource of the name is not found.


removeResource

public void removeResource(java.lang.String name)
Remove specified node resource.


clearResources

public void clearResources()
Clear all node resources.


setResource

public void setResource(java.lang.String name,
                        java.lang.Object resource)
Set node resource. The first param represents name of the resource, and the second param represents the actual resource.


getResource

public java.lang.Object getResource(java.lang.String name,
                                    java.lang.Object defaultResource)
Get node resource of specified name (the first param). If resource is not found, the specified default resource (the second param) will be associated with the name.


getWorkspaceDir

public java.lang.String getWorkspaceDir(java.lang.Long configurationId)
Get workspace directory path of specified configuration.


createDir

public void createDir(java.lang.String dir)

deleteDir

public void deleteDir(java.lang.String dir)

deleteFile

public void deleteFile(java.lang.String file)

cleanDir

public void cleanDir(java.lang.String dir)

getFileTransferUrl

public java.lang.String getFileTransferUrl()

isFileExists

public boolean isFileExists(java.lang.String path)

setIsServer

public void setIsServer(boolean isServer)

isServer

public boolean isServer()
Whether or not this is a server node.


isAgent

public boolean isAgent()
Whether or not this is an agent node.


isUserAgent

public boolean isUserAgent()
Whether or not this is an user agent node.


isBuildAgent

public boolean isBuildAgent()
Whether or not this is a build agent node.


getUser

public User getUser()
Get associated user if the node is an user agent node; otherwise, null will be returned.


setUserId

public void setUserId(java.lang.Long userId)

getUserId

public java.lang.Long getUserId()

isLocal

public boolean isLocal()
Whether or not this is local node.


getBenchmark

public long getBenchmark()
Get benchmark of this node.


setBenchmark

public void setBenchmark(long benchmark)

predictLoad

public long predictLoad()

getAddress

public java.lang.String getAddress()
Get address of this node


loadUserAttributes

public void loadUserAttributes()

saveUserAttributes

public void saveUserAttributes()

executeJob

public java.io.Serializable executeJob(java.lang.Class<? extends NodeJob> jobClass,
                                       java.io.Serializable... params)
Execute specified job with specified parameters on this node.

Parameters:
jobClass -
params -
Returns:

getWorkspaceBrowser

public WorkspaceBrowser getWorkspaceBrowser(Configuration configuration)

getResources

public java.util.Map<java.lang.String,java.lang.Integer> getResources()
Should only be used in build engine

Returns:

getReservedResources

public java.util.Map<java.lang.String,java.lang.Integer> getReservedResources()
Should only be used in build engine

Returns:

hasResource

public boolean hasResource(java.lang.String resource)
Should only be used in build engine

Parameters:
resource -
Returns:

takeReservedResources

public void takeReservedResources()
Should only be used in build engine

Parameters:
resource -

getStepCount

public int getStepCount()
Should only be used in build engine

Returns:

setStepCount

public void setStepCount(int stepCount)

getWorkspaceUsages

public java.util.Map<java.lang.Long,java.lang.String> getWorkspaceUsages()
Should only be used in build engine

Parameters:
resource -
Returns:

getToken

public java.lang.String getToken()

setToken

public void setToken(java.lang.String token)

isResourceChecked

public boolean isResourceChecked()

setResourceChecked

public void setResourceChecked(boolean resourceChecked)

compareTo

public int compareTo(GridNode o)
Specified by:
compareTo in interface java.lang.Comparable<GridNode>

getLastJobDate

public java.util.Date getLastJobDate()

setLastJobDate

public void setLastJobDate(java.util.Date lastJobDate)

getCloudProfile

public CloudProfile getCloudProfile()

setCloudProfile

public void setCloudProfile(CloudProfile cloudProfile)

getLaunchId

public java.lang.String getLaunchId()

setLaunchId

public void setLaunchId(java.lang.String launchId)

getCharacteristics

public NodeCharacteristics getCharacteristics()

setCharacteristics

public void setCharacteristics(NodeCharacteristics characteristic)


Copyright © 2005-2010 PMEase Inc. All Rights Reserved.