edu.UCL.satin.impl.advertising.central.clients.advertising
Class CentralAdvertising

java.lang.Object
  extended byedu.UCL.satin.arch.components.Component
      extended byedu.UCL.satin.impl.advertising.central.clients.advertising.CentralAdvertising
All Implemented Interfaces:
Advertiser, ComponentFacet, Facet

public class CentralAdvertising
extends Component
implements Advertiser

Author:
Stefanos Zachariadis

Field Summary
private  java.util.Vector advertisables
           
private  DebugFacet debug
           
private  boolean enabled
           
private  java.lang.String ip
           
private  LocalHost localhost
           
private  int port
           
private  java.net.Socket socket
           
 
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
CentralAdvertising()
          Creates a new CentralAdvertising component
 
Method Summary
 void addAdvertisable(Advertisable c)
          Adds a new component to be advertised with this Advertiser.
private  void advertise(Advertisable c)
           
private  void advertise(java.util.Vector v)
           
private  void closeSocket()
           
 boolean construct()
          The component constructor.
 java.lang.String getIP()
          Returns the IP of the remote server
 int getPort()
          Returns the port of the remote server
 boolean isEnabled()
          Checks whether this component is enabled or not.
private  void openSocket()
           
 void removeAdvertisable(Advertisable c)
          Removes a new component from the list of components that will be advertised using this advertiser
 void setEnabled(boolean enabled)
          Enables or disables the component
 void setIP(java.lang.String ip)
          Sets the ip address of the remote server.
 void setPort(int port)
          Sets the port of the remote server.
private  void stopAdvertising(Advertisable c)
           
private  void stopAdvertising(java.util.Vector v)
           
 
Methods inherited from class edu.UCL.satin.arch.components.Component
addAttribute, destroy, getAttribute, getProperties, hasAttribute, match, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.UCL.satin.arch.facets.ComponentFacet
addAttribute, destroy, getAttribute, getProperties, hasAttribute
 

Field Detail

advertisables

private java.util.Vector advertisables

enabled

private boolean enabled

ip

private java.lang.String ip

port

private int port

socket

private java.net.Socket socket

debug

private DebugFacet debug

localhost

private LocalHost localhost
Constructor Detail

CentralAdvertising

public CentralAdvertising()
Creates a new CentralAdvertising component

Method Detail

construct

public boolean construct()
Description copied from interface: ComponentFacet
The component constructor. This is where the component should obtain any references to other components/resources it needs.

Specified by:
construct in interface ComponentFacet
Overrides:
construct in class Component

addAdvertisable

public void addAdvertisable(Advertisable c)
Description copied from interface: Advertiser
Adds a new component to be advertised with this Advertiser.

Specified by:
addAdvertisable in interface Advertiser
Parameters:
c - The component to be advertised

advertise

private void advertise(java.util.Vector v)

advertise

private void advertise(Advertisable c)

stopAdvertising

private void stopAdvertising(java.util.Vector v)

stopAdvertising

private void stopAdvertising(Advertisable c)

removeAdvertisable

public void removeAdvertisable(Advertisable c)
Description copied from interface: Advertiser
Removes a new component from the list of components that will be advertised using this advertiser

Specified by:
removeAdvertisable in interface Advertiser
Parameters:
c - The component which will

openSocket

private void openSocket()

closeSocket

private void closeSocket()

isEnabled

public boolean isEnabled()
Description copied from interface: ComponentFacet
Checks whether this component is enabled or not.

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

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: ComponentFacet
Enables or disables the component

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

getIP

public java.lang.String getIP()
Returns the IP of the remote server

Returns:

getPort

public int getPort()
Returns the port of the remote server

Returns:

setIP

public void setIP(java.lang.String ip)
Sets the ip address of the remote server. Note that this will stop advertising, if it's currently expected.

Parameters:
ip -

setPort

public void setPort(int port)
Sets the port of the remote server. Note that this will disable this component if it is enabled

Parameters:
port -