Examples of XUpdateQueryService


Examples of org.xmldb.api.modules.XUpdateQueryService

                            message = "Failed to delete resource " + key + ": " + e.errorCode;
                            getLogger().debug(message, e);
                        }
                    } else if ("update".equals(operation)) {
                        try {
                            XUpdateQueryService service =
                                    (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                            long count = (this.key == null)?
                                    service.update(document) : service.updateResource(this.key, document);
                            message = count + " entries updated.";
                            result = "success";
                        } catch (XMLDBException e) {
                            message = "Failed to update resource " + key + ": " + e.errorCode;
                            getLogger().debug(message, e);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                            message = "Failed to delete resource " + key + ": " + e.errorCode;
                            getLogger().debug(message, e);
                        }
                    } else if ("update".equals(operation)) {
                        try {
                            XUpdateQueryService service =
                                    (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                            long count = (this.key == null)?
                                    service.update(document) : service.updateResource(this.key, document);
                            message = count + " entries updated.";
                            result = "success";
                        } catch (XMLDBException e) {
                            message = "Failed to update resource " + key + ": " + e.errorCode;
                            getLogger().debug(message, e);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                System.out.println("ERROR : Collection not found!");
                return false;
            }

            // To run XUpdate commands we use the XUpdateQueryService
            XUpdateQueryService service = null;           
            service = (XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");

           
            long result = 0;

            // See if we're updating one document or the whole collection.
            if (name == null) {
                result = service.update(commands.toString());
            }
            else {
                result = service.updateResource(name, commands.toString());
            }
               

            System.out.println(result + " documents updated");
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                    + "   <xu:update select=\"/person/phone[@type = 'work']\">"
                    + "       480-300-3003"
                    + "   </xu:update>"
                    + "</xu:modifications>";

            XUpdateQueryService service = (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
            long count = service.update(xupdate);
            System.out.println(count + " entries updated.");
        } catch (XMLDBException e) {
            System.err.println("XML:DB Exception occured " + e.errorCode + " " + e.getMessage());
        } finally {
            if (collection != null) {
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                        message = "Failed to delete resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
                    }
                } else if("update".equals(operation)) {
                    try {
                        XUpdateQueryService service =
                                (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                        long count = (this.key == null)?
                                service.update(document) : service.updateResource(this.key, document);
                        message = count + " entries updated.";
                        result = "success";
                    } catch (XMLDBException e) {
                        message = "Failed to update resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                        message = "Failed to delete resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
                    }
                } else if("update".equals(operation)) {
                    try {
                        XUpdateQueryService service =
                                (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                        long count = (this.key == null)?
                                service.update(document) : service.updateResource(this.key, document);
                        message = count + " entries updated.";
                        result = "success";
                    } catch (XMLDBException e) {
                        message = "Failed to update resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                        message = "Failed to delete resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
                    }
                } else if("update".equals(operation)) {
                    try {
                        XUpdateQueryService service =
                                (XUpdateQueryService) collection.getService("XUpdateQueryService", "1.0");
                        long count = (this.key == null)?
                                service.update(document) : service.updateResource(this.key, document);
                        message = count + " entries updated.";
                        result = "success";
                    } catch (XMLDBException e) {
                        message = "Failed to update resource " + key + ": " + e.errorCode;
                        getLogger().debug(message, e);
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

                    //TODO report error?
                }
                final String xupdate = "<xu:modifications version=\"1.0\" "
                        + "xmlns:xu=\"http://www.xmldb.org/xupdate\">"
                        + command + "</xu:modifications>";
                final XUpdateQueryService service = (XUpdateQueryService) current
                        .getService("XUpdateQueryService", "1.0");
                final long mods = service.update(xupdate);
                System.out.println(mods + " modifications processed.");
               
            } else if (args[0].equalsIgnoreCase("map")) {
                final StringTokenizer tok = new StringTokenizer(args[1], "= ");
                final String prefix;
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

        if (!(file.exists() && file.canRead())) {
            messageln("cannot read file " + filename);
            return;
        }
        final String commands = XMLUtil.readFile(file, "UTF-8");
        final XUpdateQueryService service = (XUpdateQueryService) current.getService("XUpdateQueryService", "1.0");
        final long modifications;
        if (resource == null) {
            modifications = service.update(commands);
        } else {
            modifications = service.updateResource(resource, commands);
        }
        messageln(modifications + " modifications processed " + "successfully.");
    }
View Full Code Here

Examples of org.xmldb.api.modules.XUpdateQueryService

    Assert.assertEquals(1, r.getSize());
    Assert.assertEquals(repeat, Integer.parseInt(r.getResource(0).getContent().toString()));
  }

  private void update(Collection col, String xupdate) throws XMLDBException {
    XUpdateQueryService service = (XUpdateQueryService)
    col.getService("XUpdateQueryService", "1.0");
    long mods = service.updateResource(resourceName, xupdate);
    System.out.println("Processed " + mods + " modifications.");
  }
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.