edu.UCL.satin.impl.localhost
Class SimpleLocalHost

java.lang.Object
  extended byedu.UCL.satin.arch.components.Component
      extended byedu.UCL.satin.impl.localhost.SimpleLocalHost
All Implemented Interfaces:
ComponentFacet, ComponentListener, Facet, HasLocation, LocalHost

public class SimpleLocalHost
extends Component
implements LocalHost, ComponentListener, HasLocation

SimpleLocalHost is an extremely simple LocalHost implementation. It uses a random integer to denote the host identity. The ID of this component is STN:RANDOMHOSTID It automatically attaches itself to any advertiser. It also stores a series of ip addresses for the local host, separated by commas

Author:
Stefanos Zachariadis

Field Summary
private  java.lang.String address
           
private  java.lang.String id
           
private  Location ip
           
 
Fields inherited from class edu.UCL.satin.arch.components.Component
immutable, properties
 
Fields inherited from interface edu.UCL.satin.arch.facets.ComponentFacet
DISABLED, ENABLED
 
Constructor Summary
SimpleLocalHost()
          Creates a new Host Identification component
 
Method Summary
 void componentFound(Component c)
          This method is called by a Discovery service if a new component that matches a given query is found.
 java.lang.String getHostID()
           
 Location getLocation()
           
 java.lang.Object getMessage()
           
 boolean isEnabled()
          Returns whether this component is enabled/active or not.
 void setAddress(java.lang.String address)
           
 void setEnabled(boolean b)
          Activates or deactivates this component (if applicable).
 
Methods inherited from class edu.UCL.satin.arch.components.Component
addAttribute, construct, destroy, getAttribute, getProperties, hasAttribute, match, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private final java.lang.String id

address

private java.lang.String address

ip

private Location ip
Constructor Detail

SimpleLocalHost

public SimpleLocalHost()
Creates a new Host Identification component

Method Detail

isEnabled

public boolean isEnabled()
Description copied from class: Component
Returns whether this component is enabled/active or not. Note that unless overloaded, the component is assumed to always be enabled

Specified by:
isEnabled in interface ComponentFacet
Overrides:
isEnabled in class Component
Returns:

setEnabled

public void setEnabled(boolean b)
Description copied from class: Component
Activates or deactivates this component (if applicable). Note that unless overloaded, the component is assumed to always be enabled.

Specified by:
setEnabled in interface ComponentFacet
Overrides:
setEnabled in class Component
Parameters:
b -

getHostID

public java.lang.String getHostID()
Specified by:
getHostID in interface LocalHost
Returns:
the host's identifier

getMessage

public java.lang.Object getMessage()

setAddress

public void setAddress(java.lang.String address)

componentFound

public void componentFound(Component c)
Description copied from interface: ComponentListener
This method is called by a Discovery service if a new component that matches a given query is found.

Specified by:
componentFound in interface ComponentListener
Parameters:
c - The component found

getLocation

public Location getLocation()
Specified by:
getLocation in interface HasLocation