Changeset 1800 for MDService2
- Timestamp:
- 03/17/12 21:11:31 (12 years ago)
- Location:
- MDService2/branches/MDService_simple3
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
r1681 r1800 704 704 var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id"); 705 705 //alert(i+ ',' + j + sValue); 706 searchclauseset.searchclauses[i][j].index = e.value; 706 var termsetitem = $('#' + 'sc' + i + '-' + j).find('.index-input-termset').data('item'); 707 var termset = ""; 708 if (termsetitem != null) termset = termsetitem.key; 709 searchclauseset.searchclauses[i][j].index = termset + ":" + e.value; 707 710 708 711 //handleTermsSelection(i,j,sValue); -
MDService2/branches/MDService_simple3/WorkspaceProfile.xml
r1638 r1800 6 6 <WorkspaceProfiles> 7 7 <WorkspaceProfile user="server"> 8 <Repositories> 8 <Repositories> 9 <!-- 10 <styles> 11 <style operation="searchRetrieve">http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 12 <style operation="scan">http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/scan2view.xsl</style> 13 <style operation="explain">http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/explain2view.xsl</style> 14 <style operation="default">http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/xml2view.xsl</style> 15 </styles> 16 --> 17 18 <item> 19 <name>arz_eng_006</name> 20 <label>VICAV dictionary Cairo-dialect</label> 21 <id>1</id> 22 <type>fcs</type> 23 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 24 <uri>http://corpus3.aac.ac.at/cs2/corpus_shell/fcs/wrapper/php/GlossaryOnSRU.php</uri> 25 </item> 26 <item> 27 <name>apc_eng_002</name> 28 <label>VICAV dictionary Damascus-dialect</label> 29 <id>2</id> 30 <type>fcs</type> 31 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 32 <uri>http://corpus3.aac.ac.at/cs2/corpus_shell/fcs/wrapper/php/GlossaryOnSRU.php</uri> 33 </item> 34 <item> 35 <name>deu_wikt_002</name> 36 <label>Wiktionary</label> 37 <id>3</id> 38 <type>fcs</type> 39 <!-- <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/wiktionary.xsl</style> --> 40 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 41 <uri>http://corpus3.aac.ac.at/cs2/corpus_shell/fcs/wrapper/php/WiktionaryOnSRU.php</uri> 42 </item> 43 <item> 44 <name>clarin.at:icltt:ddc</name> 45 <label>DDC on Corpus3</label> 46 <id>4</id> 47 <type>fcs.resource</type> 48 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 49 <uri>http://corpus3.aac.ac.at/ddconsru</uri> 50 </item> 51 <!-- 52 <item> 53 <name>sru-corpus-ddcon</name> 54 <label></label> 55 <id>4</id> 56 <type>fcs</type> 57 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/ddckwic.xsl</style> 58 <uri>http://corpus3.aac.ac.at/ddconsru</uri> 59 </item> 60 --> 61 <!--<item> 62 <name>sru-cqlservlet</name> 63 <label></label><id>5</id> 64 <type>sru</type> 65 <style>http://clarin.aac.ac.at/exist7/rest/db/content_repository/scripts/http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/mdset2view.xsl</style> 66 <uri>http://cqlservlet.mpi.nl/</uri> 67 </item> --> 68 <item> 69 <name>sru-gutenberg</name> 70 <label>Gutenberg Metadata</label> 71 <id>6</id> 72 <type>sru</type> 73 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 74 <uri>http://opencontent.indexdata.com/gutenberg</uri> 75 </item> 76 <item> 77 <name>vicav-profile</name> 78 <label>VICAV Profile</label> 79 <id>7</id> 80 <type>fcs</type> 81 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/profile.xsl</style> 82 <uri>http://corpus3.aac.ac.at/cs2/corpus_shell/fcs/wrapper/php/ProfileOnSRU.php</uri> 83 </item> 84 <item> 85 <name>vicav-bib</name> 86 <label>VICAV Bibliography</label> 87 <id>8</id> 88 <type>fcs</type> 89 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/bibliography.xsl</style> 90 <uri>http://corpus3.aac.ac.at/cs2/corpus_shell/fcs/wrapper/php/BibliographyOnSRU.php</uri> 91 </item> 92 <item> 93 <name>vicav-text</name> 94 <label>VICAV Sampletexte</label> 95 <id>9</id> 96 <type>fcs</type> 97 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/profilesampletext.xsl</style> 98 <uri>http://corpus3.aac.ac.at/cs2/corpus_shell/fcs/wrapper/php/SampleTextOnSRU.php</uri> 99 </item> 100 <item> 101 <name>ids-goethe</name> 102 <label>IDS Goethe</label> 103 <id>10</id> 104 <type>fcs</type> 105 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 106 <uri>http://clarin.ids-mannheim.de/cosmassru</uri> 107 </item> 108 <item> 109 <name>arz_eng_006_newStyle</name> 110 <label>VICAV dictionary Cairo-dialect newStyle</label> 111 <id>11</id> 112 <type>fcs</type> 113 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 114 <uri>http://corpus3.aac.ac.at/cs2/corpus_shell/fcs/wrapper/php/GlossaryOnSRU.php</uri> 115 </item> 116 <item> 117 <name>clarin.at:icltt:cr</name> 118 <label>ICLTT Content Repository</label> 119 <id>12</id> 120 <type>fcs.resource</type> 121 <style>http://corpus3.aac.ac.at/cs2/corpus_shell/xsl/result2view_v1.xsl</style> 122 <uri>http://clarin.aac.ac.at/exist8/rest/db/cr/cr.xql</uri> 123 </item> 124 9 125 <item> 10 126 <name>clarin.at-mirror</name> 11 <id> 2</id>127 <id>52</id> 12 128 <type>md</type> 13 129 <uri>http://clarin.aac.ac.at/exist/rest/db/clarin/cmd-model.xql/</uri> … … 15 131 <item> 16 132 <name>gu.se-main</name> 17 <id> 1</id>133 <id>51</id> 18 134 <type>md</type> 19 135 <uri>http://demo.spraakdata.gu.se/clarin/cmd/model/stats/</uri> … … 22 138 <item> 23 139 <name>sru-corpus-ddcon</name> 24 <id> 3</id>140 <id>53</id> 25 141 <type>sru</type> 26 142 <uri>http://corpus3.aac.ac.at/ddconsru</uri> … … 28 144 <item> 29 145 <name>sru-cqlservlet</name> 30 <id> 4</id>146 <id>54</id> 31 147 <type>sru</type> 32 148 <uri>http://cqlservlet.mpi.nl/</uri> … … 34 150 <item> 35 151 <name>sru-gutenberg</name> 36 <id>5 </id>152 <id>55</id> 37 153 <type>sru</type> 38 154 <uri>http://opencontent.indexdata.com/gutenberg</uri> … … 40 156 <item> 41 157 <name>pazpar</name> 42 <id> 6</id>158 <id>56</id> 43 159 <type>pazpar</type> 44 160 <uri>http://clarin.aac.ac.at/pazpar2/search.pz2/</uri> 45 161 </item> 46 162 <item> 47 <name>clarin.at-cr </name>48 <id> 8</id>163 <name>clarin.at-cr-sru</name> 164 <id>58</id> 49 165 <type>sru</type> 50 166 <uri>http://clarin.aac.ac.at/exist7/rest/db/content_repository/scripts/cr.xql/</uri> 51 167 </item> 52 </Repositories> 168 <item> 169 <name>clarin.at-cr</name> 170 <id>59</id> 171 <type>fcs</type> 172 <uri>http://clarin.aac.ac.at/cr/</uri> 173 </item> 174 </Repositories> 175 53 176 <Termsets> 54 177 <item> -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/GenericAction.java
r1663 r1800 58 58 private InputStream sourceStream; 59 59 60 pr ivateMap<String,String[]> params;60 protected Map<String,String[]> params; 61 61 62 62 private ProxyInterface target_proxy; … … 208 208 //configure 209 209 Utils.loadConfig("mdservice", "mdservice.properties", this.getClass().getClassLoader()); 210 210 params = new HashMap<String, String[]>(); 211 211 } 212 212 /** … … 337 337 @SuppressWarnings("unchecked") 338 338 protected void loadParams() { 339 params = new HashMap(getServletRequest().getParameterMap()); 340 341 //setDefaultParams(); 342 339 340 if (getServletRequest() != null){ 341 params.putAll(getServletRequest().getParameterMap()); 342 } 343 setDefaultParams(); 344 345 346 } 347 348 protected void setDefaultParams(){ 343 349 // set defaults 344 350 if ( params.get("version") == null){ … … 373 379 if ( params.get("x-cmd-repository") == null){ 374 380 if (params.get("repository") == null){ 375 addParam("repository",WorkspaceProfile.getRepositoryByIndex(0)); 381 if (params.get("x-context") == null){ 382 addParam("repository",WorkspaceProfile.getRepositoryByIndex(0)); 383 } else { 384 // search in fcs-mapping 385 addParam("repository",WorkspaceProfile.getFCSMapping(params.get("x-context")[0])); 386 //addParam("repository",params.get("x-context")[0]); 387 } 376 388 } 377 389 } else { … … 410 422 411 423 addParam("fullformat",getFullFormat()); 412 }413 414 protected void setDefaultParams(){415 //q=query416 417 418 if (getQ() != null) {419 addParam("q",getQ());420 addParam("query",getQ());421 } else {422 addParam("q",this.getParam("query"));423 }424 425 if (this.format != null) {426 addParam("format",this.format);427 }428 429 if (getParams().get("repository") == null){430 addParam("repository",WorkspaceProfile.getRepositoryByIndex(0));431 }432 424 } 433 425 /** -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/RepoAction.java
r1630 r1800 10 10 import eu.clarin.cmdi.mdservice.model.Query; 11 11 import eu.clarin.cmdi.mdservice.model.WorkspaceProfile; 12 import eu.clarin.cmdi.mdservice.proxy.FCSProxy; 12 13 import eu.clarin.cmdi.mdservice.proxy.MDRepoProxy; 13 14 import eu.clarin.cmdi.mdservice.proxy.Pz2Proxy; … … 143 144 setTargetProxy(new SRUProxy(new Query(Query.SRURECORDSET, this.getParams()))); 144 145 return; 146 case FCS: 147 setTargetProxy(new FCSProxy(new Query(Query.FCSRECORDSET, this.getParams()))); 148 return; 145 149 case MD: 146 150 setTargetProxy(new MDRepoProxy(new Query(getActionkey(), this.getParams()))); -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/SRUAction.java
r1628 r1800 89 89 } 90 90 91 pr ivatefinal static HashMap<String,Integer> operation_code = new HashMap<String,Integer>();91 protected final static HashMap<String,Integer> operation_code = new HashMap<String,Integer>(); 92 92 static 93 93 { -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/Query.java
r1663 r1800 44 44 public static String SRUEXTERN = "sruextern"; 45 45 public static String SRURECORDSET = "srurecordset"; 46 public static String FCSRECORDSET = "fcsrecordset"; 46 47 47 48 public static String PARSED = "parsed"; … … 443 444 } 444 445 445 } else if (type.equals(RECORD)) { 446 } else if (type.equals(FCSRECORDSET)) { 447 targetRequest = "?"; 448 449 450 if (!getParam("operation").equals("")) { 451 targetRequest = targetRequest + "operation=" + getParam("operation"); 452 } 453 if (!getParam("scanClause").equals("")) { 454 targetRequest = targetRequest + "&scanClause=" + getParam("scanClause"); 455 } 456 if (!getParam("query").equals("")) { 457 targetRequest = targetRequest + "&query=" + getParam("query"); 458 } 459 if (!getParam("x-context").equals("")) { 460 targetRequest = targetRequest + "&x-context=" + getParam("x-context"); 461 } 462 463 }else if (type.equals(RECORD)) { 446 464 // 2010-07-11 this is just a hack, because url-encoding the handle acted strange 447 465 //String corrid = getQueryString().replace('_', '/'); … … 451 469 log.debug("Query.toURLParam.corrid=" + corrid); 452 470 targetRequest = "//MdSelfLink[ft:query(.,'" + corrid + "')]"; 453 } else if (type.equals(SRURECORDSET) ) {471 } else if (type.equals(SRURECORDSET) || type.equals(FCSRECORDSET)) { 454 472 targetRequest = "?query="+ getParam("query") + "&operation=" + getParam("operation"); 455 473 -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/WorkspaceProfile.java
r1663 r1800 6 6 import java.io.IOException; 7 7 import java.io.InputStream; 8 import java.net.URL; 9 import java.util.HashMap; 8 10 9 11 import javax.xml.transform.TransformerException; … … 13 15 import eu.clarin.cmdi.mdservice.internal.MDTransformer; 14 16 import eu.clarin.cmdi.mdservice.internal.Utils; 17 import eu.clarin.cmdi.mdservice.action.FCSAction; 15 18 import eu.clarin.cmdi.mdservice.action.WorkspaceAction; 16 19 import eu.clarin.cmdi.mdservice.internal.NoStylesheetException; … … 27 30 public static enum RepositoryType 28 31 { 29 MD, SRU, PAZPAR, NOVALUE;32 MD, SRU, PAZPAR, FCS, FCSRESOURCE, NOVALUE; 30 33 31 34 public static RepositoryType toRepositoryType(String str) 32 35 { 33 36 try { 34 return valueOf(str. toUpperCase());37 return valueOf(str.replace(".", "").toUpperCase()); 35 38 } 36 39 catch (Exception ex) { … … 57 60 private static JSONObject options = null; 58 61 62 ///// 63 private static HashMap<String,String> fcs_mapping = null; 64 59 65 public static JSONArray getRepositories(){ 60 66 if (repositories == null){ 61 67 try { 62 68 WorkspaceProfile.setRepositories(WorkspaceProfile.createRepositories()); 69 WorkspaceProfile.createFCSRepositories(); 63 70 } catch (IOException e) { 64 71 // TODO Auto-generated catch block … … 139 146 } 140 147 148 // FCS 149 public static String getFCSMapping(String context){ 150 if (fcs_mapping == null){ 151 WorkspaceProfile.createFCSRepositories(); 152 } 153 return fcs_mapping.get(context); 154 } 155 156 public static void createFCSRepositories(){ 157 158 // static repositories 159 net.sf.json.JSONArray json = WorkspaceProfile.getRepositories(); 160 for(int i=0;i<json.size();i++){ 161 if (json.getJSONObject(i).getString("type").equals("fcs.resource")){ 162 if (!json.getJSONObject(i).containsKey("fcsresource")){ 163 if (createFCSRepository(json.getJSONObject(i))){ 164 } 165 } 166 } 167 } 168 } 169 170 public static void addToFCSMapping(JSONObject jsonendpoint, JSONObject json){ 171 String endpoint; 172 JSONObject extradata, extratermsobject; 173 net.sf.json.JSONArray extraterms; 174 175 if (fcs_mapping == null){ 176 fcs_mapping = new HashMap<String,String>(); 177 } 178 net.sf.json.JSONArray jsonterms = json.getJSONObject("sru:scanResponse").getJSONArray("sru:terms"); 179 for(int i=0;i<jsonterms.size();i++){ 180 endpoint = jsonterms.getJSONObject(i).getString("sru:value"); 181 if (jsonterms.getJSONObject(i).containsKey("sru:extraTermData")){ 182 extradata = jsonterms.getJSONObject(i).getJSONObject("sru:extraTermData"); 183 if (extradata.get("sru:terms").getClass().getName().equals("net.sf.json.JSONArray")){ 184 extraterms = extradata.getJSONArray("sru:terms"); 185 for(int j=0;j<extraterms.size();j++){ 186 fcs_mapping.put(extraterms.getJSONObject(j).getString("sru:value"), endpoint); 187 } 188 } else { 189 extratermsobject = extradata.getJSONObject("sru:terms"); 190 fcs_mapping.put(extratermsobject.getJSONObject("sru:term").getString("sru:value"), endpoint); 191 } 192 } 193 } 194 //["sru:extratermdata"]["sru:terms"] 195 } 196 197 public static boolean createFCSRepository(JSONObject jsonitem){ 198 199 //create FCSAction to scan repository data 200 FCSAction fcsa = new FCSAction(); 201 fcsa.setActionkey("fcs"); 202 fcsa.setParam("operation", "scan"); 203 fcsa.setParam("scanClause", "fcs.resource"); 204 fcsa.setParam("repository", jsonitem.getString("name")); 205 try { 206 fcsa.execute(); 207 InputStream in = fcsa.getResultStream(); 208 209 // convert to json 210 MDTransformer transformer = new MDTransformer(); 211 transformer.configure(Utils.getAppConfig("mdservice"), WorkspaceProfile.class.getClassLoader()); 212 213 transformer.setSrcFile(new URL(jsonitem.getString("uri"))); 214 transformer.setParams(MDTransformer.createParamsMap("xml2json")); 215 InputStream jsonstream = transformer.transformXML(in); 216 217 JSONObject json = JSONObject.fromObject(Utils.streamToString(jsonstream)); 218 jsonitem.put("fcsresource", json); 219 addToFCSMapping(jsonitem, json); 220 221 } catch (Exception e) { 222 // TODO Auto-generated catch block 223 e.printStackTrace(); 224 } 225 226 227 return true; 228 } 229 230 // FCS END 231 141 232 public static Boolean repositoryExists(String repository_name){ 142 233 … … 167 258 String repository_path = null; 168 259 169 170 171 260 // static repositories 172 261 net.sf.json.JSONArray json = WorkspaceProfile.getRepositories(); … … 205 294 } 206 295 296 207 297 public static String getRepositoryProperty(String repo_id, String propname){ 208 298 String typestr = ""; -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/MDRepoProxy.java
r1629 r1800 142 142 */ 143 143 // TODO ????? 144 if (getSourceAction().getActionkey().equals("sru") ){144 if (getSourceAction().getActionkey().equals("sru") || getSourceAction().getActionkey().equals("fcs")){ 145 145 getQuery().setType(hash_sruoperations.get(getParam("operation"))); 146 146 getSourceAction().setActionkey(hash_sruoperations.get(getParam("operation"))); -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/SRUProxy.java
r1654 r1800 42 42 getSourceAction().getDiagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "version"); 43 43 } 44 if (getParam("query").equals("") ) {44 if (getParam("query").equals("") && getParam("operation").equals("searchRetrieve")) { 45 45 getSourceAction().getDiagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "query"); 46 } 47 if (getParam("scanClause").equals("") && getParam("operation").equals("scan")) { 48 getSourceAction().getDiagnostics().Add(Diagnostic.MANDATORY_NOTSUPPLIED, "scan"); 46 49 } 47 50 … … 67 70 throw new CQLParseException("SRUP.query.PARSEERROR:" + getQuery().getMsg()); 68 71 } else { 69 72 70 73 URL targetURL = null; 71 74 URL tmp = getBaseURL(); 72 targetURL =new URL( tmp.to String() + getQuery().toURLParam());75 targetURL =new URL( tmp.toExternalForm() + getQuery().toURLParam()); 73 76 74 77 log.debug("SRUPA.targetURL:" + targetURL); -
MDService2/branches/MDService_simple3/src/mdservice.properties
r1787 r1800 9 9 //cache.path = /srv/tomcat6/webapps/MDService2_cache/ 10 10 //workspaceprofile.path = /srv/tomcat6/webapps/MDService2_profiles/ 11 cache.path = C:/apps/apache-tomcat/webapps/MDService2_cache/12 workspaceprofile.path = C:/apps/apache-tomcat/webapps/MDService2_profiles/13 //cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/14 //workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_profiles/11 //cache.path = C:/apps/apache-tomcat/webapps/MDService2_cache/ 12 //workspaceprofile.path = C:/apps/apache-tomcat/webapps/MDService2_profiles/ 13 cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/ 14 workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_profiles/ 15 15 workspace.file = WorkspaceProfile.xml 16 16 -
MDService2/branches/MDService_simple3/src/struts.xml
r1638 r1800 132 132 </result> 133 133 </action> 134 135 <action name="fcs" class="eu.clarin.cmdi.mdservice.action.FCSAction" method="execute"> 136 <param name="actionkey">fcs</param> 137 <result name="success" type="stream"> 138 <param name="contentType">text/xml</param> 139 <param name="inputName">resultStream</param> 140 </result> 141 <result name="error" type="stream"> 142 <param name="contentType">text/xml</param> 143 <param name="inputName">${getDiagnosticStreamName()}</param> 144 </result> 145 </action> 134 146 135 147 <action name="pazpar2/" class="eu.clarin.cmdi.mdservice.action.Pz2Action" method="execute">
Note: See TracChangeset
for help on using the changeset viewer.