<%@page language="java"%> <%@page contentType="text/html; charset=UTF-8" %> <%@page import="org.dataone.client.v1.itk.D1Client"%> <%@page import="org.dataone.service.types.v1.NodeList"%> <%@page import="java.util.List"%> <%@page import="org.dataone.service.types.v1.Node"%> <%@page import="org.dataone.service.types.v1.ObjectList"%> <%@page import="org.dataone.service.types.v1.Identifier"%> <%@page import="org.dataone.service.types.v1.ObjectLocationList"%> <%@page import="org.dataone.service.types.v1.ObjectLocation"%> <%@page import="org.dataone.service.types.v1.NodeReference"%> <%@page import="java.io.InputStream"%> <%@page import="org.dataone.service.types.v1.SystemMetadata"%> <%@page import="org.dataone.configuration.Settings"%> DataONE PID Status

Environment: <%=D1Client.getCN().getNodeBaseServiceUrl() %>

<% // disable the local cache for these requests Settings.getConfiguration().setProperty("D1Client.useLocalCache", false); // get the PID from the request if it is there Identifier pid = null; if (request.getParameter("pid") != null) { pid = new Identifier(); pid.setValue(request.getParameter("pid")); } %>
PID:
<% if (pid != null) { %>

Resolve results for <%=pid.getValue() %>

<% String errorMsg = null; ObjectLocationList objectLocationList = null; try { objectLocationList = D1Client.getCN().resolve(null, pid); } catch (Exception e) { errorMsg = e.getMessage(); } if (objectLocationList != null) { %> <% for (ObjectLocation objectLocation: objectLocationList.getObjectLocationList()) { NodeReference node = objectLocation.getNodeIdentifier(); String getString = "unavailable"; try { // TODO: check the stream for content? InputStream result = D1Client.getMN(node).get(null, pid); if (result != null) { getString = "success"; } } catch (Exception e) { // crudely report an error getString = "
" + e. getClass().getName() + " - "+ e.getMessage() + "
"; } String systemMetadataString = "unavailable"; try { // TODO: more useful part of SM to display? SystemMetadata sm = D1Client.getMN(node).getSystemMetadata(null, pid); if (sm != null) { systemMetadataString = "{" + sm.getChecksum().getAlgorithm() + "}" + sm.getChecksum().getValue(); } } catch (Exception e) { // crudely report an error systemMetadataString = "
" + e. getClass().getName() + " - "+ e.getMessage() + "
"; } // TODO: log count String logString = "check not implemented"; %> <% } %>
Location Get System Metadata Log
<%=node.getValue() %> <%=getString %> <%=systemMetadataString %> <%=logString %>

Other nodes that may contain the object

<% // show results for all other nodes NodeList nodeList = D1Client.getCN().listNodes(); if (nodeList!= null) { List nodes = nodeList.getNodeList(); for (Node n: nodes) { NodeReference node = n.getIdentifier(); String getString = "unavailable"; try { // TODO: check the stream for content? InputStream result = D1Client.getMN(node).get(null, pid); if (result != null) { getString = "success"; } } catch (Exception e) { // crudely report an error getString = "
" + e. getClass().getName() + "
"; getString += "
" + e.getMessage() + "
"; } String systemMetadataString = "unavailable"; try { // TODO: more useful part of SM to display? SystemMetadata sm = D1Client.getMN(node).getSystemMetadata(null, pid); if (sm != null) { systemMetadataString = "{" + sm.getChecksum().getAlgorithm() + "}" + sm.getChecksum().getValue(); } } catch (Exception e) { // crudely report an error systemMetadataString = "
" + e. getClass().getName() + "
"; systemMetadataString += "
" + e.getMessage() + "
"; } // TODO: log count String logString = "check not implemented"; %>
<% } %>
Location Get System Metadata Log
<%=node.getValue() %> <%=getString %> <%=systemMetadataString %> <%=logString %>
<% } } else { %>

<%=errorMsg %>

<% } } %>