Package at.salzburgresearch.nodekeeper.exception

Examples of at.salzburgresearch.nodekeeper.exception.NodeKeeperException


                    buildRecursively(path.substring(0,path.lastIndexOf(PATH_SEPARATOR)),data);
                }
                zk.create(path, data, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
            }
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("error while creating node '#s'", path));
        }
    }
View Full Code Here


            if((stat=zk.exists(node.getPath(),false))!=null) {
                if(handlers.containsKey(clazz)) {
                    //set this node
                    zk.setData(node.getPath(), handlers.get(clazz).serialize(node.getData()),stat.getVersion());
                } else {
                    throw new NodeKeeperException(String.format("cannot find handler for '%s'",node.getData().getClass().getName()));
                }
            } else {
                //create all node parent recursively if necessary
                if(node.getPath().contains(PATH_SEPARATOR) && node.getPath().lastIndexOf(PATH_SEPARATOR)>0) {
                    buildRecursively(node.getPath().substring(0, node.getPath().lastIndexOf(PATH_SEPARATOR)), String.format("created by %s", this.getClass().getName()).getBytes());
                }
                //serialize data
                if(handlers.containsKey(clazz)) {
                    //create this node
                    zk.create(node.getPath(), handlers.get(clazz).serialize(node.getData()), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
                } else {
                    throw new NodeKeeperException(String.format("cannot find handler for '%s'",node.getData().getClass().getName()));
                }
            }
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("cannot write data for node '%s'", node.getPath()));
        }
    }
View Full Code Here

            Stat stat;
            if((stat=zk.exists(node.getPath(),false))!=null) {
                zk.delete(node.getPath(),stat.getVersion());
            }
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("cannot delete node '%s'", node.getPath()));
        }
    }
View Full Code Here

                Node<T> node = readNode(path.equals("/") ? path+key : path+PATH_SEPARATOR+key, clazz);
                if(node != null) nodes.add(node);
            }
            return nodes;
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("cannot read children for '%s'", path));
        } catch (IOException e) {
            throw new NodeKeeperException(String.format("cannot read children for '%s'", path));
        }
    }
View Full Code Here

    public int nbOfChildren(String path) throws NodeKeeperException, InterruptedException {
        try {
            return zk.getChildren(path,false).size();
        } catch (KeeperException e) {
            throw new NodeKeeperException(String.format("cannot read children for '%s'", path));
        }
    }
View Full Code Here

TOP

Related Classes of at.salzburgresearch.nodekeeper.exception.NodeKeeperException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.