edu.UCL.satin.impl.advertising.central.server
Class AdvertisingServer

java.lang.Object
  extended byedu.UCL.satin.arch.components.Component
      extended byedu.UCL.satin.impl.advertising.central.server.AdvertisingServer
All Implemented Interfaces:
Advertisable, ComponentFacet, Facet, java.lang.Runnable

public class AdvertisingServer
extends Component
implements java.lang.Runnable, Advertisable

Author:
Stefanos Zachariadis

Field Summary
static int _PORT
           
private  boolean active
           
private  java.util.Vector components
           
private  DebugFacet debug
           
private  java.net.ServerSocket querySocket
           
private  boolean running
           
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
AdvertisingServer()
          Creates a new Advertigsing server
 
Method Summary
 java.util.Vector getComponents()
          Returns the list of components that this server has
 java.lang.Object getMessage()
          Returns the message that will be used to advertise this component
 int getPort()
          Returns the port that this advertising server is listening to
private  boolean isActive()
           
 boolean isEnabled()
          Returns whether this component is enabled/active or not.
 void run()
           
 void setEnabled(boolean enable)
          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

components

private java.util.Vector components

querySocket

private java.net.ServerSocket querySocket

socket

private java.net.Socket socket

_PORT

public static final int _PORT
See Also:
Constant Field Values

running

private boolean running

debug

private DebugFacet debug

active

private boolean active
Constructor Detail

AdvertisingServer

public AdvertisingServer()
Creates a new Advertigsing server

Method Detail

getMessage

public java.lang.Object getMessage()
Description copied from interface: Advertisable
Returns the message that will be used to advertise this component

Specified by:
getMessage in interface Advertisable
Returns:
The message that will be used to advertise this component

run

public void run()
Specified by:
run in interface java.lang.Runnable

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:

isActive

private boolean isActive()

setEnabled

public void setEnabled(boolean enable)
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:
enable -

getPort

public int getPort()
Returns the port that this advertising server is listening to

Returns:
the port that this server is listening to, or -1 if it is disabled

getComponents

public java.util.Vector getComponents()
Returns the list of components that this server has

Returns:
The list of components of this server