01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Library License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
06: //
07: // $Id: OzoneXUpdateQuery.java,v 1.1 2001/12/18 11:03:24 per_nyfelt Exp $
08:
09: package org.ozoneDB.xml.util;
10:
11: import java.io.*;
12:
13: import org.w3c.dom.Document;
14: import org.w3c.dom.Node;
15:
16: import org.w3c.dom.traversal.NodeFilter;
17:
18: import org.infozone.tools.xml.queries.XObject;
19: import org.infozone.tools.xml.queries.XPathQuery;
20: import org.infozone.tools.xml.queries.XUpdateQuery;
21:
22: /**
23: * @version $Revision: 1.1 $ $Date: 2001/12/18 11:03:24 $
24: * @author <a href="http://www.softwarebuero.de">SMB</a>
25: * @see XMLContainer
26: */
27: public final class OzoneXUpdateQuery implements XUpdateQuery,
28: Externalizable {
29:
30: protected final static long serialVersionUID = 1L;
31:
32: protected String qstring;
33:
34: protected Node rootNode;
35:
36: protected Node namespace;
37:
38: protected NodeFilter filter;
39:
40: protected transient XMLContainer delegate;
41:
42: public OzoneXUpdateQuery() {
43: }
44:
45: protected OzoneXUpdateQuery(XMLContainer _delegate) {
46: delegate = _delegate;
47: }
48:
49: public void setQString(String _qstring) throws Exception {
50: qstring = _qstring;
51: }
52:
53: public void setNamespace(Node _namespace) throws Exception {
54: namespace = _namespace;
55: }
56:
57: public void setNodeFilter(NodeFilter _filter) throws Exception {
58: filter = _filter;
59: }
60:
61: /**
62: * Execute the XUpdate query.
63: *
64: * @see #execute(Node)
65: */
66: public void execute() throws Exception {
67: execute(null);
68: }
69:
70: /**
71: * Execute the XUpdate query.
72: *
73: * @param rootNode The node from which the query should start. A value of
74: * null specifies that the entire document should be searched.
75: */
76: public void execute(Node _rootNode) throws Exception {
77: rootNode = _rootNode;
78: delegate.executeXUpdate(this );
79: }
80:
81: public void writeExternal(ObjectOutput out) throws IOException {
82: out.writeObject(rootNode);
83: out.writeObject(qstring);
84: out.writeObject(namespace);
85: out.writeObject(filter);
86: }
87:
88: public void readExternal(ObjectInput in) throws IOException,
89: ClassNotFoundException {
90: rootNode = (Node) in.readObject();
91: qstring = (String) in.readObject();
92: namespace = (Node) in.readObject();
93: filter = (NodeFilter) in.readObject();
94: }
95: }
|