Revision 302
Added by bojilova over 24 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
67 | 67 |
* query -- actual query text (to go with 'action=query' or 'action=squery')<br> |
68 | 68 |
* valtext -- XML text to be validated<br> |
69 | 69 |
* action=getdatadoc -- retreive a stored datadocument<br> |
70 |
* action=getdoctypes -- retreive all doctypes (publicID)<br> |
|
71 |
* action=getdataguide -- retreive a Data Guide<br> |
|
70 | 72 |
* datadoc -- data document name (id)<br> |
71 | 73 |
* <p> |
72 | 74 |
* The particular combination of parameters that are valid for each |
... | ... | |
81 | 83 |
private DBQuery queryobj = null; |
82 | 84 |
private DBReader docreader = null; |
83 | 85 |
private DBTransform dbt = null; |
86 |
private DBUtil dbutil = null; |
|
84 | 87 |
private String resultStyleURL = null; |
85 | 88 |
private String xmlcatalogfile = null; |
86 | 89 |
private String saxparser = null; |
... | ... | |
120 | 123 |
queryobj = new DBQuery(conn,saxparser); |
121 | 124 |
docreader = new DBReader(conn); |
122 | 125 |
dbt = new DBTransform(conn); |
126 |
dbutil = new DBUtil(conn); |
|
123 | 127 |
|
124 | 128 |
} catch (Exception e) { |
125 | 129 |
System.err.println("Error opening database connection"); |
... | ... | |
161 | 165 |
queryobj = new DBQuery(conn, saxparser); |
162 | 166 |
docreader = new DBReader(conn); |
163 | 167 |
dbt = new DBTransform(conn); |
168 |
dbutil = new DBUtil(conn); |
|
164 | 169 |
|
165 | 170 |
} catch (Exception e) { |
166 | 171 |
System.err.println("Error opening database connection"); |
... | ... | |
255 | 260 |
handleValidateAction(out, params, response); |
256 | 261 |
} else if (action.equals("getdatadoc")) { |
257 | 262 |
handleGetDataDocumentAction(out, params, response); |
263 |
} else if (action.equals("getdoctypes")) { |
|
264 |
handleGetDoctypesAction(out, params, response); |
|
265 |
} else if (action.equals("getdataguide")) { |
|
266 |
handleGetDataGuideAction(out, params, response); |
|
258 | 267 |
} else if (action.equals("Login") || action.equals("Login Client")) { |
259 | 268 |
} else { |
260 | 269 |
out.println("Error: action not registered. Please report this error."); |
... | ... | |
651 | 660 |
} |
652 | 661 |
} // end defaultdatapath not null if |
653 | 662 |
} |
663 |
|
|
664 |
/** |
|
665 |
* Handle the getdoctypes Action. |
|
666 |
* Read all doctypes from db connection in XML format |
|
667 |
*/ |
|
668 |
|
|
669 |
private void handleGetDoctypesAction(PrintWriter out, Hashtable params, |
|
670 |
HttpServletResponse response) { |
|
671 |
|
|
672 |
try { |
|
673 |
|
|
674 |
String doctypes = dbutil.readDoctypes(); |
|
675 |
out.println(doctypes); |
|
676 |
|
|
677 |
} catch (Exception e) { |
|
678 |
out.println("<?xml version=\"1.0\"?>"); |
|
679 |
out.println("<error>"); |
|
680 |
out.println(e.getMessage()); |
|
681 |
out.println("</error>"); |
|
682 |
} |
|
683 |
|
|
684 |
} |
|
685 |
|
|
686 |
/** |
|
687 |
* Handle the getdataguide Action. |
|
688 |
* Read Data Guide for a given doctype from db connection in XML format |
|
689 |
*/ |
|
690 |
|
|
691 |
private void handleGetDataGuideAction(PrintWriter out, Hashtable params, |
|
692 |
HttpServletResponse response) { |
|
693 |
|
|
694 |
try { |
|
695 |
|
|
696 |
String dataguide = dbutil.readDataGuide(""); |
|
697 |
out.println(dataguide); |
|
698 |
|
|
699 |
} catch (Exception e) { |
|
700 |
out.println("<?xml version=\"1.0\"?>"); |
|
701 |
out.println("<error>"); |
|
702 |
out.println(e.getMessage()); |
|
703 |
out.println("</error>"); |
|
704 |
} |
|
705 |
|
|
706 |
} |
|
707 |
|
|
654 | 708 |
} |
655 | 709 |
|
656 | 710 |
/** |
657 | 711 |
* '$Log$ |
712 |
* 'Revision 1.53 2000/07/26 20:48:29 bojilova |
|
713 |
* 'Added "Login Client" action for login from the Desktop Client |
|
714 |
* ' |
|
658 | 715 |
* 'Revision 1.52 2000/07/26 20:38:40 higgins |
659 | 716 |
* 'no message |
660 | 717 |
* ' |
Also available in: Unified diff
Added "getdoctypes" and "getdataguide" action handlers