Revision 6254
Added by Chris Jones almost 13 years ago
MNodeService.java | ||
---|---|---|
96 | 96 |
*/ |
97 | 97 |
public static MNodeService getInstance() { |
98 | 98 |
if (instance == null) { |
99 |
String metacatUrl = ""; |
|
100 |
String server; |
|
101 |
String port; |
|
102 |
String context; |
|
103 |
String serviceName; |
|
104 |
|
|
105 |
try { |
|
106 |
server = PropertyService.getProperty("server.name"); |
|
107 |
port = PropertyService.getProperty("server.httpPort"); |
|
108 |
context = PropertyService.getProperty("application.context"); |
|
109 |
serviceName = PropertyService.getProperty("dataone.serviceName"); |
|
110 |
|
|
111 |
} catch (PropertyNotFoundException e) { |
|
112 |
throw new RuntimeException("Error getting the servlet url in MNodeService: " + |
|
113 |
e.getMessage()); |
|
114 |
|
|
115 |
} |
|
116 |
metacatUrl = "http://" + server + ":" + port + "/" + context + "/" + serviceName; |
|
117 | 99 |
|
118 |
instance = new MNodeService(metacatUrl);
|
|
100 |
instance = new MNodeService(); |
|
119 | 101 |
|
120 | 102 |
} |
121 | 103 |
|
... | ... | |
124 | 106 |
|
125 | 107 |
/** |
126 | 108 |
* Constructor, private for singleton access |
127 |
* |
|
128 |
* @param metacatUrl - the URL of the metacat service, including the context |
|
129 |
* and serviceName (/d1) |
|
130 | 109 |
*/ |
131 |
private MNodeService(String metacatUrl) {
|
|
132 |
super(metacatUrl);
|
|
110 |
private MNodeService() { |
|
111 |
super(); |
|
133 | 112 |
logMetacat = Logger.getLogger(MNodeService.class); |
134 | 113 |
|
135 | 114 |
} |
... | ... | |
201 | 180 |
try { |
202 | 181 |
// delete the document |
203 | 182 |
DocumentImpl.delete(localId, subject.getValue(), groups, null); |
204 |
|
|
183 |
EventLog.getInstance().log(metacatUrl, subject.getValue(), localId, "create"); |
|
184 |
|
|
205 | 185 |
} catch (McdbDocNotFoundException e) { |
206 | 186 |
throw new InvalidRequest("1322", "The provided identifier was invalid."); |
207 | 187 |
|
... | ... | |
260 | 240 |
UnsupportedType, InsufficientResources, NotFound, InvalidSystemMetadata, |
261 | 241 |
NotImplemented, InvalidRequest { |
262 | 242 |
|
263 |
return null; |
|
243 |
|
|
244 |
return pid; |
|
264 | 245 |
} |
265 | 246 |
|
266 | 247 |
/** |
Also available in: Unified diff
At Ben's suggestion, add metacatUrl to D1NodeService and make it available to subclasses. Set the metacatUrl in the constructor using SystemUtil rather than all roll your own PropertyService calls. More concise. Also, log the delete event in MNodeService.delete().