Changeset 1613 for MDService2
- Timestamp:
- 11/05/11 17:38:57 (13 years ago)
- Location:
- MDService2/branches/MDService_simple3
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple3/WebContent/static/queries2.xml
r1575 r1613 28 28 <dd> 29 29 <ul> 30 <li><a class="query" href="?q =clarin.eu:ws-registry&repository=localhost-mirror">WS registry</a></li>30 <li><a class="query" href="?query=clarin.eu:ws-registry&repository=localhost-mirror">WS registry</a></li> 31 31 </ul> 32 32 </dd> -
MDService2/branches/MDService_simple3/WebContent/static/test2.xml
r1531 r1613 25 25 26 26 <a class="request count" href="/model/xml?repository=clarin.at-mirror&q=teiHeader">model teiHeader</a> 27 <a class="request count" href="/terms/xml /?repository=localhost-mirror&q=all">terms localhost</a>28 <a class="query count" href="? squery=syntax">squery=syntax</a>27 <a class="request count" href="/terms/xml?repository=localhost-mirror&q=all">terms localhost</a> 28 <a class="query count" href="?query=syntax">squery=syntax</a> 29 29 <!-- <a class="query" href="/terms/htmldetail/?repository=localhost-mirror&q=all">terms localhost</a> --> 30 30 -
MDService2/branches/MDService_simple3/build.properties
r1516 r1613 20 20 source.home=./src 21 21 lib.home=./WebContent/WEB-INF/lib 22 smc.home=C:/Users/m/3lingua/clarin/CMDI/_repo2/SMC/dist 22 23 #used for Jar files that are needed for compiling 23 24 #but should not be part of the war file -
MDService2/branches/MDService_simple3/build.xml
r1516 r1613 5 5 Date: January 2010 6 6 7 Project: Struts 2 Coding Actions7 Project: MDService 8 8 9 Author: Bruce Phillips9 (based on Bruce Phillips Struts 2 Coding Actions) 10 10 ====================================================================== --> 11 12 13 11 14 <project name=" Coding_Actions_Struts2_Ant" default="archive" basedir=".">12 <project name="MDService" default="archive" basedir="."> 15 13 16 14 <description> 17 Example of using Struts 2 tags.15 Basic targets for building MDService webapp 18 16 </description> 19 17 … … 72 70 <path> 73 71 <fileset dir="${lib.home}" /> 72 <fileset dir="${smc.home}" /> 74 73 <fileset dir="${lib.external}" /> 75 74 </path> -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/CompRegistryProxyAction.java
r1540 r1613 1 1 package eu.clarin.cmdi.mdservice.action; 2 2 3 3 import java.io.InputStream; … … 48 48 } 49 49 50 public void setTargetProxy(){ 51 52 setTargetProxy(new BasicProxy()); 53 50 public void setTargetProxy(){ 51 setTargetProxy(new BasicProxy()); 54 52 } 55 53 56 @Override57 /*58 54 public String getRequestKey() { 59 String key="";60 if (getActionkey()!=null) {61 key += getActionkey() + "//-" ;62 }63 if (getCompid()!=null) {64 key += getCompid() + "//-" ;65 }66 67 return key;68 }69 */70 public String getRequestKey() {71 55 String key=""; 72 56 if (getActionkey()!=null) { … … 107 91 key +="//-" ; 108 92 } 109 110 111 93 return key; 112 94 } … … 117 99 public void prepare() { 118 100 119 try { 120 101 try { 121 102 //log.debug("CRPA.prepare"); 122 103 if (!getActionkey().equals("elements")) { … … 159 140 // log.debug("CRPA-putting in cache: " + getRequestKey()); 160 141 _sourceStream = Cache.getCache().getFromCache(getRequestKey()); 161 } /*else { 162 log.debug("CRPA-reading from cache: " + getRequestKey()); 163 }*/ 164 /* 165 File file=new File(Cache.getCache().formPath(getRequestKey())); 166 log.debug("File-absolutePath " + file.getAbsolutePath()); 167 URL url = null; 168 try{ 169 url = file.toURL(); 170 log.debug("URL-tostring " + url.toString()); 171 } catch (MalformedURLException me){ 172 } 173 */ 142 } 174 143 175 144 if (getFormat().equals("xml")) { … … 188 157 setSourceStream(_sourceStream); 189 158 setResultStream(_resultStream); 190 191 /*192 if (getFormat().equals("txt")) {193 File f=new File(Cache.getCache().formPath("terms_autocomplete.txt"));194 OutputStream out=new FileOutputStream(f);195 byte buf[]=new byte[1024];196 int len;197 while((len=getResultStream().read(buf))>0)198 out.write(buf,0,len);199 out.close();200 log.debug("terms_autocomplete.txt");201 }202 */203 159 } 204 160 } catch(Exception e){ 205 161 206 162 } 207 208 163 } 209 210 164 211 165 /** … … 226 180 return paramstr; 227 181 } 182 228 183 /* 229 184 public URL getTargetRequest() throws IOException { … … 240 195 return targetURL; 241 196 } 242 */ 243 244 197 */ 245 198 } -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/DCRProxyAction.java
r1540 r1613 5 5 import eu.clarin.cmdi.mdservice.model.Termset; 6 6 import eu.clarin.cmdi.mdservice.proxy.BasicProxy; 7 import eu.clarin.cmdi.mdservice.proxy.DCRProxy; 7 8 8 9 /** … … 79 80 public void setTargetProxy(){ 80 81 81 setTargetProxy(new BasicProxy());82 setTargetProxy(new DCRProxy()); 82 83 83 84 } -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/GenericAction.java
r1569 r1613 43 43 private Diagnostics diagnostics; 44 44 45 /**46 * Properties to be filled by Struts with according request-parameters47 */48 45 private String actionkey = "generic"; 49 46 private String q; -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/RepoAction.java
r1540 r1613 34 34 return getActionkey() + "2" + getFormat(); 35 35 } 36 36 37 /** 37 38 * Based on the repository type - we create a typed Proxy, that will do the work. … … 64 65 getDiagnostics().Add(Diagnostic.SYSTEM_ERROR, "Error in workspaceprofile configuration", "repository=" + getRepository() ); 65 66 } 66 67 67 } 68 69 70 /**71 * Internal identification of the target-proxy72 * base for finding the right base_url in the properties73 * subclass has to override with its specific proxykey.74 *75 * @return the key identifying this type of proxy76 */77 public String getProxyKey() {78 return "";79 }80 68 81 69 } -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/TermsProxyAction.java
r1540 r1613 5 5 import java.net.MalformedURLException; 6 6 import java.net.URL; 7 8 7 import javax.xml.transform.TransformerException; 9 10 8 import org.apache.log4j.Logger; 11 9 … … 21 19 * 22 20 * @author vronk 23 *24 21 */ 25 22 public class TermsProxyAction extends GenericProxyAction { 26 23 27 public static Logger log = Logger.getLogger("TermsProxyAction"); 24 public static Logger log = Logger.getLogger("TermsProxyAction"); 25 private static final long serialVersionUID = 1L; 28 26 29 private static final long serialVersionUID = 1L; 30 31 public static String ALL = "all"; 32 27 public static String ALL = "all"; 33 28 private String proxy_key = "terms"; 34 29 … … 43 38 } 44 39 45 46 /* @Override47 public String getFullFormat() {48 return "terms2extract";49 }50 */51 52 /*53 @Override54 public String getRequestKey() {55 String key="";56 if (getActionkey()!=null) {57 key += getActionkey() + "//-" ;58 }59 if (getQ()!=null) {60 key += getQ() + "//-" ;61 } else {62 key +="//-" ;63 }64 if (getCollection()!=null) {65 key += getCollection() + "//-";66 } else {67 key +="//-" ;68 }69 if (getSquery()!=null) {70 key += getSquery() + "//-" ;71 } else {72 key +="//-" ;73 }74 if (getStartRecord()!=null) {75 key += getStartRecord() + "//-";76 }77 if (getMaximumRecords()!=null) {78 key += getMaximumRecords();79 }80 81 return key;82 }83 */84 40 public Termset getTermset() { 85 41 String ts_id=""; … … 106 62 return base_url; 107 63 } 108 109 64 110 65 /** 111 66 * uses base_url + url_pattern (parametrized by actionkey) to form a url … … 115 70 public URL getTargetRequest() throws IOException { 116 71 // URL targetURL =new URL( base_url, compname + ".xml"); 117 118 72 119 73 URL targetURL = null; -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/internal/Utils.java
r1540 r1613 103 103 return config; 104 104 } 105 106 /** 107 * convenience function to get a config property value 108 * @param key 109 * @return 110 */ 111 public static String getConfig(String key) { 112 return getConfig().getProperty(key); 113 } 114 105 115 106 116 /** … … 185 195 DocumentBuilderFactory.newInstance(); 186 196 DocumentBuilder builder = factory.newDocumentBuilder(); 187 document = builder.parse(path); 197 InputStream doc_is = load2Stream(path); 198 document = builder.parse(doc_is); 199 188 200 } 189 201 catch (FactoryConfigurationError e) { -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/model/Query.java
r1588 r1613 48 48 49 49 private String type; 50 /** 51 * meant a target url/service, allowing querying different services on per query basis 52 * not used yet 53 */ 54 private String target; 55 56 private URL targetRequest; 50 57 51 private String syntax = "cql"; /* cql, cmdIndex, xpath */ 58 52 private String query_string; … … 429 423 } 430 424 431 432 425 /** 433 426 * provides a xml-version of the query (if parsed successfully) … … 482 475 483 476 return xpath.replace(".", "//"); 484 } 485 486 477 } 487 478 } -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/BasicProxy.java
r1569 r1613 6 6 import java.net.URL; 7 7 import java.net.URLConnection; 8 import java.util.Map; 9 8 10 import org.apache.log4j.Logger; 9 11 import eu.clarin.cmdi.mdservice.action.GenericAction; … … 11 13 import eu.clarin.cmdi.mdservice.internal.NoStylesheetException; 12 14 import eu.clarin.cmdi.mdservice.internal.Utils; 13 import eu.clarin.cmdi.mdservice.model.Termset; 15 14 16 15 17 /** … … 44 46 } 45 47 48 public Map<String,String[]> getParams() { 49 return getSourceAction().getParams(); 50 } 51 46 52 /** 47 53 * Convenience function to access the request-parameters in the Action … … 56 62 // required Params 57 63 } 58 59 64 60 65 /** -
MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/proxy/RepoProxy.java
r1569 r1613 1 1 package eu.clarin.cmdi.mdservice.proxy; 2 2 3 import java.io.File;4 3 import java.io.IOException; 5 4 import java.io.InputStream; 6 import java.io.StringReader;7 import java.io.StringWriter;8 5 import java.net.MalformedURLException; 9 import java.net.URISyntaxException;10 6 import java.net.URL; 11 import java.util.HashMap;12 7 import java.util.Map; 13 import java.io.ByteArrayInputStream;14 15 import javax.xml.parsers.DocumentBuilder;16 import javax.xml.parsers.DocumentBuilderFactory;17 import javax.xml.transform.OutputKeys;18 import javax.xml.transform.Transformer;19 import javax.xml.transform.TransformerException;20 import javax.xml.transform.TransformerFactory;21 import javax.xml.transform.dom.DOMSource;22 import javax.xml.transform.stream.StreamResult;23 8 24 9 import org.apache.log4j.Logger; 25 import org.w3c.dom.Document;26 import org.w3c.dom.Node;27 import org.w3c.dom.NodeList;28 import org.xml.sax.InputSource;29 10 30 11 import eu.clarin.cmdi.mdservice.action.GenericAction; 31 import eu.clarin.cmdi.mdservice.action.RepoAction;32 12 import eu.clarin.cmdi.mdservice.internal.CQLParseException; 33 13 import eu.clarin.cmdi.mdservice.internal.NoStylesheetException; 34 14 import eu.clarin.cmdi.mdservice.model.Diagnostic; 35 import eu.clarin.cmdi.mdservice.model.Query;36 15 import eu.clarin.cmdi.mdservice.model.WorkspaceProfile; 37 16 … … 78 57 * @return 79 58 */ 80 public String getParam(String key) { 59 /* This is already defined in BasicProxy! ? 60 public String getParam(String key) { 61 81 62 return getSourceAction().getParam(key); 82 63 } 64 */ 83 65 84 public Map<String,String[]> getParams() {85 return getSourceAction().getParams();86 }87 66 88 67 public void checkParams() { -
MDService2/branches/MDService_simple3/src/mdservice.properties
r1559 r1613 14 14 15 15 //?? dcregistry.uri = http://www.isocat.org/rest/ 16 compregistry.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 17 components.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 18 profiles.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 16 //moving to SMC 17 //compregistry.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 18 //components.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 19 //profiles.uri = http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/ 19 20 virtualcollection.uri = http://clarin.ids-mannheim.de/vcr/service/virtualcollection 20 21 … … 22 23 //cache.path = /srv/tomcat6/webapps/MDService2_cache/ 23 24 //workspaceprofile.path = /srv/tomcat6/webapps/MDService2_profiles/ 24 //cache.path = C:/apps/apache-tomcat/webapps/MDService2_cache/25 //workspaceprofile.path = C:/apps/apache-tomcat/webapps/MDService2_profiles/26 cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/27 workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_profiles/25 cache.path = C:/apps/apache-tomcat/webapps/MDService2_cache/ 26 workspaceprofile.path = C:/apps/apache-tomcat/webapps/MDService2_profiles/ 27 //cache.path = C:/apache-tomcat-6.0.26/webapps/MDService2_cache/ 28 //workspaceprofile.path = C:/apache-tomcat-6.0.26/webapps/MDService2_profiles/ 28 29 workspace.file = WorkspaceProfile.xml 29 30 30 31 cacheindex.file = cache_index.xml 31 32 xml.comp = 33 34 32 35 xsl.profile2VC = profile2VC.xsl 33 36 xsl.XCQL2XPATH = XCQL2Xpath.xsl … … 73 76 74 77 xsl.datcat-all2terms = datcat_all2terms.xsl 75 xsl.dcr-rdf2terms = datcat_rdf2terms.xsl78 //xsl.dcr-rdf2terms = datcat_rdf2terms.xsl 76 79 xsl.rr-rdf2terms = datcat_rdf2terms.xsl 77 80 xsl.dcr-dcif2terms = datcat_dcif2terms.xsl -
MDService2/branches/MDService_simple3/src/struts.xml
r1558 r1613 140 140 </action> 141 141 142 <!-- REGISTRY PROXY ACTIONS --> 142 <!-- REGISTRY PROXY ACTIONS --> 143 <!-- SMCAction replaces all registry actions --> 144 <action name="smc/list/*" class="eu.clarin.cmdi.mdservice.action.SMCAction" method="execute"> 145 <param name="context">{1}</param> 146 <param name="actionkey">list</param> 147 <result type="stream"> 148 <param name="contentType">${getActionContentType()}</param> 149 <param name="inputName">resultStream</param> 150 </result> 151 </action> 152 153 <action name="smc/map/*" class="eu.clarin.cmdi.mdservice.action.SMCAction" method="execute"> 154 <param name="term">{1}</param> 155 <param name="actionkey">map</param> 156 <result type="stream"> 157 <param name="contentType">${getActionContentType()}</param> 158 <param name="inputName">resultStream</param> 159 </result> 160 </action> 161 162 143 163 <action name="comp/*" class="eu.clarin.cmdi.mdservice.action.CompRegistryProxyAction" method="execute"> 144 164 <param name="compid">{1}</param> -
MDService2/branches/MDService_simple3/src/xsl/mdinst2view.xsl
r1495 r1613 92 92 <xsl:if test="count(ResourceProxy) > $resourceref_limit" > 93 93 <span class="label" >showing first </span> <xsl:value-of select="$resourceref_limit" /> <span class="label" > references. </span> 94 <s><a href="{concat($default_prefix, my:encodePID(./ancestor::CMD/Header/MdSelfLink))}">see more</a></s> 94 <!-- <s><a href="{concat($default_prefix, my:encodePID(./ancestor::CMD/Header/MdSelfLink))}">see more</a></s> --> 95 <s><a href="{my:formURL('record', 'htmlpage', my:encodePID(./ancestor::CMD/Header/MdSelfLink))}">see more</a></s> 96 95 97 </xsl:if> 96 98 <xsl:apply-templates select="ResourceProxy[position() < $resourceref_limit]" /> … … 115 117 </xsl:when> 116 118 <xsl:otherwise> 117 <xsl:value-of select=" concat($default_prefix, my:encodePID(ResourceRef))" />119 <xsl:value-of select="my:formURL('record', 'htmlpage', my:encodePID(ResourceRef))" /> 118 120 </xsl:otherwise> 119 121 </xsl:choose>
Note: See TracChangeset
for help on using the changeset viewer.