private synchronized SchemaEntry createNewSchemaFile(String schema) { try { int newId = largestId + 1; File f = getSchemaFile(String.valueOf(newId)); if (!f.exists() && f.createNewFile()) { Writer output = new BufferedWriter(new FileWriter(f)); try { output.write(schema); output.flush(); } finally { output.close(); } latest = new SchemaEntry(String.valueOf(newId), schema); largestId++; return latest; } else { throw new RuntimeException( "Unable to register schema, schema file either exists already " + " or couldn't create new file"); } } catch (NumberFormatException e) { throw new RuntimeException( "Unable to register schema, invalid schema latest schema id ", e); } catch (IOException e) { throw new RuntimeException( "Unable to register schema, couldn't create schema file ", e); } }
private synchronized SchemaEntry createNewSchemaFile(String schema) { try { int newId = largestId + 1; File f = getSchemaFile(String.valueOf(newId)); if (!f.exists() && f.createNewFile()) { Writer output = new BufferedWriter(new FileWriter(f)); try { output.write(schema); output.flush(); } finally { output.close(); } latest = new SchemaEntry(String.valueOf(newId), schema); largestId++; return latest; } else { throw new RuntimeException( "Unable to register schema, schema file either exists already " + " or couldn't create new file"); } } catch (NumberFormatException e) { throw new RuntimeException( "Unable to register schema, invalid schema latest schema id ", e); } catch (IOException e) { throw new RuntimeException( "Unable to register schema, couldn't create schema file ", e); } }
private File getSchemaFile(int id) { return getSchemaFile(String.valueOf(id)); }
"' duplicated in " + idFile.getAbsolutePath()); fileReadable(getSchemaFile(id)); schemaFileNames.remove(getSchemaFileName(id));
"' duplicated in " + idFile.getAbsolutePath()); fileReadable(getSchemaFile(id)); schemaFileNames.remove(getSchemaFileName(id));
private File getSchemaFile(int id) { return getSchemaFile(String.valueOf(id)); }
private String readSchemaForId(String id) { File schemaFile = getSchemaFile(id); return readSchemaFile(schemaFile); }
private String readSchemaForId(String id) { File schemaFile = getSchemaFile(id); return readSchemaFile(schemaFile); }