KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > util > OzoneXUpdateQuery


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: OzoneXUpdateQuery.java,v 1.1 2003/11/02 17:26:15 per_nyfelt Exp $
8

9 package org.ozoneDB.xml.util;
10
11 import java.io.*;
12
13 import org.w3c.dom.Node JavaDoc;
14
15 import org.w3c.dom.traversal.NodeFilter;
16 import org.infozone.tools.xml.queries.XUpdateQuery;
17
18
19 /**
20  * @version $Revision: 1.1 $ $Date: 2003/11/02 17:26:15 $
21  * @author <a HREF="http://www.softwarebuero.de">SMB</a>
22  * @see XMLContainer
23  */

24 public final class OzoneXUpdateQuery implements XUpdateQuery, Externalizable {
25
26     protected final static long serialVersionUID = 1L;
27
28     protected String JavaDoc qstring;
29
30     protected Node JavaDoc rootNode;
31
32     protected Node JavaDoc namespace;
33
34     protected NodeFilter filter;
35
36     protected transient XMLContainer delegate;
37
38
39     public OzoneXUpdateQuery() {
40     }
41
42
43     protected OzoneXUpdateQuery( XMLContainer _delegate ) {
44         delegate = _delegate;
45     }
46
47
48     public void setQString( String JavaDoc _qstring ) throws Exception JavaDoc {
49         qstring = _qstring;
50     }
51
52
53     public void setNamespace( Node JavaDoc _namespace ) throws Exception JavaDoc {
54         namespace = _namespace;
55     }
56
57
58     public void setNodeFilter( NodeFilter _filter ) throws Exception JavaDoc {
59         filter = _filter;
60     }
61
62
63     /**
64      * Execute the XUpdate query.
65      *
66      * @see #execute(Node)
67      */

68     public void execute() throws Exception JavaDoc {
69         execute( null );
70     }
71
72
73     /**
74      * Execute the XUpdate query.
75      *
76      * @param _rootNode The node from which the query should start. A value of
77      * null specifies that the entire document should be searched.
78      */

79     public void execute( Node JavaDoc _rootNode ) throws Exception JavaDoc {
80         rootNode = _rootNode;
81         delegate.executeXUpdate( this );
82     }
83
84
85     public void writeExternal( ObjectOutput out ) throws IOException {
86         out.writeObject( rootNode );
87         out.writeObject( qstring );
88         out.writeObject( namespace );
89         out.writeObject( filter );
90     }
91
92
93     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException JavaDoc {
94         rootNode = (Node JavaDoc)in.readObject();
95         qstring = (String JavaDoc)in.readObject();
96         namespace = (Node JavaDoc)in.readObject();
97         filter = (NodeFilter)in.readObject();
98     }
99 }
100
Popular Tags