Examples of storeResource()


Examples of org.xmldb.api.base.Collection.storeResource()

     
      String data = readFileFromDisk(args[0]);

      XMLResource document = (XMLResource) collection.createResource(null, "XMLResource");
      document.setContent(data);
      collection.storeResource(document);
      System.out.println("Document " + args[0] + " inserted as " + document.getId());
    }
    catch (XMLDBException e) {
      System.err.println("XML:DB Exception occured " + e.errorCode + " " + e.getMessage());
    }
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

                           homeaddress,workaddress);
  
         // Create the XMLResource and store the document
         XMLResource resource = (XMLResource) col.createResource( "", "XMLResource" );
         resource.setContent(ourdoc);
         col.storeResource(resource);
        
      } catch ( Exception e) {
          e.printStackTrace();

    // there's not much else we can do if the response is committed
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

    public void testInsertDocumentAsDOM() throws Exception {
        Collection col = this.client.getCollection(TEST_COLLECTION_PATH);

        XMLResource document = (XMLResource) col.createResource("testdoc", "XMLResource");
        document.setContentAsDOM(DOMParser.toDocument(CONTENT));
        col.storeResource(document);
        assertEquals(1, this.client.countDocument(TEST_COLLECTION_PATH));

        String content = this.client.getDocument(TEST_COLLECTION_PATH, "testdoc");
        assertXMLEqual(CONTENT, content);
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

     * then retrieve it and verify that the data comes back right.
     */

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
    collection.storeResource(newResource);
    String id = newResource.getId();

    Resource foundResource = collection.getResource(id);

    assertNotNull("We know you're in there...", foundResource);
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

        // then list resources.
        //

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
        collection.storeResource(newResource);
        String id = newResource.getId();

        String[] resources = collection.listResources();
        assertNotNull("Can not be null", resources);
        assertEquals("Should have one resource", 1, resources.length);
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

     * then remove it and verify that it was indeed removed.
     */

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
    collection.storeResource(newResource);
    String id = newResource.getId();

    Resource foundResource = collection.getResource(id);
    assertNotNull("It should be in there", foundResource);

View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

     * Create a binary resource, set / get meta data
     */

        Resource newResource = collection.createResource(null, "BinaryResource");
        newResource.setContent(new byte[] { 0x00, 0x10, 0x01, 0x11 });
    collection.storeResource(newResource);
    String id = newResource.getId();

        MetaService service = (MetaService)collection.getService("MetaService", "1.0");
        MetaData meta = service.getMetaData(id);
    assertNotNull("Meta should be in there", meta);
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

            throw new XindiceException("DatabaseManager.getCollection(" + driver + "/" + path + ") returned null");
        }

        XMLResource document = (XMLResource) col.createResource(name, "XMLResource");
        document.setContent(doc);
        col.storeResource(document);
    }

    public int countDocument(String path) throws Exception {
        Collection col = DatabaseManager.getCollection(driver + "/" + path);
        if (col == null) {
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

        if (col == null) {
            throw new XindiceException("DatabaseManager.getCollection(" + driver + "/" + path + ") returned null");
        }
        XMLResource document = (XMLResource) col.getResource(name);
        document.setContent(doc);
        col.storeResource(document);
    }

    public void getDocumentAsSax(String path, String name, ContentHandler handler) throws Exception {
        Collection col = DatabaseManager.getCollection(driver + "/" + path);
        if (col == null) {
View Full Code Here

Examples of org.xmldb.api.base.Collection.storeResource()

            // double check to see if it actually works
            resource = (XMLResource)col.getResource(resourceName);
            System.out.println("Resource found with name " + resource.getId());          
            resource.setContentAsDOM(doc);
            System.out.println("Updated content: " + resource.getContent());
            col.storeResource(resource);
            //System.out.println("Stored the following Document:\n" + toString(doc));
            System.out.println("Stored the following Document:\n" + doc.getDocumentElement().getTagName());
            col.close();
            db.close();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.