Revision 2663
Added by sgarg about 19 years ago
src/edu/ucsb/nceas/metacat/ElementNode.java | ||
---|---|---|
35 | 35 |
import java.util.TreeSet; |
36 | 36 |
import java.util.Vector; |
37 | 37 |
|
38 |
import org.apache.log4j.Logger; |
|
39 |
|
|
38 | 40 |
/** |
39 | 41 |
* A Class that represents an XML element and its contents, |
40 | 42 |
* and can build itself from a database connection |
41 | 43 |
*/ |
42 | 44 |
public class ElementNode extends BasicNode { |
43 | 45 |
|
46 |
private static Logger logMetacat = Logger.getLogger(ElementNode.class); |
|
47 |
|
|
44 | 48 |
/** |
45 | 49 |
* Construct a new ElementNode instance, and recursively create its children |
46 | 50 |
* |
... | ... | |
57 | 61 |
while (it.hasNext()) { |
58 | 62 |
NodeRecord currentNode = (NodeRecord)it.next(); |
59 | 63 |
if (currentNode.nodeid == nodeid) { |
60 |
util.debugMessage("Got Node ID: " + currentNode.nodeid +
|
|
64 |
logMetacat.info("Got Node ID: " + currentNode.nodeid +
|
|
61 | 65 |
" (" + currentNode.parentnodeid + |
62 | 66 |
", " + currentNode.nodeindex + |
63 |
", " + currentNode.nodetype + ")", 50);
|
|
67 |
", " + currentNode.nodetype + ")"); |
|
64 | 68 |
// Process the current node |
65 | 69 |
setNodeType(currentNode.nodetype); |
66 | 70 |
setNodeID(currentNode.nodeid); |
... | ... | |
69 | 73 |
} else { |
70 | 74 |
// Process the children nodes |
71 | 75 |
if (currentNode.parentnodeid == getNodeID()) { |
72 |
util.debugMessage(" Processing child: " + currentNode.nodeid +
|
|
76 |
logMetacat.info(" Processing child: " + currentNode.nodeid +
|
|
73 | 77 |
" (" + currentNode.parentnodeid + |
74 | 78 |
", " + currentNode.nodeindex + |
75 |
", " + currentNode.nodetype + ")", 50);
|
|
79 |
", " + currentNode.nodetype + ")"); |
|
76 | 80 |
|
77 | 81 |
if ((currentNode.nodetype).equals("ELEMENT")) { |
78 |
util.debugMessage("Creating child node: " + currentNode.nodeid, 50);
|
|
82 |
logMetacat.info("Creating child node: " + currentNode.nodeid);
|
|
79 | 83 |
ElementNode child = new ElementNode(nodeRecordList, |
80 | 84 |
currentNode.nodeid); |
81 | 85 |
addChildNode(child); |
... | ... | |
100 | 104 |
} |
101 | 105 |
|
102 | 106 |
} else { |
103 |
util.debugMessage(" Discarding child: " + currentNode.nodeid +
|
|
107 |
logMetacat.info(" Discarding child: " + currentNode.nodeid +
|
|
104 | 108 |
" (" + currentNode.parentnodeid + |
105 | 109 |
", " + currentNode.nodeindex + |
106 |
", " + currentNode.nodetype + ")", 50);
|
|
110 |
", " + currentNode.nodetype + ")"); |
|
107 | 111 |
} |
108 | 112 |
} |
109 | 113 |
} |
src/edu/ucsb/nceas/metacat/QuerySpecification.java | ||
---|---|---|
40 | 40 |
|
41 | 41 |
import edu.ucsb.nceas.dbadapter.AbstractDatabase; |
42 | 42 |
|
43 |
import org.apache.log4j.Logger; |
|
43 | 44 |
import org.xml.sax.Attributes; |
44 | 45 |
import org.xml.sax.InputSource; |
45 | 46 |
import org.xml.sax.SAXException; |
... | ... | |
115 | 116 |
|
116 | 117 |
private StringBuffer textBuffer = new StringBuffer(); |
117 | 118 |
|
119 |
private static Logger logMetacat = Logger.getLogger(QuerySpecification.class); |
|
120 |
|
|
118 | 121 |
/** |
119 | 122 |
* construct an instance of the QuerySpecification class |
120 | 123 |
* |
... | ... | |
235 | 238 |
ownerQuery = ownerQuery + "lower(user_owner) ='" + userName + "'"; |
236 | 239 |
} |
237 | 240 |
|
238 |
MetaCatUtil.debugMessage("OwnerQuery: " + ownerQuery, 30);
|
|
241 |
logMetacat.info("OwnerQuery: " + ownerQuery);
|
|
239 | 242 |
return ownerQuery; |
240 | 243 |
} |
241 | 244 |
|
... | ... | |
249 | 252 |
String allowString = constructAllowString(); |
250 | 253 |
allowQuery = "SELECT docid from xml_access WHERE( " + allowString; |
251 | 254 |
allowQuery = allowQuery + ") AND subtreeid IS NULL"; |
252 |
MetaCatUtil.debugMessage("allow query is: " + allowQuery, 30);
|
|
255 |
logMetacat.info("allow query is: " + allowQuery);
|
|
253 | 256 |
return allowQuery; |
254 | 257 |
|
255 | 258 |
} |
... | ... | |
281 | 284 |
}//if |
282 | 285 |
}//for |
283 | 286 |
}//if |
284 |
MetaCatUtil.debugMessage("allow string is: " + allowQuery, 40);
|
|
287 |
logMetacat.info("allow string is: " + allowQuery);
|
|
285 | 288 |
return allowQuery; |
286 | 289 |
} |
287 | 290 |
|
... | ... | |
296 | 299 |
String denyString = constructDenyString(); |
297 | 300 |
denyQuery = "SELECT docid from xml_access WHERE( " + denyString; |
298 | 301 |
denyQuery = denyQuery + ") AND subtreeid IS NULL "; |
299 |
MetaCatUtil.debugMessage("denyquery is: " + denyQuery, 30);
|
|
302 |
logMetacat.info("denyquery is: " + denyQuery);
|
|
300 | 303 |
return denyQuery; |
301 | 304 |
|
302 | 305 |
} |
... | ... | |
349 | 352 |
accessQuery = " AND (docid IN(" + onwer + ")"; |
350 | 353 |
accessQuery = accessQuery + " OR (docid IN (" + allow + ")" |
351 | 354 |
+ " AND docid NOT IN (" + deny + ")))"; |
352 |
MetaCatUtil.debugMessage("accessquery is: " + accessQuery, 30);
|
|
355 |
logMetacat.warn("accessquery is: " + accessQuery);
|
|
353 | 356 |
return accessQuery; |
354 | 357 |
} |
355 | 358 |
|
... | ... | |
632 | 635 |
// make sure if return fields has an attribute or not |
633 | 636 |
if (inputString.indexOf(ATTRIBUTESYMBOL) == -1) { |
634 | 637 |
// no attribute value will be returned |
635 |
MetaCatUtil.debugMessage("QuerySpecification.handleReturnField(): " , 35);
|
|
636 |
MetaCatUtil.debugMessage(" there are no attributes in the XPATH statement" , 35);
|
|
638 |
logMetacat.info("QuerySpecification.handleReturnField(): " );
|
|
639 |
logMetacat.info(" there are no attributes in the XPATH statement" );
|
|
637 | 640 |
returnFieldList.add(inputString); |
638 | 641 |
containsExtendedSQL = true; |
639 | 642 |
} else { |
... | ... | |
641 | 644 |
if ( inputString.startsWith(ATTRIBUTESYMBOL) ) { |
642 | 645 |
|
643 | 646 |
// case where the return field is solely an attribute |
644 |
MetaCatUtil.debugMessage("QuerySpecification.handleReturnField(): " , 35);
|
|
645 |
MetaCatUtil.debugMessage(" there are *only* attributes in the XPATH statement" , 35);
|
|
647 |
logMetacat.info("QuerySpecification.handleReturnField(): " );
|
|
648 |
logMetacat.info(" there are *only* attributes in the XPATH statement" );
|
|
646 | 649 |
String returnPath = newPathExpressionWithOutAttribute(inputString); |
647 | 650 |
String attributeName = getAttributeName(inputString); |
648 | 651 |
Vector pathInfo = new Vector(); |
... | ... | |
662 | 665 |
// has a attribute return field |
663 | 666 |
// divied the return filed into two parts, one is path and the |
664 | 667 |
// other is attribue name |
665 |
MetaCatUtil.debugMessage("QuerySpecification.handleReturnField: " , 35);
|
|
666 |
MetaCatUtil.debugMessage(" there are both attributes and elements" , 35);
|
|
667 |
MetaCatUtil.debugMessage(" in the XPATH statement" , 35);
|
|
668 |
logMetacat.info("QuerySpecification.handleReturnField: " );
|
|
669 |
logMetacat.info(" there are both attributes and elements" );
|
|
670 |
logMetacat.info(" in the XPATH statement" );
|
|
668 | 671 |
String returnPath = newPathExpressionWithOutAttribute(inputString); |
669 | 672 |
String attributeName = getAttributeName(inputString); |
670 | 673 |
Vector pathInfo = new Vector(); |
... | ... | |
768 | 771 |
// if there is only one percentage search item, this query is a |
769 | 772 |
// percentage |
770 | 773 |
// search query |
771 |
MetaCatUtil.debugMessage("percentage number: "
|
|
772 |
+ query.getPercentageSymbolCount(), 35);
|
|
774 |
logMetacat.info("percentage number: "
|
|
775 |
+ query.getPercentageSymbolCount()); |
|
773 | 776 |
if (query.getPercentageSymbolCount() == 1) { |
774 |
MetaCatUtil.debugMessage("it is a percentage search", 30);
|
|
777 |
logMetacat.info("It is a percentage search");
|
|
775 | 778 |
percentageSearch = true; |
776 | 779 |
} |
777 | 780 |
|
... | ... | |
815 | 818 |
sql.append(")"); |
816 | 819 |
sql.append(")"); |
817 | 820 |
sql.append(")"); |
818 |
MetaCatUtil.debugMessage("accessControlSQLForReturnField: "
|
|
819 |
+ sql.toString(), 30);
|
|
821 |
logMetacat.info("accessControlSQLForReturnField: "
|
|
822 |
+ sql.toString()); |
|
820 | 823 |
return sql.toString(); |
821 | 824 |
} |
822 | 825 |
|
... | ... | |
883 | 886 |
public String printExtendedSQL(String doclist, |
884 | 887 |
Hashtable unaccessableNodePair) |
885 | 888 |
{ |
886 |
MetaCatUtil.debugMessage("querySpecification.printExtendedSQL called\n", 35);
|
|
889 |
logMetacat.info("querySpecification.printExtendedSQL called\n");
|
|
887 | 890 |
StringBuffer self = new StringBuffer(); |
888 | 891 |
|
889 | 892 |
boolean usePathIndex = true; |
... | ... | |
1080 | 1083 |
self.append(" AND xml_nodes.rootnodeid = xml_documents.rootnodeid"); |
1081 | 1084 |
} |
1082 | 1085 |
|
1083 |
MetaCatUtil.debugMessage("Attribute query: " + self.toString(), 30);
|
|
1086 |
logMetacat.warn("Attribute query: " + self.toString());
|
|
1084 | 1087 |
|
1085 | 1088 |
return self.toString(); |
1086 | 1089 |
} |
... | ... | |
1117 | 1120 |
self.append(returnPath); |
1118 | 1121 |
self.append("' AND "); |
1119 | 1122 |
}else { |
1120 |
MetaCatUtil.debugMessage("QuerySpecification.printAttributeQuery: "
|
|
1121 |
+ "returnPath is: " + returnPath, 30);
|
|
1123 |
logMetacat.info("QuerySpecification.printAttributeQuery: "
|
|
1124 |
+ "returnPath is: " + returnPath); |
|
1122 | 1125 |
} |
1123 | 1126 |
self.append("xml_nodes.nodename like '"); |
1124 | 1127 |
self.append(attributeName); |
... | ... | |
1130 | 1133 |
self.append(returnPath); |
1131 | 1134 |
self.append("' AND "); |
1132 | 1135 |
}else { |
1133 |
MetaCatUtil.debugMessage("QuerySpecification.printAttributeQuery: "
|
|
1134 |
+ "returnPath is null: " + returnPath, 30);
|
|
1136 |
logMetacat.info("QuerySpecification.printAttributeQuery: "
|
|
1137 |
+ "returnPath is null: " + returnPath); |
|
1135 | 1138 |
} |
1136 | 1139 |
self.append("xml_nodes.nodename like '"); |
1137 | 1140 |
self.append(attributeName); |
... | ... | |
1141 | 1144 |
self.append(") AND xml_nodes.docid in ("); |
1142 | 1145 |
self.append(doclist); |
1143 | 1146 |
self.append(") AND xml_nodes.nodetype = 'ATTRIBUTE'"); |
1144 |
MetaCatUtil.debugMessage("Attribute query: " + self.toString(), 30);
|
|
1147 |
logMetacat.warn("Attribute query: " + self.toString());
|
|
1145 | 1148 |
|
1146 | 1149 |
return self.toString(); |
1147 | 1150 |
} |
... | ... | |
1187 | 1190 |
if (index != 0) { |
1188 | 1191 |
newExpression = pathExpression.substring(0, index - 1); |
1189 | 1192 |
} |
1190 |
MetaCatUtil.debugMessage("The path expression without attributes: "
|
|
1191 |
+ newExpression, 30);
|
|
1193 |
logMetacat.info("The path expression without attributes: "
|
|
1194 |
+ newExpression); |
|
1192 | 1195 |
return newExpression; |
1193 | 1196 |
} |
1194 | 1197 |
|
... | ... | |
1202 | 1205 |
if (index != 1) { |
1203 | 1206 |
attributeName = path.substring(index + 1, size); |
1204 | 1207 |
} |
1205 |
MetaCatUtil.debugMessage("The attirbute name from path: "
|
|
1206 |
+ attributeName, 30);
|
|
1208 |
logMetacat.info("The attirbute name from path: "
|
|
1209 |
+ attributeName); |
|
1207 | 1210 |
return attributeName; |
1208 | 1211 |
} |
1209 | 1212 |
|
src/edu/ucsb/nceas/metacat/MetacatReplication.java | ||
---|---|---|
38 | 38 |
import javax.servlet.*; |
39 | 39 |
import javax.servlet.http.*; |
40 | 40 |
|
41 |
import org.apache.log4j.Logger; |
|
41 | 42 |
import org.xml.sax.*; |
42 | 43 |
|
43 | 44 |
public class MetacatReplication extends HttpServlet implements Runnable |
... | ... | |
55 | 56 |
private static final String TIMEREPLICATIONINTERVAl = "timedreplicationinterval"; |
56 | 57 |
private static final String FIRSTTIME = "firsttimedreplication"; |
57 | 58 |
private static final int TIMEINTERVALLIMIT = 7200000; |
58 |
|
|
59 |
private static Logger logMetacat = Logger.getLogger(MetacatReplication.class); |
|
60 |
|
|
59 | 61 |
/** |
60 | 62 |
* Initialize the servlet by creating appropriate database connections |
61 | 63 |
*/ |
... | ... | |
70 | 72 |
try |
71 | 73 |
{ |
72 | 74 |
timedReplicationIsOn = (new Boolean(util.getOption(TIMEREPLICATION ).trim())).booleanValue(); |
73 |
MetaCatUtil.debugMessage("The timed replication on is"+timedReplicationIsOn, 30);
|
|
75 |
logMetacat.info("The timed replication on is"+timedReplicationIsOn);
|
|
74 | 76 |
timeInterval = (new Long(util.getOption(TIMEREPLICATIONINTERVAl).trim())).longValue(); |
75 |
MetaCatUtil.debugMessage("The timed replication time Inerval is "+ timeInterval, 20);
|
|
77 |
logMetacat.warn("The timed replication time Inerval is "+ timeInterval);
|
|
76 | 78 |
String firstTimeStr = util.getOption(FIRSTTIME); |
77 |
MetaCatUtil.debugMessage("first replication time form property is "+firstTimeStr, 20);
|
|
79 |
logMetacat.warn("first replication time form property is "+firstTimeStr);
|
|
78 | 80 |
firstTime = ReplicationHandler.combinateCurrentDateAndGivenTime(firstTimeStr); |
79 |
MetaCatUtil.debugMessage("After combine current time, the real first time is "
|
|
80 |
+firstTime.toString()+" minisec", 20);
|
|
81 |
logMetacat.warn("After combine current time, the real first time is "
|
|
82 |
+firstTime.toString()+" minisec"); |
|
81 | 83 |
// set up time replication if it is on |
82 | 84 |
if (timedReplicationIsOn) |
83 | 85 |
{ |
... | ... | |
90 | 92 |
{ |
91 | 93 |
// the timed replication in Metacat.properties file has problem |
92 | 94 |
// so timed replication is setting to false; |
93 |
MetaCatUtil.debugMessage("Couldn't set up timed replication "+
|
|
95 |
logMetacat.error("Couldn't set up timed replication "+
|
|
94 | 96 |
" in Metacat replication servlet init because " + |
95 |
e.getMessage(), 20);
|
|
97 |
e.getMessage()); |
|
96 | 98 |
MetacatReplication.replErrorLog("Couldn't set up timed replication "+ |
97 | 99 |
" in Metacat replication servlet init because " + |
98 | 100 |
e.getMessage()); |
... | ... | |
176 | 178 |
if (params.containsKey("sessionid")) |
177 | 179 |
{ |
178 | 180 |
sess_id = ((String[]) params.get("sessionid"))[0]; |
179 |
MetaCatUtil.debugMessage("in has sessionid "+ sess_id, 40);
|
|
181 |
logMetacat.info("in has sessionid "+ sess_id);
|
|
180 | 182 |
if (sessionHash.containsKey(sess_id)) |
181 | 183 |
{ |
182 |
MetaCatUtil.debugMessage("find the id " + sess_id + " in hash table", 40);
|
|
184 |
logMetacat.info("find the id " + sess_id + " in hash table");
|
|
183 | 185 |
sess = (HttpSession) sessionHash.get(sess_id); |
184 | 186 |
} |
185 | 187 |
} |
186 | 188 |
username = (String) sess.getAttribute("username"); |
187 |
MetaCatUtil.debugMessage("The user name from session is: "+ username, 20);
|
|
189 |
logMetacat.warn("The user name from session is: "+ username);
|
|
188 | 190 |
groupnames = (String[]) sess.getAttribute("groupnames"); |
189 | 191 |
if (!MetaCatUtil.isAdministrator(username, groupnames)) |
190 | 192 |
{ |
... | ... | |
194 | 196 |
"\" is not authorized for this action."); |
195 | 197 |
out.print("</error>"); |
196 | 198 |
out.close(); |
197 |
MetaCatUtil.debugMessage("The user \"" + username +
|
|
198 |
"\" is not authorized for this action: " +action, 30);
|
|
199 |
logMetacat.warn("The user \"" + username +
|
|
200 |
"\" is not authorized for this action: " +action); |
|
199 | 201 |
replErrorLog("The user \"" + username + |
200 | 202 |
"\" is not authorized for this action: " +action); |
201 | 203 |
return; |
... | ... | |
249 | 251 |
} else { |
250 | 252 |
timeInterval = TIMEINTERVALLIMIT ; |
251 | 253 |
} |
252 |
MetaCatUtil.debugMessage("New rate is: " + timeInterval + " mini seconds.", 30);
|
|
254 |
logMetacat.info("New rate is: " + timeInterval + " mini seconds.");
|
|
253 | 255 |
if ( params.containsKey("firsttime")) |
254 | 256 |
{ |
255 | 257 |
firstTimeStr = ((String[])params.get("firsttime"))[0]; |
256 | 258 |
try |
257 | 259 |
{ |
258 | 260 |
firstTime = ReplicationHandler.combinateCurrentDateAndGivenTime(firstTimeStr); |
259 |
MetaCatUtil.debugMessage("The first time setting is "+firstTime.toString(), 30);
|
|
261 |
logMetacat.info("The first time setting is "+firstTime.toString());
|
|
260 | 262 |
} |
261 | 263 |
catch (Exception e) |
262 | 264 |
{ |
263 | 265 |
throw new ServletException(e.getMessage()); |
264 | 266 |
} |
265 |
MetaCatUtil.debugMessage("After combine current time, the real first time is "
|
|
266 |
+firstTime.toString()+" minisec", 20);
|
|
267 |
logMetacat.warn("After combine current time, the real first time is "
|
|
268 |
+firstTime.toString()+" minisec"); |
|
267 | 269 |
} |
268 | 270 |
else |
269 | 271 |
{ |
270 | 272 |
MetacatReplication.replErrorLog("You should specify the first time " + |
271 | 273 |
"to start a time replication"); |
272 |
MetaCatUtil.debugMessage("You should specify the first time " +
|
|
273 |
"to start a time replication", 30);
|
|
274 |
logMetacat.warn("You should specify the first time " +
|
|
275 |
"to start a time replication"); |
|
274 | 276 |
return; |
275 | 277 |
} |
276 | 278 |
|
... | ... | |
497 | 499 |
}//try |
498 | 500 |
catch (SQLException ee) |
499 | 501 |
{ |
500 |
MetaCatUtil.debugMessage("Error in " +
|
|
502 |
logMetacat.error("Error in " +
|
|
501 | 503 |
"MetacatReplication.handleServerControlRequest to close pstmt " |
502 |
+ ee.getMessage(), 30);
|
|
504 |
+ ee.getMessage()); |
|
503 | 505 |
}//catch |
504 | 506 |
finally |
505 | 507 |
{ |
... | ... | |
592 | 594 |
//override = true; //we are now overriding the default action |
593 | 595 |
} |
594 | 596 |
MetacatReplication.replLog("force replication request from " + server); |
595 |
MetaCatUtil.debugMessage("Force replication request from: "+ server, 34);
|
|
596 |
MetaCatUtil.debugMessage("Force replication docid: "+docid, 34);
|
|
597 |
MetaCatUtil.debugMessage("Force replication action: "+dbaction, 34);
|
|
597 |
logMetacat.info("Force replication request from: "+ server);
|
|
598 |
logMetacat.info("Force replication docid: "+docid);
|
|
599 |
logMetacat.info("Force replication action: "+dbaction);
|
|
598 | 600 |
// sending back read request to remote server |
599 | 601 |
URL u = new URL("https://" + server + "?server=" |
600 | 602 |
+util.getLocalReplicationServerName() |
... | ... | |
620 | 622 |
String homeServer=(String)docinfoHash.get("home_server"); |
621 | 623 |
String createdDate = (String)docinfoHash.get("date_created"); |
622 | 624 |
String updatedDate = (String)docinfoHash.get("date_updated"); |
623 |
MetaCatUtil.debugMessage("homeServer: "+homeServer, 34);
|
|
625 |
logMetacat.info("homeServer: "+homeServer);
|
|
624 | 626 |
// Get Document type |
625 | 627 |
String docType = (String)docinfoHash.get("doctype"); |
626 |
MetaCatUtil.debugMessage("docType: "+docType, 34);
|
|
628 |
logMetacat.info("docType: "+docType);
|
|
627 | 629 |
String parserBase = null; |
628 | 630 |
// this for eml2 and we need user eml2 parser |
629 | 631 |
if (docType != null && |
630 | 632 |
(docType.trim()).equals(DocumentImpl.EML2_0_0NAMESPACE)) |
631 | 633 |
{ |
632 |
MetaCatUtil.debugMessage("This is an eml200 document!", 30);
|
|
634 |
logMetacat.warn("This is an eml200 document!");
|
|
633 | 635 |
parserBase = DocumentImpl.EML200; |
634 | 636 |
} |
635 | 637 |
else if (docType != null && (docType.trim()).equals(DocumentImpl.EML2_0_1NAMESPACE)) |
636 | 638 |
{ |
637 |
MetaCatUtil.debugMessage("This is an eml2.0.1 document!", 30);
|
|
639 |
logMetacat.warn("This is an eml2.0.1 document!");
|
|
638 | 640 |
parserBase = DocumentImpl.EML200; |
639 | 641 |
} |
640 | 642 |
else if (docType != null && (docType.trim()).equals(DocumentImpl.EML2_1_0NAMESPACE)) |
641 | 643 |
{ |
642 |
MetaCatUtil.debugMessage("This is an eml2.1.0 document!", 30);
|
|
644 |
logMetacat.warn("This is an eml2.1.0 document!");
|
|
643 | 645 |
parserBase = DocumentImpl.EML210; |
644 | 646 |
} |
645 |
MetaCatUtil.debugMessage("The parserBase is: "+parserBase, 30);
|
|
647 |
logMetacat.warn("The parserBase is: "+parserBase);
|
|
646 | 648 |
|
647 | 649 |
// Get DBConnection from pool |
648 | 650 |
dbConn=DBConnectionPool. |
... | ... | |
663 | 665 |
" failed to added to DB with " + |
664 | 666 |
"action " + dbaction + " because "+ |
665 | 667 |
e.getMessage()); |
666 |
MetaCatUtil.debugMessage("ERROR in MetacatReplication.handleForceReplicate" +
|
|
667 |
"Request(): " + e.getMessage(), 30);
|
|
668 |
logMetacat.error("ERROR in MetacatReplication.handleForceReplicate" +
|
|
669 |
"Request(): " + e.getMessage()); |
|
668 | 670 |
|
669 | 671 |
}//catch |
670 | 672 |
finally |
... | ... | |
687 | 689 |
{ |
688 | 690 |
MetacatReplication.replLog("force replication delete request from " + server); |
689 | 691 |
MetacatReplication.replLog("force replication delete docid " + docid); |
690 |
MetaCatUtil.debugMessage("Force replication delete request from: "+ server, 34);
|
|
691 |
MetaCatUtil.debugMessage("Force replication delete docid: "+docid, 34);
|
|
692 |
logMetacat.info("Force replication delete request from: "+ server);
|
|
693 |
logMetacat.info("Force replication delete docid: "+docid);
|
|
692 | 694 |
DocumentImpl.delete(docid, null, null, server); |
693 | 695 |
MetacatReplication.replLog("document " + docid + " was successfully deleted "); |
694 |
MetaCatUtil.debugMessage("document " + docid + " was successfully deleted ", 34);
|
|
696 |
logMetacat.info("document " + docid + " was successfully deleted ");
|
|
695 | 697 |
} |
696 | 698 |
catch(Exception e) |
697 | 699 |
{ |
698 | 700 |
MetacatReplication.replErrorLog("document " + docid + |
699 | 701 |
" failed to delete because "+ |
700 | 702 |
e.getMessage()); |
701 |
MetaCatUtil.debugMessage("ERROR in MetacatReplication.handleForceDeleteReplicate" +
|
|
702 |
"Request(): " + e.getMessage(), 30);
|
|
703 |
logMetacat.error("ERROR in MetacatReplication.handleForceDeleteReplicate" +
|
|
704 |
"Request(): " + e.getMessage()); |
|
703 | 705 |
|
704 | 706 |
}//catch |
705 | 707 |
|
... | ... | |
726 | 728 |
// Make sure there is a docid and server |
727 | 729 |
if (docid==null || server==null || server.equals("")) |
728 | 730 |
{ |
729 |
MetaCatUtil.debugMessage("Didn't specify docid or server for replication" |
|
730 |
, 20); |
|
731 |
logMetacat.error("Didn't specify docid or server for replication"); |
|
731 | 732 |
return; |
732 | 733 |
} |
733 | 734 |
|
... | ... | |
751 | 752 |
} |
752 | 753 |
|
753 | 754 |
MetacatReplication.replLog("force replication request from " + server); |
754 |
MetaCatUtil.debugMessage("Force replication request from: "+ server, 34);
|
|
755 |
MetaCatUtil.debugMessage("Force replication docid: "+docid, 34);
|
|
756 |
MetaCatUtil.debugMessage("Force replication action: "+dbaction, 34);
|
|
755 |
logMetacat.info("Force replication request from: "+ server);
|
|
756 |
logMetacat.info("Force replication docid: "+docid);
|
|
757 |
logMetacat.info("Force replication action: "+dbaction);
|
|
757 | 758 |
// get the document info from server |
758 | 759 |
URL docinfourl = new URL("https://" + server + |
759 | 760 |
"?server="+util.getLocalReplicationServerName() |
... | ... | |
777 | 778 |
String createdDate = (String)docinfoHash.get("date_created"); |
778 | 779 |
|
779 | 780 |
String updatedDate = (String)docinfoHash.get("date_updated"); |
780 |
MetaCatUtil.debugMessage("docHomeServer of datafile: "+docHomeServer, 34);
|
|
781 |
logMetacat.info("docHomeServer of datafile: "+docHomeServer);
|
|
781 | 782 |
|
782 | 783 |
|
783 | 784 |
|
... | ... | |
818 | 819 |
" failed to added to DB with " + |
819 | 820 |
"action " + dbaction + " because "+ |
820 | 821 |
e.getMessage()); |
821 |
MetaCatUtil.debugMessage
|
|
822 |
logMetacat.error
|
|
822 | 823 |
("ERROR in MetacatReplication.handleForceDataFileReplicate" + |
823 |
"Request(): " + e.getMessage(), 30);
|
|
824 |
"Request(): " + e.getMessage()); |
|
824 | 825 |
} |
825 | 826 |
} |
826 | 827 |
/** |
... | ... | |
942 | 943 |
//check if the doicd is null |
943 | 944 |
if (docId==null) |
944 | 945 |
{ |
945 |
util.debugMessage("Didn't specify docid for replication", 20);
|
|
946 |
logMetacat.error("Didn't specify docid for replication");
|
|
946 | 947 |
return; |
947 | 948 |
} |
948 | 949 |
|
... | ... | |
960 | 961 |
{ |
961 | 962 |
//response.setContentType("text/xml"); |
962 | 963 |
//outPut.println("<error>Couldn't pass the trust test</error>"); |
963 |
MetaCatUtil.debugMessage("Couldn't pass the trust test", 20);
|
|
964 |
logMetacat.error("Couldn't pass the trust test");
|
|
964 | 965 |
return; |
965 | 966 |
} |
966 | 967 |
}//try |
... | ... | |
1080 | 1081 |
} |
1081 | 1082 |
catch(Exception e) |
1082 | 1083 |
{ |
1083 |
MetaCatUtil.debugMessage("error getting document from MetacatReplication."
|
|
1084 |
+"handlGetDocumentRequest " + e.getMessage(), 30);
|
|
1084 |
logMetacat.error("error getting document from MetacatReplication."
|
|
1085 |
+"handlGetDocumentRequest " + e.getMessage()); |
|
1085 | 1086 |
//e.printStackTrace(System.out); |
1086 | 1087 |
response.setContentType("text/xml"); |
1087 | 1088 |
out.println("<error>"+e.getMessage()+"</error>"); |
... | ... | |
1191 | 1192 |
docsql.append(serverLocation); |
1192 | 1193 |
revisionSql.append(serverLocation); |
1193 | 1194 |
} |
1194 |
MetaCatUtil.debugMessage("Doc sql: "+docsql.toString(), 30);
|
|
1195 |
logMetacat.info("Doc sql: "+docsql.toString());
|
|
1195 | 1196 |
|
1196 | 1197 |
// Get any deleted documents |
1197 | 1198 |
delsql.append("select distinct docid from "); |
... | ... | |
1203 | 1204 |
{ |
1204 | 1205 |
delsql.append("and server_location = 1"); |
1205 | 1206 |
} |
1206 |
MetaCatUtil.debugMessage("Deleted sql: "+delsql.toString(), 30);
|
|
1207 |
logMetacat.info("Deleted sql: "+delsql.toString());
|
|
1207 | 1208 |
|
1208 | 1209 |
|
1209 | 1210 |
|
... | ... | |
1322 | 1323 |
doclist.append(prepareRevisionDoc(dbConn,revisionSql.toString(),replicateData)); |
1323 | 1324 |
|
1324 | 1325 |
doclist.append("</updates></replication>"); |
1325 |
MetaCatUtil.debugMessage("doclist: " + doclist.toString(), 40);
|
|
1326 |
logMetacat.info("doclist: " + doclist.toString());
|
|
1326 | 1327 |
pstmt.close(); |
1327 | 1328 |
//conn.close(); |
1328 | 1329 |
response.setContentType("text/xml"); |
... | ... | |
1331 | 1332 |
} |
1332 | 1333 |
catch(Exception e) |
1333 | 1334 |
{ |
1334 |
MetaCatUtil.debugMessage("error in MetacatReplication." +
|
|
1335 |
"handleupdaterequest: " + e.getMessage(), 30);
|
|
1335 |
logMetacat.error("error in MetacatReplication." +
|
|
1336 |
"handleupdaterequest: " + e.getMessage()); |
|
1336 | 1337 |
//e.printStackTrace(System.out); |
1337 | 1338 |
response.setContentType("text/xml"); |
1338 | 1339 |
out.println("<error>"+e.getMessage()+"</error>"); |
... | ... | |
1345 | 1346 |
}//try |
1346 | 1347 |
catch (SQLException ee) |
1347 | 1348 |
{ |
1348 |
MetaCatUtil.debugMessage("Error in MetacatReplication." +
|
|
1349 |
"handleUpdaterequest to close pstmt: "+ee.getMessage(), 30);
|
|
1349 |
logMetacat.error("Error in MetacatReplication." +
|
|
1350 |
"handleUpdaterequest to close pstmt: "+ee.getMessage()); |
|
1350 | 1351 |
}//catch |
1351 | 1352 |
finally |
1352 | 1353 |
{ |
... | ... | |
1363 | 1364 |
private String prepareRevisionDoc(DBConnection dbConn, String revSql, |
1364 | 1365 |
boolean replicateData) throws Exception |
1365 | 1366 |
{ |
1366 |
MetaCatUtil.debugMessage("The revision document sql is "+ revSql, 20);
|
|
1367 |
logMetacat.warn("The revision document sql is "+ revSql);
|
|
1367 | 1368 |
StringBuffer revDocList = new StringBuffer(); |
1368 | 1369 |
PreparedStatement pstmt = dbConn.prepareStatement(revSql); |
1369 | 1370 |
//usage count should increas 1 |
... | ... | |
1470 | 1471 |
catch(Exception e) |
1471 | 1472 |
{ |
1472 | 1473 |
|
1473 |
MetaCatUtil.debugMessage("error in MetacatReplication.handleGetCatalogRequest:"+
|
|
1474 |
e.getMessage(), 30);
|
|
1474 |
logMetacat.error("error in MetacatReplication.handleGetCatalogRequest:"+
|
|
1475 |
e.getMessage()); |
|
1475 | 1476 |
e.printStackTrace(System.out); |
1476 | 1477 |
if(printFlag) |
1477 | 1478 |
{ |
... | ... | |
1486 | 1487 |
}//try |
1487 | 1488 |
catch (SQLException ee) |
1488 | 1489 |
{ |
1489 |
MetaCatUtil. |
|
1490 |
debugMessage("Error in MetacatReplication.handleGetCatalogRequest: " |
|
1491 |
+ee.getMessage(), 30); |
|
1490 |
logMetacat.error("Error in MetacatReplication.handleGetCatalogRequest: " |
|
1491 |
+ee.getMessage()); |
|
1492 | 1492 |
}//catch |
1493 | 1493 |
finally |
1494 | 1494 |
{ |
... | ... | |
1524 | 1524 |
{ |
1525 | 1525 |
try |
1526 | 1526 |
{ |
1527 |
MetaCatUtil.debugMessage("thread started for docid: " +
|
|
1528 |
(String)fileLocks.elementAt(0), 45);
|
|
1527 |
logMetacat.info("thread started for docid: " +
|
|
1528 |
(String)fileLocks.elementAt(0)); |
|
1529 | 1529 |
|
1530 | 1530 |
Thread.sleep(30000); //the lock will expire in 30 seconds |
1531 |
MetaCatUtil.debugMessage("thread for docid: " +
|
|
1531 |
logMetacat.info("thread for docid: " +
|
|
1532 | 1532 |
(String)fileLocks.elementAt(fileLocks.size() - 1) + |
1533 |
" exiting.", 45);
|
|
1533 |
" exiting."); |
|
1534 | 1534 |
|
1535 | 1535 |
fileLocks.remove(fileLocks.size() - 1); |
1536 | 1536 |
//fileLocks is treated as a FIFO queue. If there are more than one lock |
... | ... | |
1538 | 1538 |
} |
1539 | 1539 |
catch(Exception e) |
1540 | 1540 |
{ |
1541 |
MetaCatUtil.debugMessage("error in file lock thread from " +
|
|
1542 |
"MetacatReplication.run: " + e.getMessage(), 30);
|
|
1541 |
logMetacat.error("error in file lock thread from " +
|
|
1542 |
"MetacatReplication.run: " + e.getMessage()); |
|
1543 | 1543 |
} |
1544 | 1544 |
} |
1545 | 1545 |
|
... | ... | |
1589 | 1589 |
}//try |
1590 | 1590 |
catch (SQLException ee) |
1591 | 1591 |
{ |
1592 |
MetaCatUtil.debugMessage("Error in MetacactReplication.getserver: "+
|
|
1593 |
ee.getMessage(), 30);
|
|
1592 |
logMetacat.error("Error in MetacactReplication.getserver: "+
|
|
1593 |
ee.getMessage()); |
|
1594 | 1594 |
}//catch |
1595 | 1595 |
finally |
1596 | 1596 |
{ |
... | ... | |
1646 | 1646 |
}//try |
1647 | 1647 |
catch(Exception ee) |
1648 | 1648 |
{ |
1649 |
MetaCatUtil.debugMessage("Error in MetacatReplicatio.getServerCode: "
|
|
1650 |
+ee.getMessage(), 30);
|
|
1649 |
logMetacat.error("Error in MetacatReplicatio.getServerCode: "
|
|
1650 |
+ee.getMessage()); |
|
1651 | 1651 |
|
1652 | 1652 |
}//catch |
1653 | 1653 |
finally |
... | ... | |
1737 | 1737 |
} |
1738 | 1738 |
catch (Exception ee) |
1739 | 1739 |
{ |
1740 |
MetaCatUtil.debugMessage("Eror irn rplicationHandler.getHomeServer() "+
|
|
1741 |
"to close pstmt: "+ee.getMessage(), 30);
|
|
1740 |
logMetacat.error("Eror irn rplicationHandler.getHomeServer() "+
|
|
1741 |
"to close pstmt: "+ee.getMessage()); |
|
1742 | 1742 |
} |
1743 | 1743 |
finally |
1744 | 1744 |
{ |
... | ... | |
1809 | 1809 |
} |
1810 | 1810 |
catch(Exception ee) |
1811 | 1811 |
{ |
1812 |
MetaCatUtil.debugMessage("Erorr in Replication.getServerLocation "+
|
|
1813 |
"to close pstmt"+ee.getMessage(), 30);
|
|
1812 |
logMetacat.error("Erorr in Replication.getServerLocation "+
|
|
1813 |
"to close pstmt"+ee.getMessage()); |
|
1814 | 1814 |
} |
1815 | 1815 |
finally |
1816 | 1816 |
{ |
... | ... | |
1832 | 1832 |
{ |
1833 | 1833 |
char istreamChar; |
1834 | 1834 |
int istreamInt; |
1835 |
MetaCatUtil.debugMessage("Before open the stream"+u.toString(), 50);
|
|
1835 |
logMetacat.info("Before open the stream"+u.toString());
|
|
1836 | 1836 |
InputStream input = u.openStream(); |
1837 |
MetaCatUtil.debugMessage("Afetr open the stream"+u.toString(), 50);
|
|
1837 |
logMetacat.info("Afetr open the stream"+u.toString());
|
|
1838 | 1838 |
InputStreamReader istream = new InputStreamReader(input); |
1839 | 1839 |
StringBuffer serverResponse = new StringBuffer(); |
1840 | 1840 |
while((istreamInt = istream.read()) != -1) |
... | ... | |
1953 | 1953 |
}//try |
1954 | 1954 |
catch(Exception ee) |
1955 | 1955 |
{ |
1956 |
MetaCatUtil.debugMessage("Error in MetacatReplication.replToServer: "
|
|
1957 |
+ee.getMessage(), 30);
|
|
1956 |
logMetacat.error("Error in MetacatReplication.replToServer: "
|
|
1957 |
+ee.getMessage()); |
|
1958 | 1958 |
}//catch |
1959 | 1959 |
finally |
1960 | 1960 |
{ |
src/edu/ucsb/nceas/metacat/DBSAXHandler.java | ||
---|---|---|
41 | 41 |
import edu.ucsb.nceas.morpho.datapackage.Triple; |
42 | 42 |
import edu.ucsb.nceas.morpho.datapackage.TripleCollection; |
43 | 43 |
|
44 |
import org.apache.log4j.Logger; |
|
44 | 45 |
import org.xml.sax.Attributes; |
45 | 46 |
import org.xml.sax.SAXException; |
46 | 47 |
import org.xml.sax.SAXParseException; |
... | ... | |
136 | 137 |
|
137 | 138 |
public static final String ECOGRID = "ecogrid://"; |
138 | 139 |
|
140 |
private Logger logMetacat = Logger.getLogger(DBSAXHandler.class); |
|
141 |
|
|
139 | 142 |
/** |
140 | 143 |
* Construct an instance of the handler class |
141 | 144 |
* |
... | ... | |
218 | 221 |
/** SAX Handler that receives notification of beginning of the document */ |
219 | 222 |
public void startDocument() throws SAXException |
220 | 223 |
{ |
221 |
MetaCatUtil.debugMessage("start Document", 50);
|
|
224 |
logMetacat.info("start Document");
|
|
222 | 225 |
|
223 | 226 |
// Create the document node representation as root |
224 | 227 |
rootNode = new DBSAXNode(connection, this.docid); |
... | ... | |
230 | 233 |
/** SAX Handler that receives notification of end of the document */ |
231 | 234 |
public void endDocument() throws SAXException |
232 | 235 |
{ |
233 |
MetaCatUtil.debugMessage("end Document", 50);
|
|
236 |
logMetacat.info("end Document");
|
|
234 | 237 |
// Starting new thread for writing XML Index. |
235 | 238 |
// It calls the run method of the thread. |
236 | 239 |
|
... | ... | |
247 | 250 |
connection, tripleList); |
248 | 251 |
} |
249 | 252 |
} catch (Exception e) { |
250 |
MetaCatUtil.debugMessage(
|
|
253 |
logMetacat.error(
|
|
251 | 254 |
"Failed to write triples into relation table" |
252 |
+ e.getMessage(), 30);
|
|
255 |
+ e.getMessage()); |
|
253 | 256 |
throw new SAXException( |
254 | 257 |
"Failed to write triples into relation table " |
255 | 258 |
+ e.getMessage()); |
... | ... | |
261 | 264 |
public void startPrefixMapping(String prefix, String uri) |
262 | 265 |
throws SAXException |
263 | 266 |
{ |
264 |
MetaCatUtil.debugMessage("NAMESPACE", 50);
|
|
267 |
logMetacat.info("NAMESPACE");
|
|
265 | 268 |
|
266 | 269 |
namespaces.put(prefix, uri); |
267 | 270 |
} |
... | ... | |
273 | 276 |
// for element <eml:eml...> qname is "eml:eml", local name is "eml" |
274 | 277 |
// for element <acl....> both qname and local name is "eml" |
275 | 278 |
// uri is namesapce |
276 |
MetaCatUtil.debugMessage("Start ELEMENT(qName) " + qName, 50);
|
|
277 |
MetaCatUtil.debugMessage("Start ELEMENT(localName) " + localName, 50);
|
|
278 |
MetaCatUtil.debugMessage("Start ELEMENT(uri) " + uri, 50);
|
|
279 |
logMetacat.info("Start ELEMENT(qName) " + qName);
|
|
280 |
logMetacat.info("Start ELEMENT(localName) " + localName);
|
|
281 |
logMetacat.info("Start ELEMENT(uri) " + uri);
|
|
279 | 282 |
|
280 | 283 |
DBSAXNode parentNode = null; |
281 | 284 |
DBSAXNode currentNode = null; |
... | ... | |
316 | 319 |
} else { |
317 | 320 |
doctype = docname; |
318 | 321 |
} |
319 |
MetaCatUtil.debugMessage("DOCNAME-a: " + docname, 30);
|
|
320 |
MetaCatUtil.debugMessage("DOCTYPE-a: " + doctype, 30);
|
|
322 |
logMetacat.info("DOCNAME-a: " + docname);
|
|
323 |
logMetacat.info("DOCTYPE-a: " + doctype);
|
|
321 | 324 |
} else if (doctype == null) { |
322 | 325 |
// because docname is not null and it is declared in dtd |
323 | 326 |
// so could not be in schema, no namespace |
324 | 327 |
doctype = docname; |
325 |
MetaCatUtil.debugMessage("DOCTYPE-b: " + doctype, 30);
|
|
328 |
logMetacat.info("DOCTYPE-b: " + doctype);
|
|
326 | 329 |
} |
327 | 330 |
|
328 | 331 |
rootNode.writeNodename(docname); |
... | ... | |
440 | 443 |
} |
441 | 444 |
|
442 | 445 |
public void runIndexingThread(){ |
446 |
|
|
443 | 447 |
boolean useXMLIndex = |
444 | 448 |
(new Boolean(MetaCatUtil.getOption("usexmlindex"))).booleanValue(); |
445 | 449 |
if (useXMLIndex && !isRevisionDoc) { |
... | ... | |
447 | 451 |
xmlIndex.start(); |
448 | 452 |
} catch (NullPointerException e) { |
449 | 453 |
xmlIndex = null; |
450 |
MetaCatUtil.debugMessage("Error in DBSAXHandler.runIndexingThread() "
|
|
451 |
+ e.getMessage(), 20);
|
|
454 |
logMetacat.error("Error in DBSAXHandler.runIndexingThread() "
|
|
455 |
+ e.getMessage()); |
|
452 | 456 |
} |
453 | 457 |
} |
454 | 458 |
} |
... | ... | |
472 | 476 |
currentDocument.buildIndex(); |
473 | 477 |
} |
474 | 478 |
} catch (Exception e) { |
475 |
MetaCatUtil.debugMessage("Error in DBSAXHandler.run "
|
|
476 |
+ e.getMessage(), 30);
|
|
479 |
logMetacat.error("Error in DBSAXHandler.run "
|
|
480 |
+ e.getMessage()); |
|
477 | 481 |
} |
478 | 482 |
} |
479 | 483 |
|
... | ... | |
516 | 520 |
ResultSet doccheckRS = xmlDocCheck.getResultSet(); |
517 | 521 |
boolean tableHasRows = doccheckRS.next(); |
518 | 522 |
if (tableHasRows) { |
519 |
MetaCatUtil.debugMessage(
|
|
520 |
"=========== found the correct document", 35);
|
|
523 |
logMetacat.info(
|
|
524 |
"=========== found the correct document"); |
|
521 | 525 |
inxmldoc = true; |
522 | 526 |
} |
523 | 527 |
doccheckRS.close(); |
... | ... | |
534 | 538 |
//dbconn.close(); |
535 | 539 |
} catch (SQLException sqle) { |
536 | 540 |
} |
537 |
MetaCatUtil.debugMessage("Error in DBSAXHandler.checkDocumentTable "
|
|
538 |
+ e.getMessage(), 30);
|
|
541 |
logMetacat.error("Error in DBSAXHandler.checkDocumentTable "
|
|
542 |
+ e.getMessage()); |
|
539 | 543 |
|
540 | 544 |
} finally { |
541 | 545 |
DBConnectionPool.returnDBConnection(dbConn, serialNumber); |
... | ... | |
546 | 550 |
/** SAX Handler that is called for each XML text node */ |
547 | 551 |
public void characters(char[] cbuf, int start, int len) throws SAXException |
548 | 552 |
{ |
549 |
MetaCatUtil.debugMessage("CHARACTERS", 50);
|
|
553 |
logMetacat.info("CHARACTERS");
|
|
550 | 554 |
// buffer all text nodes for same element. This is for text was splited |
551 | 555 |
// into different nodes |
552 | 556 |
textBuffer.append(new String(cbuf, start, len)); |
... | ... | |
555 | 559 |
// if text buffer .size is greater than max, write it to db. |
556 | 560 |
// so we can save memory |
557 | 561 |
if (textBuffer.length() > MAXDATACHARS) { |
558 |
MetaCatUtil.debugMessage("Write text into DB in charaters" |
|
559 |
+ " when text buffer size is greater than maxmum number", |
|
560 |
50); |
|
562 |
logMetacat.info("Write text into DB in charaters" |
|
563 |
+ " when text buffer size is greater than maxmum number"); |
|
561 | 564 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
562 | 565 |
endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer, |
563 | 566 |
currentNode); |
... | ... | |
576 | 579 |
// When validation is turned "on", white spaces are reported here |
577 | 580 |
// When validation is turned "off" white spaces are not reported here, |
578 | 581 |
// but through characters() callback |
579 |
MetaCatUtil.debugMessage("IGNORABLEWHITESPACE", 50);
|
|
582 |
logMetacat.info("IGNORABLEWHITESPACE");
|
|
580 | 583 |
|
581 | 584 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
582 | 585 |
String data = null; |
... | ... | |
612 | 615 |
public void processingInstruction(String target, String data) |
613 | 616 |
throws SAXException |
614 | 617 |
{ |
615 |
MetaCatUtil.debugMessage("PI", 50);
|
|
618 |
logMetacat.info("PI");
|
|
616 | 619 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
617 | 620 |
endNodeId = currentNode.writeChildNodeToDB("PI", target, data, docid); |
618 | 621 |
} |
... | ... | |
621 | 624 |
public void endElement(String uri, String localName, String qName) |
622 | 625 |
throws SAXException |
623 | 626 |
{ |
624 |
MetaCatUtil.debugMessage("End ELEMENT " + qName, 50);
|
|
627 |
logMetacat.info("End ELEMENT " + qName);
|
|
625 | 628 |
|
626 | 629 |
// write buffered text nodes into db (so no splited) |
627 | 630 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
... | ... | |
630 | 633 |
// into the buffer, write the buffer to data base. The reason we put |
631 | 634 |
// write database here is for xerces some time split text node |
632 | 635 |
if (hitTextNode) { |
633 |
MetaCatUtil.debugMessage("Write text into DB in End Element", 50);
|
|
636 |
logMetacat.info("Write text into DB in End Element");
|
|
634 | 637 |
endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer, |
635 | 638 |
currentNode); |
636 | 639 |
|
... | ... | |
688 | 691 |
// we don't put the dtd node into node stack |
689 | 692 |
DBSAXNode dtdNode = new DBSAXNode(connection, name, publicId, systemId, |
690 | 693 |
currentNode, currentNode.getRootNodeID(), docid); |
691 |
MetaCatUtil.debugMessage("Start DTD", 50);
|
|
692 |
MetaCatUtil.debugMessage("Setting processingDTD to true", 50);
|
|
693 |
MetaCatUtil.debugMessage("DOCNAME: " + docname, 50);
|
|
694 |
MetaCatUtil.debugMessage("DOCTYPE: " + doctype, 50);
|
|
695 |
MetaCatUtil.debugMessage(" SYSID: " + systemid, 50);
|
|
694 |
logMetacat.info("Start DTD");
|
|
695 |
logMetacat.info("Setting processingDTD to true");
|
|
696 |
logMetacat.info("DOCNAME: " + docname);
|
|
697 |
logMetacat.info("DOCTYPE: " + doctype);
|
|
698 |
logMetacat.info(" SYSID: " + systemid);
|
|
696 | 699 |
} |
697 | 700 |
|
698 | 701 |
/** |
... | ... | |
702 | 705 |
{ |
703 | 706 |
|
704 | 707 |
processingDTD = false; |
705 |
MetaCatUtil.debugMessage("Setting processingDTD to false", 50);
|
|
706 |
MetaCatUtil.debugMessage("end DTD", 50);
|
|
708 |
logMetacat.info("Setting processingDTD to false");
|
|
709 |
logMetacat.info("end DTD");
|
|
707 | 710 |
} |
708 | 711 |
|
709 | 712 |
/** |
... | ... | |
711 | 714 |
*/ |
712 | 715 |
public void comment(char[] ch, int start, int length) throws SAXException |
713 | 716 |
{ |
714 |
MetaCatUtil.debugMessage("COMMENT", 50);
|
|
717 |
logMetacat.info("COMMENT");
|
|
715 | 718 |
if (!processingDTD) { |
716 | 719 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
717 | 720 |
endNodeId = currentNode.writeChildNodeToDB("COMMENT", null, |
... | ... | |
724 | 727 |
*/ |
725 | 728 |
public void startCDATA() throws SAXException |
726 | 729 |
{ |
727 |
MetaCatUtil.debugMessage("start CDATA", 50);
|
|
730 |
logMetacat.info("start CDATA");
|
|
728 | 731 |
} |
729 | 732 |
|
730 | 733 |
/** |
... | ... | |
732 | 735 |
*/ |
733 | 736 |
public void endCDATA() throws SAXException |
734 | 737 |
{ |
735 |
MetaCatUtil.debugMessage("end CDATA", 50);
|
|
738 |
logMetacat.info("end CDATA");
|
|
736 | 739 |
} |
737 | 740 |
|
738 | 741 |
/** |
... | ... | |
740 | 743 |
*/ |
741 | 744 |
public void startEntity(String name) throws SAXException |
742 | 745 |
{ |
743 |
MetaCatUtil.debugMessage("start ENTITY: " + name, 50);
|
|
746 |
logMetacat.info("start ENTITY: " + name);
|
|
744 | 747 |
//System.out.println("start ENTITY: " + name); |
745 | 748 |
if (name.equals("[dtd]")) { |
746 | 749 |
processingDTD = true; |
... | ... | |
752 | 755 |
*/ |
753 | 756 |
public void endEntity(String name) throws SAXException |
754 | 757 |
{ |
755 |
MetaCatUtil.debugMessage("end ENTITY: " + name, 50);
|
|
758 |
logMetacat.info("end ENTITY: " + name);
|
|
756 | 759 |
//System.out.println("end ENTITY: " + name); |
757 | 760 |
if (name.equals("[dtd]")) { |
758 | 761 |
processingDTD = false; |
... | ... | |
766 | 769 |
throws org.xml.sax.SAXException |
767 | 770 |
{ |
768 | 771 |
//System.out.println("ELEMENTDECL: " + name + " " + model); |
769 |
MetaCatUtil.debugMessage("ELEMENTDECL: " + name + " " + model, 50);
|
|
772 |
logMetacat.info("ELEMENTDECL: " + name + " " + model);
|
|
770 | 773 |
} |
771 | 774 |
|
772 | 775 |
/** |
... | ... | |
779 | 782 |
//System.out.println("ATTRIBUTEDECL: " + eName + " " |
780 | 783 |
// + aName + " " + type + " " + valueDefault + " " |
781 | 784 |
// + value); |
782 |
MetaCatUtil.debugMessage("ATTRIBUTEDECL: " + eName + " " + aName + " "
|
|
783 |
+ type + " " + valueDefault + " " + value, 50);
|
|
785 |
logMetacat.info("ATTRIBUTEDECL: " + eName + " " + aName + " "
|
|
786 |
+ type + " " + valueDefault + " " + value); |
|
784 | 787 |
} |
785 | 788 |
|
786 | 789 |
/** |
... | ... | |
790 | 793 |
throws org.xml.sax.SAXException |
791 | 794 |
{ |
792 | 795 |
//System.out.println("INTERNENTITYDECL: " + name + " " + value); |
793 |
MetaCatUtil.debugMessage("INTERNENTITYDECL: " + name + " " + value, 50);
|
|
796 |
logMetacat.info("INTERNENTITYDECL: " + name + " " + value);
|
|
794 | 797 |
} |
795 | 798 |
|
796 | 799 |
/** |
... | ... | |
801 | 804 |
{ |
802 | 805 |
//System.out.println("EXTERNENTITYDECL: " + name + " " + publicId |
803 | 806 |
// + " " + systemId); |
804 |
MetaCatUtil.debugMessage("EXTERNENTITYDECL: " + name + " " + publicId
|
|
805 |
+ " " + systemId, 50);
|
|
807 |
logMetacat.info("EXTERNENTITYDECL: " + name + " " + publicId
|
|
808 |
+ " " + systemId); |
|
806 | 809 |
// it processes other external entity, not the DTD; |
807 | 810 |
// it doesn't signal for the DTD here |
808 | 811 |
processingDTD = false; |
... | ... | |
817 | 820 |
*/ |
818 | 821 |
public void fatalError(SAXParseException exception) throws SAXException |
819 | 822 |
{ |
820 |
MetaCatUtil.debugMessage("FATALERROR: " + exception.getMessage(), 50);
|
|
823 |
logMetacat.fatal("FATALERROR: " + exception.getMessage());
|
|
821 | 824 |
throw (new SAXException("Fatal processing error.", exception)); |
822 | 825 |
} |
823 | 826 |
|
... | ... | |
826 | 829 |
*/ |
827 | 830 |
public void error(SAXParseException exception) throws SAXException |
828 | 831 |
{ |
829 |
MetaCatUtil.debugMessage("ERROR: " + exception.getMessage(), 50);
|
|
832 |
logMetacat.error("ERROR: " + exception.getMessage());
|
|
830 | 833 |
throw (new SAXException("Error in processing EML.", exception)); |
831 | 834 |
} |
832 | 835 |
|
... | ... | |
835 | 838 |
*/ |
836 | 839 |
public void warning(SAXParseException exception) throws SAXException |
837 | 840 |
{ |
838 |
MetaCatUtil.debugMessage("WARNING: " + exception.getMessage(), 50);
|
|
841 |
logMetacat.warn("WARNING: " + exception.getMessage());
|
|
839 | 842 |
throw (new SAXException("Warning.", exception)); |
840 | 843 |
} |
841 | 844 |
|
... | ... | |
896 | 899 |
|
897 | 900 |
// if there are some cotent in buffer, write it |
898 | 901 |
if (bufferSize > 0) { |
899 |
MetaCatUtil.debugMessage("Write text into DB", 50);
|
|
902 |
logMetacat.info("Write text into DB");
|
|
900 | 903 |
// This loop deals with the case where there are more characters |
901 | 904 |
// than can fit in a single database text field (limit is |
902 | 905 |
// MAXDATACHARS). If the text to be inserted exceeds MAXDATACHARS, |
src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java | ||
---|---|---|
45 | 45 |
import java.util.Stack; |
46 | 46 |
import java.util.Vector; |
47 | 47 |
|
48 |
import org.apache.log4j.Logger; |
|
48 | 49 |
import org.xml.sax.Attributes; |
49 | 50 |
import org.xml.sax.SAXException; |
50 | 51 |
|
... | ... | |
281 | 282 |
|
282 | 283 |
private static final String DISTRIBUTION = "distribution"; |
283 | 284 |
|
285 |
private Logger logMetacat = Logger.getLogger(Eml200SAXHandler.class); |
|
286 |
|
|
284 | 287 |
/** |
285 | 288 |
* Construct an instance of the handler class In this constructor, user can |
286 | 289 |
* specify the version need to upadate |
... | ... | |
345 | 348 |
} |
346 | 349 |
catch (Exception e) |
347 | 350 |
{ |
348 |
MetaCatUtil.debugMessage("erorr in Eml200SAXHanlder is "
|
|
349 |
+e.getMessage(), 30);
|
|
351 |
logMetacat.error("erorr in Eml200SAXHanlder is "
|
|
352 |
+e.getMessage()); |
|
350 | 353 |
throw new SAXException(e.getMessage()); |
351 | 354 |
} |
352 | 355 |
} |
... | ... | |
560 | 563 |
// for element <eml:eml...> qname is "eml:eml", local name is "eml" |
561 | 564 |
// for element <acl....> both qname and local name is "eml" |
562 | 565 |
// uri is namesapce |
563 |
MetaCatUtil.debugMessage("Start ELEMENT(qName) " + qName, 10);
|
|
564 |
MetaCatUtil.debugMessage("Start ELEMENT(localName) " + localName, 10);
|
|
565 |
MetaCatUtil.debugMessage("Start ELEMENT(uri) " + uri, 10);
|
|
566 |
logMetacat.info("Start ELEMENT(qName) " + qName);
|
|
567 |
logMetacat.info("Start ELEMENT(localName) " + localName);
|
|
568 |
logMetacat.info("Start ELEMENT(uri) " + uri);
|
|
566 | 569 |
|
567 | 570 |
DBSAXNode parentNode = null; |
568 | 571 |
DBSAXNode currentNode = null; |
... | ... | |
673 | 676 |
} else { |
674 | 677 |
doctype = docname; |
675 | 678 |
} |
676 |
MetaCatUtil.debugMessage("DOCNAME-a: " + docname, 30);
|
|
677 |
MetaCatUtil.debugMessage("DOCTYPE-a: " + doctype, 30);
|
|
679 |
logMetacat.info("DOCNAME-a: " + docname);
|
|
680 |
logMetacat.info("DOCTYPE-a: " + doctype);
|
|
678 | 681 |
} else if (doctype == null) { |
679 | 682 |
// because docname is not null and it is declared in dtd |
680 | 683 |
// so could not be in schema, no namespace |
681 | 684 |
doctype = docname; |
682 |
MetaCatUtil.debugMessage("DOCTYPE-b: " + doctype, 30);
|
|
685 |
logMetacat.info("DOCTYPE-b: " + doctype);
|
|
683 | 686 |
} |
684 | 687 |
rootNode.writeNodename(docname); |
685 | 688 |
//System.out.println("here!!!!!!!!!!!!!!!!!!1"); |
... | ... | |
833 | 836 |
// described element. If it has a descirbed element, |
834 | 837 |
// this code would hurt any thing |
835 | 838 |
processAdditionalAccess = true; |
836 |
MetaCatUtil.debugMessage("assing process addtional access true when meet access", 20);
|
|
839 |
logMetacat.warn("accessing process addtional access true when meet access");
|
|
837 | 840 |
} |
838 | 841 |
|
839 | 842 |
|
... | ... | |
934 | 937 |
localName, prefix, MetaCatUtil.normalize(null)); |
935 | 938 |
storedAccessNodeStack.push(nodeElement); |
936 | 939 |
processAdditionalAccess = true; |
937 |
MetaCatUtil.debugMessage("set processAdditonalAccess ture when meet describe", 20);
|
|
940 |
logMetacat.warn("set processAdditonalAccess ture when meet describe");
|
|
938 | 941 |
} |
939 | 942 |
else if (inAddtionalMetaData && processAdditionalAccess && |
940 | 943 |
parentNode.getTagName().equals(ADDITIONALMETADATA) && |
... | ... | |
950 | 953 |
// If additionalMetadata has access element, the flag will be |
951 | 954 |
// terminated in endElement |
952 | 955 |
processAdditionalAccess = false; |
953 |
MetaCatUtil.debugMessage("set processAddtionAccess false if the there is no access in additional", 20);
|
|
956 |
logMetacat.warn("set processAddtionAccess false if the there is no access in additional");
|
|
954 | 957 |
} |
955 | 958 |
else if (currentNode.getTagName().equals(DISTRIBUTION) && |
956 | 959 |
!inAddtionalMetaData) |
... | ... | |
1005 | 1008 |
inlineDataNameSpace = null; |
1006 | 1009 |
inlineDataNameSpace = new Hashtable(); |
1007 | 1010 |
//write inline data into file |
1008 |
MetaCatUtil.debugMessage("the inline element data is: "
|
|
1009 |
+ inlineElements.toString(), 50);
|
|
1011 |
logMetacat.info("the inline element data is: "
|
|
1012 |
+ inlineElements.toString()); |
|
1010 | 1013 |
writeInlineDataIntoFile(inlineDataFileWriter, inlineElements); |
1011 | 1014 |
}//else |
1012 | 1015 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
... | ... | |
1018 | 1021 |
/** SAX Handler that is called for each XML text node */ |
1019 | 1022 |
public void characters(char[] cbuf, int start, int len) throws SAXException |
1020 | 1023 |
{ |
1021 |
MetaCatUtil.debugMessage("CHARACTERS", 50);
|
|
1024 |
logMetacat.info("CHARACTERS");
|
|
1022 | 1025 |
if (!handleInlineData) { |
1023 | 1026 |
// buffer all text nodes for same element. This is for text was |
1024 | 1027 |
// splited |
... | ... | |
1030 | 1033 |
// so we can save memory |
1031 | 1034 |
if (textBuffer.length() >= MAXDATACHARS) |
1032 | 1035 |
{ |
1033 |
MetaCatUtil |
|
1034 |
.debugMessage( |
|
1035 |
"Write text into DB in charaters" |
|
1036 |
+ " when text buffer size is greater than maxmum number", |
|
1037 |
50); |
|
1036 |
logMetacat.info("Write text into DB in charaters" |
|
1037 |
+ " when text buffer size is greater than maxmum number"); |
|
1038 | 1038 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
1039 | 1039 |
endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer, |
1040 | 1040 |
currentNode); |
... | ... | |
1058 | 1058 |
// we don't need to buffered it. |
1059 | 1059 |
StringBuffer inlineText = new StringBuffer(); |
1060 | 1060 |
inlineText.append(new String(cbuf, start, len)); |
1061 |
MetaCatUtil.debugMessage(
|
|
1061 |
logMetacat.info(
|
|
1062 | 1062 |
"The inline text data write into file system: " |
1063 |
+ inlineText.toString(), 50);
|
|
1063 |
+ inlineText.toString()); |
|
1064 | 1064 |
writeInlineDataIntoFile(inlineDataFileWriter, inlineText); |
1065 | 1065 |
} |
1066 | 1066 |
} |
... | ... | |
1069 | 1069 |
public void endElement(String uri, String localName, String qName) |
1070 | 1070 |
throws SAXException |
1071 | 1071 |
{ |
1072 |
MetaCatUtil.debugMessage("End ELEMENT " + qName, 50);
|
|
1072 |
logMetacat.info("End ELEMENT " + qName);
|
|
1073 | 1073 |
|
1074 | 1074 |
// when close inline element |
1075 | 1075 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
... | ... | |
1079 | 1079 |
// Get the node from the stack |
1080 | 1080 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.pop(); |
1081 | 1081 |
String currentTag = currentNode.getTagName(); |
1082 |
MetaCatUtil.debugMessage("End of inline data", 35);
|
|
1082 |
logMetacat.info("End of inline data");
|
|
1083 | 1083 |
// close file writer |
1084 | 1084 |
try |
1085 | 1085 |
{ |
... | ... | |
1109 | 1109 |
} |
1110 | 1110 |
else |
1111 | 1111 |
{ |
1112 |
MetaCatUtil.debugMessage(
|
|
1112 |
logMetacat.info(
|
|
1113 | 1113 |
"inline data was changed by a user" |
1114 |
+ " who doesn't have permission", 30);
|
|
1114 |
+ " who doesn't have permission"); |
|
1115 | 1115 |
throw new SAXException(PERMISSIONERROR); |
1116 | 1116 |
|
1117 | 1117 |
} |
... | ... | |
1121 | 1121 |
// user get the inline data |
1122 | 1122 |
if (modifiedInlineData(distributionId, inlineDataFileName)) |
1123 | 1123 |
{ |
1124 |
MetaCatUtil.debugMessage(
|
|
1124 |
logMetacat.info(
|
|
1125 | 1125 |
"inline data was changed by a user" |
1126 |
+ " who doesn't have permission", 30);
|
|
1126 |
+ " who doesn't have permission"); |
|
1127 | 1127 |
throw new SAXException(PERMISSIONERROR); |
1128 | 1128 |
}//if |
1129 | 1129 |
}//else |
... | ... | |
1262 | 1262 |
}//else if |
1263 | 1263 |
// write text to db if it is not inline data |
1264 | 1264 |
|
1265 |
MetaCatUtil.debugMessage(
|
|
1266 |
"Write text into DB in End Element", 50);
|
|
1265 |
logMetacat.info(
|
|
1266 |
"Write text into DB in End Element"); |
|
1267 | 1267 |
|
1268 | 1268 |
// write text node into db |
1269 | 1269 |
endNodeId = writeTextForDBSAXNode(endNodeId, textBuffer, |
... | ... | |
1411 | 1411 |
endElement.append("</"); |
1412 | 1412 |
endElement.append(qName); |
1413 | 1413 |
endElement.append(">"); |
1414 |
MetaCatUtil.debugMessage("inline endElement: "
|
|
1415 |
+ endElement.toString(), 50);
|
|
1414 |
logMetacat.info("inline endElement: "
|
|
1415 |
+ endElement.toString()); |
|
1416 | 1416 |
writeInlineDataIntoFile(inlineDataFileWriter, endElement); |
1417 | 1417 |
} |
1418 | 1418 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
... | ... | |
1438 | 1438 |
{ |
1439 | 1439 |
return modified; |
1440 | 1440 |
} |
1441 |
MetaCatUtil.debugMessage("in handle inline data", 35);
|
|
1442 |
MetaCatUtil.debugMessage("the inline data file name from xml_access is: "
|
|
1443 |
+ oldInlineInternalFileName, 40);
|
|
1441 |
logMetacat.info("in handle inline data");
|
|
1442 |
logMetacat.info("the inline data file name from xml_access is: "
|
|
1443 |
+ oldInlineInternalFileName); |
|
1444 | 1444 |
|
1445 | 1445 |
try |
1446 | 1446 |
{ |
... | ... | |
1514 | 1514 |
*/ |
1515 | 1515 |
public void comment(char[] ch, int start, int length) throws SAXException |
1516 | 1516 |
{ |
1517 |
MetaCatUtil.debugMessage("COMMENT", 50);
|
|
1517 |
logMetacat.info("COMMENT");
|
|
1518 | 1518 |
if (!handleInlineData) { |
1519 | 1519 |
if (!processingDTD) { |
1520 | 1520 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
... | ... | |
1547 | 1547 |
inlineComment.append("<!--"); |
1548 | 1548 |
inlineComment.append(new String(ch, start, length)); |
1549 | 1549 |
inlineComment.append("-->"); |
1550 |
MetaCatUtil.debugMessage("inline data comment: "
|
|
1551 |
+ inlineComment.toString(), 50);
|
|
1550 |
logMetacat.info("inline data comment: "
|
|
1551 |
+ inlineComment.toString()); |
|
1552 | 1552 |
writeInlineDataIntoFile(inlineDataFileWriter, inlineComment); |
1553 | 1553 |
} |
1554 | 1554 |
} |
... | ... | |
1562 | 1562 |
public void processingInstruction(String target, String data) |
1563 | 1563 |
throws SAXException |
1564 | 1564 |
{ |
1565 |
MetaCatUtil.debugMessage("PI", 50);
|
|
1565 |
logMetacat.info("PI");
|
|
1566 | 1566 |
if (!handleInlineData) { |
1567 | 1567 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
1568 | 1568 |
endNodeId = currentNode.writeChildNodeToDB("PI", target, data, |
... | ... | |
1574 | 1574 |
inlinePI.append(" "); |
1575 | 1575 |
inlinePI.append(data); |
1576 | 1576 |
inlinePI.append("?>"); |
1577 |
MetaCatUtil.debugMessage("inline data pi is: "
|
|
1578 |
+ inlinePI.toString(), 50);
|
|
1577 |
logMetacat.info("inline data pi is: "
|
|
1578 |
+ inlinePI.toString()); |
|
1579 | 1579 |
writeInlineDataIntoFile(inlineDataFileWriter, inlinePI); |
1580 | 1580 |
} |
1581 | 1581 |
} |
... | ... | |
1584 | 1584 |
public void startPrefixMapping(String prefix, String uri) |
1585 | 1585 |
throws SAXException |
1586 | 1586 |
{ |
1587 |
MetaCatUtil.debugMessage("NAMESPACE", 50);
|
|
1588 |
MetaCatUtil.debugMessage("NAMESPACE prefix "+prefix, 50);
|
|
1589 |
MetaCatUtil.debugMessage("NAMESPACE uri "+uri, 50);
|
|
1587 |
logMetacat.info("NAMESPACE");
|
|
1588 |
logMetacat.info("NAMESPACE prefix "+prefix);
|
|
1589 |
logMetacat.info("NAMESPACE uri "+uri);
|
|
1590 | 1590 |
if (!handleInlineData) { |
1591 | 1591 |
namespaces.put(prefix, uri); |
1592 | 1592 |
} else { |
... | ... | |
1604 | 1604 |
// When validation is turned "on", white spaces are reported here |
1605 | 1605 |
// When validation is turned "off" white spaces are not reported here, |
1606 | 1606 |
// but through characters() callback |
1607 |
MetaCatUtil.debugMessage("IGNORABLEWHITESPACE", 50);
|
|
1607 |
logMetacat.info("IGNORABLEWHITESPACE");
|
|
1608 | 1608 |
if (!handleInlineData) { |
1609 | 1609 |
DBSAXNode currentNode = (DBSAXNode) nodeStack.peek(); |
1610 | 1610 |
String data = null; |
... | ... | |
1663 | 1663 |
/** SAX Handler that receives notification of end of the document */ |
1664 | 1664 |
public void endDocument() throws SAXException |
1665 | 1665 |
{ |
1666 |
MetaCatUtil.debugMessage("end Document", 50);
|
|
1666 |
logMetacat.info("end Document");
|
|
1667 | 1667 |
if (needCheckingAccessModule) |
1668 | 1668 |
{ |
1669 | 1669 |
compareAllAccessModules(); |
... | ... | |
1767 | 1767 |
{ |
1768 | 1768 |
// make sure stack1 and stack2 are not empty |
1769 | 1769 |
if (stack1.isEmpty() || stack2.isEmpty()) { |
1770 |
MetaCatUtil.debugMessage("Because stack is empty!", 35);
|
|
1770 |
logMetacat.info("Because stack is empty!");
|
|
1771 | 1771 |
throw new SAXException(UPDATEACCESSERROR); |
1772 | 1772 |
} |
1773 | 1773 |
// go throw two stacks and compare every element |
... | ... | |
1781 | 1781 |
record2 = (NodeRecord) stack2.pop(); |
1782 | 1782 |
} catch (EmptyStackException ee) { |
1783 | 1783 |
|
1784 |
MetaCatUtil.debugMessage(
|
|
1785 |
"Node stack2 is empty but stack1 isn't!", 35);
|
|
1784 |
logMetacat.error(
|
|
1785 |
"Node stack2 is empty but stack1 isn't!"); |
|
1786 | 1786 |
throw new SAXException(UPDATEACCESSERROR); |
1787 | 1787 |
} |
1788 | 1788 |
// if two records are not same throw a exception |
1789 | 1789 |
if (!record1.contentEquals(record2)) { |
1790 |
MetaCatUtil |
|
1791 |
.debugMessage( |
|
1792 |
"Two records from new and old stack are not " |
|
1793 |
+ "same!" + record1 + "--" +record2, 30); |
|
1790 |
logMetacat.info("Two records from new and old stack are not " |
|
1791 |
+ "same!" + record1 + "--" +record2); |
|
1794 | 1792 |
throw new SAXException(UPDATEACCESSERROR); |
1795 | 1793 |
}//if |
1796 | 1794 |
}//while |
... | ... | |
1798 | 1796 |
// now stack1 is empty and we should make sure stack2 is empty too |
1799 | 1797 |
if (!stack2.isEmpty()) { |
1800 | 1798 |
|
1801 |
MetaCatUtil.debugMessage(
|
|
1799 |
logMetacat.info(
|
|
1802 | 1800 |
"stack2 still have some elements while stack1 " |
1803 |
+ "is empty! ", 30);
|
|
1801 |
+ "is empty! "); |
|
1804 | 1802 |
throw new SAXException(UPDATEACCESSERROR); |
1805 | 1803 |
}//if |
1806 | 1804 |
}//comparingNodeStacks |
... | ... | |
1836 | 1834 |
{ |
1837 | 1835 |
if (access == null) |
1838 | 1836 |
{ |
1839 |
MetaCatUtil.debugMessage("access module is null in " +
|
|
1840 |
"resolveAccessRulesReference", 30);
|
|
1837 |
logMetacat.info("access module is null in " +
|
|
1838 |
"resolveAccessRulesReference"); |
|
1841 | 1839 |
throw new SAXException("An access modules is null"); |
1842 | 1840 |
} |
1843 | 1841 |
String subTreeId = access.getSubTreeId(); |
... | ... | |
1966 | 1964 |
for (int j = 0; j < describeIdList.size(); j++) |
1967 | 1965 |
{ |
1968 | 1966 |
String subreeid = (String)describeIdList.elementAt(j); |
1969 |
MetaCatUtil.debugMessage("describe id in additional access " +
|
|
1970 |
subreeid, 30);
|
|
1967 |
logMetacat.info("describe id in additional access " +
|
|
1968 |
subreeid); |
|
1971 | 1969 |
// we need to figure out the real id if this subreeid is points to |
1972 | 1970 |
// a distribution reference. |
1973 | 1971 |
subreeid = resolveDistributionReference(subreeid); |
1974 | 1972 |
if (subreeid != null && !subreeid.trim().equals("")) |
1975 | 1973 |
{ |
1976 |
MetaCatUtil.debugMessage("subtree id is "+ subreeid +
|
|
1977 |
" after resolve reference id", 30 );
|
|
1974 |
logMetacat.info("subtree id is "+ subreeid +
|
|
1975 |
" after resolve reference id" ); |
|
1978 | 1976 |
// if this id is for line data, we need to delete the records first |
1979 | 1977 |
// then add new records. The key for deleting is subtee id |
1980 | 1978 |
if (inlineDistributionIdList.containsKey(subreeid)) |
... | ... | |
1982 | 1980 |
String inlineFileName = (String) |
1983 | 1981 |
inlineDistributionIdList.get(subreeid); |
1984 | 1982 |
deleteSubtreeAccessRule(subreeid); |
1985 |
MetaCatUtil.debugMessage("Write inline data access into " +
|
|
1986 |
"xml_access table for"+ inlineFileName, 30);
|
|
1983 |
logMetacat.info("Write inline data access into " +
|
|
1984 |
"xml_access table for"+ inlineFileName); |
|
1987 | 1985 |
writeGivenAccessRuleIntoDB(permOrder, accessRule, |
1988 | 1986 |
inlineFileName, subreeid); |
1989 | 1987 |
} |
... | ... | |
1997 | 1995 |
// for online data, the subtree id we set is null. |
1998 | 1996 |
// So in xml_access, only the inline data subteeid is not null |
1999 | 1997 |
String dataFileName = handleOnlineUrlDataFile(url); |
2000 |
MetaCatUtil.debugMessage("The data fileName in online url " +
|
|
2001 |
dataFileName, 30);
|
|
1998 |
logMetacat.info("The data fileName in online url " +
|
|
1999 |
dataFileName); |
|
2002 | 2000 |
if (dataFileName != null) |
2003 | 2001 |
{ |
2004 | 2002 |
deletePermissionsInAccessTableForDoc(dataFileName); |
2005 | 2003 |
writeGivenAccessRuleIntoDB(permOrder, accessRule, |
2006 | 2004 |
dataFileName, null); |
2007 |
MetaCatUtil.debugMessage("Write online data access into " +
|
|
2008 |
"xml_access table for " + dataFileName, 30);
|
|
2005 |
logMetacat.info("Write online data access into " +
|
|
2006 |
"xml_access table for " + dataFileName); |
|
2009 | 2007 |
// put the id into a hashtalbe. So when we run wirtetop level |
2010 | 2008 |
// access, those id will be ignored because they already has |
2011 | 2009 |
// additional access rules |
... | ... | |
2083 | 2081 |
dataId.trim().equals("") || accessRules == null || |
2084 | 2082 |
accessRules.isEmpty()) |
2085 | 2083 |
{ |
2086 |
MetaCatUtil.debugMessage("The access object is null and tried to " +
|
|
2087 |
" write to xml_access table", 30);
|
|
2084 |
logMetacat.info("The access object is null and tried to " +
|
|
2085 |
" write to xml_access table"); |
|
2088 | 2086 |
throw new SAXException("The access object is null"); |
2089 | 2087 |
} |
2090 | 2088 |
// get rid of rev from dataId |
... | ... | |
2104 | 2102 |
connection.increaseUsageCount(1); |
2105 | 2103 |
// Bind the values to the query |
2106 | 2104 |
pstmt.setString(1, dataId); |
2107 |
MetaCatUtil.debugMessage("Docid in accesstable: " + docid, 35);
|
|
2105 |
logMetacat.info("Docid in accesstable: " + docid);
|
|
2108 | 2106 |
pstmt.setString(6, docid); |
2109 |
MetaCatUtil.debugMessage("Accessfileid in accesstable: " + docid, |
|
2110 |
35); |
|
2107 |
logMetacat.info("Accessfileid in accesstable: " + docid); |
|
2111 | 2108 |
pstmt.setString(5, permOrder); |
2112 |
MetaCatUtil.debugMessage("PermOder in accesstable: " + permOrder, |
|
2113 |
35); |
|
2109 |
logMetacat.info("PermOder in accesstable: " + permOrder); |
|
2114 | 2110 |
pstmt.setString(7, subTreeId); |
2115 |
MetaCatUtil.debugMessage("subtree id in accesstable: " + subTreeId, |
|
2116 |
35); |
|
2111 |
logMetacat.info("subtree id in accesstable: " + subTreeId); |
|
2117 | 2112 |
// if it is not top level, set s id |
2118 | 2113 |
|
2119 | 2114 |
//Vector accessRules = accessSection.getAccessRules(); |
... | ... | |
2124 | 2119 |
String permType = rule.getPermissionType(); |
2125 | 2120 |
int permission = rule.getPermission(); |
2126 | 2121 |
pstmt.setInt(3, permission); |
Also available in: Unified diff
Replacing MetaCatUtil.debugMessage or MetaCatUtil.logMetacat call with logMetacat (private Logger object) call