@Test public void fedoraUtilsURL() throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { Document extDoc = XMLUtils.parseDocument(this.getClass().getResourceAsStream("dsProfileExternal.xml")); String location = FedoraUtils.getLocation(KConfiguration.getInstance(), extDoc); TestCase.assertNotNull(location); URL url = new URL(location); TestCase.assertEquals("/img.jp2",url.getFile()); }
public static String getLocation(KConfiguration conf, Document profileDoc) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("/datastreamProfile/dsLocation/text()"); NodeList nodes = (NodeList) expr.evaluate(profileDoc, XPathConstants.NODESET); if (nodes.getLength() > 0) { Text text = (Text) nodes.item(0); String trimedString = text.getData().trim(); return trimedString; } else { return null; } }
FedoraUtils { public static String getLocation(KConfiguration conf, Document profileDoc) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("/datastreamProfile/dsLocation/text()"); NodeList nodes = (NodeList) expr.evaluate(profileDoc, XPathConstants.NODESET); if (nodes.getLength() > 0) { Text text = (Text) nodes.item(0); String trimedString = text.getData().trim(); return trimedString; } else { return null; } } }
FedoraUtils { public static String getLocation(KConfiguration conf, Document profileDoc) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("/datastreamProfile/dsLocation/text()"); NodeList nodes = (NodeList) expr.evaluate(profileDoc, XPathConstants.NODESET); if (nodes.getLength() > 0) { Text text = (Text) nodes.item(0); String trimedString = text.getData().trim(); return trimedString; } else { return null; } }  }
FedoraUtils { public static String getLocation(KConfiguration conf, Document profileDoc) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("/datastreamProfile/dsLocation/text()"); NodeList nodes = (NodeList) expr.evaluate(profileDoc, XPathConstants.NODESET); if (nodes.getLength() > 0) { Text text = (Text) nodes.item(0); String trimedString = text.getData().trim(); return trimedString; } else { return null; } }  static ArrayList<String> getRdfPids(String pid, String relation); static String findFirstPagePid(String pid); static String getDjVuImage(KConfiguration configuration, String pid); static String getFedoraStreamPath(KConfiguration conf, String pid, String stream); static String getFedoraDescribe(KConfiguration conf); static boolean isFedoraExternalStream(KConfiguration conf, Document profileDoc); static String getLocation(KConfiguration conf, Document profileDoc); static String getThumbnailFromFedora(KConfiguration configuration, String pid); static String getFedoraDatastreamsList(KConfiguration configuration, String pid); static String getVersionCompatibilityPrefix(String fedoraVersion); }
FedoraUtils { public static String getLocation(KConfiguration conf, Document profileDoc) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile("/datastreamProfile/dsLocation/text()"); NodeList nodes = (NodeList) expr.evaluate(profileDoc, XPathConstants.NODESET); if (nodes.getLength() > 0) { Text text = (Text) nodes.item(0); String trimedString = text.getData().trim(); return trimedString; } else { return null; } }  static ArrayList<String> getRdfPids(String pid, String relation); static String findFirstPagePid(String pid); static String getDjVuImage(KConfiguration configuration, String pid); static String getFedoraStreamPath(KConfiguration conf, String pid, String stream); static String getFedoraDescribe(KConfiguration conf); static boolean isFedoraExternalStream(KConfiguration conf, Document profileDoc); static String getLocation(KConfiguration conf, Document profileDoc); static String getThumbnailFromFedora(KConfiguration configuration, String pid); static String getFedoraDatastreamsList(KConfiguration configuration, String pid); static String getVersionCompatibilityPrefix(String fedoraVersion); static final java.util.logging.Logger LOGGER; static final String RELS_EXT_STREAM; static final String IMG_THUMB_STREAM; static final String IMG_FULL_STREAM; static final String IMG_PREVIEW_STREAM; static final String ALTO_STREAM; static final String DC_STREAM; static final String BIBLIO_MODS_STREAM; static final String TEXT_OCR_STREAM; static final String MP3_STREAM; static final String OGG_STREAM; static final String WAV_STREAM; static final String MIGRATION_STREAM; static final String POLICY_STREAM; static List<String> INTERNAL_STREAM; static List<String> AUDIO_STREAMS; static List<String> FEDORA_INTERNAL_STREAMS; static final int THUMBNAIL_HEIGHT; static final int PREVIEW_HEIGHT; static final DateFormat[] XSD_DATE_FORMATS; }