Ejemplo n.º 1
0
  @Override
  public List<MdTable> getTables() {
    List<MdTable> tables = new ArrayList<>();

    for (String xmlFile : reflections.getStore().getResources(XML_FILE)) {
      try (InputStream is = getClass().getClassLoader().getResourceAsStream(xmlFile)) {
        List<MdTable> ts = getTables(is);
        int numTables = 0;
        if (ts != null) {

          tables.addAll(ts);
          numTables = ts.size();

          for (MdTable t : ts) {
            t.getMetadata().put(TABLE_SOURCE_KEY, xmlFile);
          }
        }
        log.info(String.format("%d tables loaded from XML file: %s", numTables, xmlFile));
      } catch (Exception ex) {
        if (log.isDebugEnabled()) {
          log.debug(String.format("Error while loading tables from XML file %s: %s", xmlFile, ex));
        }
      }
    }
    return tables;
  }
Ejemplo n.º 2
0
 @Get
 public void data() throws ResourceException {
   MdTable t = tmd.getTable();
   String sql = String.format(SQL, t.getNamespace(), t.getName());
   String id = qf.createQuery(sql);
   String path =
       getReference()
           .getPath()
           .replaceFirst(
               "/table/" + t.getNamespace() + "/" + t.getName() + "/", "/query/" + id + "/");
   URL ref = cfg.getReference(getHostRef(), getReference().getQuery(), path);
   getResponse().redirectTemporary(ref.toString());
 }