Changeset 5040


Ignore:
Timestamp:
04/24/14 09:59:52 (10 years ago)
Author:
yana.panchenko@uni-tuebingen.de
Message:

add mode 'search' to run the search immediately after the aggregator is called
update depenency to the latest wlfxb version

Location:
SRUAggregator/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/pom.xml

    r5034 r5040  
    6868            <groupId>eu.clarin.weblicht</groupId>
    6969            <artifactId>wlfxb</artifactId>
    70             <version>1.2.2</version>
     70            <version>1.2.9</version>
    7171        </dependency>
    7272        <dependency>
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/Aggregator.java

    r5039 r5040  
    2525
    2626/**
    27  * Main component of the Aggregator application.
     27 * Main component of the Aggregator application intended to provide
     28 * users access to CLARIN-FCS resources.
     29 *
     30 * The webapp base URL corresponds to the default behavior of displaying
     31 * the main aggregator page, where the user can enter query, select the
     32 * resources of CQL endpoints (as specified in the Clarin center registry),
     33 * and search in these resources. The endpoints/resources selection is
     34 * optional, by default all the endpoints root resources are selected.
     35 *
     36 * If invoked with 'x-aggregation-context' and 'query' parameter,
     37 * the aggregator will pre-select provided resources and fill in the query field.
     38 * This mechanism is currently used by VLO.
     39 * Example:
     40 * POST http://weblicht.sfs.uni-tuebingen.de/Aggregator HTTP/1.1
     41 * operation = searchRetrieve &
     42 * version = 1.2 &
     43 * query = bellen &
     44 * x-aggregation-context = {"http://fedora.clarin-d.uni-saarland.de/sru/":["hdl:11858/00-246C-0000-0008-5F2A-0"]}
     45 *
     46 *
     47 * Additionally, if run with the a URL query string parameter 'mode', the
     48 * special behavior of the aggregator is triggered:
     49 *
     50 * /?mode=testing
     51 * corresponds to the mode where the CQL endpoints are taken not from Clarin
     52 * center repository, but from a hard-coded endpoints list; this functionality
     53 * is useful for testing the development instances of endpoints, before they
     54 * are moved to production. Was done to meet the request from MPI.
     55 *
     56 * /?mode=search
     57 * corresponds to the mode where the aggregator page is requested with the
     58 * already known query and (optionally) resources to search in, and if the
     59 * immediate search is desired. In this case the aggregator search results
     60 * page is displayed and search results of the provided query start to fill
     61 * it in immediately (i.e. users don't need to click 'search' in the aggregator
     62 * page). Was done to meet the request from CLARIN ERIC ( Martin Wynne
     63 * contacted us).
    2864 *
    2965 * @author Yana Panchenko
     
    85121    private static final String WEBLICHT_URL =
    86122            "https://weblicht.sfs.uni-tuebingen.de/WebLicht-4/?input=";
     123   
     124    public static final String MODE_PARAM = "mode";
     125    public static final String MODE_PARAM_VALUE_TEST = "testing";
     126    public static final String MODE_PARAM_VALUE_SEARCH = "search";
     127    public static final String MODE_PARAM_VALUE_LIVE = "live";
     128   
    87129   
    88130   
     
    92134        processParameters();
    93135        searchOptionsComposer = (SearchOptions) soDiv.getChildren().get(0).getChildren().get(0).getAttribute("$" + SearchOptions.class.getSimpleName());
     136        searchOptionsComposer.setAggregatorController(this);
    94137        searchResultsComposer = (SearchResults) srDiv.getChildren().get(0).getChildren().get(0).getAttribute("$" + SearchResults.class.getSimpleName());
    95138        pagesVisibility = new PagesVisibility(aboutDiv, aboutLabel, soDiv, soLabel, srDiv, srLabel, helpDiv, helpLabel);
     
    364407                    startHit + "-" + endHit);
    365408    }
     409
    366410}
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/SearchOptions.java

    r5039 r5040  
    4949
    5050/**
    51  * Class representing Search Options page. Displays and let's user select corpora,
    52  * languages, number of records per page to be displayed, etc.
     51 * Class representing Search Options view of the Aggregator. Displays and lets
     52 * users select corpora, languages, number of records per page to be displayed,
     53 * etc.
    5354 *
    5455 * @author Yana Panchenko
     
    7980
    8081    private ScanCache cache;
     82   
     83    private Aggregator aggregatorController;
    8184   
    8285    @Override
     
    9194        languages = (Languages) Executions.getCurrent().getDesktop().getWebApp().getAttribute(WebAppListener.LANGUAGES);
    9295        languageSelect.setSelectedItem(anyLanguage);
     96    }
     97   
     98   
     99    void setAggregatorController(Aggregator aggregatorController) {
     100        this.aggregatorController = aggregatorController;
    93101    }
    94102
     
    141149    @Listen(ZulEvents.ON_AFTER_RENDER + "=#tree")
    142150    public void onAfterRenderCorporaTree(Event ev) {
    143         if (this.xAggregationContext == null) {
     151        loadLanguages();
     152        if (isSearchOn() && (xAggregationContext == null || xAggregationContext.isEmpty())) {
     153            onSelectAll(null);
     154        } else if (this.xAggregationContext == null) {
    144155            onSelectAll(null);
    145156        } else {
    146157            selectCorpora(xAggregationContext);
    147158        }
    148         loadLanguages();
     159        if (isSearchOn()) {
     160            this.aggregatorController.onExecuteSearch(null);
     161        }
    149162    }
    150163
     
    262275    }
    263276
    264     private boolean isTestingOn() {
    265         boolean testingOn = false;
    266         String[] paramValue = Executions.getCurrent().getParameterMap().get("mode");
    267         if (paramValue != null) {
    268             String mode = paramValue[0].trim();
    269             if (mode.equals("testing")) {
    270                 testingOn = true;
    271             }
    272         }
    273         return testingOn;
    274     }
    275277
    276278    private void setUpAggerationContext() {
     
    364366        }
    365367    }
     368   
     369   
     370    private boolean isTestingOn() {
     371        boolean testingOn = false;
     372        String[] paramValue = Executions.getCurrent().getParameterMap().get(Aggregator.MODE_PARAM);
     373        if (paramValue != null) {
     374            String mode = paramValue[0].trim();
     375            LOGGER.log(Level.INFO, "Received parameter: {0}[{1}]", new String[]{Aggregator.MODE_PARAM, mode});
     376            if (mode.equals(Aggregator.MODE_PARAM_VALUE_TEST)) {
     377                testingOn = true;
     378            }
     379        }
     380        return testingOn;
     381    }
     382       
     383    private boolean isSearchOn() {
     384        boolean searchOn = false;
     385        String[] paramValue = Executions.getCurrent().getParameterMap().get(Aggregator.MODE_PARAM);
     386        if (paramValue != null) {
     387            String mode = paramValue[0].trim();
     388            LOGGER.log(Level.INFO, "Received parameter: {0}[{1}]", new String[]{Aggregator.MODE_PARAM, mode});
     389            if (mode.equals(Aggregator.MODE_PARAM_VALUE_SEARCH)) {
     390                searchOn = true;
     391            }
     392        }
     393        return searchOn;
     394    }
    366395
    367396}
  • SRUAggregator/trunk/src/main/java/eu/clarin/sru/fcs/aggregator/app/WebAppListener.java

    r5039 r5040  
    7171        webapp.setAttribute(LANGUAGES, languages);
    7272       
    73         setUpScanCache(webapp);
    74         //setUpScanCacheForReadOnly(webapp);
     73        //setUpScanCache(webapp);
     74        setUpScanCacheForReadOnly(webapp);
    7575       
    7676        setUpTokenizers(webapp);
     
    9292
    9393    private String getScanDirectory() {
    94         //File aggregatorDir = new File(System.getProperty("user.home"), "/." + AGGREGATOR_DIR_NAME);
     94        File aggregatorDir = new File(System.getProperty("user.home"), "/." + AGGREGATOR_DIR_NAME);
    9595        //File aggregatorDir = new File("/var/www", "/." + AGGREGATOR_DIR_NAME);
    96         File aggregatorDir = new File("/data/fcsAggregator");
     96        //File aggregatorDir = new File("/data/fcsAggregator");
    9797       
    9898        if (!aggregatorDir.exists()) {
Note: See TracChangeset for help on using the changeset viewer.