com.sun.sgs.impl.app.profile
Class ProfileDataManager

java.lang.Object
  extended by com.sun.sgs.impl.app.profile.ProfileDataManager
All Implemented Interfaces:
DataManager

public class ProfileDataManager
extends Object
implements DataManager

This implementation of DataManager simply calls its backing manager for each manager method.


Constructor Summary
ProfileDataManager(DataManager backingManager)
          Creates an instance of ProfileDataManager.
 
Method Summary
<T> ManagedReference<T>
createReference(T object)
          Creates a managed reference to an object, storing the object in the data manager if it is transient.
 ManagedObject getBinding(String name)
          Obtains the object bound to a name.
 ManagedObject getBindingForUpdate(String name)
          Obtains the object bound to a name, and notifies the system that the object is going to be modified.
 BigInteger getObjectId(Object object)
          Returns a unique identifier for the object, storing the object in the data manager if it is transient.
 void markForUpdate(Object object)
          Notifies the system that an object is going to be modified, doing nothing if the object is transient.
 String nextBoundName(String name)
          Returns the next name after the specified name that has a binding, or null if there are no more bound names.
 void removeBinding(String name)
          Removes the binding for a name.
 void removeObject(Object object)
          Removes an object from the DataManager, if the object is persistent.
 void setBinding(String name, Object object)
          Binds an object to a name, replacing any previous binding, and storing the object in the data manager if it is transient.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileDataManager

public ProfileDataManager(DataManager backingManager)
Creates an instance of ProfileDataManager.

Parameters:
backingManager - the DataManager to call through to
Method Detail

getBinding

public ManagedObject getBinding(String name)
Obtains the object bound to a name. For implementations that need to be notified of object modifications, applications should call markForUpdate or ManagedReference.getForUpdate before modifying the returned object or any of the non-managed objects it refers to.

Specified by:
getBinding in interface DataManager
Parameters:
name - the name
Returns:
the object bound to the name
See Also:
markForUpdate, ManagedReference.getForUpdate, getBindingForUpdate

getBindingForUpdate

public ManagedObject getBindingForUpdate(String name)
Obtains the object bound to a name, and notifies the system that the object is going to be modified.

Specified by:
getBindingForUpdate in interface DataManager
Parameters:
name - the name
Returns:
the object bound to the name

setBinding

public void setBinding(String name,
                       Object object)
Binds an object to a name, replacing any previous binding, and storing the object in the data manager if it is transient. The object must implement ManagedObject, and both the object and any objects it refers to must implement Serializable. Note that this method will throw IllegalArgumentException if object does not implement Serializable, but is not guaranteed to check that all referred to objects implement Serializable. Any instances of ManagedObject that object refers to directly, or indirectly through non-managed objects, need to be referred to through instances of ManagedReference.

Specified by:
setBinding in interface DataManager
Parameters:
name - the name
object - the object

removeBinding

public void removeBinding(String name)
Removes the binding for a name. Note that the object previously bound to the name, if any, is not removed; only the binding between the name and the object is removed. To remove the object, use the removeObject method.

Specified by:
removeBinding in interface DataManager
Parameters:
name - the name
See Also:
removeObject

nextBoundName

public String nextBoundName(String name)
Returns the next name after the specified name that has a binding, or null if there are no more bound names. If name is null, then the search starts at the beginning.

The order of the names corresponds to the ordering of the UTF-8 encoding of the names. To provide flexibility to the implementation, the UTF-8 encoding used can be either standard UTF-8, as defined by the IETF in RFC 3629, or modified UTF-8, as used by serialization and defined by the DataInput interface.

Specified by:
nextBoundName in interface DataManager
Parameters:
name - the name to search after, or null to start at the beginning
Returns:
the next name with a binding following name, or null if there are no more bound names

removeObject

public void removeObject(Object object)
Removes an object from the DataManager, if the object is persistent. The system will make an effort to flag subsequent references to the removed object through getBinding or ManagedReference by throwing ObjectNotFoundException, although this behavior is not guaranteed.

If object implements ManagedObjectRemoval, even if it is transient, then this method first calls the ManagedObjectRemoval.removingObject method on the object, to notify it that it is being removed. If the call to removingObject throws a RuntimeException, then this method will throw that exception without removing the object. A call to removingObject that causes removeObject to be called recursively on the same object will result in an IllegalStateException being thrown.

Specified by:
removeObject in interface DataManager
Parameters:
object - the object
See Also:
ManagedObjectRemoval

markForUpdate

public void markForUpdate(Object object)
Notifies the system that an object is going to be modified, doing nothing if the object is transient.

Specified by:
markForUpdate in interface DataManager
Parameters:
object - the object
See Also:
ManagedReference.getForUpdate

createReference

public <T> ManagedReference<T> createReference(T object)
Creates a managed reference to an object, storing the object in the data manager if it is transient. Applications should use managed references when a managed object refers to another managed object, either directly or indirectly through non-managed objects.

Specified by:
createReference in interface DataManager
Type Parameters:
T - the type of the object
Parameters:
object - the object
Returns:
the managed reference

getObjectId

public BigInteger getObjectId(Object object)
Returns a unique identifier for the object, storing the object in the data manager if it is transient. The value returned by this method is the same as the one that would be obtained by calling ManagedReference.getId on a managed reference associated with the object produced by createReference.

Specified by:
getObjectId in interface DataManager
Parameters:
object - the object
Returns:
a unique identifier for the object

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved