Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.UpdatableSchema


   * @param surrogate a surrogate
   * @return a schema or null
   * @throws T2DBException
   */
  public UpdatableSchema getSchema(Surrogate surrogate) throws T2DBException {
    UpdatableSchema schema = null;
    RawSchema rawSchema = getRawSchema(surrogate);
    if (rawSchema != null)
      schema = getSchema(surrogate.getDatabase(), rawSchema, null);
    return schema;
  }
View Full Code Here


   * @return an updatable schema
   * @throws T2DBException
   */
  private UpdatableSchema getSchema(Database database, RawSchema rawSchema, Set<Integer> cycleDetector) throws T2DBException {
   
    UpdatableSchema schema = null;
    if (cycleDetector == null)
      cycleDetector = new HashSet<Integer>();

    boolean cycleDetected = !cycleDetector.add(rawSchema.getId());
   
    String name = rawSchema.getName();
    UpdatableSchema base = null;
    if (rawSchema.getParent() > 0 && !cycleDetected) {
      Surrogate parentKey = makeSurrogate(database, DBObjectType.SCHEMA, rawSchema.getParent());
      RawSchema rawBaseSchema = getRawSchema(parentKey);
      if (rawBaseSchema == null)
        throw T2DBMsg.exception(E.E30116, rawSchema.getParent(), name);
View Full Code Here

    boolean nameEdited = nameEdited(schema, rawSchema);
    boolean baseEdited = baseEdited(schema, rawSchema);
    if (nameEdited || baseEdited) {
      try {
        check(Permission.MODIFY, schema);
        UpdatableSchema previousBase = ((UpdatableSchemaImpl) schema).getPreviousBase();
        if (schema.getBase() != null && !schema.getBase().equals(previousBase))
          check(Permission.READ, schema.getBase());
        update_schema = open(UPDATE_SCHEMA, schema, update_schema);
        update_schema.setString(1, name);
        update_schema.setInt(2, getIdOrZero(base));
View Full Code Here

  private boolean nameEdited(UpdatableSchema schema, RawSchema current) {
    return !schema.getName().equals(current.getName());
  }
 
  private boolean baseEdited(UpdatableSchema schema, RawSchema current) {
    UpdatableSchema base = schema.getBase();
    int editedBaseId = getIdOrZero(base);
    int currentBaseId = current.getParent();
    return editedBaseId != currentBaseId;
  }
View Full Code Here

   * @param surrogate a surrogate
   * @return a schema or null
   * @throws T2DBException
   */
  public UpdatableSchema getSchema(Surrogate surrogate) throws T2DBException {
    UpdatableSchema schema = null;
    RawSchema rawSchema = getRawSchema(surrogate);
    if (rawSchema != null)
      schema = getSchema(surrogate.getDatabase(), rawSchema, null);
    return schema;
  }
View Full Code Here

    if (cycleDetector.contains(rawSchema.getId()))
      throw T2DBJMsg.exception(J.J30115, rawSchema.getId(), cycleDetector.toString());
    cycleDetector.add(rawSchema.getId());
    UpdatableSchemaImpl schema = null;
    String name = rawSchema.getName();
    UpdatableSchema base = null;
    if (rawSchema.getParent() > 0) {
      Surrogate parentKey = makeSurrogate(database, DBObjectType.SCHEMA, rawSchema.getParent());
      RawSchema brs = getRawSchema(parentKey);
      if (brs == null)
        throw T2DBJMsg.exception(J.J30116, rawSchema.getParent(), name);
View Full Code Here

    return getReadMethodsForSchema().getSchemaSurrogateList(this, pattern);
  }

  @Override
  public UpdatableSchema getUpdatableSchema(Surrogate surrogate) throws T2DBException {
    UpdatableSchema schema = getReadMethodsForSchema().getSchema(surrogate);
    if (schema == null)
      throw T2DBMsg.exception(E.E30109, surrogate.toString());
    return schema;
  }
View Full Code Here

    return getReadMethodsForSchema().getSchemaSurrogateList(this, pattern);
  }

  @Override
  public UpdatableSchema getUpdatableSchema(Surrogate surrogate) throws T2DBException {
    UpdatableSchema schema = getReadMethodsForSchema().getSchema(surrogate);
    if (schema == null)
      throw T2DBJMsg.exception(J.J30109, surrogate.toString());
    return schema;
  }
View Full Code Here

    return schema;
  }

  @Override
  public void create(UpdatableSchema schema) throws T2DBException {
    UpdatableSchema base = schema.getBase();
    getWriteMethodsForSchema().createSchema((UpdatableSchemaImpl) schema, base);
    publish(new UpdateEventImpl(UpdateEventOperation.CREATE, schema));
  }
View Full Code Here

    return getReadMethodsForSchema().getSchemaSurrogateList(this, pattern);
  }

  @Override
  public UpdatableSchema getUpdatableSchema(Surrogate surrogate) throws T2DBException {
    UpdatableSchema schema = getReadMethodsForSchema().getSchema(surrogate);
    if (schema == null)
      throw T2DBMsg.exception(E.E30109, surrogate.toString());
    return schema;
  }
View Full Code Here

TOP

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

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.