private void checkTableExists() throws ResourceInitializationException { // Check whether the table we are supposed to read from actually exists. if (!dbc.withConnectionQueryBoolean(c -> c.tableExists(tableName))) { throw new ResourceInitializationException( new IllegalArgumentException("The configured table \"" + tableName + "\" does not exist.")); } }
String tableName = rawTableName.replaceAll("\\.", "_"); resultTableName = schema + "." + tableName; } else if (dbc.tableExists(rawName)) { resultTableName = rawName; } else if (dbc.tableExists(additionalTablesPGSchema + "." + rawName.replaceAll("\\.", "_"))) { resultTableName = additionalTablesPGSchema + "." + rawName.replaceAll("\\.", "_");
private void createNamespaceTable(DataBaseConnector dbc) { if (!dbc.tableExists(dbc.getActiveDataPGSchema() + "." + XMI_NS_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("CREATE TABLE %s (%s text PRIMARY KEY, %s text)", dbc.getActiveDataPGSchema() + "." + XMI_NS_TABLE, PREFIX, NS_URI); stmt.execute(sql); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } }
private Map<String, String> getNamespaceMap() { Map<String, String> map = null; if (dbc.tableExists(dbc.getActiveDataPGSchema() + "." + XmiSplitConstants.XMI_NS_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ map = new HashMap<>(); conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("SELECT %s,%s FROM %s", XmiSplitConstants.PREFIX, XmiSplitConstants.NS_URI, dbc.getActiveDataPGSchema() + "." + XmiSplitConstants.XMI_NS_TABLE); ResultSet rs = stmt.executeQuery(String.format(sql)); while (rs.next()) map.put(rs.getString(1), rs.getString(2)); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } else { log.warn( "Table \"{}\" was not found it is assumed that the table from which is read contains complete XMI documents.", dbc.getActiveDataPGSchema() + "." + XmiSplitConstants.XMI_NS_TABLE); } return map; }
private void createAnnotationListTable() { if (!dbc.tableExists(dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE)) { try (CoStoSysConnection conn = dbc.obtainOrReserveConnection()){ conn.setAutoCommit(true); Statement stmt = conn.createStatement(); String sql = String.format("CREATE TABLE %s (%s text PRIMARY KEY)", dbc.getActiveDataPGSchema() + "." + ANNOTATION_LIST_TABLE, TABLE_NAME); stmt.execute(sql); } catch (SQLException e) { e.printStackTrace(); SQLException ne = e.getNextException(); if (null != ne) ne.printStackTrace(); } } } }
effectiveTableName = dbDocumentTableName; try { if (!dbc.tableExists(effectiveTableName)) { log.info("Creating table '{}' with schema '{}' (columns: {}).", effectiveTableName, schema, dbc.getFieldConfiguration(schema).getColumns());
for (String annotation : annotationsToStore) { String annotationTableName = annotationTableManager.convertAnnotationTypeToTableName(annotation, storeAll); if (dbc.tableExists(annotationTableName)) checkTableDefinition(annotationTableName, schemaAnnotation); serializedCASes.put(annotationTableName, new ArrayList<>()); if (dbc.tableExists(effectiveDocTableName)) checkTableDefinition(effectiveDocTableName, schemaDocument);