Changeset 1508 for MDService2
- Timestamp:
- 09/02/11 19:28:46 (13 years ago)
- Location:
- MDService2/branches/MDService_simple
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/branches/MDService_simple/src/eu/clarin/cmdi/mdservice/action/CollectionProxyAction.java
r1496 r1508 39 39 URL targetURL = null; 40 40 //targetURL =new URL( getBaseURL(), getActionkey()); 41 //FIXME: get maxdepth-constant out of here !!41 42 42 String params = ""; 43 43 params = "&maxdepth=" + getMaxdepth(); -
MDService2/branches/MDService_simple/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java
r1503 r1508 59 59 private String lang="en"; 60 60 private int maxdepth; 61 private String format ;61 private String format="xml"; // default no transformation 62 62 private String options; 63 63 private String actionContentType; -
MDService2/branches/MDService_simple/src/eu/clarin/cmdi/mdservice/action/RepoProxyAction.java
r1496 r1508 39 39 * 40 40 */ 41 public class RepoProxyAction extends MDRepoProxyAction {41 public class RepoProxyAction extends GenericProxyAction { 42 42 43 43 private static final long serialVersionUID = 1L; … … 49 49 return proxy_key; 50 50 } 51 52 /** 53 * Override of the basic method provided by the super-class 54 * Reading the repository-uri from the WorkspaceProfile based on the repository-parameter 55 */ 56 @Override 57 public String getBaseURI() { 58 String uri = WorkspaceProfile.getRepositoryPath(getRepository()); 59 return uri; 60 } 61 62 /** 63 * A mapping between the actionkeys in the request and the operation-parameter expected by the MD!Repository 64 * FIXME: This is taken from MDRepoProxyAction - so it will not work for SRU and Pazpar2 65 */ 66 private final static HashMap<String,String> urls = new HashMap<String,String>(); 67 static 68 { urls.put("collection", "?operation=getCollections&collection="); 69 urls.put("model", "?operation=queryModel&q="); 70 urls.put("values", "?operation=scanIndex&q="); 71 urls.put("search", "?operation=searchRetrieve&query="); 72 urls.put("record", "?operation=searchRetrieve&query="); 73 } 74 51 75 52 76 //TODO remove - just for tests … … 161 185 162 186 } 163 164 @Override 187 188 public String fullQueryString(){ 189 String full_query_string= this.getQ(); 190 191 if (!getSquery().equals("") && !this.getQ().equals("")){ 192 full_query_string = "(" + this.getSquery() + " ) and (" + this.getQ() + ")"; 193 } else if (!this.getSquery().equals("")) { 194 full_query_string = this.getSquery(); 195 } else if (!this.getQ().equals("")){ 196 full_query_string = this.getQ(); 197 } else { 198 full_query_string = ""; 199 } 200 201 return full_query_string; 202 } 203 204 205 /** 206 * uses base_url + url_pattern (parametrized by actionkey) to form a url 207 * @return the URL to the component-file 208 * @throws Exception 209 */ 210 @Override 165 211 public URL getTargetRequest() throws IOException { 212 // URL targetURL =new URL( base_url, compname + ".xml"); 213 214 Admin.notifyUser("RPA.getQ:" + getSquery() + " and (" + getQ() + ")"); 215 Admin.notifyUser("RPA.getActionkey:" + getActionkey()); 216 217 Query query = new Query(getSquery(), getQ(),getActionkey()); 218 219 // check if the query could get parsed 220 if (query.isStatus(Query.PARSEERROR)) { 221 Admin.notifyUser("RPA.query.PARSEERROR:" + query.getMsg()); 222 // pass this bad news to the client 223 setUserMsg(query.getMsg()); 224 return null; 225 } else { 226 query.setMaxdepth(getMaxdepth()); 227 query.setCollection(getCollection()); 228 query.setColumns(getColumns()); 229 query.setMaximumItems(getMaximumItems()); 230 query.setStartItem(getStartItem()); 231 query.setOptions(getOptions()); 232 query.setSort(getSort()); 233 234 URL targetURL = null; 235 targetURL =new URL( getBaseURL(), urls.get(getActionkey()) + query.toURLParam() ); 236 Admin.notifyUser("RPA.targetURL.query.toURLParam:" + query.toURLParam()); 237 Admin.notifyUser("RPA.targetURL:" + targetURL); 238 return targetURL; 239 } 240 } 241 242 243 244 /* @Override 245 public URL getTargetRequest() throws IOException { 246 166 247 switch (WorkspaceProfile.RepositoryType.toRepositoryType(WorkspaceProfile.getRepositoryType(getRepository()))) 167 248 { … … 181 262 } 182 263 } 183 } 264 */ 265 } -
MDService2/branches/MDService_simple/src/eu/clarin/cmdi/mdservice/model/Query.java
r1489 r1508 35 35 public static String MODEL = "model"; 36 36 public static String VALUES = "values"; 37 public static String RECORDSET = " recordset";37 public static String RECORDSET = "search"; 38 38 public static String RECORD = "record"; 39 39 public static String SRUEXTERN = "sruextern"; -
MDService2/branches/MDService_simple/src/struts.xml
r1506 r1508 12 12 <package name="basicstruts2" extends="struts-default"> 13 13 14 <default-action-ref name=" index" />14 <default-action-ref name="catchall" /> 15 15 16 16 <global-results> … … 48 48 </action> 49 49 --> 50 <action name="/?*" class="eu.clarin.cmdi.mdservice.action.StaticAction" method="execute">50 <!-- <action name="/?*" class="eu.clarin.cmdi.mdservice.action.StaticAction" method="execute"> 51 51 <param name="actionkey">static</param> 52 52 <param name="format">htmlpage</param> … … 57 57 </result> 58 58 </action> 59 59 --> 60 60 <action name="index" class="eu.clarin.cmdi.mdservice.action.StaticAction" method="execute"> 61 61 <param name="actionkey">static</param> … … 68 68 </action> 69 69 70 <action name="catchall" class="eu.clarin.cmdi.mdservice.action.StaticAction" method="execute"> 71 <param name="actionkey">static</param> 72 <param name="format">htmlpage</param> 73 <param name="q">catchall</param> 74 <param name="userMsg">Invalid request!</param> 75 <result type="stream"> 76 <param name="contentType">${getActionContentType()}</param> 77 <param name="inputName">resultStream</param> 78 </result> 79 </action> 70 80 <action name="static/*" class="eu.clarin.cmdi.mdservice.action.StaticAction" method="execute"> 71 81 <param name="format">htmlpage</param> … … 212 222 </action> 213 223 214 <action name="search/*" class="eu.clarin.cmdi.mdservice.action.RepoProxyAction" method="execute"> 215 <param name="actionkey">search</param> 216 <param name="q">{1}</param> 217 <result type="stream"> 218 <param name="contentType">${getActionContentType()}</param> 219 <param name="inputName">resultStream</param> 220 </result> 221 </action> 222 </package> 224 <action name="model/*" class="eu.clarin.cmdi.mdservice.action.RepoProxyAction" method="execute"> 225 <param name="q">{1}</param> 226 <param name="actionkey">model</param> 227 <result type="stream"> 228 <param name="contentType">${getActionContentType()}</param> 229 <param name="inputName">resultStream</param> 230 </result> 231 </action> 232 233 <action name="search/*" class="eu.clarin.cmdi.mdservice.action.RepoProxyAction" method="execute"> 234 <param name="q">{*}</param> 235 <param name="actionkey">search</param> 236 <result type="stream"> 237 <param name="contentType">${getActionContentType()}</param> 238 <param name="inputName">resultStream</param> 239 </result> 240 </action> 241 242 <action name="record/*" class="eu.clarin.cmdi.mdservice.action.RepoProxyAction" method="execute"> 243 <param name="q">{1}</param> 244 <param name="actionkey">record</param> 245 <result type="stream"> 246 <param name="contentType">${getActionContentType()}</param> 247 <param name="inputName">resultStream</param> 248 </result> 249 </action> 250 251 252 </package> 223 253 224 254 </struts> -
MDService2/branches/MDService_simple/src/xsl/cmd_functions.xsl
r1503 r1508 189 189 </xsl:when> 190 190 <xsl:when test="$q=''"> 191 <xsl:value-of select="concat($base_dir, '/',$action, '/ ', $format, '/')" />191 <xsl:value-of select="concat($base_dir, '/',$action, '/?format=', $format)" /> 192 192 </xsl:when> 193 193 <xsl:otherwise> 194 <xsl:value-of select="concat($base_dir, '/',$action, '/ ', $format, '/?q=', $q, '&repository=', $repository_name)" />194 <xsl:value-of select="concat($base_dir, '/',$action, '/?format=', $format, '&', $q, '&repository=', $repository_name)" /> 195 195 </xsl:otherwise> 196 196 </xsl:choose> -
MDService2/branches/MDService_simple/src/xsl/html_snippets.xsl
r1504 r1508 56 56 </xsl:otherwise> 57 57 </xsl:choose> 58 <a target="_blank" href=" docs/htmlpage/info" > docs</a>58 <a target="_blank" href="static/info" > docs</a> 59 59 </div> 60 60 <div id="notify" class="cmds-elem-plus note" >
Note: See TracChangeset
for help on using the changeset viewer.