Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.core.references
Interface IRSEBasePersistableReferenceManager

All Known Subinterfaces:
ISystemFilterPoolReferenceManager

public interface IRSEBasePersistableReferenceManager

A class for managing a list of shadow objects that reference master objects.

Sometimes we have a master list of objects, and we let the user select a subset of that list and we wish to persist that users selections. To accomplish this, in your Rose model, follow these steps:

  1. Include the references package from the SystemReferences .cat file
  2. Ensure the class for the master objects subclass SystemPersistableReferencedObject, or implement IRSEPersistableReferencedObject. YOU MUST OVERRIDE getReferenceName() IN SYSTEMPERSISTABLEREFERENCEDOBJECT!
  3. Create a class subclassing SystemPersistableReferencingObject to hold a reference to the master object. This will hold a transient pointer, and a persistable name, of the master object. The name must be sufficient to be able to re-create the pointer upon restoration from disk. When you set the pointer via the setReferencedObject method, it will automatically extract the name of that object (by calling its getReferenceName method) and store it in the mof-modelled attribute of the SystemPersistableReferencingObject class.
  4. Create a class subclassing this class (SystemPersistableReferenceManager) to manage the list of referencing objects. Each time you instantiate a reference object, add it to the referencingObjects list managed by this class. YOU MUST OVERRIDE resolveReferencesAfterRestore() IN SYSTEMPERSISTABLEREFERENCEMANAGERIMPL!

Once you have an instantiated and populated instance of this class, you can either choose to save it to disk in its own file (save/restore methods are supplied for this) or you can simply choose to store it as part of your own class via your own save and restore methods. If using MOF, and the containment of the manager class is modelled in your own containing class, this will happen automatically when you use mof to save your containing class instance.


Method Summary
 int addReferencingObject ( IRSEBasePersistableReferencingObject object)
          Add a referencing object to the managed list.
  String getName ()
           
  IRSEBasePersistableReferencingObject getReferencedObject ( IRSEBasePersistableReferencedObject object)
          Search list of referencing objects to see if one of them references the given referencable object.
 int getReferencingObjectCount ()
          Return how many referencing objects are currently in the list.
  List getReferencingObjectList ()
           
 int getReferencingObjectPosition ( IRSEBasePersistableReferencingObject object)
          Return the zero-based position of the given referencing object within the list.
  IRSEBasePersistableReferencingObject[] getReferencingObjects ()
          Return an array of the referencing objects currently being managed.
 boolean isReferenced ( IRSEBasePersistableReferencedObject object)
          Return true if the given referencable object is indeed referenced by a referencing object in the current list.
 void moveReferencingObjectPosition (int newPosition, IRSEBasePersistableReferencingObject object)
          Move the given referencing object to a new zero-based position in the list.
 void removeAllReferencingObjects ()
          Remove all objects from the list.
 void removeAndDeReferenceAllReferencingObjects ()
          Remove and dereference all objects from the list.
 int removeAndDeReferenceReferencingObject ( IRSEBasePersistableReferencingObject object)
          Remove and dereferences a referencing object from the managed list.
 int removeReferencingObject ( IRSEBasePersistableReferencingObject object)
          Remove a referencing object from the managed list.
 void setName ( String value)
           
 void setReferencingObjects ( IRSEBasePersistableReferencingObject[] objects, boolean deReference)
          Set in one shot the list of referencing objects.
 

Method Detail

getReferencingObjects

IRSEBasePersistableReferencingObject[] getReferencingObjects()
Return an array of the referencing objects currently being managed.

Returns:
array of the referencing objects currently in this list.

setReferencingObjects

void setReferencingObjects(
IRSEBasePersistableReferencingObject[] objects,
                           boolean deReference)
Set in one shot the list of referencing objects. Replaces current list.

Parameters:
objects - An array of referencing objects which is to become the new list.
deReference - true to first de-reference all objects in the existing list.

addReferencingObject

int addReferencingObject(
IRSEBasePersistableReferencingObject object)
Add a referencing object to the managed list.

Returns:
new count of referenced objects being managed.

removeReferencingObject

int removeReferencingObject(
IRSEBasePersistableReferencingObject object)
Remove a referencing object from the managed list.

Does NOT call removeReference on the master referenced object.

Returns:
new count of referenced objects being managed.

removeAndDeReferenceReferencingObject

int removeAndDeReferenceReferencingObject(
IRSEBasePersistableReferencingObject object)
Remove and dereferences a referencing object from the managed list.

DOES call removeReference on the master referenced object.

Returns:
new count of referenced objects being managed.

removeAllReferencingObjects

void removeAllReferencingObjects()
Remove all objects from the list.

Does NOT call removeReference on the master referenced objects.


removeAndDeReferenceAllReferencingObjects

void removeAndDeReferenceAllReferencingObjects()
Remove and dereference all objects from the list.

DOES call removeReference on the master referenced objects.


getReferencingObjectCount

int getReferencingObjectCount()
Return how many referencing objects are currently in the list.

Returns:
current count of referenced objects being managed.

getReferencingObjectPosition

int getReferencingObjectPosition(
IRSEBasePersistableReferencingObject object)
Return the zero-based position of the given referencing object within the list. Does a memory address comparison (==) to find the object.

Parameters:
object - The referencing object to find position of.
Returns:
zero-based position within the list. If not found, returns -1

moveReferencingObjectPosition

void moveReferencingObjectPosition(int newPosition,
                                   
IRSEBasePersistableReferencingObject object)
Move the given referencing object to a new zero-based position in the list.

Parameters:
newPosition - New zero-based position
object - The referencing object to move

isReferenced

boolean isReferenced(
IRSEBasePersistableReferencedObject object)
Return true if the given referencable object is indeed referenced by a referencing object in the current list. This is done by comparing the reference names of each, not the in-memory pointers.

Parameters:
object - The referencable object to which to search for a referencing object within this list
Returns:
true if found in list, false otherwise.

getReferencedObject

IRSEBasePersistableReferencingObject getReferencedObject(
IRSEBasePersistableReferencedObject object)
Search list of referencing objects to see if one of them references the given referencable object. This is done by comparing the reference names of each, not the in-memory pointers.

Parameters:
object - The referencable object to which to search for a referencing object within this list
Returns:
the referencing object within this list which references the given referencable object, or null if no reference found.

getName

String getName()
Returns:
The value of the Name attribute

setName

void setName(
String value)
Parameters:
value - The new value of the Name attribute

getReferencingObjectList

List getReferencingObjectList()
Returns:
The list of ReferencingObjectList references

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire