Changeset 795 for MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/DCRProxyAction.java
- Timestamp:
- 10/16/10 20:09:34 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/DCRProxyAction.java
r789 r795 42 42 private static final long serialVersionUID = 1L; 43 43 44 private final static HashMap<String,Object> dcrs = new HashMap<String,Object>();45 46 44 47 45 public String getDcrid() { … … 53 51 } 54 52 55 public HashMap<String, Object> getDCRs() {56 if (dcrs.size()==0) {57 initDCRs();58 }59 return dcrs;60 }61 62 53 public Termset getDCR() { 63 54 String dcr_id=""; … … 66 57 if (getDcrid()!=null && !getDcrid().equals("")) dcr_id = getDcrid(); 67 58 68 Termset res = (Termset) getDCRs().get(dcr_id);59 Termset res = (Termset) Termset.getTermset(dcr_id); 69 60 if (res==null) Admin.notifyUser("getDCR(): no termset found for:" + dcr_id); 70 61 //else … … 109 100 110 101 public String getBaseURI() { 111 return getDCRAttr("url"); 112 102 return getDCRAttr("url"); 113 103 } 114 104 … … 163 153 resultStream = urlConnection.getInputStream(); 164 154 } 165 return resultStream; 166 155 return resultStream; 167 156 168 157 } 169 170 171 public void initDCRs() {172 if (dcrs.size() > 0) {173 }174 175 Document dcrs_setup = Admin.getXMLDocument(Admin.getConfig().getProperty("datcats.file"));176 177 // Admin.loadFile(Admin.getConfig().getProperty("service.list.file"));178 Admin.notifyUser("initDCRs().loaded:" + dcrs_setup.getDocumentURI());179 Admin.notifyUser("firstchild:" + dcrs_setup.getFirstChild());180 //.getDocumentElement().getLocalName()181 //Document chains_doc = Admin.getXMLDocument(Admin.getConfig().getProperty("chains.file"));182 183 //Admin.notifyUser("formPath:xpath:"+xpath_expr);184 //creating an XPathFactory:185 XPathFactory factory = XPathFactory.newInstance();186 //using this factory to create an XPath object:187 XPath xpath = factory.newXPath();188 //XPath object created compiles the XPath expression:189 XPathExpression expr;190 try {191 expr = xpath.compile("//Termset");192 //expression is evaluated with respect to a certain context node which is doc.193 Object result = expr.evaluate(dcrs_setup, XPathConstants.NODESET);194 NodeList list = (NodeList) result;195 196 // <Termset type="dcr" id="isocat" label="isoCAT" url="http://www.isocat.org/rest/" format="dcif" />197 for (int i = 0; i<list.getLength();i++) {198 //String value = list.item(i).getTextContent();199 Node n = list.item(i);200 Termset ts = new Termset(n);201 202 Admin.notifyUser("reading in dcr:" + ts.getAttr("id"));203 dcrs.put(ts.getAttr("id"), ts );204 }205 } catch (XPathExpressionException e) {206 // TODO Auto-generated catch block207 e.printStackTrace();208 }209 210 }211 212 158 213 159 }
Note: See TracChangeset
for help on using the changeset viewer.