Package com.xmlcalabash.io.DataStore

Examples of com.xmlcalabash.io.DataStore.DataInfo


    URI file = store.writeEntry("dir/", tmp, "text/plain", new DataWriter() {
      public void store(OutputStream content) throws IOException {
        content.write("content".getBytes());
      }
    });
    store.infoEntry(file.getPath(), tmp, "text/plain", new DataInfo() {
      public void list(URI id, String media, long lastModified)
          throws IOException {
        assertEquals("text/plain", media);
      }
    });
View Full Code Here


  public void testListEachEntry() throws IOException {
    URI dir = store.createList("dir", tmp);
    final File text = File.createTempFile("test", ".txt", new File(dir));
    final File xml = File.createTempFile("test", ".xml", new File(dir));
    store.listEachEntry("dir", tmp, "text/plain", new DataInfo() {
      public void list(URI id, String media, long lastModified)
          throws IOException {
        assertEquals("text/plain", media);
        assertEquals(text.getAbsolutePath(), new File(id).getAbsolutePath());
      }
    });
    store.listEachEntry("dir", tmp, "application/xml", new DataInfo() {
      public void list(URI id, String media, long lastModified)
          throws IOException {
        assertEquals("application/xml", media);
        assertEquals(xml.getAbsolutePath(), new File(id).getAbsolutePath());
      }
View Full Code Here

                boolean sameDocumentReference = uri.startsWith("#");
                // What if this is a directory?
                URI baseURI = URI.create(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 {
                            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);
                                    }
View Full Code Here

        tree.addAttribute(XProcConstants.xml_base, uri.toASCIIString());
        tree.startContent();

        final DataStore store = runtime.getDataStore();
        try {
            store.listEachEntry(path, "file:///", "*/*", new DataInfo() {
                public void list(URI id, String media, long lastModified) throws IOException {
                    boolean use = true;
                    String filename = getName(id);

                    logger.trace(MessageFormatter.nodeMessage(step.getNode(), "name: " + filename));
View Full Code Here

  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);
        }
View Full Code Here

        try {
            DataStore store = runtime.getDataStore();
            String base = href.getBaseURI().toASCIIString();
            try {
                store.infoEntry(href.getString(), base, "*/*", new DataInfo() {
                    public void list(URI id, String media, long lastModified)
                            throws IOException {
                        // file already exists
                        tree.addText(id.toASCIIString());
                    }
View Full Code Here

            }

            final List<Long> list = new ArrayList<Long>(1);
            DataStore store = runtime.getDataStore();
            try {
                store.infoEntry(uri.toASCIIString(), uri.toASCIIString(), "*/*", new DataInfo() {
                    public void list(URI id, String media, long lastModified)
                            throws IOException {
                        list.add(lastModified);
                    }
                });
View Full Code Here

TOP

Related Classes of com.xmlcalabash.io.DataStore.DataInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.