Esempio n. 1
0
 public synchronized void registerNode(CommonNode parent, CommonNode node) {
   if (parent == null) {
     nodeMap.put(node.getObject(), node);
   } else {
     // we make a registration per role (attrNodeMap is instance scope)
     // do not move this to CommonNode
     Map<Object, CommonNode> tempNodeMap =
         (Map<Object, CommonNode>) parent.getAttribute(attrNodeMap);
     if (tempNodeMap == null) {
       tempNodeMap = new WeakHashMap<Object, CommonNode>();
       parent.setAttribute(attrNodeMap, tempNodeMap);
     }
     tempNodeMap.put(node.getObject(), node);
   }
 }
Esempio n. 2
0
 public synchronized CommonNode lookupNode(CommonNode parent, Object object) {
   if (parent == null) {
     return nodeMap.get(object);
   }
   // we make a lookup per role (attrNodeMap is instance scope)
   // do not move this to CommonNode
   Map<Object, CommonNode> tempNodeMap =
       (Map<Object, CommonNode>) parent.getAttribute(attrNodeMap);
   if (tempNodeMap == null) {
     return null;
   }
   return tempNodeMap.get(object);
 }