Revision 2663
Added by sgarg over 18 years ago
RelationHandler.java | ||
---|---|---|
28 | 28 |
import java.util.*; |
29 | 29 |
import java.net.*; |
30 | 30 |
|
31 |
import org.apache.log4j.Logger; |
|
31 | 32 |
|
33 |
|
|
32 | 34 |
public class RelationHandler //implements Runnable |
33 | 35 |
{ |
34 | 36 |
private DBConnection connection = null; |
35 | 37 |
private String docid = null; |
36 | 38 |
private String docType = null; |
37 |
|
|
39 |
private static Logger logMetacat = Logger.getLogger(RelationHandler.class); |
|
40 |
|
|
38 | 41 |
TripleCollection tripleForPackage = null; |
39 | 42 |
|
40 | 43 |
/** |
... | ... | |
73 | 76 |
String objDoctype = null; |
74 | 77 |
PreparedStatement tstmt = null; // to insert each relation into xml_relation |
75 | 78 |
|
76 |
MetaCatUtil.debugMessage("Running relation handler!", 40);
|
|
79 |
logMetacat.info("Running relation handler!");
|
|
77 | 80 |
|
78 | 81 |
// first delete the relations for this package document if any |
79 | 82 |
deleteRelations(docid); |
... | ... | |
101 | 104 |
connection.increaseUsageCount(1); |
102 | 105 |
// Get the triple |
103 | 106 |
Triple triple = (Triple)tripleList.elementAt(i); |
104 |
MetaCatUtil.debugMessage("Info from triple: ", 30);
|
|
105 |
MetaCatUtil.debugMessage("subject from triple:"+triple.getSubject(), 30);
|
|
106 |
MetaCatUtil.debugMessage("relationship from triple:"+triple.getRelationship(),30);
|
|
107 |
MetaCatUtil.debugMessage("object from triple: "+triple.getObject(),30);
|
|
107 |
logMetacat.info("Info from triple: ");
|
|
108 |
logMetacat.info("subject from triple:"+triple.getSubject());
|
|
109 |
logMetacat.info("relationship from triple:"+triple.getRelationship());
|
|
110 |
logMetacat.info("object from triple: "+triple.getObject());
|
|
108 | 111 |
//subject = (new DocumentIdentifier(triple.getSubject())).getIdentifier(); |
109 | 112 |
subject = MetaCatUtil.getDocIdFromString(triple.getSubject()); |
110 | 113 |
relationship = triple.getRelationship(); |
... | ... | |
115 | 118 |
{ |
116 | 119 |
|
117 | 120 |
//put the new relation into xml_relation |
118 |
MetaCatUtil.debugMessage("Insert into xml_relation table", 30);
|
|
121 |
logMetacat.info("Insert into xml_relation table");
|
|
119 | 122 |
tstmt.setString(1, docid); |
120 |
MetaCatUtil.debugMessage("Insert docid into xml_relation table" +
|
|
121 |
docid, 30);
|
|
123 |
logMetacat.info("Insert docid into xml_relation table" +
|
|
124 |
docid); |
|
122 | 125 |
tstmt.setString(2, packagetype); |
123 | 126 |
tstmt.setString(3, subject); |
124 |
MetaCatUtil.debugMessage("Insert subject into xml_relation table" +
|
|
125 |
subject, 30);
|
|
127 |
logMetacat.info("Insert subject into xml_relation table" +
|
|
128 |
subject); |
|
126 | 129 |
tstmt.setString(4, subDoctype); |
127 | 130 |
tstmt.setString(5, relationship); |
128 |
MetaCatUtil.debugMessage("Insert relationship into xml_relation table" +
|
|
129 |
relationship, 30);
|
|
131 |
logMetacat.info("Insert relationship into xml_relation table" +
|
|
132 |
relationship); |
|
130 | 133 |
tstmt.setString(6, object); |
131 |
MetaCatUtil.debugMessage("Insert object into xml_relation table" +
|
|
132 |
object, 30);
|
|
134 |
logMetacat.info("Insert object into xml_relation table" +
|
|
135 |
object); |
|
133 | 136 |
tstmt.setString(7, objDoctype); |
134 | 137 |
tstmt.execute(); |
135 | 138 |
}//if |
... | ... | |
160 | 163 |
pstmt.execute(); |
161 | 164 |
pstmt.close(); |
162 | 165 |
} catch(SQLException e) { |
163 |
MetaCatUtil.debugMessage("error in RelationHandler.deleteRelations(): " +
|
|
164 |
e.getMessage(), 30);
|
|
166 |
logMetacat.error("error in RelationHandler.deleteRelations(): " +
|
|
167 |
e.getMessage()); |
|
165 | 168 |
|
166 | 169 |
throw e; |
167 | 170 |
} |
... | ... | |
226 | 229 |
}//finally |
227 | 230 |
}//finally |
228 | 231 |
|
229 |
MetaCatUtil.debugMessage("The access docid get from xml_relation is: "+
|
|
230 |
aclid, 30);
|
|
232 |
logMetacat.info("The access docid get from xml_relation is: "+
|
|
233 |
aclid); |
|
231 | 234 |
return aclid; |
232 | 235 |
} |
233 | 236 |
|
Also available in: Unified diff
Replacing MetaCatUtil.debugMessage or MetaCatUtil.logMetacat call with logMetacat (private Logger object) call