Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Chronicle


      sel_entities_by_attribute.setString(1, stringValue);
      sel_entities_by_attribute.setInt(2, getId(property));
      ResultSet rs = sel_entities_by_attribute.executeQuery();
      while (rs.next()) {
        Surrogate surrogate = makeSurrogate(property.getSurrogate().getDatabase(), DBObjectType.CHRONICLE, rs.getInt(1));
        Chronicle chronicle = new ChronicleImpl(surrogate);
        check(Permission.READ, chronicle);
        chronicles.add(chronicle);
        if (maxSize > 0 && chronicles.size() >= maxSize)
          break;
      }
View Full Code Here


      select_series_by_id = open(SELECT_SERIES_BY_ID, surrogate, select_series_by_id);
      int id = getId(surrogate);
      select_series_by_id.setInt(1, id);
      ResultSet rs = select_series_by_id.executeQuery();
      if (rs.next()) {
        Chronicle chronicle = new ChronicleImpl(makeSurrogate(surrogate.getDatabase(), DBObjectType.CHRONICLE, rs.getInt(1)));
        return new SeriesImpl<T>(chronicle, null, rs.getInt(2), surrogate);
      } else
        return null;
    } catch (SQLException e) {
      throw T2DBJMsg.exception(e, J.J50119, surrogate.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

  public UpdatableChronicle createChronicle(String orig, boolean tweakable, String description, Collection<Attribute<?>> attributes, Schema schema) throws T2DBException {
    if (getSurrogate().inConstruction() && !isTopChronicle())
      throw T2DBMsg.exception(D.D40108, getName(true));
    else {
      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 (!equals(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.