Package de.fhg.igd.mongomvcc

Examples of de.fhg.igd.mongomvcc.VException


      //synchronize the following part, because we first resolve the branch
      //and then update it
      synchronized (this) {
        //check for conflicts (i.e. if another thread has already updated the branch's head)
        if (_tree.resolveBranch(_name).getCID() != c.getParentCID()) {
          throw new VException("Branch " + _name + " has already been " +
              "updated by another commit");
        }
        _tree.updateBranchHead(_name, c.getCID());
      }
    }
View Full Code Here


    //synchronize here, because we first check for branch existence
    //and then we write
    synchronized(this) {
      //check prerequisites
      if (_branches.findOne(name) != null) {
        throw new VException("A branch with the name " + name + " already exists");
      }
      resolveCommit(headCID);
     
      //create branch
      DBObject o = new BasicDBObject();
View Full Code Here

   * @throws VException if the branch does not exist
   */
  private DBObject findBranch(String name) {
    DBObject branch = _branches.findOne(name);
    if (branch == null) {
      throw new VException("Unknown branch: " + name);
    }
    return branch;
  }
View Full Code Here

   * @throws VException if the commit is unknown
   */
  public Commit resolveCommit(long cid) {
    DBObject o = _commits.findOne(cid);
    if (o == null) {
      throw new VException("Unknown commit: " + cid);
    }
    return deserializeCommit(o);
  }
View Full Code Here

 
  @Override
  public long getParent(long cid) {
    DBObject o = _commits.findOne(cid, new BasicDBObject(PARENT_CID, 1));
    if (o == null) {
      throw new VException("Unknown commit: " + cid);
    }
    return (Long)o.get(PARENT_CID);
  }
View Full Code Here

  }

  @Override
  public long[] getChildren(long cid) {
    if (cid != 0 && !existsCommit(cid)) {
      throw new VException("Unknown commit: " + cid);
    }
    DBCursor c = _commits.find(new BasicDBObject(PARENT_CID, cid),
        new BasicDBObject(MongoDBConstants.ID, 1));
    long[] r = new long[c.count()];
    int i = 0;
View Full Code Here

   * @param cid the commit's CID
   * @return true if the commit has children, false otherwise
   */
  public boolean hasChildren(long cid) {
    if (cid != 0 && !existsCommit(cid)) {
      throw new VException("Unknown commit: " + cid);
    }
    return (_commits.count(new BasicDBObject(PARENT_CID, cid)) > 0);
  }
View Full Code Here

  public void connect(String name) throws VException {
    Mongo mongo;
    try {
      mongo = new Mongo();
    } catch (UnknownHostException e) {
      throw new VException("Unknown host", e);
    }
    connectInternal(name, mongo);
  }
View Full Code Here

  public void connect(String name, String host, int port) throws VException {
    Mongo mongo;
    try {
      mongo = new Mongo(new ServerAddress(host, port));
    } catch (UnknownHostException e) {
      throw new VException("Unknown host", e);
    }
    connectInternal(name, mongo);
  }
View Full Code Here

      for (String attr : binaryAttributes) {
        long gridId = (Long)obj.get(attr);
        obj.put(attr, _convert.convert(gridId));
      }
    } catch (IOException e) {
      throw new VException("Could not read binary data", e);
    }
   
    obj.remove(BINARY_ATTRIBUTES);
  }
View Full Code Here

TOP

Related Classes of de.fhg.igd.mongomvcc.VException

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.