org.eigenbase.jmi.mem
Class JmiMemFactory.ElementImpl

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap<String,Object>
          extended by org.eigenbase.jmi.mem.JmiMemFactory.ElementImpl
All Implemented Interfaces:
Serializable, Cloneable, InvocationHandler, Map<String,Object>, SortedMap<String,Object>
Direct Known Subclasses:
JmiMemFactory.MofPackageImpl, JmiMemFactory.RefAssociationImpl, JmiMemFactory.RefClassImpl, JmiMemFactory.RefPackageImpl
Enclosing class:
JmiMemFactory

protected class JmiMemFactory.ElementImpl
extends TreeMap<String,Object>
implements InvocationHandler

Implementation of a RefBaseObject via an InvocationHandler interface.

Attributes are held in a TreeMap. (Not a HashMap, because we want the attributes to be returned in a predictable order.)

See Also:
Serialized Form

Nested Class Summary
private  class JmiMemFactory.ElementImpl.ResolvedReference
           
 
Field Summary
protected  Class<? extends RefBaseObject> clazz
           
private  long id
           
protected  JmiMemFactory.RefPackageImpl immediatePkg
           
(package private)  String persistentMofId
           
private  Object proxy
           
 
Constructor Summary
JmiMemFactory.ElementImpl(Class<? extends RefBaseObject> clazz, JmiMemFactory.RefPackageImpl immediatePkg)
           
 
Method Summary
private  boolean attemptReferenceResolution(JmiMemFactory.ElementImpl.ResolvedReference rr, AssociationEnd referencedEnd)
           
protected
<T> Collection<T>
filterChildren(Class<T> iface)
           
protected  String getAccessorName(Object moniker)
           
private  void initCollection(String collectionName)
           
 Object invoke(Object proxy, Method method, Object[] args)
           
private  boolean isInstanceOf(MofClass mofClass, RefObject refObject, boolean considerSubTypes)
           
protected  Object proxyCreate(String attrName, Object[] args, Class createClass)
           
protected  Object proxyGet(String attrName, Method method, Object[] args)
           
protected  Object proxyImmediateComposite()
           
protected  JmiMemFactory.ElementImpl proxyImpl()
           
protected  Boolean proxyRefAddLink(RefObject firstEnd, RefObject secondEnd)
           
protected  Collection proxyRefAllPackages()
           
protected  Object proxyRefByMoniker(Object moniker)
           
protected  Object proxyRefCreateInstance(List args)
           
protected  Object proxyRefGetEnum(Object moniker, String name)
           
protected  RefPackage proxyRefImmediatePackage()
           
protected  Boolean proxyRefIsInstanceOf(RefObject refObject, boolean considerSubTypes)
           
protected  Boolean proxyRefLinkExists(RefObject firstEnd, RefObject secondEnd)
           
protected  String proxyRefMofId()
           
protected  Object proxyRefPackage(Object moniker)
           
protected  Boolean proxyRefRemoveLink(RefObject firstEnd, RefObject secondEnd)
           
protected  Object proxyRefSetValue(Object moniker, Object value)
           
protected  Object proxySet(String attrName, Method method, Object[] args)
           
protected  Object proxySet(String attrName, Object value, boolean needRelationshipCheck)
           
private  JmiMemFactory.ElementImpl.ResolvedReference resolveReference(RefObject firstEnd, RefObject secondEnd)
           
protected  Object wrap()
          Returns this object wrapped in a proxy.
 
Methods inherited from class java.util.TreeMap
clear, clone, comparator, containsKey, containsValue, entrySet, firstKey, get, headMap, keySet, lastKey, put, putAll, remove, size, subMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Field Detail

clazz

protected final Class<? extends RefBaseObject> clazz

id

private final long id

proxy

private final Object proxy

immediatePkg

protected final JmiMemFactory.RefPackageImpl immediatePkg

persistentMofId

String persistentMofId
Constructor Detail

JmiMemFactory.ElementImpl

JmiMemFactory.ElementImpl(Class<? extends RefBaseObject> clazz,
                          JmiMemFactory.RefPackageImpl immediatePkg)
Method Detail

initCollection

private void initCollection(String collectionName)

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Throwable
Specified by:
invoke in interface InvocationHandler
Throws:
Throwable

proxyRefMofId

protected String proxyRefMofId()

proxyCreate

protected Object proxyCreate(String attrName,
                             Object[] args,
                             Class createClass)

proxySet

protected Object proxySet(String attrName,
                          Method method,
                          Object[] args)

proxySet

protected Object proxySet(String attrName,
                          Object value,
                          boolean needRelationshipCheck)

proxyGet

protected Object proxyGet(String attrName,
                          Method method,
                          Object[] args)

proxyImmediateComposite

protected Object proxyImmediateComposite()

proxyRefPackage

protected Object proxyRefPackage(Object moniker)

proxyRefAllPackages

protected Collection proxyRefAllPackages()

proxyRefImmediatePackage

protected RefPackage proxyRefImmediatePackage()

proxyRefByMoniker

protected Object proxyRefByMoniker(Object moniker)

proxyRefSetValue

protected Object proxyRefSetValue(Object moniker,
                                  Object value)

getAccessorName

protected String getAccessorName(Object moniker)

proxyRefGetEnum

protected Object proxyRefGetEnum(Object moniker,
                                 String name)
                          throws Throwable
Throws:
Throwable

proxyRefLinkExists

protected Boolean proxyRefLinkExists(RefObject firstEnd,
                                     RefObject secondEnd)

proxyRefAddLink

protected Boolean proxyRefAddLink(RefObject firstEnd,
                                  RefObject secondEnd)

proxyRefRemoveLink

protected Boolean proxyRefRemoveLink(RefObject firstEnd,
                                     RefObject secondEnd)

resolveReference

private JmiMemFactory.ElementImpl.ResolvedReference resolveReference(RefObject firstEnd,
                                                                     RefObject secondEnd)

attemptReferenceResolution

private boolean attemptReferenceResolution(JmiMemFactory.ElementImpl.ResolvedReference rr,
                                           AssociationEnd referencedEnd)

proxyRefCreateInstance

protected Object proxyRefCreateInstance(List args)

proxyRefIsInstanceOf

protected Boolean proxyRefIsInstanceOf(RefObject refObject,
                                       boolean considerSubTypes)

isInstanceOf

private boolean isInstanceOf(MofClass mofClass,
                             RefObject refObject,
                             boolean considerSubTypes)

filterChildren

protected <T> Collection<T> filterChildren(Class<T> iface)

proxyImpl

protected JmiMemFactory.ElementImpl proxyImpl()

wrap

protected Object wrap()
Returns this object wrapped in a proxy. The proxy will implement the interface specified in the clazz member.