Revision 219
Added by Matt Jones over 24 years ago
src/edu/ucsb/nceas/metacat/ElementNode.java | ||
---|---|---|
185 | 185 |
setAttribute(nodename,nodedata); |
186 | 186 |
} else if (nodetype.equals("TEXT")) { |
187 | 187 |
TextNode child = new TextNode(element_id,parentnodeid, |
188 |
nodedata,nodetype);
|
|
188 |
nodedata); |
|
189 | 189 |
addChildNode(child); |
190 |
} else if (nodetype.equals("COMMENT")) { |
|
191 |
CommentNode child = new CommentNode(element_id,parentnodeid, |
|
192 |
nodedata); |
|
193 |
addChildNode(child); |
|
194 |
} else if (nodetype.equals("PI")) { |
|
195 |
PINode child = new PINode(element_id,parentnodeid,nodename, |
|
196 |
nodedata); |
|
197 |
addChildNode(child); |
|
190 | 198 |
} |
191 | 199 |
|
192 | 200 |
} catch (SQLException e) { |
... | ... | |
245 | 253 |
|
246 | 254 |
/** |
247 | 255 |
* '$Log$ |
256 |
* 'Revision 1.20 2000/06/26 10:35:05 jones |
|
257 |
* 'Merged in substantial changes to DBWriter and associated classes and to |
|
258 |
* 'the MetaCatServlet in order to accomodate the new UPDATE and DELETE |
|
259 |
* 'functions. The command line tools and the parameters for the |
|
260 |
* 'servlet have changed substantially. |
|
261 |
* ' |
|
248 | 262 |
* 'Revision 1.19.2.2 2000/06/25 23:38:16 jones |
249 | 263 |
* 'Added RCSfile keyword |
250 | 264 |
* ' |
src/edu/ucsb/nceas/metacat/CommentNode.java | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile$' |
|
3 |
* Purpose: A Class that represents an XML Comment node and its contents, |
|
4 |
* and can build itself from a database connection |
|
5 |
* Copyright: 2000 Regents of the University of California and the |
|
6 |
* National Center for Ecological Analysis and Synthesis |
|
7 |
* Authors: Matt Jones |
|
8 |
* |
|
9 |
* '$Author$' |
|
10 |
* '$Date$' |
|
11 |
* '$Revision$' |
|
12 |
*/ |
|
13 |
|
|
14 |
package edu.ucsb.nceas.metacat; |
|
15 |
|
|
16 |
/** |
|
17 |
* A Class that represents an XML Comment node and its contents, |
|
18 |
*/ |
|
19 |
public class CommentNode extends BasicNode { |
|
20 |
|
|
21 |
private String nodeData = null; |
|
22 |
|
|
23 |
/** |
|
24 |
* Construct a new CommentNode instance |
|
25 |
* |
|
26 |
* @param nodeid the element_id for the node to be created |
|
27 |
* @param parentnodeid the id of the parent node |
|
28 |
* @param nodedata the text of the node |
|
29 |
* @param nodetype the type of the node |
|
30 |
*/ |
|
31 |
public CommentNode (long nodeid, long parentnodeid, |
|
32 |
String nodedata) { |
|
33 |
setNodeID(nodeid); |
|
34 |
setParentID(parentnodeid); |
|
35 |
setNodeData(nodedata); |
|
36 |
setNodeType("COMMENT"); |
|
37 |
} |
|
38 |
|
|
39 |
/** Set the node data to the given string */ |
|
40 |
public void setNodeData(String nodedata) { |
|
41 |
this.nodeData = nodedata; |
|
42 |
} |
|
43 |
|
|
44 |
/** Get the node data as a string value */ |
|
45 |
public String getNodeData() { |
|
46 |
return nodeData; |
|
47 |
} |
|
48 |
|
|
49 |
/** |
|
50 |
* String representation of this text node |
|
51 |
*/ |
|
52 |
public String toString () { |
|
53 |
return ("<!-- " + nodeData + " -->"); |
|
54 |
} |
|
55 |
} |
|
56 |
|
|
57 |
/** |
|
58 |
* '$Log$ |
|
59 |
*/ |
|
0 | 60 |
src/edu/ucsb/nceas/metacat/PINode.java | ||
---|---|---|
1 |
/** |
|
2 |
* '$RCSfile$' |
|
3 |
* Purpose: A Class that represents an XML PI node and its contents, |
|
4 |
* and can build itself from a database connection |
|
5 |
* Copyright: 2000 Regents of the University of California and the |
|
6 |
* National Center for Ecological Analysis and Synthesis |
|
7 |
* Authors: Matt Jones |
|
8 |
* |
|
9 |
* '$Author$' |
|
10 |
* '$Date$' |
|
11 |
* '$Revision$' |
|
12 |
*/ |
|
13 |
|
|
14 |
package edu.ucsb.nceas.metacat; |
|
15 |
|
|
16 |
/** |
|
17 |
* A Class that represents an XML PI node and its contents, |
|
18 |
*/ |
|
19 |
public class PINode extends BasicNode { |
|
20 |
|
|
21 |
private String nodeData = null; |
|
22 |
|
|
23 |
/** |
|
24 |
* Construct a new PINode instance |
|
25 |
* |
|
26 |
* @param nodeid the id for the node to be created |
|
27 |
* @param parentnodeid the id of the parent node |
|
28 |
* @param nodename the name of the PI node |
|
29 |
* @param nodedata the contents of the PI node |
|
30 |
*/ |
|
31 |
public PINode (long nodeid, long parentnodeid, String nodename, |
|
32 |
String nodedata) { |
|
33 |
setNodeID(nodeid); |
|
34 |
setParentID(parentnodeid); |
|
35 |
setTagName(nodename); |
|
36 |
setNodeData(nodedata); |
|
37 |
setNodeType("PI"); |
|
38 |
} |
|
39 |
|
|
40 |
/** Set the node data to the given string */ |
|
41 |
public void setNodeData(String nodedata) { |
|
42 |
this.nodeData = nodedata; |
|
43 |
} |
|
44 |
|
|
45 |
/** Get the node data as a string value */ |
|
46 |
public String getNodeData() { |
|
47 |
return nodeData; |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* String representation of this text node |
|
52 |
*/ |
|
53 |
public String toString () { |
|
54 |
return ("<?" + getTagName() + " " + nodeData + " ?>"); |
|
55 |
} |
|
56 |
} |
|
57 |
|
|
58 |
/** |
|
59 |
* '$Log$ |
|
60 |
*/ |
|
0 | 61 |
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
215 | 215 |
} catch (Exception npe) { |
216 | 216 |
//out.println("<P>Caught exception looking for Y value."); |
217 | 217 |
} |
218 |
|
|
219 |
/* |
|
218 | 220 |
// Jivka added |
219 | 221 |
// handle login action |
220 | 222 |
if (action.equals("Login")) { |
... | ... | |
230 | 232 |
} else { |
231 | 233 |
HttpSession sess = request.getSession(false); |
232 | 234 |
if (sess == null) { |
233 |
out.println("Session expired. You will be redirected to Login page again."); |
|
235 |
out.println("Session expired. " + |
|
236 |
"You will be redirected to Login page again."); |
|
234 | 237 |
response.sendRedirect("/xmltodb/lib/login.html"); |
235 | 238 |
} |
236 | 239 |
} |
237 | 240 |
// End of Jivka added |
241 |
*/ |
|
242 |
|
|
238 | 243 |
if (action.equals("query") || action.equals("squery")) { |
239 | 244 |
handleQueryAction(out, params, response); |
240 | 245 |
} else if (action.equals("getdocument")) { |
... | ... | |
266 | 271 |
* Handle the Login request. Create a new session object. |
267 | 272 |
* Make a user authentication through SRB RMI Connection. |
268 | 273 |
*/ |
274 |
/* |
|
269 | 275 |
private void handleLoginAction(PrintWriter out, Hashtable params, |
270 | 276 |
HttpServletRequest request, HttpServletResponse response) { |
271 | 277 |
String un = (String)params.get("username"); |
... | ... | |
275 | 281 |
try { |
276 | 282 |
if (sess.userAuth(pw)) { |
277 | 283 |
try { |
278 |
response.sendRedirect(response.encodeRedirectUrl("/xmltodb/lib/index.html")); |
|
284 |
response.sendRedirect( |
|
285 |
response.encodeRedirectUrl("/xmltodb/lib/index.html")); |
|
279 | 286 |
} catch ( java.io.IOException ioe) { |
280 | 287 |
sess.disconnect(); |
281 | 288 |
out.println("MetaCatServlet.handleLoginAction() - " + |
... | ... | |
288 | 295 |
out.println("SRB Connection failed. " + |
289 | 296 |
"SRB RMI Server is not running now or " + |
290 | 297 |
"user " + un + |
291 |
" has not been authenticated to use the system"); |
|
298 |
" has not been authenticated to use the system.");
|
|
292 | 299 |
} |
293 | 300 |
} catch ( java.rmi.RemoteException re) { |
294 | 301 |
sess.disconnect(); |
295 | 302 |
out.println("SRB Connection failed. " + re.getMessage()); |
296 | 303 |
} |
297 | 304 |
} |
305 |
*/ |
|
306 |
|
|
298 | 307 |
/** |
299 | 308 |
* Handle the database query request and return a result set, possibly |
300 | 309 |
* transformed from XML into HTML |
... | ... | |
634 | 643 |
|
635 | 644 |
/** |
636 | 645 |
* '$Log$ |
646 |
* 'Revision 1.35 2000/06/28 00:00:47 bojilova |
|
647 |
* 'changed to |
|
648 |
* 'response.sendRedirect(response.encodeRedirectUrl("/xmltodb/lib/index.html")); |
|
649 |
* ' |
|
637 | 650 |
* 'Revision 1.33 2000/06/27 04:50:33 jones |
638 | 651 |
* 'Updated javadoc documentation. |
639 | 652 |
* ' |
src/edu/ucsb/nceas/metacat/TextNode.java | ||
---|---|---|
29 | 29 |
* @param nodetype the type of the node |
30 | 30 |
*/ |
31 | 31 |
public TextNode (long nodeid, long parentnodeid, |
32 |
String nodedata, String nodetype) {
|
|
32 |
String nodedata) { |
|
33 | 33 |
setNodeID(nodeid); |
34 | 34 |
setParentID(parentnodeid); |
35 | 35 |
setNodeData(nodedata); |
36 |
setNodeType(nodetype);
|
|
36 |
setNodeType("TEXT");
|
|
37 | 37 |
} |
38 | 38 |
|
39 | 39 |
/** Set the node data to the given string */ |
... | ... | |
56 | 56 |
|
57 | 57 |
/** |
58 | 58 |
* '$Log$ |
59 |
* 'Revision 1.7 2000/06/26 10:35:05 jones |
|
60 |
* 'Merged in substantial changes to DBWriter and associated classes and to |
|
61 |
* 'the MetaCatServlet in order to accomodate the new UPDATE and DELETE |
|
62 |
* 'functions. The command line tools and the parameters for the |
|
63 |
* 'servlet have changed substantially. |
|
64 |
* ' |
|
59 | 65 |
* 'Revision 1.6.2.2 2000/06/25 23:38:17 jones |
60 | 66 |
* 'Added RCSfile keyword |
61 | 67 |
* ' |
Also available in: Unified diff
Added feature to now ouput COMMENTs and PIs when the document is
read from the database with DBReader.