if(path.matches(pattern)) {
for(NodeListener listener : listeners.get(pattern)) {
if(handlers.containsKey(listener.getType())) {
switch (version) {
case NodeCreated:
listener.onNodeCreated(new Node(path,handlers.get(listener.getType()).parse(zk.getData(path,this,stat))));
setStatus(path,stat.getVersion());
break;
case NodeDataChanged:
listener.onNodeUpdated(new Node(path,handlers.get(listener.getType()).parse(zk.getData(path,this,stat))));
setStatus(path,stat.getVersion());
break;
case NodeDeleted:
listener.onNodeDeleted(new Node(path));
removeStatus(path);
break;
}
} else throw new NodeKeeperException(String.format("cannot handle type %s",listener.getType()));
}