Ignore:
Timestamp:
10/16/10 20:09:34 (14 years ago)
Author:
vronk
Message:

dcr/rr terms htmllist, welcome-message

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/DCRProxyAction.java

    r789 r795  
    4242        private static final long serialVersionUID = 1L;
    4343       
    44         private final static HashMap<String,Object> dcrs = new HashMap<String,Object>();
    45        
    4644       
    4745        public String getDcrid() {
     
    5351        }
    5452
    55         public HashMap<String, Object> getDCRs() {
    56                 if (dcrs.size()==0) {
    57                         initDCRs();                             
    58                 }
    59                 return dcrs;
    60         }
    61 
    6253        public Termset getDCR() {               
    6354                String dcr_id="";
     
    6657                if (getDcrid()!=null && !getDcrid().equals("")) dcr_id = getDcrid();                   
    6758
    68                 Termset res = (Termset) getDCRs().get(dcr_id);
     59                Termset res = (Termset) Termset.getTermset(dcr_id);
    6960                if (res==null)          Admin.notifyUser("getDCR(): no termset found for:" + dcr_id);
    7061                //else
     
    109100       
    110101        public String getBaseURI() {           
    111                 return getDCRAttr("url");       
    112                
     102                return getDCRAttr("url");
    113103        }
    114104       
     
    163153                resultStream = urlConnection.getInputStream();
    164154                }
    165         return resultStream;
    166        
     155        return resultStream;   
    167156   
    168157        }
    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 block
    207                         e.printStackTrace();
    208                 }
    209 
    210         }
    211        
    212158
    213159}
Note: See TracChangeset for help on using the changeset viewer.