Revision 2752
Added by Matt Jones over 18 years ago
DBValidate.java | ||
---|---|---|
67 | 67 |
public boolean alreadyHandle = false; |
68 | 68 |
|
69 | 69 |
/** Construct a new validation object */ |
70 |
public DBValidate(String parserName) {
|
|
70 |
public DBValidate() { |
|
71 | 71 |
alreadyHandle = false; |
72 | 72 |
try { |
73 | 73 |
// Get an instance of the parser |
74 |
String parserName = MetaCatUtil.getOption("saxparser"); |
|
74 | 75 |
parser = XMLReaderFactory.createXMLReader(parserName); |
75 | 76 |
parser.setFeature("http://xml.org/sax/features/validation",true); |
76 | 77 |
//parser.setValidationMode(true); // Oracle |
... | ... | |
80 | 81 |
} |
81 | 82 |
|
82 | 83 |
/** Construct a new validation object using an OASIS catalog file */ |
83 |
public DBValidate(String parserName, String xmlcatalogfile) {
|
|
84 |
this(parserName);
|
|
84 |
public DBValidate(String xmlcatalogfile) { |
|
85 |
this(); |
|
85 | 86 |
|
86 | 87 |
CatalogEntityResolver cer = new CatalogEntityResolver(); |
87 | 88 |
try { |
... | ... | |
97 | 98 |
} |
98 | 99 |
|
99 | 100 |
/** Construct a new validation object using a database entity resolver */ |
100 |
public DBValidate(String parserName, DBConnection conn) {
|
|
101 |
this(parserName);
|
|
101 |
public DBValidate(DBConnection conn) { |
|
102 |
this(); |
|
102 | 103 |
|
103 | 104 |
DBEntityResolver dbresolver = new DBEntityResolver(conn); |
104 | 105 |
parser.setEntityResolver(dbresolver); |
... | ... | |
234 | 235 |
conn = DBConnectionPool.getDBConnection("DBValidate.main"); |
235 | 236 |
serailNumber = conn.getCheckOutSerialNumber(); |
236 | 237 |
|
237 |
DBValidate gxv = new DBValidate(util.getOption("saxparser"), conn);
|
|
238 |
DBValidate gxv = new DBValidate(conn); |
|
238 | 239 |
if (gxv.validate(doc)) { |
239 | 240 |
System.out.print(gxv.returnErrors()); |
240 | 241 |
} else { |
Also available in: Unified diff
Metacat has had problems with threading issues when accessed from ecogrid. These problems may stem from the use of shared global variables within the servlet that are not protected against threading problems. We used a lot of these, which I am eliminating in this commit. Besides final variables used as constants (which are not a problem), now there are only three unprotected variables (sessionHash, logMetacat, and conn) which are harder to eliminate. I will be discussiong this with Sid tomorrow to see how to eliminate them.