com.ibm.portal.identification
Interface Identification


public interface Identification

The Identification interface provides serialization and deserialization functionality for ObjectID instances.
Basically, deserialization can only be applied to String instances, which have been created by serialize(com.ibm.portal.ObjectID). One exception is a String that contains a unique name, because deserialize(java.lang.String) also resolves unique names.
Serialized com.ibm.portal.ObjectID instances do not expire. They can be deserialized using this method at any time. Additionally, serialized representations will be recognized in future versions of WebSphere Portal.
However, transient flavors of com.ibm.portal.ObjectID do have an expiration period. They are valid within a single session. During that session they are serializable and deserializable for up to 50 days.
Usage:
try
{
    Context ctx = new InitialContext();

    Name ctxName = new CompositeName("portal:service/Identification");
    Identification identification = (Identification) ctx.lookup(ctxName);

    String serializedOID = identification.serialize(aOID);

    ...

    ObjectID anotherOID = identification.deserialize(serializedOID);
}
catch (SerializationException sx)
{
    // some error handling code here
}
catch (NamingException nx)
{
    // some error handling code here
}

Since:
5.1.0.1

Field Summary
static java.lang.String JNDI_NAME
          JNDI name used to lookup this service
 
Method Summary
 ObjectID deserialize(java.lang.String serialized)
          Deserializes String instances to ObjectID instances.
Input of this method must be the output of serialize(com.ibm.portal.ObjectID).
Unique names are the only exception.
 ObjectType getObjectType(java.lang.String name)
          Provides access to instances of ObjectType.
 java.lang.String serialize(ObjectID oid)
          Serializes ObjectID instances into their String representation.
In order to revert the resulting String back to the corresponding ObjectID instance use deserialize(java.lang.String).
 java.lang.String serializeWithDatabaseDomain(ObjectID oid)
          Serializes ObjectID instances into their String representation.
In order to revert the resulting String back to the corresponding ObjectID instance use deserialize.
This method also includes information about the database domain, where the corresponding object is located, into the result String.
 

Field Detail

JNDI_NAME

static final java.lang.String JNDI_NAME
JNDI name used to lookup this service

Since:
6.1.0.1
See Also:
Constant Field Values
Method Detail

serialize

java.lang.String serialize(ObjectID oid)
                           throws SerializationException
Serializes ObjectID instances into their String representation.
In order to revert the resulting String back to the corresponding ObjectID instance use deserialize(java.lang.String).

Parameters:
oid - The ObjectID instance, which will be serialized
Returns:
The String representation of the ObjectID instance supplied
Throws:
SerializationException - The exception is thrown if there was an error during serialization

serializeWithDatabaseDomain

java.lang.String serializeWithDatabaseDomain(ObjectID oid)
                                             throws SerializationException
Serializes ObjectID instances into their String representation.
In order to revert the resulting String back to the corresponding ObjectID instance use deserialize.
This method also includes information about the database domain, where the corresponding object is located, into the result String. A database domain is a logical location. It may be a physical database or a subset of database objects in a shared database. Database domains are WebSphere Portal installation specific. Therefore, this String representation of an ObjectID instance cannot be used to exchange information between different installations of WebSphere Portal. However, it is adequate for transferring resource identifying information between nodes within one cluster.
The given object ID is only serialized, if the database domain information can be determined, otherwise a SerializationException is thrown.

Parameters:
oid - Object ID to be serialized
Returns:
serialized Object ID including database domain information as String
Throws:
SerializationException - The exception is thrown if the database domain information cannot be determined or if any other error has occurred during serialization.
Since:
6.0

deserialize

ObjectID deserialize(java.lang.String serialized)
                     throws SerializationException
Deserializes String instances to ObjectID instances.
Input of this method must be the output of serialize(com.ibm.portal.ObjectID).
Unique names are the only exception. They can be resolved to ObjectID instances by this method, too, if they have been defined in this portal before. Unknown names cause this method to throw a SerializationException.
An exception is thrown, if a ObjectID is supposed to be deserialized although this object ID still can be generated in future.
However, a successful deserialization does not give any evidence regarding the validity of the value that was provided as parameter. But the parameter has an incorrect value, if an exception was thrown.

Parameters:
serialized - A serialized ObjectID or a valid unique name, respectively
Returns:
The ObjectID instance that is represented by the parameter
Throws:
SerializationException - The exception is thrown if the parameter is neither a ObjectID instance in its serialized format nor a valid unique name

getObjectType

ObjectType getObjectType(java.lang.String name)
                         throws java.lang.IllegalArgumentException
Provides access to instances of ObjectType. To address particular object types, use their names. To obtain predefined object types, use members of ObjectTypeConstants.

Parameters:
name - The name of the requested object type.
Returns:
The corresponding object type instance.
Throws:
java.lang.IllegalArgumentException - This exception is thrown if the specified name is not the name of a registered object type.