Revision 2663
Added by sgarg over 18 years ago
DBEntityResolver.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
package edu.ucsb.nceas.metacat; |
30 | 30 |
|
31 |
import org.apache.log4j.Logger; |
|
31 | 32 |
import org.xml.sax.*; |
32 | 33 |
import org.xml.sax.helpers.DefaultHandler; |
33 | 34 |
|
... | ... | |
58 | 59 |
private String doctype = null; |
59 | 60 |
private String systemid = null; |
60 | 61 |
private Reader dtdtext = null; |
61 |
|
|
62 |
private static Logger logMetacat = Logger.getLogger(DBEntityResolver.class); |
|
63 |
|
|
62 | 64 |
/** |
63 | 65 |
* Construct an instance of the DBEntityResolver class |
64 | 66 |
* |
... | ... | |
91 | 93 |
public InputSource resolveEntity (String publicId, String systemId) |
92 | 94 |
throws SAXException |
93 | 95 |
{ |
94 |
MetaCatUtil.debugMessage("in DBEntityResolver.resolveEntity", 60);
|
|
96 |
logMetacat.debug("in DBEntityResolver.resolveEntity");
|
|
95 | 97 |
String dbSystemID; |
96 | 98 |
String doctype = null; |
97 | 99 |
|
... | ... | |
105 | 107 |
// public ID is doctype |
106 | 108 |
if (publicId != null) { |
107 | 109 |
doctype = publicId; |
108 |
MetaCatUtil.debugMessage("in get type from publicId and doctype is: "
|
|
109 |
+doctype, 50);
|
|
110 |
logMetacat.info("in get type from publicId and doctype is: "
|
|
111 |
+doctype); |
|
110 | 112 |
// assume public ID (doctype) is docname |
111 | 113 |
} else if (systemId != null) { |
112 | 114 |
doctype = dhandler.getDocname(); |
... | ... | |
130 | 132 |
// get System ID for doctype |
131 | 133 |
if (doctype != null) { |
132 | 134 |
// look at db XML Catalog for System ID |
133 |
MetaCatUtil.debugMessage("get systemId from doctype: "+doctype, 35);
|
|
135 |
logMetacat.info("get systemId from doctype: "+doctype);
|
|
134 | 136 |
dbSystemID = getDTDSystemID(doctype); |
135 |
MetaCatUtil.debugMessage("The Systemid is: "+dbSystemID, 35);
|
|
137 |
logMetacat.info("The Systemid is: "+dbSystemID);
|
|
136 | 138 |
boolean doctypeIsInDB = true; |
137 | 139 |
// no System ID found in db XML Catalog |
138 | 140 |
if (dbSystemID == null) { |
... | ... | |
141 | 143 |
if (systemId != null) { |
142 | 144 |
dbSystemID = systemId; |
143 | 145 |
} |
144 |
MetaCatUtil.debugMessage("If above Systemid is null and then get "
|
|
145 |
+" system id from file" + dbSystemID, 35);
|
|
146 |
logMetacat.info("If above Systemid is null and then get "
|
|
147 |
+" system id from file" + dbSystemID); |
|
146 | 148 |
} |
147 | 149 |
// there are dtd text provided; try to upload on Metacat |
148 | 150 |
if ( dtdtext != null ) { |
... | ... | |
175 | 177 |
return is; |
176 | 178 |
} else { |
177 | 179 |
// use provided systemId for the other cases |
178 |
MetaCatUtil.debugMessage("doctype is null and using system id from file", 50);
|
|
180 |
logMetacat.info("doctype is null and using system id from file");
|
|
179 | 181 |
InputStream istream = checkURLConnection(systemId); |
180 | 182 |
return null; |
181 | 183 |
|
... | ... | |
221 | 223 |
}//try |
222 | 224 |
catch (SQLException sqlE) |
223 | 225 |
{ |
224 |
MetaCatUtil.debugMessage("Error in DBEntityReolver.getDTDSystemId: "
|
|
225 |
+sqlE.getMessage(), 30);
|
|
226 |
logMetacat.error("Error in DBEntityReolver.getDTDSystemId: "
|
|
227 |
+sqlE.getMessage()); |
|
226 | 228 |
}//catch |
227 | 229 |
finally |
228 | 230 |
{ |
... | ... | |
275 | 277 |
}//try |
276 | 278 |
catch (SQLException sqlE) |
277 | 279 |
{ |
278 |
MetaCatUtil.debugMessage("Error in DBEntityReolver.registerDTD: "
|
|
279 |
+sqlE.getMessage(), 30);
|
|
280 |
logMetacat.error("Error in DBEntityReolver.registerDTD: "
|
|
281 |
+sqlE.getMessage()); |
|
280 | 282 |
}//catch |
281 | 283 |
//DBConnectionPool.returnDBConnection(conn, serialNumber); |
282 | 284 |
}//finally |
Also available in: Unified diff
Replacing MetaCatUtil.debugMessage or MetaCatUtil.logMetacat call with logMetacat (private Logger object) call