org.gcube.common.core.contexts
Class GHNContext

java.lang.Object
  extended by org.gcube.common.core.contexts.GCUBEContext
      extended by org.gcube.common.core.contexts.GHNContext
Direct Known Subclasses:
GHNClientContext

public class GHNContext
extends GCUBEContext

A specialisation of GCUBEContext for gCube Hosting Nodes (gHNs).

(*) it manages the lifetime of the gHN, from its initialisation to its shutdown and failure. This functionality supports the internal operation of the gHN and remains transparent to most service developers.
(*) it exposes the configuration of the gHN and its hosting environment. This functionality allows service developers to inspect at runtime the environment in which their code is deployed.
(*) it mediates between RIs of deployed services. This functionality supports dynamic discovery of RIs and, while it is generically available to all service developers, it is key for the correct operation of the gHN and distinguished Local Services.

Clients can obtain the single instance of the GHNContext by invoking its static method getContext(). The first invocation of the method triggers the initialisation of the instance.

Author:
Manuele Simi (ISTI-CNR), Fabio Simeoni (University of Strathclyde);

Nested Class Summary
static class GHNContext.Mode
          GHN modes
static class GHNContext.Status
          Enumerates the possible statuses of the GHN.
static class GHNContext.Type
          GHN types
 
Field Summary
static String ALLOWEDSCOPES_JNDI_NAME
          Name of allowedScopes Name JNDI environment.
static String CONFIGDIR_NAME
          Configuration directory name.
static String CONTAINER_STATUS_JNDI_NAME
          Container status system property.
static String COORDINATES_JNDI_NAME
          Name of Coordinates JNDI environment.
static String COUNTRY_JNDI_NAME
          Name of Country JNDI environment.
static String CUSTOMLABELS_JNDI_NAME
          Name of Custom Labels JNDI environment.
static int DEFAULT_TEST_INTERVAL
          Default test interval in seconds
static long DEFAULT_TRUSTEDGHNINTERVAL
          Name of the interval for trusted gHNs synchronization
static long DEFAULT_UPDATE_INTERVAL
          Default update interval in seconds.
static String GCF_VERSION
          current gcf version
static String GHN_CLIENT_JNDI_RESOURCE
          The classpath resource which contains the configuration of the GHN for client use.
static String GHN_JNDI_RESOURCE
          The classpath resource which contains the configuration of the GHN.
static String GHN_TYPE
          Name of GHNType JNDI environment.
static short GHN_UPDATE_ATTEMPTS
          Number of attempts for GHN updates.
protected static Properties implementations
          Properties set with implementations of the interfaces
static String IMPLEMENTATIONS_RESOURCE
          The classpath resource which contains the current implementations of gCF interfaces.
static String INFRASTRUCTURE_NAME
          Name of Coordinates JNDI environment.
static String JNDI_SERVICES_BASE_NAME
          Name of the jndi root for service configurations.
static String LOCATION_JNDI_NAME
          Name of Location JNDI environment.
static String MBEANS_PREFIX
          Prefix for mbeans.
static String MODE_JNDI_NAME
          Name of the Mode startup JNDI environment
static String MSGBROKER
          Name of the MSGBROKER on the ServiceMap.
protected static GCUBEHostingNode node
          The GCUBE Hosting Node resource associated with the context.
static String OPEN_PORTS
          Name of OpenPorts JNDI environment.
static String OVERRIDE_SERVICE_SECURITY
          Name of Override service Security JNDI environment.
static String PROFILE_FILE_NAME
          Name of the file in which the GHN is serialised.
static String PUBLISHED_HOST_NAME
          The name of the host to publish in the local profiles, if different from the container's one
static String PUBLISHED_PORT_NAME
          The name of the port to publish in the local profiles, if different from the container's one
static String SECURITY_JNDI_NAME
          Name of Security JNDI environment.
static int SHUTDOWN_DELAY
          Delay before gHN shutdown
protected static GHNContext singleton
          Singleton context.
static String STARTSCOPES_JNDI_NAME
          Name of startScopes Name JNDI environment.
static String STORAGE_ROOT
          The absolute path to the storage root on the local file system.
static String TESTINTERVAL_JNDI_NAME
          Name of the test interval JNDI environment.
static String TRUSTEDGHNINTERVAL_JNDI_NAME
          Name of the interval for trusted gHNs synchronization
static String UPDATEINTERVAL_JNDI_NAME
          Name of the update interval JNDI environment.
 
Fields inherited from class org.gcube.common.core.contexts.GCUBEContext
logger, timers
 
Constructor Summary
protected GHNContext()
          Creates an instance
 
Method Summary
 Set<GCUBEScope> addScope(GCUBEScope... scopes)
          Adds one or more scopes to the GHN.
protected  void configureGHN(File file)
          Used internally to load external configuration.
protected  void configureGHNResource()
          Used internally to configure the GCUBEHostingNode resource that models the local gHN.
 void delegateCredentials(GCUBEServiceContext context, GSSCredential credentials)
          Delegates credentials to a service.
 GCUBEScope[] getAllowedScopes()
          Returns the allowed scopes of the GHN.
 String getBaseURL()
          Returns the base endpoint of the gHN.
 String getBaseURLToPublish()
          Returns the base endpoint of the gHN.
static GHNContext getContext()
          Returns a context instance.
 ArrayList<HashMap<String,String>> getCPUInfo()
          Returns information about the processors underlying of the gHN.
 List<String> getDeployedPortTypes()
          Returns the names of the port-types of the gCube services deployed in the GHN.
 File getFile(String fileName, boolean... writeMode)
          Gives read or write access to a File.
 Integer getFreePort()
          Returns the number of the first free port on the gHN in the range specified in the GHN configuration (openPorts) or, if no such range exist, in the range 60000-65000;
 long getFreeSpace(String localFS)
          Returns the amount of free space on a partition of the underlying file system.
 GCUBEHostingNode getGHN()
          Sets the GCUBE Hosting Node resource associated with the context.
 String getGHNID()
          Returns the GHN identifier.
 String getHostDomain()
          Returns the host domain of the gHN.
 String getHostname()
          Returns the hostname of the gHN.
 String getHostnameAndPort()
          Returns the hostname and port of the gHN.
static
<INTERFACE>
INTERFACE
getImplementation(Class<INTERFACE> interfaceClass)
          Returns an implementation for a gCF interface.
 String getIP()
          Returns the IP address.
 Map<String,Double> getLoadStatistics()
          Returns load statistics for the gHN.
 LocalInstanceContext getLocalInstanceContext()
           
 String getLocation()
          Returns the installation folder of the gHN.
 GHN getManagementBean()
          Return the management bean of the GHN.
 Map<String,Long> getMemoryUsage()
          Returns virtual memory statistics.
 GHNContext.Mode getMode()
          Gets the GHN mode.
 int getPort()
          Returns the port of the gHN.
 String getPublishedHostDomain()
          Returns the host domain of the gHN.
 String getPublishedHostname()
          Returns the hostname of the gHN.
 String getPublishedHostnameAndPort()
          Returns the hostname and port of the gHN to publish.
 int getPublishedPort()
          Returns the port of the gHN.
 InputStream getResource(String resourceName)
          Returns a classpath resource given its path.
 GCUBEServiceContext getServiceContext(String serviceClass, String serviceName)
          Returns the context of a registered service from its class and name.
 Set<GCUBEServiceContext> getServiceContexts()
          Returns all the registered service contexts (no matter about which status they have)
 String getServiceEndpointPrefix()
          Returns the prefix to the relative endpoint of services.
 GCUBEScope[] getStartScopes()
          Returns the start scopes of the GHN.
 GHNContext.Status getStatus()
          Returns the current status of the GHN.
 String getStatusMessage()
          Returns the message associated to the current status of the GHN.
 String getStorageRoot()
          Returns the absolute path to the storage root folder on local the file system.
 long getTrustedGHNSynchInterval()
          Returns the synchronization interval for the local list of trusted gHNs
 GHNContext.Type getType()
          Returns the GHN type.
 String getUptime()
          Returns the length of time since the underlying machine.
 String getVirtualPlatformsLocation()
          Returns the virtual platforms folder of the gHN.
protected  void initialise()
          Used internally to initialise the context at class loading time.
 boolean isClientMode()
          Indicates whether the context is running within a container or else in client mode.
 boolean isGHNReady()
          Checks if the GHN has completed the startup procedure.
 boolean isSecurityEnabled()
          Indicates whether the GHN is operating in a secure infrastructure.
 boolean overrideServiceSecurity()
          Indicates whether the GHN security status must override the security status of the services.
 void registerService(GCUBEServiceContext context)
          Registers a service context in the current node.
 Set<GCUBEScope> removeScope(GCUBEScope... scopes)
          Removes one or more scopes from the GHN.
 void restart(String... message)
          Restarts the gHN.
 void restartAndClean(String... message)
           
 void setMode(GHNContext.Mode mode)
          Sets the GHN mode.
 void setStatus(GHNContext.Status newStatus, String... message)
          Sets the current status of the GHN.
 void shutdown(String... message)
          Shuts down the gHN.
 void subscribeForCredential(CredentialConsumer consumer)
          Subscribes a consumer to CredentialDelegationEvents.
 void subscribeForCredentialRequest(CredentialRequestConsumer consumer)
          Subscribes a consumer to CredentialRequestEvents.
 void subscribeGHNEvents(GHNConsumer consumer, Events.GHNTopic... topics)
          Subscribes a consumer to one or more GHNTopics.
 void unsubscribeGHNEvents(GHNConsumer consumer, Events.GHNTopic... topics)
          Unsubscribe a consumer to one or more GHNTopics.
 
Methods inherited from class org.gcube.common.core.contexts.GCUBEContext
debugContext, getJNDIContext, getName, getProperty, getTiming, printContext, resetTimer, setJNDIContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GCF_VERSION

public static final String GCF_VERSION
current gcf version

See Also:
Constant Field Values

CUSTOMLABELS_JNDI_NAME

public static final String CUSTOMLABELS_JNDI_NAME
Name of Custom Labels JNDI environment.

See Also:
Constant Field Values

COORDINATES_JNDI_NAME

public static final String COORDINATES_JNDI_NAME
Name of Coordinates JNDI environment.

See Also:
Constant Field Values

COUNTRY_JNDI_NAME

public static final String COUNTRY_JNDI_NAME
Name of Country JNDI environment.

See Also:
Constant Field Values

LOCATION_JNDI_NAME

public static final String LOCATION_JNDI_NAME
Name of Location JNDI environment.

See Also:
Constant Field Values

SECURITY_JNDI_NAME

public static final String SECURITY_JNDI_NAME
Name of Security JNDI environment.

See Also:
Constant Field Values

OVERRIDE_SERVICE_SECURITY

public static final String OVERRIDE_SERVICE_SECURITY
Name of Override service Security JNDI environment.

See Also:
Constant Field Values

STARTSCOPES_JNDI_NAME

public static final String STARTSCOPES_JNDI_NAME
Name of startScopes Name JNDI environment.

See Also:
Constant Field Values

ALLOWEDSCOPES_JNDI_NAME

public static final String ALLOWEDSCOPES_JNDI_NAME
Name of allowedScopes Name JNDI environment.

See Also:
Constant Field Values

INFRASTRUCTURE_NAME

public static final String INFRASTRUCTURE_NAME
Name of Coordinates JNDI environment.

See Also:
Constant Field Values

MODE_JNDI_NAME

public static final String MODE_JNDI_NAME
Name of the Mode startup JNDI environment

See Also:
Constant Field Values

PUBLISHED_HOST_NAME

public static final String PUBLISHED_HOST_NAME
The name of the host to publish in the local profiles, if different from the container's one

See Also:
Constant Field Values

PUBLISHED_PORT_NAME

public static final String PUBLISHED_PORT_NAME
The name of the port to publish in the local profiles, if different from the container's one

See Also:
Constant Field Values

GHN_TYPE

public static final String GHN_TYPE
Name of GHNType JNDI environment.

See Also:
Constant Field Values

OPEN_PORTS

public static final String OPEN_PORTS
Name of OpenPorts JNDI environment.

See Also:
Constant Field Values

CONTAINER_STATUS_JNDI_NAME

public static final String CONTAINER_STATUS_JNDI_NAME
Container status system property.

See Also:
Constant Field Values

CONFIGDIR_NAME

public static final String CONFIGDIR_NAME
Configuration directory name.

See Also:
Constant Field Values

PROFILE_FILE_NAME

public static final String PROFILE_FILE_NAME
Name of the file in which the GHN is serialised.

See Also:
Constant Field Values

IMPLEMENTATIONS_RESOURCE

public static final String IMPLEMENTATIONS_RESOURCE
The classpath resource which contains the current implementations of gCF interfaces.

See Also:
Constant Field Values

GHN_JNDI_RESOURCE

public static final String GHN_JNDI_RESOURCE
The classpath resource which contains the configuration of the GHN.

See Also:
Constant Field Values

GHN_CLIENT_JNDI_RESOURCE

public static final String GHN_CLIENT_JNDI_RESOURCE
The classpath resource which contains the configuration of the GHN for client use.

See Also:
Constant Field Values

GHN_UPDATE_ATTEMPTS

public static final short GHN_UPDATE_ATTEMPTS
Number of attempts for GHN updates.

See Also:
Constant Field Values

UPDATEINTERVAL_JNDI_NAME

public static final String UPDATEINTERVAL_JNDI_NAME
Name of the update interval JNDI environment.

See Also:
Constant Field Values

DEFAULT_UPDATE_INTERVAL

public static final long DEFAULT_UPDATE_INTERVAL
Default update interval in seconds.

See Also:
Constant Field Values

TRUSTEDGHNINTERVAL_JNDI_NAME

public static final String TRUSTEDGHNINTERVAL_JNDI_NAME
Name of the interval for trusted gHNs synchronization

See Also:
Constant Field Values

DEFAULT_TRUSTEDGHNINTERVAL

public static final long DEFAULT_TRUSTEDGHNINTERVAL
Name of the interval for trusted gHNs synchronization

See Also:
Constant Field Values

SHUTDOWN_DELAY

public static final int SHUTDOWN_DELAY
Delay before gHN shutdown

See Also:
Constant Field Values

STORAGE_ROOT

public static final String STORAGE_ROOT
The absolute path to the storage root on the local file system.


MBEANS_PREFIX

public static final String MBEANS_PREFIX
Prefix for mbeans.

See Also:
Constant Field Values

DEFAULT_TEST_INTERVAL

public static final int DEFAULT_TEST_INTERVAL
Default test interval in seconds

See Also:
Constant Field Values

TESTINTERVAL_JNDI_NAME

public static final String TESTINTERVAL_JNDI_NAME
Name of the test interval JNDI environment.

See Also:
Constant Field Values

MSGBROKER

public static final String MSGBROKER
Name of the MSGBROKER on the ServiceMap.

See Also:
Constant Field Values

JNDI_SERVICES_BASE_NAME

public static final String JNDI_SERVICES_BASE_NAME
Name of the jndi root for service configurations.

See Also:
Constant Field Values

implementations

protected static Properties implementations
Properties set with implementations of the interfaces


singleton

protected static GHNContext singleton
Singleton context.


node

protected static GCUBEHostingNode node
The GCUBE Hosting Node resource associated with the context.

Constructor Detail

GHNContext

protected GHNContext()
Creates an instance

Method Detail

getContext

public static GHNContext getContext()
Returns a context instance.

Returns:
the instance.

initialise

protected void initialise()
                   throws Exception
Used internally to initialise the context at class loading time.

Throws:
Exception - if the context could not be initialised.

isClientMode

public boolean isClientMode()
Indicates whether the context is running within a container or else in client mode.

Returns:
true if the context is running in client mode, false otherwise

configureGHN

protected void configureGHN(File file)
                     throws Exception
Used internally to load external configuration.

Parameters:
file - the configuration file.
Throws:
Exception - if it could not load external configuration

configureGHNResource

protected void configureGHNResource()
                             throws Exception
Used internally to configure the GCUBEHostingNode resource that models the local gHN.

Throws:
Exception - if the resource could not be configured

setStatus

public void setStatus(GHNContext.Status newStatus,
                      String... message)
               throws IllegalStateException
Sets the current status of the GHN.

Parameters:
newStatus - the status.
message - message associated to the status
Throws:
IllegalStateException - if the transition from the current to the new status is illegal.

getStatus

public GHNContext.Status getStatus()
Returns the current status of the GHN.

Returns:
the status.

getStatusMessage

public String getStatusMessage()
Returns the message associated to the current status of the GHN.

Returns:
the status message.

restart

public void restart(String... message)
Restarts the gHN.


restartAndClean

public void restartAndClean(String... message)

shutdown

public void shutdown(String... message)
Shuts down the gHN.


registerService

public void registerService(GCUBEServiceContext context)
                     throws Exception
Registers a service context in the current node.

Parameters:
context - the context.
Throws:
Exception - if the service is already registered or the registration could not be completed.
IllegalStateException - if the container is down.

getServiceContext

public GCUBEServiceContext getServiceContext(String serviceClass,
                                             String serviceName)
                                      throws Exception
Returns the context of a registered service from its class and name.

Parameters:
serviceClass - the service class.
serviceName - the service name.
Returns:
the service context.
Throws:
Exception - if the service is not registered.
IllegalStateException - if the gHN is down.

getServiceContexts

public Set<GCUBEServiceContext> getServiceContexts()
                                            throws Exception
Returns all the registered service contexts (no matter about which status they have)

Returns:
the Set of all service contexts
Throws:
Exception - if there is no service registered.
IllegalStateException - if the gHN is down.

subscribeGHNEvents

public void subscribeGHNEvents(GHNConsumer consumer,
                               Events.GHNTopic... topics)
                        throws Exception
Subscribes a consumer to one or more GHNTopics.

Parameters:
consumer - the consumer.
topics - the topics of interest.
Throws:
Exception - if the subscription could not be completed.

unsubscribeGHNEvents

public void unsubscribeGHNEvents(GHNConsumer consumer,
                                 Events.GHNTopic... topics)
Unsubscribe a consumer to one or more GHNTopics.

Parameters:
consumer - the consumer.
topics - the topics.

isSecurityEnabled

public boolean isSecurityEnabled()
Indicates whether the GHN is operating in a secure infrastructure.

Returns:
true if its is, false otherwise.

overrideServiceSecurity

public boolean overrideServiceSecurity()
Indicates whether the GHN security status must override the security status of the services.

Returns:
true if its is, false otherwise.

subscribeForCredentialRequest

public void subscribeForCredentialRequest(CredentialRequestConsumer consumer)
                                   throws Exception
Subscribes a consumer to CredentialRequestEvents.

Parameters:
consumer - the consumer.
Throws:
Exception - if the subscription could not be completed.

subscribeForCredential

public void subscribeForCredential(CredentialConsumer consumer)
                            throws Exception
Subscribes a consumer to CredentialDelegationEvents.

Parameters:
consumer - the consumer.
Throws:
Exception - if the subscription could not be completed.

delegateCredentials

public void delegateCredentials(GCUBEServiceContext context,
                                GSSCredential credentials)
Delegates credentials to a service.

Parameters:
context - the service context.
credentials - the credentials.

addScope

public Set<GCUBEScope> addScope(GCUBEScope... scopes)
                         throws GCUBEResource.InvalidScopeException
Adds one or more scopes to the GHN.

Parameters:
scopes - the scopes.
Returns:
the list of scopes actually added to the GHN.
Throws:
GCUBEResource.InvalidScopeException

removeScope

public Set<GCUBEScope> removeScope(GCUBEScope... scopes)
Removes one or more scopes from the GHN. Only scopes currently associated with the instance are actually removed.


getImplementation

public static <INTERFACE> INTERFACE getImplementation(Class<INTERFACE> interfaceClass)
                                   throws Exception
Returns an implementation for a gCF interface. The implementation class is configured in the classpath resource implementations.property found in the GHN's configuration folder.

Type Parameters:
INTERFACE - the interface.
Parameters:
interfaceClass - the Class of the interface.
Returns:
the implementation, or null if an implementation could not be found.
Throws:
Exception - if the implementation is not compatible with the interface or could not be instantiated.

getFile

public File getFile(String fileName,
                    boolean... writeMode)
             throws IllegalArgumentException
Gives read or write access to a File. Write access induces backups and read access relies on backups to recover from failures.

Overrides:
getFile in class GCUBEContext
Parameters:
fileName - the file path.
writeMode - (optional) the access mode, true for write access and false for read access (default).
Returns:
the file.
Throws:
IllegalArgumentException - if access is in write mode and the path is to a folder.

getResource

public InputStream getResource(String resourceName)
Returns a classpath resource given its path. By default, a relative path is resolved with respect to the context implementation.

Overrides:
getResource in class GCUBEContext
Returns:
the resource, or null if the path could not be resolved.

getGHNID

public String getGHNID()
Returns the GHN identifier.

Returns:
the identifier.

isGHNReady

public boolean isGHNReady()
Checks if the GHN has completed the startup procedure.

Returns:
true if the GHN is started, false otherwise.

getManagementBean

public GHN getManagementBean()
Return the management bean of the GHN.

Returns:
the bean.

getGHN

public GCUBEHostingNode getGHN()
Sets the GCUBE Hosting Node resource associated with the context.

Returns:
the resource

getMode

public GHNContext.Mode getMode()
Gets the GHN mode.

Returns:
the mode.

getType

public GHNContext.Type getType()
Returns the GHN type.

Returns:
the type.

setMode

public void setMode(GHNContext.Mode mode)
Sets the GHN mode.

Parameters:
mode - the new mode.

getFreePort

public Integer getFreePort()
                    throws RuntimeException,
                           Exception
Returns the number of the first free port on the gHN in the range specified in the GHN configuration (openPorts) or, if no such range exist, in the range 60000-65000;

Returns:
the port number.
Throws:
Exception - if no free port could be found.
RuntimeException - if no free port-configuration was found.

getDeployedPortTypes

public List<String> getDeployedPortTypes()
                                  throws Exception,
                                         IllegalStateException
Returns the names of the port-types of the gCube services deployed in the GHN.

Returns:
the names.
Throws:
Exception - if the names could not be returned.
IllegalStateException - if the query fails

getStartScopes

public GCUBEScope[] getStartScopes()
Returns the start scopes of the GHN.

Returns:
the start scopes.

getAllowedScopes

public GCUBEScope[] getAllowedScopes()
Returns the allowed scopes of the GHN.

Returns:
the allowed scopes.

getTrustedGHNSynchInterval

public long getTrustedGHNSynchInterval()
Returns the synchronization interval for the local list of trusted gHNs

Returns:
the synchronization interval for the local list of trusted gHNs

getLocation

public String getLocation()
Returns the installation folder of the gHN.

Returns:
the installation folder.

getVirtualPlatformsLocation

public String getVirtualPlatformsLocation()
Returns the virtual platforms folder of the gHN.

Returns:
the folder where local virtual platforms are deployed

getBaseURL

public String getBaseURL()
                  throws IOException
Returns the base endpoint of the gHN.

Returns:
the endpoint in the form host:port.
Throws:
IOException - if the endpoint could not be identified.

getBaseURLToPublish

public String getBaseURLToPublish()
                           throws IOException
Returns the base endpoint of the gHN.

Returns:
the endpoint in the form host:port.
Throws:
IOException - if the endpoint could not be identified.

getPublishedPort

public int getPublishedPort()
Returns the port of the gHN.

Returns:
the port.

getPort

public int getPort()
Returns the port of the gHN.

Returns:
the port.

getPublishedHostname

public String getPublishedHostname()
Returns the hostname of the gHN.

Returns:
the hostname.
Throws:
IOException - if the hostname could not be returned.

getLocalInstanceContext

public LocalInstanceContext getLocalInstanceContext()

getHostname

public String getHostname()
Returns the hostname of the gHN.

Returns:
the hostname.
Throws:
IOException - if the hostname could not be returned.

getServiceEndpointPrefix

public String getServiceEndpointPrefix()
Returns the prefix to the relative endpoint of services.

Returns:
the prefix.

getStorageRoot

public String getStorageRoot()
Returns the absolute path to the storage root folder on local the file system.

Returns:
the path.

getFreeSpace

public long getFreeSpace(String localFS)
Returns the amount of free space on a partition of the underlying file system.

Parameters:
localFS - the partition name.
Returns:
the free available space in bytes in a String format

getUptime

public String getUptime()
Returns the length of time since the underlying machine.

Returns:
the uptime of the machine.

getMemoryUsage

public Map<String,Long> getMemoryUsage()
Returns virtual memory statistics.

Returns:
a map with the following keys:
  • "ramVirtualAvailable"
  • "ramVirtualSize"

getCPUInfo

public ArrayList<HashMap<String,String>> getCPUInfo()
Returns information about the processors underlying of the gHN.

Returns:
a list of processor-specific maps with the following keys:
  • "vendor_id"
  • "cpu_family"
  • "model"
  • "model_name"
  • "cpu_MHz"
  • "cache_size"
  • "bogomips"

getLoadStatistics

public Map<String,Double> getLoadStatistics()
Returns load statistics for the gHN.

Returns:
a map with the following keys:
  • 1min: report the load of the last minute
  • 5mins: report the load of the last 5 minutes
  • 15mins: report the load of the last 1S5 minutes

getIP

public String getIP()
Returns the IP address.

Returns:
the address.

getHostnameAndPort

public String getHostnameAndPort()
Returns the hostname and port of the gHN.

Returns:
a string with the format hostname:port.

getPublishedHostnameAndPort

public String getPublishedHostnameAndPort()
Returns the hostname and port of the gHN to publish. These could be different from the effective ones when a proxy or dispatcher is dedicated to manage incoming calls

Returns:
a string with the format hostname:port.

getHostDomain

public String getHostDomain()
                     throws IOException
Returns the host domain of the gHN.

Returns:
the host domain.
Throws:
IOException - if the host domain could not identified.

getPublishedHostDomain

public String getPublishedHostDomain()
                              throws IOException
Returns the host domain of the gHN.

Returns:
the host domain.
Throws:
IOException - if the host domain could not identified.


Copyright © 2012. All Rights Reserved.