Remote Systems
v6.4.1

com.ibm.etools.systems.references.impl
Class SystemPersistableReferenceManagerImpl

java.lang.Object
  extended byEObjectImpl
      extended bycom.ibm.etools.systems.references.impl.SystemPersistableReferenceManagerImpl
All Implemented Interfaces:
SystemPersistableReferenceManager
Direct Known Subclasses:
SystemFilterPoolReferenceManagerImpl

public class SystemPersistableReferenceManagerImpl
extends EObjectImpl
implements SystemPersistableReferenceManager

YOU MUST OVERRIDE resolveReferencesAfterRestore() IN THIS CLASS!

YOU MUST OVERRIDE getReferenceName() IN SYSTEMPERSISTABLEREFERENCEDOBJECT!

See Also:
SystemPersistableReferenceManager, Serialized Form

Field Summary
static String copyright
           
static boolean debug
           
static HashMap EMPTY_MAP
           
protected  String name
           
protected static String NAME_EDEFAULT
          The default value of the 'Name' attribute
protected  EList referencingObjectList
           
 
Constructor Summary
protected SystemPersistableReferenceManagerImpl()
          Constructor.
 
Method Summary
static String addPathTerminator(String path)
          Ensure given path ends with path separator.
 int addReferencingObject(ISystemPersistableReferencingObject object)
          Add a referencing object to the managed list.
 Object eGet(EStructuralFeature eFeature, boolean resolve)
           
 NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs)
           
 NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs)
           
 boolean eIsSet(EStructuralFeature eFeature)
           
 void eSet(EStructuralFeature eFeature, Object newValue)
           
protected  EClass eStaticClass()
           
 void eUnset(EStructuralFeature eFeature)
           
 String getName()
           
 ISystemPersistableReferencingObject getReferencedObject(ISystemPersistableReferencedObject 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.
 EList getReferencingObjectList()
           
 int getReferencingObjectPosition(ISystemPersistableReferencingObject object)
          Return the zero-based position of the given referencing object within the list.
 ISystemPersistableReferencingObject[] getReferencingObjects()
          Return an array of the referencing objects currently being managed.
static ReferencesFactory initMOF()
          Initialize the MOF package.
protected  EList internalGetList()
          Internal method to get the mof EList that is the current list.
protected  void invalidateCache()
          Internal method to invalidate any cached info.
 boolean isReferenced(ISystemPersistableReferencedObject object)
          Return true if the given referencable object is indeed referenced by a referencing object in the current list.
 void moveReferencingObjectPosition(int newPosition, ISystemPersistableReferencingObject 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(ISystemPersistableReferencingObject object)
          Remove and dereferences a referencing object from the managed list.
 int removeReferencingObject(ISystemPersistableReferencingObject object)
          Remove a referencing object from the managed list.
 boolean resolveReferencesAfterRestore()
          YOU MUST OVERRIDE THIS METHOD!
static SystemPersistableReferenceManager restore(IFolder folder, String fileName)
          Restore a persisted manager from disk.
 void save(IFolder folder, String fileName)
          Attempt to save contents of manager to disk.
 void setName(String newName)
           
 void setReferencingObjects(ISystemPersistableReferencingObject[] objects, boolean deReference)
          Set in one shot the list of referencing objects.
 String toString()
          Return string identifying this filter
 String toStringGen()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_EDEFAULT

protected static final String NAME_EDEFAULT
The default value of the 'Name' attribute.

See Also:
getName()

debug

public static boolean debug

EMPTY_MAP

public static HashMap EMPTY_MAP

copyright

public static final String copyright
See Also:
Constant Field Values

name

protected String name

referencingObjectList

protected EList referencingObjectList
Constructor Detail

SystemPersistableReferenceManagerImpl

protected SystemPersistableReferenceManagerImpl()
Constructor. Typically called by EMF framework via factory create method.

Method Detail

eStaticClass

protected EClass eStaticClass()


internalGetList

protected EList internalGetList()
Internal method to get the mof EList that is the current list.


invalidateCache

protected void invalidateCache()
Internal method to invalidate any cached info. Must be called religiously by any method affecting list.


getReferencingObjects

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

Specified by:
getReferencingObjects in interface SystemPersistableReferenceManager

setReferencingObjects

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

Specified by:
setReferencingObjects in interface SystemPersistableReferenceManager
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

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

Specified by:
addReferencingObject in interface SystemPersistableReferenceManager
Returns:
new count of referenced objects being managed.

removeReferencingObject

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

Does NOT call removeReference on the master referenced object.

Specified by:
removeReferencingObject in interface SystemPersistableReferenceManager
Returns:
new count of referenced objects being managed.

removeAndDeReferenceReferencingObject

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

DOES call removeReference on the master referenced object.

Specified by:
removeAndDeReferenceReferencingObject in interface SystemPersistableReferenceManager
Returns:
new count of referenced objects being managed.

removeAllReferencingObjects

public void removeAllReferencingObjects()
Remove all objects from the list.

Does NOT call removeReference on the master referenced objects.

Specified by:
removeAllReferencingObjects in interface SystemPersistableReferenceManager

removeAndDeReferenceAllReferencingObjects

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

DOES call removeReference on the master referenced objects.

Specified by:
removeAndDeReferenceAllReferencingObjects in interface SystemPersistableReferenceManager

getReferencingObjectCount

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

Specified by:
getReferencingObjectCount in interface SystemPersistableReferenceManager
Returns:
current count of referenced objects being managed.

getReferencingObjectPosition

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

Specified by:
getReferencingObjectPosition in interface SystemPersistableReferenceManager
Parameters:
object - The referencing object to find position of.
Returns:
zero-based position within the list. If not found, returns -1

moveReferencingObjectPosition

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

Specified by:
moveReferencingObjectPosition in interface SystemPersistableReferenceManager
Parameters:
newPosition - New zero-based position
object - The referencing object to move

isReferenced

public boolean isReferenced(ISystemPersistableReferencedObject 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.

Specified by:
isReferenced in interface SystemPersistableReferenceManager
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

public ISystemPersistableReferencingObject getReferencedObject(ISystemPersistableReferencedObject 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.

Specified by:
getReferencedObject in interface SystemPersistableReferenceManager
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.

toString

public String toString()
Return string identifying this filter


resolveReferencesAfterRestore

public boolean resolveReferencesAfterRestore()
YOU MUST OVERRIDE THIS METHOD!

After restoring this from disk, there is only the referenced object name, not the referenced object pointer, for each referencing object.

This method is called after restore and for each restored object in the list must:

  1. Do what is necessary to find the referenced object, and set the internal reference pointer.
  2. Call addReference(this) on that object so it can maintain it's in-memory list of all referencing objects.

Specified by:
resolveReferencesAfterRestore in interface SystemPersistableReferenceManager
Returns:
true if resolved successfully. False if some references were not found and hence those referencing objects removed from the restored list.

save

public void save(IFolder folder,
                 String fileName)
          throws Exception
Attempt to save contents of manager to disk. Only call if not doing your own save from your own model that uses a subclass of this.

Specified by:
save in interface SystemPersistableReferenceManager
Parameters:
folder - The folder in which to save the manager.
fileName - The unqualified file name to save to. Should include extension, such as .xmi
Throws:
Exception

restore

public static SystemPersistableReferenceManager restore(IFolder folder,
                                                        String fileName)
                                                 throws Exception
Restore a persisted manager from disk.

After restoration, YOU MUST CALL resolveReferencesAfterRestore This presumes yours subclass has overridden that method!

Parameters:
folder - The folder in which the saved manager exists.
fileName - The unqualified save file name including extension such as .xmi
Returns:
The restored object, or null if given file not found. Any other error gives an exception.
Throws:
Exception

initMOF

public static ReferencesFactory initMOF()
Initialize the MOF package. Need only be done once.


addPathTerminator

public static String addPathTerminator(String path)
Ensure given path ends with path separator.


getName

public String getName()
Specified by:
getName in interface SystemPersistableReferenceManager
Returns:
The value of the Name attribute

setName

public void setName(String newName)
Specified by:
setName in interface SystemPersistableReferenceManager
Parameters:
newName - The new value of the Name attribute

getReferencingObjectList

public EList getReferencingObjectList()
Specified by:
getReferencingObjectList in interface SystemPersistableReferenceManager
Returns:
The list of ReferencingObjectList references

eInverseAdd

public NotificationChain eInverseAdd(InternalEObject otherEnd,
                                     int featureID,
                                     Class baseClass,
                                     NotificationChain msgs)


eInverseRemove

public NotificationChain eInverseRemove(InternalEObject otherEnd,
                                        int featureID,
                                        Class baseClass,
                                        NotificationChain msgs)


eGet

public Object eGet(EStructuralFeature eFeature,
                   boolean resolve)


eIsSet

public boolean eIsSet(EStructuralFeature eFeature)

eSet

public void eSet(EStructuralFeature eFeature,
                 Object newValue)

eUnset

public void eUnset(EStructuralFeature eFeature)

toStringGen

public String toStringGen()

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.