Пример #1
0
  // save to the indus server
  public static boolean writeTypeOld(DataType type) {
    // the old XML-based storage
    // return write(CMD_UPDATE_TYPE, type.getName(), type);

    // 2006-06-20 compressed plain text
    // @see InfoReader
    String text = Zip.encode(type.toText());
    // Debug.trace("after encoding: "+text.length());
    // send to server
    IndusHttpClient client = new IndusHttpClient();
    String res = client.sendCmd(CMD_UPDATE_TYPE + ";name=" + type.getName() + ";value=" + text);
    return res.equals(RES_OK);
  }
Пример #2
0
  /**
   * @param schema
   * @return
   * @author Jie Bao
   * @since 2006-07-01
   */
  public static boolean writeSchema(Schema schema) {
    // save to database
    String value = Zip.encode(schema.toText());
    String name = schema.getName();
    String space = IndusBasis.user.name;

    Map<String, String> values = new HashMap<String, String>();

    values.put("name", name);
    values.put("value", value);
    values.put("space", space);

    Connection db = IndusBasis.indusSystemDB.db;
    return JDBCUtils.insertOrUpdateDatabase(db, "schemas", values, "name");
  }
Пример #3
0
  public static boolean writeMapping(DataSourceMapping mapping) {
    // writeMappingOld(type);

    // save to database
    String value = Zip.encode(mapping.toText());
    String name = mapping.getName();
    String space = IndusBasis.user.name;
    String format = "XML1.0";

    Map<String, String> values = new HashMap<String, String>();

    values.put("name", name);
    values.put("value", value);
    values.put("space", space);
    values.put("ont1", mapping.schemaMapping.from);
    values.put("ont2", mapping.schemaMapping.to);
    values.put("format", format);

    Connection db = IndusBasis.indusSystemDB.db;
    return JDBCUtils.insertOrUpdateDatabase(db, "mappings", values, "name");
  }