de.stz.bt.fnd
Class FND_DataPointContext

java.lang.Object
  extended byde.stz.bt.framework.DataPointContext
      extended byde.stz.bt.fnd.FND_DataPointContext
All Implemented Interfaces:
FND_DatapointService

public class FND_DataPointContext
extends DataPointContext
implements FND_DatapointService

Represents the container for datapoint opbjects and message infrastructure The FND_DatapointContext is the runtime environment for datapoints. Each datapoint running on an either an island control or on an central control needs a set of common parameters and services that are provided by an datapoint context. The context offer the following services:

 
 
 - FND Connectivity
 		This service provides means of receiving FND_Datagram Messages and
 		to deliver messages to. It is configurable to act with other systems or processes.
 		At the moment it runs a FND UDP Server to interact with datagram messages.
 		extensions will be built for using the IBM MQTT Architecture.
 
 - FND DataPoint Factory
 		The factory provides means of creating datapoints. The handling
 		of the datapoints is done by the context.
 		The reason why this is a factory is that the context (and also the factory as subcomponent)
 		are configured, so that we do't need to care about this when we need a DataPoint Object
 	
 - FND Datagram Factory
 		This factory provides datagrams needed by the datapoints, or by an external entity
 		that want's to access an datapoint.
 		
 		A datagram has a source and a drain. It is sourced either by API Interaction
 		with a datapoint, or by a datagram received through an outside interface like the
 		UDPServer. The Datagram Factory provides the source, and should in the future also be 
 		the sink and contain a datagram pool for deterministic memory consumption
 	
 	
 

Version:
$Id: FND_DataPointContext.java,v 1.4 2004/10/17 21:45:40 jseitter Exp $
Author:
J. Seitter

Nested Class Summary
 class FND_DataPointContext.FND_ContextThread
          The Context thread monitors continously the INCOMING queue of UDPTransport and dispatches datagrams found to the corrosponding handler (NORMAL,ERROR,REJECT) dependend on the type of datagram.
 
Field Summary
static int CENTRAL
           
private  org.jdom.Element config
           
private  int contextControlType
           
protected  java.util.LinkedHashMap datapoints
           
protected  FND_DatagramFactory dgramFactory
           
protected  FND_DataPointFactory dpFactory
           
private  FND_UDPTransport fndUDPServer
           
static int ISLAND
           
private  java.net.InetAddress target
           
protected  java.lang.String URL_PREFIX
           
 
Fields inherited from class de.stz.bt.framework.DataPointContext
logger
 
Constructor Summary
FND_DataPointContext(org.jdom.Element config)
          Default Constructor.
 
Method Summary
private  void createDatapoints(java.util.List datapoints)
          creates the datapoint objects
 java.util.List enumerateAllDatapoints()
           
 FND_CollectAddressPoint getCollectAddresspoint(java.lang.String dpid)
           
 int getContextControlType()
           
 FND_DatagramFactory getDatagramFactory()
           
 FND_DataPointFactory getDataPointFactory()
           
 FND_MeasurePoint getMeasurePoint(java.lang.String dpid)
           
 FND_MessagePoint getMessagePoint(java.lang.String dpid)
           
 FND_SetPoint getSetPoint(java.lang.String dpid)
           
 FND_SwitchPoint getSwitchPoint(java.lang.String dpid)
           
 java.net.InetAddress getTarget()
           
 FND_TransferPoint getTransferPoint(java.lang.String dpid)
           
protected  void handleERRORDatagram(FND_Datagram dgram)
          this method handles error datagrams Only ISLAND contexts can send error datagrams, son only CENTRAL contexts have to handle them
protected  void handleNORMALDatagram(FND_Datagram dgram)
          handles a normal datagram.
protected  void handleREJECTDatagram(FND_Datagram dgram)
          this method handles reject datagrams
 void init()
          After creating the object it has to be initialized by calling this method.
protected  void sendDatagram(FND_Datagram out)
           
private  void setContextControlType(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CENTRAL

public static final int CENTRAL
See Also:
Constant Field Values

ISLAND

public static final int ISLAND
See Also:
Constant Field Values

URL_PREFIX

protected java.lang.String URL_PREFIX

target

private java.net.InetAddress target

dgramFactory

protected FND_DatagramFactory dgramFactory

dpFactory

protected FND_DataPointFactory dpFactory

contextControlType

private int contextControlType

fndUDPServer

private FND_UDPTransport fndUDPServer

datapoints

protected java.util.LinkedHashMap datapoints

config

private org.jdom.Element config
Constructor Detail

FND_DataPointContext

public FND_DataPointContext(org.jdom.Element config)
Default Constructor. Set the configuration Element and detaches it from its Tree.

Method Detail

createDatapoints

private void createDatapoints(java.util.List datapoints)
creates the datapoint objects

Parameters:
datapoints - contains an XML JDOM Element describing the datapoints

init

public void init()
After creating the object it has to be initialized by calling this method.


getDatagramFactory

public FND_DatagramFactory getDatagramFactory()
Returns:
a reference to the datagram factory belonging to this context.

getDataPointFactory

public FND_DataPointFactory getDataPointFactory()
Specified by:
getDataPointFactory in class DataPointContext
Returns:
a reference to the datapoint factory belonging to this context.

handleNORMALDatagram

protected void handleNORMALDatagram(FND_Datagram dgram)
                             throws java.lang.Exception
handles a normal datagram. In this method we have to diffenratiate the type of the datagram and check if this context is responsible for handling it with one of it's datapoints

Throws:
java.lang.Exception

handleREJECTDatagram

protected void handleREJECTDatagram(FND_Datagram dgram)
this method handles reject datagrams

Parameters:
dgram -

handleERRORDatagram

protected void handleERRORDatagram(FND_Datagram dgram)
this method handles error datagrams Only ISLAND contexts can send error datagrams, son only CENTRAL contexts have to handle them


getContextControlType

public int getContextControlType()
Returns:
The current control type, either CENTRAL or ISLAND

setContextControlType

private void setContextControlType(int i)
Parameters:
i - Sets the Controltype to either CENTRAL or ISLAND

sendDatagram

protected void sendDatagram(FND_Datagram out)

getTarget

public java.net.InetAddress getTarget()
Returns:
the target InetAddress for this context at the moment contexts support only a single target

enumerateAllDatapoints

public java.util.List enumerateAllDatapoints()
Specified by:
enumerateAllDatapoints in interface FND_DatapointService

getMessagePoint

public FND_MessagePoint getMessagePoint(java.lang.String dpid)
Specified by:
getMessagePoint in interface FND_DatapointService

getSwitchPoint

public FND_SwitchPoint getSwitchPoint(java.lang.String dpid)
Specified by:
getSwitchPoint in interface FND_DatapointService

getMeasurePoint

public FND_MeasurePoint getMeasurePoint(java.lang.String dpid)
Specified by:
getMeasurePoint in interface FND_DatapointService

getSetPoint

public FND_SetPoint getSetPoint(java.lang.String dpid)
Specified by:
getSetPoint in interface FND_DatapointService

getTransferPoint

public FND_TransferPoint getTransferPoint(java.lang.String dpid)
Specified by:
getTransferPoint in interface FND_DatapointService

getCollectAddresspoint

public FND_CollectAddressPoint getCollectAddresspoint(java.lang.String dpid)
Specified by:
getCollectAddresspoint in interface FND_DatapointService