Exemple #1
0
  /*
   * (non-Javadoc)
   * @see org.mmbase.module.core.MMObjectBuilder#notify(org.mmbase.core.event.NodeEvent)
   */
  @Override
  public void notify(NodeEvent event) {
    if (log.isDebugEnabled()) {
      log.debug(
          "Changed "
              + event.getMachine()
              + " "
              + event.getNodeNumber()
              + " "
              + event.getBuilderName()
              + " "
              + NodeEvent.newTypeToOldType(event.getType()));
    }
    if (tableName.equals(event.getBuilderName())) {
      if (event.getType() == Event.TYPE_NEW) {
        MMObjectNode typeRelNode = getNode(event.getNodeNumber());
        if (typeRelNode != null) {
          Set<MMObjectNode> newTypeRels = addCacheEntry(typeRelNode, true);
          log.service("Added to typerelcache: " + newTypeRels);
        } else {
          log.warn("Could not found typerel node with number " + event.getNodeNumber());
        }

      } else {
        // something else changed in a typerel node? reread the complete typeRelNodes Set
        log.service(
            "Received '" + event + "' which is about typrels. Now re-reading the entire cache");
        readCache();
      }
      // also, clear all query-caches, because result may change by this. See MMB-348
      for (Cache qc : CacheManager.getMap().values()) {
        if (qc instanceof QueryResultCache) {
          qc.clear();
        }
      }
    }
    super.notify(event);
  }
 // ------------------------------------------------------------------------
 // *****---Node Deleted---******//
 // this function defines what you do when a new node is deleted
 // It is called by net.tinyos.tinydb.topology.PacketAnalyzer.ObjectMainter
 public synchronized void NodeDeleted(NodeEvent e) {
   Integer deletedNodeNumber =
       e.GetNodeNumber(); // you probably want to delete the info pbject to track the data of
   // this new node
   proprietaryNodeInfo.remove(deletedNodeNumber);
 }
 // It is called by net.tinyos.tinydb.topology.PacketAnalyzer.ObjectMainter
 public synchronized void NodeCreated(NodeEvent e) {
   Integer newNodeNumber =
       e.GetNodeNumber(); // you probably want to create a new info pbject to track the data of
   // this new node
   proprietaryNodeInfo.put(newNodeNumber, new NodeInfo(newNodeNumber));
 }