Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Chronicle


    Surrogate s = chronicle.getSurrogate();
    MongoDatabase db = (MongoDatabase) s.getDatabase();
    try {
      check(Permission.MODIFY, chronicle);
      policy.willDelete(chronicle);
      Chronicle original = getChronicle(s);
      getMongoDB(s).getChronicles().remove(asQuery(s.getId()), WriteConcern.SAFE);
      db.sleep();
      try {
        policy.willDelete(chronicle);
      } catch (T2DBException e) {
View Full Code Here


  public <T> void willDelete(ValueType<T> valueType, T valuethrows T2DBException {
  }
 
  private String chronicleName(Surrogate entity) {
    try {
      Chronicle c = entity.getDatabase().getChronicle(entity);
      return c.getName(true);
    } catch (T2DBException e) {
      // no read permission for example
      return entity.toString();
    }
  }
View Full Code Here

    return result;
  }

  @Override
  public Chronicle getCollection() throws T2DBException {
    Chronicle result = null;
    if (collection != null)
      result = collection;
    else if (!getSurrogate().inConstruction())
      result = super.getCollection();
    return result;
View Full Code Here

   
    if (schema instanceof UpdatableSchema)
      throw T2DBMsg.exception(D.D40104, getName(true), schema.getName());
   
    String name = getDatabase().getNamingPolicy().checkSimpleName(orig,  tweakable);
    Chronicle current = getChronicle(name, false);
    if (current != null) {
      if (tweakable) {
        name = findNextAvailableName(name, 2, 9);
        if (name == null)
          throw T2DBMsg.exception(D.D40127, name, getName(true));
View Full Code Here

 
  private boolean updateIfModified() throws T2DBException {
    boolean anything = false;
    String name = getName(false);
    String description = getDescription(false);
    Chronicle current = getDatabase().getChronicle(this);
    Chronicle collection = getCollection();
    Schema schema = getSchema(false);
    if (!equal(name, current.getName(false))) {
      getDatabase().getNamingPolicy().checkSimpleName(name, false);
      anything = true;
    }
View Full Code Here

    String seriesName = es[1];
    UpdatableSeries<T> series = null;
    if (chronicleName == null) {
      throw T2DBMsg.exception(D.D50116, name);
    } else {
      Chronicle ent = getChronicle(chronicleName, mustExist);
      if (ent != null) {
        UpdatableChronicle updEnt = ent.edit();
        series = updEnt.updateSeries(seriesName);
        if (series == null && mustExist)
          series = updEnt.createSeries(seriesName);
      }
    }
View Full Code Here

  public <T> Series<T> getSeries(String name, boolean mustExist) throws T2DBException {
    Series<T> series = null;
    String[] split = getNamingPolicy().split(name);
    if (split[0] == null)
      throw T2DBMsg.exception(D.D50116, name);
    Chronicle chronicle = getChronicle(split[0], mustExist);
    if (chronicle != null) {
      Series<T>[] s = chronicle.getSeries(new String[]{split[1]}, null, mustExist);
      series = s[0];
    }
    if (series == null && mustExist)
      throw T2DBMsg.exception(D.D50106, name);
    return series;
View Full Code Here

  }

  @Override
  public Chronicle getChronicle(Surrogate surrogate) throws T2DBException {
    checkSurrogate(surrogate, DBObjectType.CHRONICLE);
    Chronicle chronicle = new ChronicleImpl(surrogate);
    chronicle.getName(false); // side-effect: make sure it exists
    return chronicle;
  }
View Full Code Here

      ChronicleImpl e = c == null ? null : c.lookUpChronicle(getSurrogate());
      if (e != null) {
        data = e.data;
//        int log4j; d.getMessageListener().log(Level.INFO, String.format("*** CACHE HIT: %s %d", toString(), c.size()));
      } else {
        Chronicle chronicle = d.getChronicle(this);
        data = ((ChronicleImpl) chronicle).data;
        // cache the "parent"
        if (c != null && data.collection != null)
          c.store((ChronicleImpl) data.collection);
//        int log4j; d.getMessageListener().log(Level.INFO, String.format("*** CACHE MISS: %s %d", toString(),  c.size()));
View Full Code Here

    }
  }
 
  @Override
  public Chronicle getChronicle(String simpleName, boolean mustExist) throws T2DBException {
    Chronicle chronicle = getDatabase().getChronicleOrNull(this, simpleName);
    if (chronicle == null && mustExist)
      throw T2DBMsg.exception(D.D40102, getName(true), simpleName);
    else
      return chronicle;
  }
View Full Code Here

TOP

Related Classes of ch.agent.crnickl.api.Chronicle

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.