Changeset 713
- Timestamp:
- 09/21/10 21:24:48 (14 years ago)
- Location:
- MDService2/trunk/MDService2
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/WebContent/scripts/mdservice2_ui.js
r706 r713 787 787 788 788 if (jsonw["WorkspaceProfile"].Querysets[0] == undefined){ 789 var jj = jsonw["WorkspaceProfile"]["Querysets"][" Queryset"];790 delete jsonw["WorkspaceProfile"]["Querysets"][" Queryset"];789 var jj = jsonw["WorkspaceProfile"]["Querysets"]["item"]; 790 delete jsonw["WorkspaceProfile"]["Querysets"]["item"]; 791 791 jsonw["WorkspaceProfile"]["Querysets"] = [{}]; 792 792 jsonw["WorkspaceProfile"]["Querysets"][0] = jj; … … 796 796 $.each(jsonw["WorkspaceProfile"]["Querysets"], function(i,item) { 797 797 if (this.Queries[0] == undefined){ 798 var jj = this["Queries"][" Query"];799 delete this["Queries"][" Query"];798 var jj = this["Queries"]["item"]; 799 delete this["Queries"]["item"]; 800 800 this.Queries = [{}]; 801 801 this.Queries[0] = jj; … … 816 816 if (this.columns != "null") { 817 817 if (this.columns[0] == undefined){ 818 var jj = this["columns"][" col"];819 delete this["columns"][" col"];818 var jj = this["columns"]["item"]; 819 delete this["columns"]["item"]; 820 820 this.columns = [{}]; 821 821 this.columns[0] = jj; … … 885 885 886 886 var tmp = JSON.stringify(jsonw["WorkspaceProfile"]); 887 887 /* 888 888 if (String(jsonw["WorkspaceProfile"]["Querysets"]) != "null") { 889 889 $.each(jsonw["WorkspaceProfile"]["Querysets"], function(i,item) { … … 906 906 } 907 907 }); 908 */908 // / 909 909 } 910 910 }); … … 920 920 921 921 } 922 922 */ 923 923 var JSONText = JSON.stringify(jsonw["WorkspaceProfile"]); 924 924 /* 925 925 if (jsonw["WorkspaceProfile"].Querysets[0] == undefined){ 926 926 var jj = jsonw["WorkspaceProfile"]["Querysets"]["Queryset"]; … … 940 940 }); 941 941 } 942 942 */ 943 943 //$.post("/MDService2/workspaceprofilesave/1/" + JSONText, ""); 944 944 //var JSONText1 = "{WorkspaceProfile:{Querysets:{[{Query:}]}}}"; 945 $.post("/MDService2/workspaceprofilesave/1/" , JSONText);945 $.post("/MDService2/workspaceprofilesave/1/" + JSONText, ""); 946 946 } 947 947 -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/Cache.java
r704 r713 129 129 } 130 130 131 if (key_array.length > 3){ 132 e.setAttribute("startRecord", key_array[3]); 133 }else{ 134 e.setAttribute("startRecord", ""); 135 } 136 if (key_array.length > 4){ 137 e.setAttribute("maximumRecords", key_array[4]); 138 }else{ 139 e.setAttribute("maximumRecords", ""); 140 } 131 141 DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd:hh-mm-ss"); 132 142 e.setAttribute("date", dateFormat.format(new Date()).toString()); … … 218 228 219 229 if (key_array.length > 2){ 220 xpath_expr = xpath_expr + "and @collection='"+key_array[2]+"']"; 221 }else{ 222 xpath_expr = xpath_expr + " and @collection='']"; 230 xpath_expr = xpath_expr + "and @collection='"+key_array[2]+"'"; 231 }else{ 232 xpath_expr = xpath_expr + " and @collection=''"; 233 } 234 if (key_array.length > 3){ 235 xpath_expr = xpath_expr + "and @startRecord='"+key_array[3]+"'"; 236 }else{ 237 xpath_expr = xpath_expr + " and @startRecord=''"; 238 } 239 if (key_array.length > 4){ 240 xpath_expr = xpath_expr + "and @maximumRecords='"+key_array[4]+"']"; 241 }else{ 242 xpath_expr = xpath_expr + " and @maximumRecords='']"; 223 243 } 224 244 -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java
r706 r713 30 30 private String actionkey; 31 31 private String q; 32 private String cache = Cache. SKIP;32 private String cache = Cache.USE; 33 33 private String collection; 34 34 private String columns; … … 227 227 sourceStream = Cache.getCache().getFromCache(getRequestKey()); 228 228 } 229 230 229 if (sourceStream == null) { // either not in cache or cache_flag=refresh 231 230 //sourceStream = getTargetRequest().openStream(); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDRepoProxyAction.java
r706 r713 43 43 urls.put("record", "?operation=searchRetrieve&query="); 44 44 } 45 45 46 @Override 47 public String getRequestKey() { 48 String key=""; 49 if (getActionkey()!=null) { 50 key += getActionkey() + "//-" ; 51 } 52 if (getQ()!=null) { 53 key += getQ() + "//-" ; 54 } 55 if (getCollection()!=null) { 56 key += getCollection() + "//-"; 57 } 58 if (getStartRecord()!=null) { 59 key += getStartRecord() + "//-"; 60 } 61 if (getMaximumRecords()!=null) { 62 key += getMaximumRecords(); 63 } 64 65 return key; 66 } 46 67 /** 47 68 * uses base_url + url_pattern (parametrized by actionkey) to form a url -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/WorkspaceAction.java
r706 r713 7 7 import java.io.IOException; 8 8 import java.io.InputStream; 9 import java.net.MalformedURLException; 10 import java.net.URL; 11 9 12 import java.io.StringReader; 10 13 import java.io.StringWriter; 11 import java.net.MalformedURLException;12 import java.net.URL;13 14 import javax.servlet.http.HttpServletRequest;15 14 import javax.xml.parsers.DocumentBuilder; 16 15 import javax.xml.parsers.DocumentBuilderFactory; … … 25 24 import javax.xml.transform.stream.StreamResult; 26 25 26 27 27 import net.sf.json.JSON; 28 28 import net.sf.json.JSONSerializer; 29 29 import net.sf.json.xml.XMLSerializer; 30 30 31 import org.apache.commons.io.IOUtils;32 import org.apache.struts2.interceptor.ServletRequestAware;33 31 import org.w3c.dom.Document; 34 32 import org.w3c.dom.Node; … … 38 36 39 37 import com.opensymphony.xwork2.ActionSupport; 38 40 39 41 40 /** … … 208 207 node.getParentNode().replaceChild(node2, node); 209 208 } 210 209 210 /* 211 211 public String save(){ 212 212 … … 302 302 return SUCCESS; 303 303 } 304 305 */ 306 public String save(){ 307 308 String jsonData = getData(); 309 Admin.notifyUser("JSON data:"+jsonData); 310 311 XMLSerializer serializer = new XMLSerializer(); 312 JSON json = JSONSerializer.toJSON( jsonData ); 313 serializer.setRootName("WorkspaceProfile"); 314 serializer.setElementName("item"); 315 serializer.setTypeHintsEnabled(false); 316 String xml = serializer.write( json ); 317 Admin.notifyUser("XML:" + xml); 318 319 InputStream is_xml = new ByteArrayInputStream( xml.getBytes( ) ); 320 Admin.writeToFile(getPath(), is_xml); 321 322 String ret = "1"; 323 resultStream = new ByteArrayInputStream(ret.getBytes()); 324 325 326 return SUCCESS; 327 } 328 304 329 /** 305 330 * default Action method -
MDService2/trunk/MDService2/src/mdservice.properties
r689 r713 1 mdrepository.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats/ 2 dcregistry.uri = http://www.isocat.org/rest/ 1 //mdrepository.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats/ 2 mdrepository.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql/ 3 //dcregistry.uri = http://www.isocat.org/rest/ 4 dcregistry.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql/ 3 5 //compregistry.uri = file:/c:/Users/master/3lingua/clarin/CMDI/_repo2/metadata/toolkit/components/clarin/ 4 compregistry.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 6 //compregistry.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 7 compregistry.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql/ 5 8 //collections.uri = file:/c:/Users/master/3lingua/clarin/CMDI/data_zx_metares/fsls.xml 6 collections.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats?operation=getCollections&collection= 9 //collections.uri = http://demo.spraakdata.gu.se/clarin/cmd/model/stats?operation=getCollections&collection= 10 collections.uri = http://corpus5.aac.oeaw.ac.at/exist/rest/db/clarin/cmd-model.xql?operation=getCollections&collection= 7 11 //scripts.path = C:/Users/master/3lingua/clarin/CMDI/scripts/ 8 12 scripts.path = xsl/ 9 13 //cache.path = /srv/tomcat6/webapps/MDService2_cache/ 10 cache.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/11 //cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/12 //workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/13 workspaceprofile.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/14 //cache.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/ 15 cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/ 16 workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/ 17 //workspaceprofile.path = C:/apps/ApacheTomcat/webapps/MDService2_cache/ 14 18 cacheindex.file = cache_index.xml 15 19 xml.comp =
Note: See TracChangeset
for help on using the changeset viewer.