Revision 6542
Added by ben leinfelder over 12 years ago
MNResourceHandler.java | ||
---|---|---|
308 | 308 |
} catch (Exception e) { |
309 | 309 |
logMetacat.warn("No permission specified"); |
310 | 310 |
} |
311 |
boolean result = MNodeService.getInstance().isAuthorized(session, pid, permission); |
|
311 |
boolean result = MNodeService.getInstance(request).isAuthorized(session, pid, permission);
|
|
312 | 312 |
response.setStatus(200); |
313 | 313 |
response.setContentType("text/xml"); |
314 | 314 |
return result; |
... | ... | |
335 | 335 |
throw new ServiceFailure("2161", e.getMessage()); |
336 | 336 |
} |
337 | 337 |
|
338 |
MNodeService.getInstance().synchronizationFailed(session, syncFailed); |
|
338 |
MNodeService.getInstance(request).synchronizationFailed(session, syncFailed);
|
|
339 | 339 |
} |
340 | 340 |
|
341 | 341 |
|
... | ... | |
364 | 364 |
|
365 | 365 |
if (pathInfo.toLowerCase().equals("ping")) { |
366 | 366 |
logMetacat.debug("processing ping request"); |
367 |
boolean result = MNodeService.getInstance().ping(); |
|
367 |
boolean result = MNodeService.getInstance(request).ping();
|
|
368 | 368 |
return result; |
369 | 369 |
|
370 | 370 |
} else if (pathInfo.toLowerCase().equals("status")) { |
... | ... | |
429 | 429 |
event = Event.convert(eventName); |
430 | 430 |
} |
431 | 431 |
|
432 |
MonitorList monitorList = MNodeService.getInstance().getOperationStatistics(session, fromDate, toDate, subject, event, fmtid); |
|
432 |
MonitorList monitorList = MNodeService.getInstance(request).getOperationStatistics(session, fromDate, toDate, subject, event, fmtid);
|
|
433 | 433 |
|
434 | 434 |
OutputStream out = response.getOutputStream(); |
435 | 435 |
response.setStatus(200); |
... | ... | |
500 | 500 |
} |
501 | 501 |
logMetacat.debug("getting checksum for object " + pid + " with algorithm " + checksumAlgorithm); |
502 | 502 |
|
503 |
Checksum c = MNodeService.getInstance().getChecksum(session, pidid, checksumAlgorithm); |
|
503 |
Checksum c = MNodeService.getInstance(request).getChecksum(session, pidid, checksumAlgorithm);
|
|
504 | 504 |
logMetacat.debug("got checksum " + c.getValue()); |
505 | 505 |
response.setStatus(200); |
506 | 506 |
logMetacat.debug("serializing response"); |
... | ... | |
534 | 534 |
logMetacat.debug("sourceNode: " + sn); |
535 | 535 |
NodeReference sourceNode = TypeMarshaller.unmarshalTypeFromStream(NodeReference.class, new ByteArrayInputStream(sn.getBytes("UTF-8"))); |
536 | 536 |
|
537 |
MNodeService.getInstance().replicate(session, sysmeta, sourceNode); |
|
537 |
MNodeService.getInstance(request).replicate(session, sysmeta, sourceNode);
|
|
538 | 538 |
|
539 | 539 |
response.setStatus(200); |
540 | 540 |
|
... | ... | |
553 | 553 |
private void node() |
554 | 554 |
throws JiBXException, IOException, NotImplemented, NotAuthorized, ServiceFailure, InvalidRequest { |
555 | 555 |
|
556 |
Node n = MNodeService.getInstance().getCapabilities(); |
|
556 |
Node n = MNodeService.getInstance(request).getCapabilities();
|
|
557 | 557 |
|
558 | 558 |
response.setContentType("text/xml"); |
559 | 559 |
response.setStatus(200); |
... | ... | |
580 | 580 |
Identifier id = new Identifier(); |
581 | 581 |
id.setValue(pid); |
582 | 582 |
|
583 |
DescribeResponse dr = MNodeService.getInstance().describe(session, id); |
|
583 |
DescribeResponse dr = MNodeService.getInstance(request).describe(session, id);
|
|
584 | 584 |
//response.addHeader("pid", pid); |
585 | 585 |
response.addHeader("DataONE-Checksum", dr.getDataONE_Checksum().getAlgorithm() + "," + dr.getDataONE_Checksum().getValue()); |
586 | 586 |
response.addHeader("Content-Length", dr.getContent_Length() + ""); |
... | ... | |
644 | 644 |
} |
645 | 645 |
|
646 | 646 |
logMetacat.debug("calling getLogRecords"); |
647 |
Log log = MNodeService.getInstance().getLogRecords(session, fromDate, toDate, event, start, count); |
|
647 |
Log log = MNodeService.getInstance(request).getLogRecords(session, fromDate, toDate, event, start, count);
|
|
648 | 648 |
|
649 | 649 |
OutputStream out = response.getOutputStream(); |
650 | 650 |
response.setStatus(200); |
... | ... | |
673 | 673 |
Identifier id = new Identifier(); |
674 | 674 |
id.setValue(pid); |
675 | 675 |
|
676 |
SystemMetadata sm = MNodeService.getInstance().getSystemMetadata(session, id); |
|
676 |
SystemMetadata sm = MNodeService.getInstance(request).getSystemMetadata(session, id);
|
|
677 | 677 |
|
678 | 678 |
//set the content type |
679 | 679 |
if (sm.getFmtid().getValue().trim().equals( |
... | ... | |
699 | 699 |
response.setHeader("Content-Disposition", "inline; filename=" + id.getValue() + ".xml"); |
700 | 700 |
} |
701 | 701 |
|
702 |
InputStream data = MNodeService.getInstance().get(session, id); |
|
702 |
InputStream data = MNodeService.getInstance(request).get(session, id);
|
|
703 | 703 |
|
704 | 704 |
out = response.getOutputStream(); |
705 | 705 |
IOUtils.copyLarge(data, out); |
... | ... | |
783 | 783 |
|
784 | 784 |
} |
785 | 785 |
ObjectList ol = |
786 |
MNodeService.getInstance().listObjects(session, startTime, endTime, |
|
786 |
MNodeService.getInstance(request).listObjects(session, startTime, endTime,
|
|
787 | 787 |
fmtid, replicaStatus, start, count); |
788 | 788 |
|
789 | 789 |
out = response.getOutputStream(); |
... | ... | |
813 | 813 |
|
814 | 814 |
Identifier id = new Identifier(); |
815 | 815 |
id.setValue(pid); |
816 |
SystemMetadata sysmeta = MNodeService.getInstance().getSystemMetadata(session, id); |
|
816 |
SystemMetadata sysmeta = MNodeService.getInstance(request).getSystemMetadata(session, id);
|
|
817 | 817 |
|
818 | 818 |
response.setContentType("text/xml"); |
819 | 819 |
response.setStatus(200); |
... | ... | |
870 | 870 |
Identifier id = new Identifier(); |
871 | 871 |
id.setValue(pid); |
872 | 872 |
logMetacat.debug("creating object with pid " + pid); |
873 |
Identifier rId = MNodeService.getInstance().create(session, id, object, smd); |
|
873 |
Identifier rId = MNodeService.getInstance(request).create(session, id, object, smd);
|
|
874 | 874 |
TypeMarshaller.marshalTypeToOutputStream(rId, out); |
875 | 875 |
|
876 | 876 |
} else if (action.equals(FUNCTION_NAME_UPDATE)) { |
... | ... | |
893 | 893 |
// get the systemmetadata object |
894 | 894 |
SystemMetadata smd = TypeMarshaller.unmarshalTypeFromStream(SystemMetadata.class, sysmeta); |
895 | 895 |
|
896 |
Identifier rId = MNodeService.getInstance().update(session, obsoletedPid, object, newPid, smd); |
|
896 |
Identifier rId = MNodeService.getInstance(request).update(session, obsoletedPid, object, newPid, smd);
|
|
897 | 897 |
TypeMarshaller.marshalTypeToOutputStream(rId, out); |
898 | 898 |
} else { |
899 | 899 |
throw new InvalidRequest("1000", "Operation must be create or update."); |
... | ... | |
925 | 925 |
id.setValue(pid); |
926 | 926 |
|
927 | 927 |
logMetacat.debug("Calling delete"); |
928 |
MNodeService.getInstance().delete(session, id); |
|
928 |
MNodeService.getInstance(request).delete(session, id);
|
|
929 | 929 |
TypeMarshaller.marshalTypeToOutputStream(id, out); |
930 | 930 |
|
931 | 931 |
} |
... | ... | |
953 | 953 |
id.setValue(pid); |
954 | 954 |
|
955 | 955 |
AccessPolicy accessPolicy = collectAccessPolicy(); |
956 |
MNodeService.getInstance().setAccessPolicy(session, id, accessPolicy); |
|
956 |
MNodeService.getInstance(request).setAccessPolicy(session, id, accessPolicy);
|
|
957 | 957 |
|
958 | 958 |
|
959 | 959 |
} |
Also available in: Unified diff
add User-Agent logging to support D1 requirements