net.ponder2
Class OID

java.lang.Object
  extended by net.ponder2.OID
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, P2Serializable

public class OID
extends java.lang.Object
implements P2Serializable, java.io.Externalizable

This is the fundamental object identifier for all the managed objects in the system. Every managed object will have a single, unique OID associated with it on a one to one, reversible mapping. The OID also contains all the known ways of remotely contacting the SMC where the managed object resides.

Version:
$Id: OID.java,v 1.12 2005/10/28 21:58:00 kpt Exp $
Author:
Kevin Twidle
See Also:
Serialized Form

Constructor Summary
OID()
          Dummy required for serialisation
OID(P2ManagedObject managedObject)
          creates a new OID, initialises its fields and adds it to the SMC's list of OIDs
 
Method Summary
static void addAddress(java.net.URI address)
          adds a new address to the set of addresses for this SMC
static OID fromXML(com.twicom.qdparser.TaggedElement xml)
          generates an OID from an XML structure.
static java.util.Set<java.net.URI> getAddresses()
           
protected  java.util.Set<java.net.URI> getAddressSet()
           
 P2ManagedObject getManagedObject()
          returns the actual managed object associated with this OID
 P2Object getP2Object()
          returns the actual managed object associated with this OID
protected  java.util.Set<java.net.URI> getRemoteAddresses()
           
 java.lang.String getUid()
           
 boolean isDomain()
          checks whether this OID is associated with a domain managed object
 void readExternal(java.io.ObjectInput in)
           
protected  java.lang.Object readResolve()
          Called by the serialization routines after readExternal as been called.
 P2Object readXml(com.twicom.qdparser.TaggedElement xml, java.util.Map<java.lang.Integer,P2Serializable> read)
           
protected  void setDomain(boolean isDomain)
          sets whether this OID is associated with a domain managed object
protected  void setUid(java.lang.String uid)
           
 java.lang.String toString()
           
 com.twicom.qdparser.TaggedElement toXML()
          returns the OID as an XML structure.
 void writeExternal(java.io.ObjectOutput out)
           
 com.twicom.qdparser.TaggedElement writeXml(java.util.Set<P2Object> written)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OID

public OID()
Dummy required for serialisation


OID

public OID(P2ManagedObject managedObject)
creates a new OID, initialises its fields and adds it to the SMC's list of OIDs

Method Detail

addAddress

public static void addAddress(java.net.URI address)
adds a new address to the set of addresses for this SMC

Parameters:
address - the address to be added

getAddresses

public static java.util.Set<java.net.URI> getAddresses()

fromXML

public static OID fromXML(com.twicom.qdparser.TaggedElement xml)
                   throws Ponder2OperationException,
                          Ponder2ArgumentException
generates an OID from an XML structure. If the OID is already known to the SMC then the original OID is returned, otherwise a new OID is created and added to the SMC's set of OIDs.

Parameters:
xml - the XML structure containing the OID
Returns:
the OID generated from the XML structure
Throws:
Ponder2ArgumentException
Ponder2OperationException

isDomain

public boolean isDomain()
checks whether this OID is associated with a domain managed object

Returns:
true if this OID is associated with a domain managed object

setDomain

protected void setDomain(boolean isDomain)
sets whether this OID is associated with a domain managed object

Parameters:
isDomain - true if this OID is to be associated with a domain managed object

getManagedObject

public P2ManagedObject getManagedObject()
returns the actual managed object associated with this OID

Returns:
the OID's managed object

getP2Object

public P2Object getP2Object()
returns the actual managed object associated with this OID

Returns:
the OID's managed object

getRemoteAddresses

protected java.util.Set<java.net.URI> getRemoteAddresses()

getAddressSet

protected java.util.Set<java.net.URI> getAddressSet()

toXML

public com.twicom.qdparser.TaggedElement toXML()
returns the OID as an XML structure.

Returns:
a description of the OID as an XML structure

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Called by the serialization routines after readExternal as been called.

Returns:
the newly read in OID, actually probably an old one.
Throws:
java.io.ObjectStreamException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

getUid

public java.lang.String getUid()
Returns:
the uid

setUid

protected void setUid(java.lang.String uid)
Parameters:
uid - the uid to set

writeXml

public com.twicom.qdparser.TaggedElement writeXml(java.util.Set<P2Object> written)
                                           throws Ponder2OperationException
Specified by:
writeXml in interface P2Serializable
Throws:
Ponder2OperationException

readXml

public P2Object readXml(com.twicom.qdparser.TaggedElement xml,
                        java.util.Map<java.lang.Integer,P2Serializable> read)
                 throws Ponder2OperationException,
                        Ponder2ArgumentException
Specified by:
readXml in interface P2Serializable
Throws:
Ponder2OperationException
Ponder2ArgumentException


Copyright © 2008 Imperial College. All Rights Reserved.