Changeset 2577
- Timestamp:
- 02/13/13 12:29:21 (11 years ago)
- Location:
- vlo/branches/vlo-2.13-param/vlo_webapp
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-2.13-param/vlo_webapp/pom.xml
r2570 r2577 9 9 vlo_solr_importer.sh in src/main/bin and the version number 10 10 in the parent's pom.xml --> 11 <version>2.1 2</version>11 <version>2.13</version> 12 12 <name>VirtualLanguageObservatory</name> 13 13 <description></description> -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/bin/vlo_solr_importer.sh
r2540 r2577 12 12 13 13 14 $JAVA -Xmx1024M -cp .:vlo-2.1 2-jar.jar eu.clarin.cmdi.vlo.importer.MetadataImporter14 $JAVA -Xmx1024M -cp .:vlo-2.13-jar.jar eu.clarin.cmdi.vlo.importer.MetadataImporter -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/VloApplication.java
r2570 r2577 2 2 3 3 import eu.clarin.cmdi.vlo.config.WebAppConfig; 4 import org.apache.wicket.protocol.http.WebApplication;5 import org.springframework.beans.factory.BeanFactory;6 import org.springframework.context.support.ClassPathXmlApplicationContext;7 8 4 import eu.clarin.cmdi.vlo.dao.SearchResultsDao; 9 5 import eu.clarin.cmdi.vlo.pages.FacetedSearchPage; 6 import org.apache.wicket.protocol.http.WebApplication; 10 7 11 8 /** … … 20 17 // BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { Configuration.CONFIG_FILE }); 21 18 // factory.getBean("configuration"); //Use Configuration.getInstance to get the Configuration just loading the instance here. 19 WebAppConfig.setServletContext(this.getServletContext()); 20 String test = WebAppConfig.open().getSolrUrl(); 22 21 23 22 searchResults = new SearchResultsDao(); … … 27 26 * @see org.apache.wicket.Application#getHomePage() 28 27 */ 28 @Override 29 29 public Class<FacetedSearchPage> getHomePage() { 30 30 return FacetedSearchPage.class; -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/config/ConfigFileParam.java
r2570 r2577 64 64 65 65 /** 66 * Write a assignedvalues to an XML file.66 * Write annotated member values to an XML file. 67 67 * 68 68 * @param config the object whose annotated members and values will be -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/config/WebAppConfig.java
r2570 r2577 1 2 1 package eu.clarin.cmdi.vlo.config; 3 2 4 3 import java.io.UnsupportedEncodingException; 5 4 import java.net.URLEncoder; 5 import javax.servlet.ServletContext; 6 6 import org.simpleframework.xml.Element; 7 7 import org.simpleframework.xml.ElementArray; … … 11 11 /** 12 12 * Web application configuration<br><br> 13 * 14 * A parameter that is part of the configuration of the VLO web application can 15 * be of two types: it is either a parameter that is defined from within the 16 * application, an application parameter, or it is a parameter that is defined 17 * in the context in which the application will live as a {@literal servlet}. 18 * Application parameters reside in the {@literal WebAppConfig.xml} file, while 19 * {@literal servlet} context parameters are part of the Tomcat server 20 * configuration. <br><br> 21 * 22 * An application parameter is defined an XML file in the resources directory of 23 * the application package. For every application parameter, the WebApplication 24 * class contains a member that is annotated according to the Simple framework 25 * specification. So<br><br> 26 * 27 * {@literal <parameterMember>}"the value of the 28 * parameter"{@literal </parameterMember>}<br><br> 29 * 30 * in the XML file is accompanied by<br><br> 31 * 32 * {@literal 33 * 34 * @element}<br> {@literal parameterMember}<br><br> 35 * 36 * in the WebAppConfig class. When the application invokes Simple by<br><br> 37 * 38 * WebAppConfig.open();<br><br> 39 * 40 * the parameter itself is accessed by<br><br> 41 * 42 * WebAppConfig.open().getParameterMember();<br><br> 43 * 44 * If you want to add a type of member that is not included in the class yet, 45 * refer to the Simple framework's specification.<br><br> 46 * 47 * A context parameter also resides in an XML file. For more information on the 48 * location and the format of this file, please refer to the Apache Tomcat 49 * configuration reference.<br><br> 13 50 * 14 * The parameter members which are part of the web application configuration15 * come in two categories. One type of parameters play a role only in the16 * application, others are determined by the context of the application.<br><br>17 *18 * The first type of parameter is defined in the web application parameter file.19 * These parameters are referred to as application parameters. The second type20 * of parameter is determined by the context of the application. These21 * parameters are called context parameters.<br><br>22 *23 51 * Because the application is indifferent to the origin of a parameter, the 24 52 * WebAppConfig class is the place to switch from one type of parameter to the … … 30 58 * application.<br><br> 31 59 * 32 * An application parameter is defined an XML file in the resources directory of 33 * the package. For every application parameter, the WebApplication class 34 * contains a member that is annotated according to the Simple framework 35 * specification. So<br><br> 36 * 37 * {@literal <parameterMember>}"the value of the 38 * parameter"{@literal </parameterMember>}<br><br> 39 * 40 * in the XML file is accompanied by<br><br> 41 * 42 * {@literal 43 * 44 * @element}<br> {@literal parameterMember}<br><br> 45 * 46 * in the WebAppConfig class. When the application invokes Simple by<br><br> 47 * 48 * WebAppConfig.get();<br><br> 49 * 50 * the parameter itself is accessed by<br><br> 51 * 52 * WebAppConfig.get().getParameterMember();<br><br> 53 * 54 * If you want to add a type of member that is not included in the class yet, 55 * refer to the Simple framework's specification.<br><br> 56 * 57 * A context parameter also resides in an XML file. For more information on the 58 * location and the format of this file, please refer to the Apache Tomcat 59 * configuration reference.<br><br> 60 * 61 * Note on the explanation of the meaning of the parameters. Because the meaning 62 * of a parameter is not local to this class, or even not local to the 60 * Please note on the explanation of the meaning of the parameters. Because the 61 * meaning of a parameter is not local to this class, or even not local to the 63 62 * configuration package, they are described in the general VLO 64 63 * documentation.<br><br> … … 72 71 private final static org.slf4j.Logger LOG = 73 72 LoggerFactory.getLogger(WebAppConfig.class); 74 73 75 74 // connect to the logging framework 76 75 private class WebAppConfigLogger implements ConfigFilePersister.Logger { … … 82 81 } 83 82 } 84 85 83 private static WebAppConfigLogger logger; 86 84 … … 91 89 // let the superclass know about the logger defined here 92 90 // ConfigFileParam.logger = webAppConfigLogger; 93 91 94 92 logger = new WebAppConfigLogger(); 95 93 96 94 ConfigFilePersister.setLogger(WebAppConfig.logger); 97 95 } 98 96 99 97 /** 100 * Application parameter XML file. 101 */ 102 public static final String CONFIG_FILE = WebAppConfig.class.getResource("/WebAppConfig.xml").getFile(); 103 104 /** 105 * Application parameter XML file. Represent the filename by a method 106 * primarily for making it available to the superclass. In other words: this 107 * method overrides a method in the superclass. 98 * XML File in which the application configuration is stored 99 */ 100 public static final String CONFIG_FILE = 101 WebAppConfig.class.getResource("/WebAppConfig.xml").getFile(); 102 103 /** 104 * Get the name of the XML file. 105 * 106 * Represent the filename by a method primarily for making it available to 107 * the superclass. In other words: this method overrides a method in the 108 * superclass. 108 109 * 109 110 * @return the name of the application parameter XML file … … 119 120 120 121 /** 121 * Make the configuration accessible<br><br>122 * 122 * Make the configuration statically accessible<br><br> 123 * 123 124 * Both the Simple framework and the methods in the web application need to 124 125 * access the configuration. Access is granted by defining a member holding … … 128 129 129 130 /** 130 * Make the configuration statically accessible<br><br> 131 * 132 * Access for the Simple framework is achieved by passing the member to the 133 * read method defined in the superclass.<br><br> 131 * Open a static context of WebAppConfig members, and assign values to 132 * them.<br><br> 134 133 * 135 * Access for the web application is achieved by invoking one of the get or 136 * read methods. Because these methods return a non-static value, while 137 * WebAppConfig on the other hand denotes a static context,<br><br> 134 * The web application can access a parameter by invoking one of the get or 135 * set methods defined below. Because these methods return a non-static 136 * value, while WebAppConfig on the other hand denotes a static 137 * context,<br><br> 138 138 * 139 139 * WebAppConfig.getParameterMember()<br><br> 140 140 * 141 * for example, would not be valid. On encountering get() however, a new142 * context is opened, and from that, getParameterMember() can be141 * for example, would not be valid. On encountering open() however, a new 142 * static context is opened, and from that, getParameterMember() can be 143 143 * invoked:<br><br> 144 144 * 145 * WebAppConfig. get().getParameterMember()<br><br>146 * 147 * @return the web application configuration in a new context148 */ 149 public static WebAppConfig get() {145 * WebAppConfig.open().getParameterMember()<br><br> 146 * 147 * @return the web application configuration in a new static context 148 */ 149 public static WebAppConfig open() { 150 150 if (config == null) { 151 151 // the configuration is not there yet; create it now … … 153 153 } 154 154 155 // get the xml file configuration by invoking the superclass method 155 /** 156 * get the XML file configuration from the file by invoking the 157 * superclass method 158 */ 156 159 config = (WebAppConfig) read(config); 157 160 158 /* Contrary to Simple, the webcontext parameters are not retrieved161 /* Contrary to Simple, the servlet context parameters are not retrieved 159 162 * by annotation. Get them by invoking a local method. 160 163 */ 161 // config = addFromContext(config);164 config = addServletContext(config); 162 165 163 166 return config; 164 167 } 168 169 /** 170 * Close the static context of WebAppConfig members<br><cr> 171 * 172 * As a counterpart to open() the close() method just writes the value of 173 * the parameters in the XML file back to this file. 174 */ 175 public void close() { 176 if (config == null) { 177 // no configuration is not there yet; no need to do anything 178 } else { 179 // put it away by invoking the superclass write method 180 181 write (config); 182 183 /** 184 * Contrary to web the application parameters, servlet context 185 * parameters can not be written back to where they reside, so there 186 * is nothing left to do here. 187 */ 188 } 189 } 165 190 166 191 /** 167 192 * Web application parameter members<br><br> 168 * 193 * 169 194 * Initialize a member corresponding to application parameters with an empty 170 195 * string at least, for this will allow them to be linearized to 171 * corresponding elements in the XML file. Note that for the moment only 172 * de-linearization is supported by the WebAppConfig class. 173 * 174 * Refer to the general VLO documentation for a description of the member 175 * parameters. 196 * corresponding elements in the XML file. 197 * 198 * Please refer to the general VLO documentation for a description of the 199 * member parameters. 176 200 */ 177 201 … … 188 212 @Element 189 213 private String handleServerUrl = ""; 190 191 // In the XML file, the value of the parameter is expanded by Maven.192 @Element193 private String solrUrl = "";194 214 195 215 @Element … … 197 217 198 218 /** 199 * Note . The national project mapping itself is not part of the web219 * Note: the national project mapping itself is not part of the web 200 220 * application configuration. 201 221 */ … … 205 225 /** 206 226 * An array of facetFields<br><br> 207 * 227 * 208 228 * In case of an array of elements, the number of elements in the array 209 229 * needs to be communicated to Simple. The following would be a correct 210 230 * description of an array of three facet fields<br><br> 211 * 212 * {@literal <facetFields length="3">}<br> 213 * {@literal <facetField>}<br> 214 * {@literal fieldOne}<br> 215 * {@literal </facetField>}<br> 216 * {@literal <facetField>}<br> 217 * {@literal fieldTwo}<br> 218 * {@literal </facetField>}<br> 219 * {@literal <facetField>}<br> 220 * {@literal fieldThree}<br> 221 * {@literal </facetField>}<br> 231 * 232 * {@literal <facetFields length="3">}<br> {@literal <facetField>}<br> 233 * {@literal fieldOne}<br> {@literal </facetField>}<br> 234 * {@literal <facetField>}<br> {@literal fieldTwo}<br> 235 * {@literal </facetField>}<br> {@literal <facetField>}<br> 236 * {@literal fieldThree}<br> {@literal </facetField>}<br> 222 237 * {@literal </facetFields>}<br><br> 223 * 238 * 224 239 * To let Spring now it has to interpret the facetFields element as an 225 240 * array, use the ElementArray directive. Use the directive to let Spring 226 * know that the elements inside 'facetFields' are named 'facetField'. 227 */ 228 229 @ElementArray(entry="facetField") 241 * know that the elements inside 'facetFields' are named 'facetField'. 242 */ 243 @ElementArray(entry = "facetField") 230 244 private String[] facetFields = {"", "", ""}; 231 245 … … 234 248 235 249 @Element 236 private String language2LetterCodeComponentUrl = "";250 private String language2LetterCodeComponentUrl = ""; 237 251 238 252 @Element … … 244 258 @Element 245 259 private String FederatedContentSearchUrl = " "; 246 260 247 261 /** 248 262 * Get and read methods for web application parameter members<br><br> 249 * 263 * 250 264 * By using a get or read method, you can apply an operation to a parameter 251 265 * here, in the WebAppConfig class, without the need to make changes in … … 255 269 /** 256 270 * Get the VloHomeLink parameter<br><br> 257 * 271 * 258 272 * For a description of the parameter, refer to the general VLO 259 273 * documentation. … … 267 281 /** 268 282 * Set the VloHomeLink parameter<br><br> 269 * 283 * 270 284 * For a description of the parameter, refer to the general VLO 271 285 * documentation. … … 273 287 * @param vloHomeLink the parameter 274 288 */ 275 public void setVloHomeLink(String vloHomeLink) {276 this.vloHomeLink = vloHomeLink;289 public void setVloHomeLink(String link) { 290 this.vloHomeLink = link; 277 291 } 278 292 279 293 /** 280 294 * Get the ProfileSchemaUrl by profileId parameter<br><br> 281 * 295 * 282 296 * For a description of the schema, refer to the general VLO documentation. 283 297 * Note: the profileId needs to be expanded. … … 285 299 * @return the parameter 286 300 */ 287 public String getComponentRegistryProfileSchema(String profileId) {288 return profileSchemaUrl.replace("${PROFILE_ID}", profileId);301 public String getComponentRegistryProfileSchema(String id) { 302 return profileSchemaUrl.replace("${PROFILE_ID}", id); 289 303 } 290 304 291 305 /** 292 306 * Set the ProfileSchemaUrl parameter<br><br> 293 * 307 * 294 308 * For a description of the schema, refer to the general VLO documentation. 295 309 * Note: the profileId needs to be expanded. … … 297 311 * @param profileId the parameter 298 312 */ 299 public void setProfileSchemaUrl(String profileSchemaUrl) {300 this.profileSchemaUrl = profileSchemaUrl;313 public void setProfileSchemaUrl(String url) { 314 this.profileSchemaUrl = url; 301 315 } 302 316 303 317 /** 304 318 * Get the ComponentRegisteryRESTURL parameter<br><br> 305 * 319 * 306 320 * For a description of the parameter, refer to the general VLO 307 321 * documentation. … … 315 329 /** 316 330 * Set the ComponentRegisteryRESTURL parameter<br><br> 317 * 318 * For a description of the parameter, refer to the general VLO 319 * documentation. 320 * 331 * 332 * For a description of the parameter, refer to the general VLO 333 * documentation. 334 * 321 335 * @param componentRegistryRESTURL the parameter 322 336 */ 323 public void setComponentRegistryRESTURL(String componentRegistryRESTURL) {324 this.componentRegistryRESTURL = componentRegistryRESTURL;337 public void setComponentRegistryRESTURL(String url) { 338 this.componentRegistryRESTURL = url; 325 339 } 326 340 327 341 /** 328 342 * Get the HandleServerUrl parameter<br><br> 329 * 343 * 330 344 * For a description of the parameter, refer to the general VLO 331 345 * documentation. … … 339 353 /** 340 354 * Set the HandleServerUrl parameter<br><br> 341 * 342 * For a description of the parameter, refer to the general VLO 343 * documentation. 344 * 355 * 356 * For a description of the parameter, refer to the general VLO 357 * documentation. 358 * 345 359 * @param handleServerUrl the parameter 346 360 */ 347 public void setHandleServerUrl(String handleServerUrl) { 348 this.handleServerUrl = handleServerUrl; 349 } 350 351 /** 352 * Get the SolrUrl parameter<br><br> 353 * 354 * For a description of the parameter, refer to the general VLO 355 * documentation. 356 * 357 * @return the parameter 358 */ 359 public void setSolrUrl(String solrUrl) { 360 this.solrUrl = solrUrl; 361 } 362 363 /** 364 * Set the SolrUrl parameter<br><br> 365 * 366 * For a description of the parameter, refer to the general VLO 367 * documentation. 368 * 369 * @param solrUrl the parameter 370 */ 371 public String getSolrUrl() { 372 return solrUrl; 361 public void setHandleServerUrl(String url) { 362 this.handleServerUrl = url; 373 363 } 374 364 … … 381 371 * @param imdiBrowserUrl the parameter 382 372 */ 383 public void setIMDIBrowserUrl(String imdiBrowserUrl) {384 this.imdiBrowserUrl = imdiBrowserUrl;373 public void setIMDIBrowserUrl(String url) { 374 this.imdiBrowserUrl = url; 385 375 } 386 376 … … 401 391 return result; 402 392 } 403 404 393 405 394 /** 406 395 * Get the FederatedContentSearchUrl parameter<br><br> 407 * 408 * For a description of the parameter, refer to the general VLO 409 * documentation. 410 * 411 * @return the parameter 412 */ 413 public void setFederatedContentSearchUrl(String solrUrl) {414 this.FederatedContentSearchUrl = FederatedContentSearchUrl;396 * 397 * For a description of the parameter, refer to the general VLO 398 * documentation. 399 * 400 * @return the parameter 401 */ 402 public void setFederatedContentSearchUrl(String url) { 403 this.FederatedContentSearchUrl = url; 415 404 } 416 405 … … 435 424 * @param nationalProjectMapping the parameter 436 425 */ 437 public void setNationalProjectMapping(String nationalProjectMapping) {438 this.nationalProjectMapping = nationalProjectMapping;426 public void setNationalProjectMapping(String mapping) { 427 this.nationalProjectMapping = mapping; 439 428 } 440 429 … … 471 460 * @param facetFields the parameter, a list of facet fields 472 461 */ 473 public void setFacetFields(String[] f acetFields) {474 this.facetFields = f acetFields;462 public void setFacetFields(String[] fields) { 463 this.facetFields = fields; 475 464 } 476 465 … … 495 484 * @param countryComponentUrl the parameter 496 485 */ 497 public void setCountryComponentUrl(String countryComponentUrl) {498 this.countryComponentUrl = countryComponentUrl;486 public void setCountryComponentUrl(String url) { 487 this.countryComponentUrl = url; 499 488 } 500 489 … … 519 508 * @param language2LetterCodeComponentUrl the parameter 520 509 */ 521 public void setLanguage2LetterCodeComponentUrl(String language2LetterCodeComponentUrl) {522 this.language2LetterCodeComponentUrl = language2LetterCodeComponentUrl;510 public void setLanguage2LetterCodeComponentUrl(String url) { 511 this.language2LetterCodeComponentUrl = url; 523 512 } 524 513 … … 539 528 * @param language3LetterCodeComponentUrl the parameter 540 529 */ 541 public void setLanguage3LetterCodeComponentUrl(String language3LetterCodeComponentUrl) {542 this.language3LetterCodeComponentUrl = language3LetterCodeComponentUrl;530 public void setLanguage3LetterCodeComponentUrl(String url) { 531 this.language3LetterCodeComponentUrl = url; 543 532 } 544 533 … … 563 552 * @param silToISO639CodesUrl the parameter 564 553 */ 565 public void setSilToISO639CodesUrl(String silToISO639CodesUrl) { 566 this.silToISO639CodesUrl = silToISO639CodesUrl; 567 } 568 569 /** 570 * Retrieve the context parameters<br><br> 571 * 572 * Note that in terms of the configuration, properties of the context are 573 * treated as parameters also. 574 * 575 * @param config the static WebAppConfig member 554 public void setSilToISO639CodesUrl(String url) { 555 this.silToISO639CodesUrl = url; 556 } 557 558 // reference to the servlet context 559 private static ServletContext servletContext = null; 560 561 /** 562 * Set the {@literal servlet} context 563 * 564 * Note: this method needs to be invoked before open() is invoked 565 */ 566 public static void setServletContext (ServletContext context){ 567 568 servletContext = context; 569 } 570 571 /** 572 * Add properties of the {@literal servlet's} context<br><br> 573 * 574 * Keep the properties in the static context of the WebAppConfig class, next 575 * to the members representing the values in WebAppConfig.xml file.<br><br> 576 * 577 * @param config static configuration 576 578 * 577 579 * @return the static WebAppConfig member 578 580 */ 579 static WebAppConfig add FromContext(WebAppConfig config) {580 581 // retrieve parameter s from the context of the web application582 583 docBase = WebAppParam.getContextParam ("docBase");584 581 static WebAppConfig addServletContext(WebAppConfig config) { 582 583 // retrieve parameter valies from the servlet context 584 585 config.solrUrl = servletContext.getInitParameter("solrUrl"); 586 585 587 return config; 586 588 } 587 589 588 590 /** 589 * Web application context members<br><br> 590 * 591 * The following defines the members corresponding to context. 592 */ 593 594 /** 595 * Context members 596 */ 597 static String docBase = ""; 598 599 /** 600 * Get and read methods for the context members 601 */ 602 603 /** 604 * 605 * @return 606 */ 607 public String getDocbaBase() { 608 return docBase; 609 } 610 611 /** 612 * 613 * @return 614 */ 615 public String setDocBase(String param) { 616 // potentially, modify the parameter in the configuration 617 docBase = param; 618 return docBase; 591 * {@literal Servlet} context members<br><br> 592 * 593 * The following defines the members corresponding to {@servlet} context 594 * parameters. 595 */ 596 597 @Element 598 private String solrUrl = ""; 599 600 /** 601 * Get methods for the {@literal servlet} context members 602 */ 603 604 /** 605 * Get the SolrUrl parameter<br><br> 606 * 607 * For a description of the parameter, refer to the general VLO 608 * documentation. 609 * 610 * @param solrUrl the parameter 611 */ 612 public String getSolrUrl() { 613 return solrUrl; 619 614 } 620 615 } -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/resources/WebAppConfig.xml
r2570 r2577 4 4 <componentRegistryRESTURL>http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/</componentRegistryRESTURL> 5 5 <handleServerUrl>http://hdl.handle.net/</handleServerUrl> 6 <solrUrl>http://localhost:8084/vlo_solr/</solrUrl>7 6 <imdiBrowserUrl>http://corpus1.mpi.nl/ds/imdi_browser?openpath=</imdiBrowserUrl> 8 7 <nationalProjectMapping>nationalProjectsMapping.xml</nationalProjectMapping> -
vlo/branches/vlo-2.13-param/vlo_webapp/src/main/webapp/META-INF/context.xml
r2570 r2577 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <Context antiJARLocking="true" path="/vlo"/> 2 3 <!-- VLO application context file 4 5 solrURL : URL through which the Solr server should be reached<br><br> 6 7 Note that the VLO importer needs about this URL to. Because the 8 importer is not a web application, the value of the parameter should 9 be defined in the ImporterConfig.xml<br><br> 10 11 as<br><br> 12 13 <solrUrl>http://localhost:8084/vlo_solr/</solrUrl><br><br> 14 15 --> 16 17 <Context antiJARLocking="true" path="/vlo"> 18 <Parameter name=solrURL value="http://localhost:8084/vlo_solr/"/> 19 </Context>
Note: See TracChangeset
for help on using the changeset viewer.