disciplex.dni
Class DNIAdapter

java.lang.Object
  |
  +--disciplex.dni.DNIAdapter
All Implemented Interfaces:
AttributeListener, DocumentListener, ElementListener

public class DNIAdapter
extends java.lang.Object
implements AttributeListener, DocumentListener, ElementListener

Copyright (c) 2003 Rutgers, The State University of New Jersey

Version:
$Revision: 1.5 $

Constructor Summary
DNIAdapter()
          Creates an instance of the DISCIPLE middleware endpoint, and initializes the repository, data distributor and set up event listeners.
 
Method Summary
 void attributeRemoved(org.w3c.dom.Node node, java.lang.String attribute)
          Implementation of the AttributeListener interface.
 void attributeSet(org.w3c.dom.Node node, java.lang.String attribute, java.lang.String value, java.lang.String oldValue)
          Implementation of the AttributeListener interface.
 Connection createConnection(java.lang.String host, java.lang.String port)
          Creates conection to the host specified in the parameters and if successful, adds the connection to the Controller.
 org.w3c.dom.Document createDocument()
          Convenience method to create XML DOM documents.
 void documentAdded(java.lang.String name, org.w3c.dom.Document document)
          Implementation of the DocumentListener interface.
 void documentRemoved(java.lang.String name, org.w3c.dom.Document document)
          Implementation of the DocumentListener interface.
 DNIEvent eventCallback()
          Event callback method.
 Controller getController()
           
 void nodeAdded(org.w3c.dom.Node node)
          Implementation of the ElementListener interface.
 void nodeRemoved(org.w3c.dom.Node node)
          Implementation of the ElementListener interface.
 void nodeValueSet(org.w3c.dom.Node node, java.lang.String value, java.lang.String oldValue)
          Implementation of the ElementListener interface.
 void sendAddSubtreeCommand(java.lang.String docName, java.lang.String path, org.w3c.dom.Node node)
          Creates an AddSubtreeCommand and sends it to the peer DISCIPLE endpoints.
 void sendSetAttributeCommand(java.lang.String docName, java.lang.String path, java.lang.String name, java.lang.String value)
          Creates an SetAttributeCommand and sends it to the peer DISCIPLE endpoints.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DNIAdapter

public DNIAdapter()
Creates an instance of the DISCIPLE middleware endpoint, and initializes the repository, data distributor and set up event listeners.

Method Detail

getController

public Controller getController()
Returns:
the Controller

createConnection

public Connection createConnection(java.lang.String host,
                                   java.lang.String port)
Creates conection to the host specified in the parameters and if successful, adds the connection to the Controller.

Parameters:
host - the host name
port - the port number

createDocument

public org.w3c.dom.Document createDocument()
Convenience method to create XML DOM documents.

Returns:
the created Document

sendAddSubtreeCommand

public void sendAddSubtreeCommand(java.lang.String docName,
                                  java.lang.String path,
                                  org.w3c.dom.Node node)
Creates an AddSubtreeCommand and sends it to the peer DISCIPLE endpoints.

Parameters:
docName - the name of the XML DOM document
path - the path within the document to the target node
node - the subtree root node to be added

sendSetAttributeCommand

public void sendSetAttributeCommand(java.lang.String docName,
                                    java.lang.String path,
                                    java.lang.String name,
                                    java.lang.String value)
Creates an SetAttributeCommand and sends it to the peer DISCIPLE endpoints.

Parameters:
docName - the name of the XML DOM document
path - the path within the document to the target node
name - the attribute name
value - the new attribute value

eventCallback

public DNIEvent eventCallback()
Event callback method. Objects listening for events from DNI must call this method.

The method implements a blocking wait and will only return when an event is available or it is interrupted.

Returns:
the event

attributeSet

public void attributeSet(org.w3c.dom.Node node,
                         java.lang.String attribute,
                         java.lang.String value,
                         java.lang.String oldValue)
Implementation of the AttributeListener interface.

Specified by:
attributeSet in interface AttributeListener

attributeRemoved

public void attributeRemoved(org.w3c.dom.Node node,
                             java.lang.String attribute)
Implementation of the AttributeListener interface.

Specified by:
attributeRemoved in interface AttributeListener

documentAdded

public void documentAdded(java.lang.String name,
                          org.w3c.dom.Document document)
Implementation of the DocumentListener interface.

Specified by:
documentAdded in interface DocumentListener

documentRemoved

public void documentRemoved(java.lang.String name,
                            org.w3c.dom.Document document)
Implementation of the DocumentListener interface.

Specified by:
documentRemoved in interface DocumentListener

nodeAdded

public void nodeAdded(org.w3c.dom.Node node)
Implementation of the ElementListener interface.

Specified by:
nodeAdded in interface ElementListener
Parameters:
node -

nodeRemoved

public void nodeRemoved(org.w3c.dom.Node node)
Implementation of the ElementListener interface.

Specified by:
nodeRemoved in interface ElementListener

nodeValueSet

public void nodeValueSet(org.w3c.dom.Node node,
                         java.lang.String value,
                         java.lang.String oldValue)
Implementation of the ElementListener interface.

Specified by:
nodeValueSet in interface ElementListener


Copyright (c) 2003 Rutgers, The State University of New Jersey