@Override public Id newDataSource(String name, String baseURI) { checkLink(); if ( !DeltaOps.isValidName(name) ) throw new IllegalArgumentException("Invalid data source name: '" + name + "'"); return localServer.createDataSource(name, baseURI); }
public PHandlerOutput(OutputStream output) { TokenWriter tokenWriter = DeltaOps.tokenWriter(output) ; scWriter = new RDFChangesWriter(tokenWriter) ; }
@Override public Id newDataSource(String name, String uri) { Objects.requireNonNull(name); if ( ! DeltaOps.isValidName(name) ) throw new IllegalArgumentException("Invalid data source name: '"+name+"'"); JsonObject arg = JSONX.buildObject((b) -> { b.key(DeltaConst.F_NAME).value(name); if ( uri != null ) b.key(DeltaConst.F_URI).value(uri); }); JsonObject obj = rpc(DeltaConst.OP_CREATE_DS, arg); // Exists? String idStr = obj.get(DeltaConst.F_ID).getAsString().value(); Id dsRef = Id.fromString(idStr); return dsRef; }
private RDFChangesHTTP(String label, Object syncObject, Supplier<String> urlSupplier, Runnable resetAction, ByteArrayOutputStream out) { super(DeltaOps.tokenWriter(out)); this.syncObject = (syncObject!=null) ? syncObject : new Object(); this.resetAction = resetAction; this.urlSupplier = urlSupplier; this.destLabel = label; this.bytes = out; reset(); }
public void logDetails() { // Information. List<DataSource> sources = listDataSources(); if ( sources.isEmpty() ) FmtLog.info(LOG, " No data sources"); else { //descriptions.forEach(dsd->FmtLog.info(LOG, " Data source : %s", dsd)); // Print nicely. sources.sort( (ds1, ds2)-> ds1.getName().compareTo(ds2.getName()) ); sources.forEach(ds->{ PatchLogInfo info = ds.getPatchLog().getInfo(); FmtLog.info(Delta.DELTA_LOG, " Data source: %s version [%s,%s]", info.getDataSourceDescr(), verString(info.getMinVersion()), verString(info.getMaxVersion()) ); }); } }
throw new CmdException(String.format("Illegal character '%c' in data source name: '%s'", ch, dataSourceName)); if ( ! DeltaOps.isValidName(dataSourceName) ) throw new CmdException("Not a valid data source name: '"+dataSourceName+"'");