Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Surrogate


//
//  }

  private Property<?> getBuiltInProperty(int magicNumber) throws T2DBException {
    SurrogateImpl thisKey = (SurrogateImpl) getSurrogate();
    Surrogate propKey = new SurrogateImpl(thisKey.getDatabase(), DBObjectType.PROPERTY, magicNumber);
    return thisKey.getDatabase().getProperty(propKey);
  }
View Full Code Here


        new SurrogateImpl(this, DBObjectType.VALUE_TYPE, null));
  }
 
  @Override
  public <T> UpdatableProperty<T> createProperty(String name,  ValueType<T> valueType, boolean indexed) throws T2DBException {
    Surrogate  surrogate = new SurrogateImpl(this, DBObjectType.PROPERTY, null);
    return new UpdatablePropertyImpl<T>(name, valueType, indexed, surrogate);
  }
View Full Code Here

      Collection<UpdatableSchema> list = getUpdatableSchemas(nameOfBase);
      if (list.size() != 1)
        throw T2DBMsg.exception(D.D30109, name, nameOfBase);
      base = list.iterator().next();
    }
    Surrogate surrogate = new SurrogateImpl(this, DBObjectType.SCHEMA, null);
    return new UpdatableSchemaImpl(name, base, null, null, surrogate);
  }
View Full Code Here

  @Override
  public Range getRange(Series<Double> series) throws T2DBException {
    Range range = null;
    try {
      check(Permission.READ, series);
      Surrogate s = series.getSurrogate();
      BasicDBObject obj = (BasicDBObject) getObject(s, false);
      if (obj != null) {
        long first = obj.getLong(MongoDatabase.FLD_SER_FIRST);
        long last = obj.getLong(MongoDatabase.FLD_SER_LAST);
        range = new Range(series.getTimeDomain(), first, last);
View Full Code Here

    if (range != null && range.isEmpty())
      return 0;
    long count = 0;
    try {
      check(Permission.READ, series);
      Surrogate s = series.getSurrogate();
      DBObject obj = getObject(s, true);
      count = extractValues(obj, range, ts);
    } catch (Exception e) {
      if (range == null)
        throw T2DBMsg.exception(e, E.E50121, series.getName(true));
View Full Code Here

 
  @Override
  public Observation<Double> getFirst(Series<Double> series, TimeIndex time) throws T2DBException {
    try {
      check(Permission.READ, series);
      Surrogate s = series.getSurrogate();
      DBObject obj = getObject(s, true);
      return extractFirstValue((BasicDBObject) obj, series.getTimeDomain(),  time);
    } catch (Exception e) {
      throw T2DBMsg.exception(e, E.E50123, series.getName(true), time.toString());
    }
View Full Code Here

 
  @Override
  public Observation<Double> getLast(Series<Double> series, TimeIndex time) throws T2DBException {
    try {
      check(Permission.READ, series);
      Surrogate s = series.getSurrogate();
      DBObject obj = getObject(s, true);
      return extractLastValue((BasicDBObject) obj, series.getTimeDomain(),  time);
    } catch (Exception e) {
      throw T2DBMsg.exception(e, E.E50124, series.getName(true), time.toString());
    }
View Full Code Here

    try {
      check(Permission.MODIFY, series);
      policy.willDelete(series, t);
      policy.deleteValue(series, t);
     
      Surrogate s = series.getSurrogate();
      DBObject obj = getObject(s, true);
      // force sparse, so it's always possible to repair when there are excessive gaps
      TimeAddressable<Double> values = TimeSeriesFactory.make(series.getTimeDomain(), Double.class, true);
      extractValues(obj, null, values);
      if (values.getRange().isInRange(t)) {
View Full Code Here

    boolean done = false;
    try {
      check(Permission.MODIFY, series);
      policy.willUpdate(series, range);
      done = policy.update(series, range);
      Surrogate s = series.getSurrogate();
      DBObject obj = getObject(s, true);
      // force sparse, so it's always possible to repair when there are excessive gaps
      TimeAddressable<Double> values = TimeSeriesFactory.make(series.getTimeDomain(), Double.class, true);
      extractValues(obj, null, values);
      if (values.setRange(range))
View Full Code Here

  public long updateValues(UpdatableSeries<Double> series, TimeAddressable<Double> values, ChronicleUpdatePolicy policy) throws T2DBException {
    long count = 0;
   
    try {
      check(Permission.MODIFY, series);
      Surrogate s = series.getSurrogate();
      DBObject obj = getObject(s, true);
      // force sparse, so it's always possible to repair when there are excessive gaps
      TimeAddressable<Double> current = TimeSeriesFactory.make(series.getTimeDomain(), Double.class, true);
      extractValues(obj, null, current);
      for(Observation<Double> obs : values) {
View Full Code Here

TOP

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

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.