Changeset 1495 for MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDRepoProxyAction.java
- Timestamp:
- 08/25/11 20:21:23 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/MDRepoProxyAction.java
r1234 r1495 29 29 30 30 /** 31 * Main Struts 2 controller32 * responds to requests (collections, model, recordset)31 * Proxy to the Metadata Repository. 32 * Responds to requests (collections, model, recordset) 33 33 * by dispatching the requests to appropriate internal methods and filling the inputStream with the result 34 34 * … … 44 44 private String proxy_key = "mdrepository"; 45 45 46 @Override 46 /** 47 * Override of the basic method provided by the super-class 48 */ 49 @Override 47 50 public String getBaseURI() { 48 Admin.notifyUser("MDREPO-property:" + Admin.getConfig().getProperty(getProxyKey() + ".uri")); 49 Admin.notifyUser("MDREPO-profile:" + getRepositoryPath()); 50 String uri = getRepositoryPath();//Admin.getConfig().getProperty(getProxyKey() + ".uri"); 51 String uri = getRepositoryPath(); 51 52 return uri; 52 53 } … … 56 57 super.setFormat(format); 57 58 } 59 58 60 @Override 59 61 public String getProxyKey() { … … 61 63 } 62 64 63 65 /** 66 * A mapping between the actionkeys in the request and the operation-parameter expected by the MDRepository 67 */ 64 68 private final static HashMap<String,String> urls = new HashMap<String,String>(); 65 69 static … … 70 74 urls.put("record", "?operation=searchRetrieve&query="); 71 75 } 72 /* 73 @Override 74 public URL getBaseURL() throws MalformedURLException { 75 if (base_url == null) { 76 base_url = new URL(Admin.getConfig().getProperty(getProxyKey() + ".uri")); 77 try { 78 Admin.notifyUser("TEST-URLold:" + base_url.toURI()); 79 } catch (URISyntaxException e) { 80 // TODO Auto-generated catch block 81 e.printStackTrace(); 82 } 83 base_url = new URL(getRepository()); 84 try { 85 Admin.notifyUser("TEST-URLnew:" + base_url.toURI()); 86 } catch (URISyntaxException e) { 87 // TODO Auto-generated catch block 88 e.printStackTrace(); 89 } 90 } 91 return base_url; 92 } 93 */ 94 76 95 77 /** 96 78 * uses base_url + url_pattern (parametrized by actionkey) to form a url … … 102 84 103 85 Admin.notifyUser("MDRPA.getQ:" + getSquery() + " and (" + getQ() + ")"); 104 Admin.notifyUser("MDRPA.getActionkey:" + getActionkey()); 105 Admin.notifyUser("MDRPA.getMaxdepth:" + getMaxdepth()); 86 Admin.notifyUser("MDRPA.getActionkey:" + getActionkey()); 106 87 107 88 Query query = new Query(getSquery(), getQ(),getActionkey()); 89 90 // check if the query could get parsed 108 91 if (query.isStatus(Query.PARSEERROR)) { 109 92 Admin.notifyUser("MDRPA.query.PARSEERROR:" + query.getMsg()); … … 119 102 query.setOptions(getOptions()); 120 103 query.setSort(getSort()); 121 //Admin.notifyUser("MDRPA.records:" + query.getStartRecord()); 122 //Admin.notifyUser("MDRPA.records:" + query.getMaximumRecords()); 123 URL targetURL = null; 124 104 105 URL targetURL = null; 125 106 targetURL =new URL( getBaseURL(), urls.get(getActionkey()) + query.toURLParam() ); 126 107 Admin.notifyUser("MDRPA.targetURL.query.toURLParam:" + query.toURLParam()); … … 130 111 } 131 112 132 133 /*134 * FOLLOWING ARE OBSOLETE METHODS135 * for processing the requests and serving the results136 * they stay here for reference (as bad examples) temporarily137 * and can/shall be removed in the near future.138 */139 140 /**141 * serves the collections, passes the Request to MDRepositoryProxy142 * @return143 * @throws Exception144 */145 /*146 public String collections() throws Exception {147 148 Query query = new Query(getQ(),Query.COLLECTIONS);149 150 // inputStream = getMDRepo().getCollections(query);151 152 return SUCCESS;153 }154 */155 /**156 * serves the model/terms, via Query.execute() and .getResult()157 * @return158 * @throws Exception159 */160 /*161 public String model() throws Exception {162 163 Query query = new Query(getQ(), Query.MODEL, getCollection());164 Admin.notifyUser(query.getTargetRequest().toString());165 query.setMaxdepth(getMaxdepth());166 query.execute();167 168 //inputStream = query.getResult().getResultStream(format);169 return SUCCESS;170 }171 */172 /**173 * the method for actual querying of MDRepository174 * and getting back the MD-recordset175 * using Query-object (not asking MDRepository yet)176 *177 * @return178 * @throws Exception179 * @throws Exception180 */181 /*182 public String recordset() throws Exception {183 184 Query query = new Query(getQ(), Query.RECORDSET, getCollection());185 186 Admin.notifyUser("recordset_target_uri:" + query.getTargetRequest().toString());187 query.execute();188 113 189 // String str =query.getResult().getHeader();190 191 // inputStream = new ByteArrayInputStream(str.getBytes());192 193 // inputStream = query.getResult().getResultStream(format);194 return SUCCESS;195 196 }197 */198 199 114 @Override 200 115 public void prepare() throws Exception{
Note: See TracChangeset
for help on using the changeset viewer.