Package org.apache.zookeeper.proto

Examples of org.apache.zookeeper.proto.Create2Response


                case ZooDefs.OpCode.create:
                    new CreateResponse(((OpResult.CreateResult) result).getPath()).serialize(archive, tag);
                    break;
                case ZooDefs.OpCode.create2:
                  OpResult.CreateResult createResult = (OpResult.CreateResult) result;
                    new Create2Response(createResult.getPath(),
                        createResult.getStat()).serialize(archive, tag);
                    break;
                case ZooDefs.OpCode.delete:
                case ZooDefs.OpCode.check:
                    break;
View Full Code Here


                    cr.deserialize(archive, tag);
                    results.add(new OpResult.CreateResult(cr.getPath()));
                    break;

                case ZooDefs.OpCode.create2:
                    Create2Response cr2 = new Create2Response();
                    cr2.deserialize(archive, tag);
                    results.add(new OpResult.CreateResult(cr2.getPath(), cr2.getStat()));
                    break;

                case ZooDefs.OpCode.delete:
                    results.add(new OpResult.DeleteResult());
                    break;
View Full Code Here

        final String serverPath = prependChroot(clientPath);

        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.create2);
        Create2Request request = new Create2Request();
        Create2Response response = new Create2Response();
        request.setData(data);
        request.setFlags(createMode.toFlag());
        request.setPath(serverPath);
        if (acl != null && acl.size() == 0) {
            throw new KeeperException.InvalidACLException();
        }
        request.setAcl(acl);
        ReplyHeader r = cnxn.submitRequest(h, request, response, null);
        if (r.getErr() != 0) {
            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
                    clientPath);
        }
        if (stat != null) {
            DataTree.copyStat(response.getStat(), stat);
        }
        if (cnxn.chrootPath == null) {
            return response.getPath();
        } else {
            return response.getPath().substring(cnxn.chrootPath.length());
        }
    }
View Full Code Here

        final String serverPath = prependChroot(clientPath);

        RequestHeader h = new RequestHeader();
        h.setType(ZooDefs.OpCode.create2);
        Create2Request request = new Create2Request();
        Create2Response response = new Create2Response();
        ReplyHeader r = new ReplyHeader();
        request.setData(data);
        request.setFlags(createMode.toFlag());
        request.setPath(serverPath);
        request.setAcl(acl);
View Full Code Here

                      } else {
                          cb.processResult(rc, clientPath, p.ctx, null);
                      }
                  } else if (p.response instanceof Create2Response) {
                    Create2Callback cb = (Create2Callback) p.cb;
                      Create2Response rsp = (Create2Response) p.response;
                      if (rc == 0) {
                          cb.processResult(rc, clientPath, p.ctx,
                                  (chrootPath == null
                                          ? rsp.getPath()
                                          : rsp.getPath()
                                    .substring(chrootPath.length())), rsp.getStat());
                      } else {
                          cb.processResult(rc, clientPath, p.ctx, null, null);
                      }                  
                  } else if (p.response instanceof MultiResponse) {
                    MultiCallback cb = (MultiCallback) p.cb;
                    MultiResponse rsp = (MultiResponse) p.response;
                    if (rc == 0) {
                      List<OpResult> results = rsp.getResultList();
                      int newRc = rc;
                      for (OpResult result : results) {
                        if (result instanceof ErrorResult
                            && KeeperException.Code.OK.intValue() != (newRc = ((ErrorResult) result)
                            .getErr())) {
View Full Code Here

                err = Code.get(rc.err);
                break;
            }
            case OpCode.create2: {
                lastOp = "CREA";
                rsp = new Create2Response(rc.path, rc.stat);
                err = Code.get(rc.err);
                break;
            }
            case OpCode.delete: {
                lastOp = "DELE";
View Full Code Here

TOP

Related Classes of org.apache.zookeeper.proto.Create2Response

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.