Interface COM.ibm.jaws.mofw.Identifiable
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface COM.ibm.jaws.mofw.Identifiable

public interface Identifiable
extends Object
Identifiable is an abstract interface not really meant for anything but CORBA compliance. That is, to be Identifiable outside of the address space in the Managed Object Framework, an implementation needs to be Managed. Being Managed imples that it can get an Identifier suitable for resolving against a "root" BaseCollection of some sort.

The reason for this is that no object is truly "self identified", but rather, it is always identified with respect to some context. In the MOFW, the BaseCollection provides this context (within which an ORB can be considered a BC).

We could relax this restriction if: a) there can always be thought to be a single root per address space ("named" the server name if the identity needs to go beyond the address space boundary), and b) Identifable includes a getIdentifier() method that provides a key with respect to this well known root (with a well known method of accessing it). The former would require a change to the CORBA standard, while the latter is simply a convention that AA's may choose to adhere to. For this reason, we feel that "self identified" objects should be subclasses of Managed (note that Managed extends Manageable, Identifiable and Lifecycle).

All this aside, Identifiable allows an object's client to test whether two references refer to the same object using isIdentical().

It also allows efficient testing of whether an object is a member of a large group of objects using getRandomConstantID(). This returns a standard hash of the objects Identifier relative to a specified BaseCollection onto a long, which has the property that, if two of these are not equal, then they do not refer to the same object. However, if two of these are equal, then the objects may be different. Thus, membership in a large group of objects can can be done with a minimum of isIdentical() tests.

The idIdentical() method should be contrasted with the Java Object equals() method, which tests whether two references refer to object of equal or equivalent value. Identity implies equality, but equality does not imply identity. Assuming the following: String a = new String("abc"); String b = new String("abc"); String c = a; Then a.equals(b) is true while a.isIdentical(b) is false. And a.equals(c) and a.isIdentical(c) are both true. The Java default implementation of equals() for Object is identity, but this only works for objects in the same address space and it may be overridden by an implementation with weaker semantics. An distribution enabled implementation of equals() should be provided for Managed objects.


Method Index

 o getConstantRandomId()
Use this method to get a standard hash of the object's Identifier that can be used to quickly prove "non" identity (but not identity).
 o isIdentical(Identifiable)
Use this method to see if two objects refer to the same object.

Methods

 o isIdentical
  public abstract boolean isIdentical(Identifiable otherObject)
Use this method to see if two objects refer to the same object. This may require actually comparing identifiers (see the description of Managed objects), but this is up to the implementor. It is recommended that implementors of Identifiable objects use getConstantRandomId() to increase performance for the "false" case.
Parameters:
otherObject - the Identifiable object to check.
Returns:
a boolean indicating whether the two objects are identical.
 o getConstantRandomId
  public abstract int getConstantRandomId()
Use this method to get a standard hash of the object's Identifier that can be used to quickly prove "non" identity (but not identity). That is, two equal constantRandomId values is not proof of equal identity (use isIdentical() in this case.

Good implementations of isIdentical() will use this value exactly as specified above for performance, so most clients should use it instead.

Returns:
an int representing a value that can be used to quickly determine non identity.

All Packages  Class Hierarchy  This Package  Previous  Next  Index