public URI createList(String href, String base) throws MalformedURLException, FileNotFoundException, IOException { return fallback.createList(href, base); }
public void deleteEntry(String href, String base) throws MalformedURLException, FileNotFoundException, IOException { fallback.deleteEntry(href, base); }
boolean isFile(URI id) throws IOException { final String entry = id.toASCIIString(); final List<String> entries = new ArrayList<String>(); DataStore store = runtime.getDataStore(); store.infoEntry(entry, entry, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { if (media != null) { entries.add(media); } } }); return !entries.isEmpty(); } }
public void list(URI id, String media, long lastModified) throws IOException { final String accept = pattern == null ? ACCEPT_XML : "*/*"; final DataReader handler = new DataReader() { public void load(URI id, String media, InputStream content, long len) throws IOException { content.close(); String name = new File(id).getName(); if (pattern == null || pattern.matcher(name).matches()) { documents.add(parse(id.toASCIIString(), base)); } } }; String entry = id.toASCIIString(); if (media == null) { store.listEachEntry(entry, entry, accept, new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { String entry = id.toASCIIString(); store.readEntry(entry, entry, accept, null, handler); } }); } else { store.readEntry(entry, entry, accept, null, handler); } } });
public void store(OutputStream content) throws IOException { final ZipOutputStream outZip = new ZipOutputStream(content); try { store.readEntry(zipFn, base, "application/zip", null, new DataStore.DataReader() { public void load(URI id, String media, InputStream content, long len) throws IOException { ZipInputStream inZip = new ZipInputStream(content); try { update(inZip, outZip); } finally { inZip.close(); } } }); } catch (FileNotFoundException e) { update(null, outZip); } finally { outZip.close(); } } });
return fallback.writeEntry(href, base, media, handler);
public void listEachEntry(String href, String base, String accept, DataInfo handler) throws MalformedURLException, FileNotFoundException, IOException { fallback.listEachEntry(href, base, accept, handler); }
String base = href.getBaseURI().toASCIIString(); try { store.infoEntry(href.getString(), base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { URI uri = store.writeEntry(href.getString(), base, "text/plain", new DataWriter() { public void store(OutputStream content) throws IOException {
final DataStore store = runtime.getDataStore(); String base = href.getBaseURI().toASCIIString(); store.readEntry(href.getString(), base, "*/*", null, new DataReader() { public void load(URI id, String media, final InputStream src, long len) throws IOException { store.deleteEntry(href.getString(), base);
if (!sameDocumentReference && "file".equalsIgnoreCase(baseURI.resolve(uri).getScheme())) { final DataStore store = runtime.getDataStore(); store.infoEntry(uri, base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { try { DataStore store = runtime.getDataStore(); store.readEntry(uri, base, ACCEPT_JSON, null, new DataReader() { public void load(URI id, String media, InputStream content, long len) throws IOException {
final String base = getOption(_href).getBaseURI().toASCIIString(); final DataStore store = runtime.getDataStore(); store.writeEntry(zipFn, base, "application/zip", new DataStore.DataWriter() { public void store(OutputStream content) throws IOException { final ZipOutputStream outZip = new ZipOutputStream(content); final DatatypeFactory dfactory = DatatypeFactory.newInstance(); DataStore store = runtime.getDataStore(); store.readEntry(zipFn, zipFn, "application/zip, */*", null, new DataReader() { public void load(URI id, String media, InputStream stream, long len) throws IOException { TreeWriter tree = new TreeWriter(runtime);
public void store(OutputStream content) throws IOException { final ZipOutputStream outZip = new ZipOutputStream(content); try { store.readEntry(zipFn, base, "application/zip", null, new DataStore.DataReader() { public void load(URI id, String media, InputStream content, long len) throws IOException { ZipInputStream inZip = new ZipInputStream(content); try { update(inZip, outZip); } finally { inZip.close(); } } }); } catch (FileNotFoundException e) { update(null, outZip); } finally { outZip.close(); } } });
return fallback.writeEntry(href, base, media, handler);
public void listEachEntry(String href, String base, String accept, DataInfo handler) throws MalformedURLException, FileNotFoundException, IOException { fallback.listEachEntry(href, base, accept, handler); }
public void list(URI id, String media, long lastModified) throws IOException { final String accept = pattern == null ? ACCEPT_XML : "*/*"; final DataReader handler = new DataReader() { public void load(URI id, String media, InputStream content, long len) throws IOException { content.close(); String name = new File(id).getName(); if (pattern == null || pattern.matcher(name).matches()) { documents.add(parse(id.toASCIIString(), base)); } } }; String entry = id.toASCIIString(); if (media == null) { store.listEachEntry(entry, entry, accept, new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { String entry = id.toASCIIString(); store.readEntry(entry, entry, accept, null, handler); } }); } else { store.readEntry(entry, entry, accept, null, handler); } } });
String base = href.getBaseURI().toASCIIString(); try { store.infoEntry(href.getString(), base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { URI uri = store.writeEntry(href.getString(), base, "text/plain", new DataWriter() { public void store(OutputStream content) throws IOException {
final DataStore store = runtime.getDataStore(); String base = href.getBaseURI().toASCIIString(); store.readEntry(href.getString(), base, "*/*", null, new DataReader() { public void load(URI id, String media, final InputStream src, long len) throws IOException { store.deleteEntry(href.getString(), base);
if (!sameDocumentReference && "file".equalsIgnoreCase(baseURI.resolve(uri).getScheme())) { final DataStore store = runtime.getDataStore(); store.infoEntry(uri, base, "*/*", new DataInfo() { public void list(URI id, String media, long lastModified) throws IOException { try { DataStore store = runtime.getDataStore(); store.readEntry(uri, base, ACCEPT_JSON, null, new DataReader() { public void load(URI id, String media, InputStream content, long len) throws IOException {
final String base = getOption(_href).getBaseURI().toASCIIString(); final DataStore store = runtime.getDataStore(); store.writeEntry(zipFn, base, "application/zip", new DataStore.DataWriter() { public void store(OutputStream content) throws IOException { final ZipOutputStream outZip = new ZipOutputStream(content); final DatatypeFactory dfactory = DatatypeFactory.newInstance(); DataStore store = runtime.getDataStore(); store.readEntry(zipFn, zipFn, "application/zip, */*", null, new DataReader() { public void load(URI id, String media, InputStream stream, long len) throws IOException { TreeWriter tree = new TreeWriter(runtime);
public void readEntry(String href, String base, String accept, String overrideContentType, DataReader handler) throws MalformedURLException, FileNotFoundException, IOException { URI baseURI = URI.create(base); URI uri = baseURI.resolve(href); String sch = uri.getScheme(); if ("http".equalsIgnoreCase(sch) || "https".equalsIgnoreCase(sch)) { readHttpEntity(uri, accept, overrideContentType, handler); } else { fallback.readEntry(href, base, accept, overrideContentType, handler); } }