Changeset 4247


Ignore:
Timestamp:
01/10/14 09:35:01 (10 years ago)
Author:
keeloo
Message:

Added parameters controlling the Wicket page store. Please update your VloConfig? files by adding and defining the pagesInApplicationCache and sessionCacheSize parameters.

Location:
vlo/branches/to-wicket-1.6
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/to-wicket-1.6/vlo_importer/src/main/java/eu/clarin/cmdi/vlo/config/VloConfig.java

    r4071 r4247  
    105105
    106106        /**
    107          * Initialize the ConfigFilePersister's reference to the interface
     107         * Initialise the ConfigFilePersister's reference to the interface
    108108         */
    109109        ConfigFilePersister.setLogger(VloConfig.logger);
     
    148148    }
    149149
    150     /**
     150    /*
    151151     * VLO application parameter members<br><br>
    152152     *
    153      * Initialise the annotated members in a proper way. This will allow them to
    154      * be linearised to corresponding elements in an XML file.
     153     * Please Initialise the annotated members in a proper way. This will allow
     154     * them to be linearised to corresponding elements in an XML file.
    155155     *
    156156     * Please refer to the general VLO documentation for a description of the
    157157     * member parameters.
    158158     */
     159   
     160    // page cache related parameters
     161   
     162    @Element
     163    private static int pagesInApplicationCache = 0;
     164   
     165    @Element
     166    private static int sessionCacheSize = 0;
    159167   
    160168    // data base related parameters
     
    294302     * application.
    295303     */
    296    
     304           
     305    /**
     306     * Get the value of the pagesInApplicationCache parameter<br><br>
     307     *
     308     * The parameter represents the number of pages that Wicket will allow
     309     * to be stored in the application's cache.
     310     *
     311     * @return the value
     312     */
     313    public static int getPagesInApplicationCache() {
     314        return pagesInApplicationCache;
     315    }
     316
     317    /**
     318     * Set the value of the pagesInApplicationCache parameter<br><br>
     319     *
     320     * The parameter represents the number of pages that Wicket will allow
     321     * to be stored in the application's cache.
     322     *
     323     * @param param the value
     324     */
     325    public static void setPagesInApplicationCache(int param) {
     326        pagesInApplicationCache = param;
     327    }
     328   
     329    /**
     330     * Get the value of the sessionCacheSize parameter<br><br>
     331     *
     332     * The parameter represents the size in kilobytes of the session
     333     * page cache.
     334     *
     335     * @return the value
     336     */
     337    public static int getSessionCacheSize() {
     338        return sessionCacheSize;
     339    }
     340
     341    /**
     342     * Set the value of the sessionCacheSize parameter<br><br>
     343     *
     344     * The parameter represents the size in megabytes of the session
     345     * page cache.
     346     *
     347     * @param param the value
     348     */
     349    public static void setSessionCacheSize(int param) {
     350        sessionCacheSize = param;
     351    }
     352
    297353    /**
    298354     * Get the value of the deleteAllFirst parameter<br><br>
     
    302358     *
    303359     * @return the value
    304      */
    305    
     360     */
    306361    public static boolean deleteAllFirst() {
    307362        return deleteAllFirst;
  • vlo/branches/to-wicket-1.6/vlo_importer/src/main/resources/VloConfig.xml

    r4030 r4247  
    11<VloConfig>
     2   
     3    <pagesInApplicationCache>128</pagesInApplicationCache>
     4   
     5    <sessionCacheSize>500</sessionCacheSize>
    26   
    37    <deleteAllFirst>true</deleteAllFirst>
  • vlo/branches/to-wicket-1.6/vlo_importer/src/test/java/eu/clarin/cmdi/vlo/config/VloConfigTest.java

    r4030 r4247  
    8787    }
    8888
     89    /**
     90     * Test the getPagesInApplicationCache method
     91     */
     92    @Test
     93    public void testGetPagesInApplicationCache() {
     94       
     95        System.out.println("getPagesInApplicationCache");
     96       
     97        int expResult = 128;
     98        int result = VloConfig.getPagesInApplicationCache();
     99       
     100        assertEquals(expResult, result);
     101    }
     102
     103    /**
     104     * Test the setPagesInApplicationCache method
     105     */
     106    @Test
     107    public void testSetPagesInApplicationCache() {
     108       
     109        System.out.println("setPagesInApplicationCache");
     110       
     111        int param = 500;
     112       
     113        VloConfig.setPagesInApplicationCache(param);
     114
     115        int result = VloConfig.getPagesInApplicationCache();
     116       
     117        assertEquals(param, result);
     118    }
     119   
     120   
     121    /**
     122     * Test the getSessionCacheSize method
     123     */
     124    @Test
     125    public void testGetSessionCacheSize() {
     126       
     127        System.out.println("getPagesInApplicationCache");
     128       
     129        int expResult = 128;
     130        int result = VloConfig.getPagesInApplicationCache();
     131       
     132        assertEquals(expResult, result);
     133    }
     134
     135    /**
     136     * Test the setSessionCacheSize method
     137     */
     138    @Test
     139    public void testSetSessionCacheSize() {
     140       
     141        System.out.println("setPagesInApplicationCache");
     142       
     143        int param = 128;
     144       
     145        VloConfig.setMaxDocsInList(param);
     146
     147        int result = VloConfig.getPagesInApplicationCache();
     148       
     149        assertEquals(param, result);
     150    }
     151   
    89152    /**
    90153     * Test the getMaxDocsInList method
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/VloWebApplication.java

    r4244 r4247  
    2020import org.apache.wicket.request.mapper.parameter.PageParameters;
    2121import org.apache.wicket.util.string.StringValue;
     22import org.apache.wicket.util.lang.Bytes;
    2223
    2324/**
     
    8687
    8788        if (inContext) {
    88 
     89           
    8990            /*
    9091             * send messages to objects that need a static reference to this web
     
    110111            getRequestCycleListeners().add(new CustomRequestCycleListener());
    111112        }
     113       
     114        // configure cache by applying the vlo configuration settings to it
     115        this.getStoreSettings().setInmemoryCacheSize(VloConfig.getPagesInApplicationCache());
     116        this.getStoreSettings().setMaxSizePerSession(Bytes.kilobytes((long)VloConfig.getSessionCacheSize()));
    112117
    113118        // creata an object referring to the search results
     
    140145     */
    141146    public VloWebApplication() {
    142 
     147       
    143148        /*
    144149         * Read the application's packaged configuration
Note: See TracChangeset for help on using the changeset viewer.