private void determineDataInGzipFormat(String table) throws ResourceInitializationException { doGzip = true; dataTable = dbc.getNextOrThisDataTable(table); log.debug("Fetching a single row from data table {} in order to determine whether data is in GZIP format", dataTable); try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ ResultSet rs = conn.createStatement().executeQuery(String.format("SELECT xmi FROM %s LIMIT 1", dataTable)); while (rs.next()) { byte[] xmiData = rs.getBytes("xmi"); try (GZIPInputStream gzis = new GZIPInputStream(new ByteArrayInputStream(xmiData))) { gzis.read(); } catch (IOException e) { log.debug("Attempt to read XMI data in GZIP format failed. Assuming non-gzipped XMI data. Expected exception:", e); doGzip = false; } } } catch (SQLException e) { if (e.getMessage().contains("does not exist")) log.error("An exception occurred when trying to read the xmi column of the data table \"{}\". It seems the table does not contain XMI data and this is invalid to use with this reader.", dataTable); throw new ResourceInitializationException(e); } }
private void determineDataInGzipFormat(String table) throws ResourceInitializationException { doGzip = true; dataTable = dbc.getNextOrThisDataTable(table); log.debug("Fetching a single row from data table {} in order to determine whether data is in GZIP format", dataTable); try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ ResultSet rs = conn.createStatement().executeQuery(String.format("SELECT xmi FROM %s LIMIT 1", dataTable)); while (rs.next()) { byte[] xmiData = rs.getBytes("xmi"); try (GZIPInputStream gzis = new GZIPInputStream(new ByteArrayInputStream(xmiData))) { gzis.read(); } catch (IOException e) { log.debug("Attempt to read XMI data in GZIP format failed. Assuming non-gzipped XMI data. Expected exception:", e); doGzip = false; } } } catch (SQLException e) { if (e.getMessage().contains("does not exist")) log.error("An exception occurred when trying to read the xmi column of the data table \"{}\". It seems the table does not contain XMI data and this is invalid to use with this reader.", dataTable); throw new ResourceInitializationException(e); } } }
private void determineDataInGzipFormat(String table) throws ResourceInitializationException { doGzip = true; dataTable = dbc.getNextOrThisDataTable(table); log.debug("Fetching a single row from data table {} in order to determine whether data is in GZIP format", dataTable); try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()) { ResultSet rs = conn.createStatement().executeQuery(String.format("SELECT xmi FROM %s LIMIT 1", dataTable)); while (rs.next()) { byte[] xmiData = rs.getBytes("xmi"); try (GZIPInputStream gzis = new GZIPInputStream(new ByteArrayInputStream(xmiData))) { gzis.read(); } catch (IOException e) { log.debug("Attempt to read XMI data in GZIP format failed. Assuming non-gzipped XMI data. Expected exception:", e); doGzip = false; } } } catch (SQLException e) { if (e.getMessage().contains("does not exist")) log.error("An exception occurred when trying to read the xmi column of the data table \"{}\". It seems the table does not contain XMI data and this is invalid to use with this reader.", dataTable); throw new ResourceInitializationException(e); } } }
/** * Determines the data table. This may be the specified table itself or, if it is a subset, the first referenced data table. * * @throws ResourceInitializationException If an SQL exception occurs. */ private void determineDataTable() throws ResourceInitializationException { try { readDataTable = dbc.withConnectionQueryBoolean(c -> c.isDataTable(tableName)); dataTable = dbc.withConnectionQueryString(c -> c.getNextOrThisDataTable(tableName)); if (readDataTable) log.info("The table \"{}\" is a data table, documents will not be marked to be in process and no " + "synchronization of multiple DB readers will happen.", tableName); } catch (CoStoSysSQLRuntimeException e) { throw new ResourceInitializationException(e); } }
String dataTable = null; try { dataTable = dbc.getNextOrThisDataTable(tableName); dbc.checkTableDefinition(dataTable, xmiDocumentTableSchema.getName()); } catch (CoStoSysSQLRuntimeException e) {