com.novell.nds.dirxml.shimhost
Class ShimState

java.lang.Object
  extended bycom.novell.nds.dirxml.shimhost.ShimState
All Implemented Interfaces:
ConfigElement

public class ShimState
extends Object
implements ConfigElement

Encapsulation of "driver state" information stored on behalf of application shims.


Field Summary
static int DRIVER
          Parameter value for getState() method indicating DriverShim state.
static int PUBLISHER
          Parameter value for getState() method indicating PublicationShim state.
static int SUBSCRIBER
          Parameter value for getState() method indicating SubscriptionShim state.
static String TAG_SHIM_STATE
          Tag name of "shim-state" element.
 
Constructor Summary
ShimState()
          Construct an empty ShimState instance.
ShimState(Element shimState)
          Construct a ShimState instance from a <shim-state> element.
 
Method Summary
 Element getDriverState()
          Get the DriverShim state.
 Element getPublisherState()
          Get the PublicationShim state
 Element getState(int which)
          Return state for one of the shims.
 Element getSubscriberState()
          Get the SubscriptionShim state
 boolean hasBeenModified()
          Return true if this instance has been modified.
 void resetModified()
          Reset the modified flag for this instance such that hasBeenModified() will return false.
 void serializeXML(OutputStream os)
          Serialize the shim state data as an XML document.
 void setDriverState(Element newDriverState)
          Set the DriverShim state.
 void setPublisherState(Element newPublisherState)
          Set the PublicationShim state.
 void setSubscriberState(Element newSubscriberState)
          Set the SubscriptionShim state.
 Element toXML(Node parent)
          Construct an XML representation of this ShimState instance

Note that the act of creating an XML representation does not reset this instance's modified flag.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_SHIM_STATE

public static final String TAG_SHIM_STATE
Tag name of "shim-state" element.

See Also:
Constant Field Values

DRIVER

public static final int DRIVER
Parameter value for getState() method indicating DriverShim state.

See Also:
getState(int), Constant Field Values

SUBSCRIBER

public static final int SUBSCRIBER
Parameter value for getState() method indicating SubscriptionShim state.

See Also:
getState(int), Constant Field Values

PUBLISHER

public static final int PUBLISHER
Parameter value for getState() method indicating PublicationShim state.

See Also:
getState(int), Constant Field Values
Constructor Detail

ShimState

public ShimState()
Construct an empty ShimState instance.


ShimState

public ShimState(Element shimState)
Construct a ShimState instance from a <shim-state> element.

Parameters:
shimState - <shim-state> element
Method Detail

hasBeenModified

public boolean hasBeenModified()
Return true if this instance has been modified.

The instance is considered to have been modified if a change was made that affects the persistent representation since:

  1. The instance was constructed from an XML representation.
  2. resetModified() was last called

Specified by:
hasBeenModified in interface ConfigElement
Returns:
true or false
See Also:
resetModified(), toXML(org.w3c.dom.Node)

resetModified

public void resetModified()
Reset the modified flag for this instance such that hasBeenModified() will return false.

Specified by:
resetModified in interface ConfigElement
See Also:
hasBeenModified()

toXML

public Element toXML(Node parent)
Construct an XML representation of this ShimState instance

Note that the act of creating an XML representation does not reset this instance's modified flag. It must be reset by calling resetModified().

Specified by:
toXML in interface ConfigElement
Parameters:
parent - Node under which to build XML representation
Returns:
constructed <shim-state> element
See Also:
hasBeenModified(), resetModified()

serializeXML

public void serializeXML(OutputStream os)
                  throws IOException
Serialize the shim state data as an XML document. Serialized using UTF-8 encoding.

Parameters:
os - OutputStream to which to serialize.
Throws:
IOException - if error occurs writing to OutputStream

getState

public Element getState(int which)
                 throws IllegalArgumentException
Return state for one of the shims.

Parameters:
which - DRIVER, SUBSCRIBER, or PUBLISHER
Returns:
state Element
Throws:
IllegalArgumentException - if which is incorrect

getDriverState

public Element getDriverState()
Get the DriverShim state.

Returns:
<driver-state> element

setDriverState

public void setDriverState(Element newDriverState)
                    throws IllegalArgumentException
Set the DriverShim state.

Parameters:
newDriverState - <driver-state element
Throws:
IllegalArgumentException - if parameter doesn't have the correct name, or is null.

getSubscriberState

public Element getSubscriberState()
Get the SubscriptionShim state

Returns:
<subscriber-state> element

setSubscriberState

public void setSubscriberState(Element newSubscriberState)
                        throws IllegalArgumentException
Set the SubscriptionShim state.

Parameters:
newSubscriberState - <subscriber-state element
Throws:
IllegalArgumentException - if parameter doesn't have the correct name, or is null.

getPublisherState

public Element getPublisherState()
Get the PublicationShim state

Returns:
<publisher-state> element

setPublisherState

public void setPublisherState(Element newPublisherState)
                       throws IllegalArgumentException
Set the PublicationShim state.

Parameters:
newPublisherState - <publisher-state element
Throws:
IllegalArgumentException - if parameter doesn't have the correct name, or is null.