Revision 699
Added by bojilova about 23 years ago
MetaCatServlet.java | ||
---|---|---|
94 | 94 |
* action=getdatadoc -- retrieve a stored datadocument<br> |
95 | 95 |
* action=getaccesscontrol -- retrieve acl info for Metacat document<br> |
96 | 96 |
* action=getdoctypes -- retrieve all doctypes (publicID)<br> |
97 |
* action=getdtdschema -- retrieve a DTD or Schema file<br> |
|
97 | 98 |
* action=getdataguide -- retrieve a Data Guide<br> |
98 | 99 |
* datadoc -- data document name (id)<br> |
99 | 100 |
* <p> |
... | ... | |
370 | 371 |
out.println("You must be authenticated to perform the getdataport " + |
371 | 372 |
"action!"); |
372 | 373 |
} |
374 |
} else if (action.equals("getdtdschema")) { |
|
375 |
PrintWriter out = response.getWriter(); |
|
376 |
handleGetDTDSchemaAction(out, params, response); |
|
373 | 377 |
} else if (action.equals("getdataguide")) { |
374 | 378 |
PrintWriter out = response.getWriter(); |
375 | 379 |
handleGetDataGuideAction(out, params, response); |
... | ... | |
1621 | 1625 |
} |
1622 | 1626 |
|
1623 | 1627 |
/** |
1628 |
* Handle the "getdtdschema" action. |
|
1629 |
* Read DTD or Schema file for a given doctype from Metacat catalog system |
|
1630 |
*/ |
|
1631 |
private void handleGetDTDSchemaAction(PrintWriter out, Hashtable params, |
|
1632 |
HttpServletResponse response) { |
|
1633 |
|
|
1634 |
Connection conn = null; |
|
1635 |
String doctype = null; |
|
1636 |
String[] doctypeArr = (String[])params.get("doctype"); |
|
1637 |
|
|
1638 |
// get only the first doctype specified in the list of doctypes |
|
1639 |
// it could be done for all doctypes in that list |
|
1640 |
if (doctypeArr != null) { |
|
1641 |
doctype = ((String[])params.get("doctype"))[0]; |
|
1642 |
} |
|
1643 |
|
|
1644 |
try { |
|
1645 |
|
|
1646 |
// get connection from the pool |
|
1647 |
conn = util.getConnection(); |
|
1648 |
DBUtil dbutil = new DBUtil(conn); |
|
1649 |
String dtdschema = dbutil.readDTDSchema(doctype); |
|
1650 |
out.println(dtdschema); |
|
1651 |
|
|
1652 |
} catch (Exception e) { |
|
1653 |
out.println("<?xml version=\"1.0\"?>"); |
|
1654 |
out.println("<error>"); |
|
1655 |
out.println(e.getMessage()); |
|
1656 |
out.println("</error>"); |
|
1657 |
} finally { |
|
1658 |
util.returnConnection(conn); |
|
1659 |
} |
|
1660 |
|
|
1661 |
} |
|
1662 |
|
|
1663 |
/** |
|
1624 | 1664 |
* Handle the "getdataguide" action. |
1625 | 1665 |
* Read Data Guide for a given doctype from db connection in XML format |
1626 | 1666 |
*/ |
Also available in: Unified diff
implemented interface for download of DTD or Schema file from Metacat file system
through the params:
action="getdtdschema"
doctype