Changeset 849 for MDService2/trunk/MDService2/src
- Timestamp:
- 11/06/10 21:59:50 (14 years ago)
- Location:
- MDService2/trunk/MDService2/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/CollectionProxyAction.java
r676 r849 2 2 3 3 import java.io.IOException; 4 import java.net.MalformedURLException; 4 5 import java.net.URL; 5 6 … … 32 33 URL targetURL = null; 33 34 //targetURL =new URL( getBaseURL(), getActionkey()); 34 targetURL = new URL(getBaseURL(), " ");35 targetURL = new URL(getBaseURL(), "?operation=getCollections&collection="); 35 36 //Admin.notifyUser("CollectionProxy.targetURL:" + targetURL); 36 37 … … 39 40 40 41 42 @Override 43 public URL getBaseURL() throws MalformedURLException { 44 if (base_url == null) { 45 //base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri")); 46 base_url = new URL(getRepository()); 47 //Admin.notifyUser("TEST-URLnew:" + base_url.toString()); 48 49 } 50 return base_url; 51 } 52 41 53 42 54 } -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/CompRegistryProxyAction.java
r795 r849 92 92 Admin.notifyUser("CCCRPA." + getFullFormat()); 93 93 MDTransformer.getMDTransformer().setSrcFile(getTargetRequest()); 94 _sourceStream = MDTransformer.getMDTransformer().transformXML(__sourceStream, getFullFormat(),null,null,null,null,null );94 _sourceStream = MDTransformer.getMDTransformer().transformXML(__sourceStream, getFullFormat(),null,null,null,null,null,null); 95 95 Admin.notifyUser("CRPA.- elements"); 96 96 setActionkey("elements"); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java
r832 r849 4 4 import java.io.InputStream; 5 5 import java.net.MalformedURLException; 6 import java.net.URISyntaxException; 6 7 import java.net.URL; 7 8 … … 119 120 } 120 121 121 public String getRepos tory() {122 public String getRepository() { 122 123 return repository; 123 124 } … … 214 215 public URL getBaseURL() throws MalformedURLException { 215 216 if (base_url == null) { 216 base_url = new URL( Admin.getConfig().getProperty(getProxyKey() + ".uri"));217 base_url = new URL(getBaseURI());//Admin.getConfig().getProperty(getProxyKey() + ".uri")); 217 218 } 218 219 return base_url; 219 220 } 220 221 221 222 public String getBaseURI() { 222 223 String uri =Admin.getConfig().getProperty(getProxyKey() + ".uri"); … … 232 233 } 233 234 235 /* 234 236 public String getRequestKey() { 235 237 String key=""; … … 246 248 return key; 247 249 } 248 250 */ 251 252 public String getRequestKey() { 253 String key=""; 254 if (getActionkey()!=null) { 255 key += getActionkey() + "//-" ; 256 }else { 257 key +="//-" ; 258 } 259 if (getQ()!=null) { 260 key += getQ() + "//-" ; 261 } else { 262 key +="//-" ; 263 } 264 if (getCollection()!=null) { 265 key += getCollection() + "//-"; 266 } else { 267 key +="//-" ; 268 } 269 if (getSquery()!=null) { 270 key += getSquery() + "//-" ; 271 } else { 272 key +="//-" ; 273 } 274 if (getStartRecord()!=null) { 275 key += getStartRecord() + "//-"; 276 } 277 else{ 278 key +="//-" ; 279 } 280 if (getMaximumRecords()!=null) { 281 key += getMaximumRecords() + "//-"; 282 } 283 else{ 284 key +="//-" ; 285 } 286 if (getRepository()!=null) { 287 key += getRepository() + "//-"; 288 }else{ 289 key +="//-" ; 290 } 291 292 key += getMaxdepth() + "//-"; 293 294 if (getLang()!=null) { 295 key += getLang(); 296 } 297 298 return key; 299 } 249 300 public InputStream getSourceStream() throws IOException { 250 301 return getTargetRequest().openStream(); … … 289 340 MDTransformer.getMDTransformer().setSrcFile(getTargetRequest()); 290 341 // getColumns 291 resultStream = MDTransformer.getMDTransformer().transformXML(sourceStream, getFullFormat(), getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ() );342 resultStream = MDTransformer.getMDTransformer().transformXML(sourceStream, getFullFormat(), getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ(),getRepository()); 292 343 } 293 344 -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDRepoProxyAction.java
r832 r849 7 7 import java.io.StringWriter; 8 8 import java.net.MalformedURLException; 9 import java.net.URISyntaxException; 9 10 import java.net.URL; 10 11 import java.util.HashMap; … … 52 53 53 54 @Override 55 public String getBaseURI() { 56 Admin.notifyUser("MDREPO-property:" + Admin.getConfig().getProperty(getProxyKey() + ".uri")); 57 Admin.notifyUser("MDREPO-profile:" + getRepository()); 58 String uri = getRepository();//Admin.getConfig().getProperty(getProxyKey() + ".uri"); 59 return uri; 60 } 61 62 @Override 54 63 public void setFormat(String format) { 55 64 super.setFormat(format); … … 74 83 urls.put("record", "?operation=searchRetrieve&query="); 75 84 } 76 85 /* 77 86 @Override 78 public String getRequestKey() { 79 String key=""; 80 if (getActionkey()!=null) { 81 key += getActionkey() + "//-" ; 87 public URL getBaseURL() throws MalformedURLException { 88 if (base_url == null) { 89 base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri")); 90 try { 91 Admin.notifyUser("TEST-URLold:" + base_url.toURI()); 92 } catch (URISyntaxException e) { 93 // TODO Auto-generated catch block 94 e.printStackTrace(); 95 } 96 base_url = new URL(getRepository()); 97 try { 98 Admin.notifyUser("TEST-URLnew:" + base_url.toURI()); 99 } catch (URISyntaxException e) { 100 // TODO Auto-generated catch block 101 e.printStackTrace(); 102 } 82 103 } 83 if (getQ()!=null) { 84 key += getQ() + "//-" ; 85 } else { 86 key +="//-" ; 87 } 88 if (getCollection()!=null) { 89 key += getCollection() + "//-"; 90 } else { 91 key +="//-" ; 92 } 93 if (getSquery()!=null) { 94 key += getSquery() + "//-" ; 95 } else { 96 key +="//-" ; 97 } 98 if (getStartRecord()!=null) { 99 key += getStartRecord() + "//-"; 100 } 101 if (getMaximumRecords()!=null) { 102 key += getMaximumRecords(); 103 } 104 105 return key; 106 } 104 return base_url; 105 } 106 */ 107 107 108 /** 108 109 * uses base_url + url_pattern (parametrized by actionkey) to form a url -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDTransformer.java
r795 r849 165 165 * @throws IOException 166 166 */ 167 public void transformXML (InputStream in, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, OutputStream out ) throws TransformerException, IOException {167 public void transformXML (InputStream in, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, String repositoryURI, OutputStream out ) throws TransformerException, IOException { 168 168 169 169 // Create a transform factory instance. … … 185 185 transformer.setParameter("startRecord", startRecord); 186 186 transformer.setParameter("maximumRecords", maximumRecords); 187 } 188 if (repositoryURI != null) { 189 190 transformer.setParameter("repository_uri", repositoryURI); 187 191 } 188 192 /* transformer.setParameter("cols", "<col label='id'>Id</col>" + … … 204 208 xsrcfile = "file:///" + f.getPath().replace('\\', '/'); 205 209 } 210 // TODO repository-path -removed, bad formating 211 String[] xsrcfiles = xsrcfile.split("&repository="); 212 String[] root_uris = root_uri.split("&repository="); 213 xsrcfile = xsrcfiles[0]; 214 root_uri = root_uris[0]; 215 /// 216 206 217 Admin.notifyUser("root_uri:" + root_uri ); 207 218 Admin.notifyUser("xsrcfile:" + xsrcfile ); … … 227 238 * @throws TransformerException 228 239 */ 229 public InputStream transformXML ( InputStream xmlStream, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q ) throws IOException, InterruptedException, TransformerException {240 public InputStream transformXML ( InputStream xmlStream, String transkey, String cols, String startRecord, String maximumRecords, String lang, String q, String repositoryURI) throws IOException, InterruptedException, TransformerException { 230 241 231 242 ByteArrayOutputStream out = new ByteArrayOutputStream(); 232 transformXML(xmlStream, transkey, cols, startRecord, maximumRecords, lang, q, out);243 transformXML(xmlStream, transkey, cols, startRecord, maximumRecords, lang, q, repositoryURI, out); 233 244 InputStream transformedStream = new ByteArrayInputStream(out.toByteArray()); 234 245 //Admin.notifyUser("transformedStream:" + transformedStream.toString()); … … 248 259 249 260 ByteArrayOutputStream out = new ByteArrayOutputStream(); 250 transformXML(xmlStream, transkey, "", "", "","","", out);261 transformXML(xmlStream, transkey, "", "", "","","", "", out); 251 262 InputStream transformedStream = new ByteArrayInputStream(out.toByteArray()); 252 263 //Admin.notifyUser("transformedStream:" + transformedStream.toString()); -
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/TermsProxyAction.java
r795 r849 38 38 } 39 39 40 40 /* 41 41 @Override 42 42 public String getRequestKey() { … … 69 69 return key; 70 70 } 71 71 */ 72 72 public Termset getTermset() { 73 73 String ts_id=""; … … 85 85 return val; 86 86 } 87 88 87 89 88 public URL getBaseURL() throws MalformedURLException { 90 89 … … 95 94 return base_url; 96 95 } 96 97 97 98 98 /** … … 107 107 URL targetURL = null; 108 108 //targetURL = new URL(getBaseURI() + getQ()); 109 Admin.notifyUser("TPA.q: " + get Q());110 targetURL = new URL(getBaseURI() + getQ() );109 Admin.notifyUser("TPA.q: " + getBaseURI() + getQ() + getRepository()); 110 targetURL = new URL(getBaseURI() + getQ() + "&repository=" + getRepository()); 111 111 // TPA.targetURL:http://localhost:8080/MDService2/model/matrix/?q=all 112 112 return targetURL; … … 119 119 // if dcr|rr call model/matrix/all: http://localhost:8080/MDService2/model/matrix/?q=all 120 120 // + run through terms2extract transform (parametrized with getQ()-param!!), to serve the subset = appropriate Termset 121 URL matrix_all_URL = new URL(getBaseURI() + ALL); 121 URL matrix_all_URL = new URL(getBaseURI() + ALL + "&repository="+ getRepository()); 122 //URL matrix_all_URL = new URL(getBaseURI() + ALL ); 123 Admin.notifyUser("TPA.getSourceStream: " + getBaseURI() + ALL); 122 124 InputStream stream_matrix_all = matrix_all_URL.openStream(); 123 125 InputStream resultStream=null; 124 126 try { 125 resultStream = MDTransformer.getMDTransformer().transformXML(stream_matrix_all, "terms2extract", getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ() );127 resultStream = MDTransformer.getMDTransformer().transformXML(stream_matrix_all, "terms2extract", getColumns(), getStartRecord(), getMaximumRecords(),getLang(),getQ(), getRepository()); 126 128 } catch (InterruptedException e) { 127 129 Admin.notifyUser("TPA.getSourceStream(): "+ e.getMessage()); -
MDService2/trunk/MDService2/src/struts.xml
r832 r849 178 178 </action> 179 179 180 <action name="workspaceprofilesave/ " class="eu.clarin.cmdi.mdservice.action.WorkspaceAction" method="save">180 <action name="workspaceprofilesave/*" class="eu.clarin.cmdi.mdservice.action.WorkspaceAction" method="save"> 181 181 <param name="format">JSON</param> 182 <param name="type"> USER</param>182 <param name="type">{1}</param> 183 183 <!-- <param name="data">{1}</param> 184 184 <param name="actionkey"></param> -
MDService2/trunk/MDService2/src/xsl/model2matrix.xsl
r799 r849 35 35 <xsl:variable name="termset_name" select="if (not(Term/@name='')) then Term/@name else replace(Term/@path,'/','')"></xsl:variable> 36 36 37 <xsl:message>processing model-term: <xsl:value-of select=" termset_name" /> </xsl:message>37 <xsl:message>processing model-term: <xsl:value-of select="$termset_name" /> </xsl:message> 38 38 39 39 <xsl:choose> … … 42 42 </xsl:when> 43 43 <xsl:when test="$termset_name='Components'" > 44 44 <xsl:message>processing model-term: 1 <xsl:value-of select="$repository_uri" /></xsl:message> 45 45 <!-- get the whole Termset for every root-node (teiHeader, TCP, ...) --> 46 46 <Termsets> 47 47 <xsl:for-each select="Term/Term" > 48 48 <xsl:variable name="termset_name" select="@name" /> 49 <xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name )" />50 49 <xsl:variable name="resolved_termset_uri" select="concat($model_matrix_uri,$termset_name,'&repository=',$repository_uri)" /> 50 <xsl:message>processing model-term($resolved_termset_uri): <xsl:value-of select="$resolved_termset_uri" /> </xsl:message> 51 51 <xsl:variable name="termset" select="document($resolved_termset_uri)" /> 52 52 … … 67 67 </xsl:when> 68 68 <xsl:otherwise> 69 70 69 <xsl:variable name="termset_name" select="Term/@name" /> 71 70 <xsl:variable name="profile" select="my:profilematrix($termset_name)" /> … … 114 113 <xsl:template name="full-matrix" > 115 114 <!-- collect all model termMatrix --> 116 117 <xsl:variable name="model_termsets_uri" select="concat($model_matrix_uri,'Components')" /> 115 <xsl:variable name="model_termsets_uri" select="concat($model_matrix_uri,'Components', '&repository=',$repository_uri)" /> 118 116 <xsl:variable name="model_termsets" select="document($model_termsets_uri)" /> 117 119 118 120 119 <!-- collect all datcat terms --> … … 135 134 </xsl:apply-templates> 136 135 </xsl:variable> 137 138 136 139 137 <Termsets> 140 138 <xsl:copy-of select="$model_termsets/Termsets/*" /> -
MDService2/trunk/MDService2/src/xsl/params.xsl
r823 r849 23 23 24 24 25 <xsl:param name="repository_uri" select="''" /> 26 25 27 <!-- for resolving components by suffixing with @ComponentId --> 26 28 <!-- <xsl:param name="components_uri" select="'http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/components/'" /> -->
Note: See TracChangeset
for help on using the changeset viewer.