Changeset 4311


Ignore:
Timestamp:
01/21/14 10:49:17 (10 years ago)
Author:
twagoo
Message:

Merged changes, amongst which a fix for #481 and most likely the fix for the heap space issues from trunk to 2.18 branch.

Location:
vlo/branches/vlo-2.18
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-2.18

  • vlo/branches/vlo-2.18/UPGRADE

  • vlo/branches/vlo-2.18/vlo_importer/src/main/resources/VloConfig.xml

    r4247 r4311  
    11<VloConfig>
    22   
    3     <pagesInApplicationCache>128</pagesInApplicationCache>
     3    <!-- Sets the maximum number of page instances which will be stored in the application scoped second level cache for faster retrieval -->
     4    <pagesInApplicationCache>40</pagesInApplicationCache>
    45   
    5     <sessionCacheSize>500</sessionCacheSize>
     6    <!-- Sets the maximum size (in KILOBYTES) of the File where page instances per session are stored. -->
     7    <sessionCacheSize>10000</sessionCacheSize>
    68   
    79    <deleteAllFirst>true</deleteAllFirst>
  • vlo/branches/vlo-2.18/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/VloWebApplication.java

    r4247 r4311  
    2121import org.apache.wicket.util.string.StringValue;
    2222import org.apache.wicket.util.lang.Bytes;
     23import org.slf4j.Logger;
     24import org.slf4j.LoggerFactory;
    2325
    2426/**
     
    3234public class VloWebApplication extends WebApplication {
    3335
     36    private final static Logger logger = LoggerFactory.getLogger(VloWebApplication.class);
     37   
    3438    /**
    3539     * Customised client request cycle<br><br>
     
    113117       
    114118        // 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()));
     119        final int pagesInApplicationCache = VloConfig.getPagesInApplicationCache();
     120        logger.info("Setting Wicket in-memory cache size to {}", pagesInApplicationCache);
     121        this.getStoreSettings().setInmemoryCacheSize(pagesInApplicationCache);
     122       
     123        final Bytes sessionCacheSize = Bytes.kilobytes((long)VloConfig.getSessionCacheSize());
     124        logger.info("Setting Wicket max size per session to {}", sessionCacheSize);
     125        this.getStoreSettings().setMaxSizePerSession(sessionCacheSize);
    117126
    118127        // creata an object referring to the search results
  • vlo/branches/vlo-2.18/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/FacetBoxPanel.java

    r4240 r4311  
    6666        };
    6767        add(facetList);
    68         PageParameters facetParameters = new PageParameters ();
     68        PageParameters facetParameters = query.getPageParameters();
    6969        facetParameters.add(ShowAllFacetValuesPage.SELECTED_FACET_PARAM, facetField.getName());
    7070        facetParameters.add(ShowAllFacetValuesPage.FACET_MIN_OCCURS, "1");
  • vlo/branches/vlo-2.18/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java

    r4259 r4311  
    77import eu.clarin.cmdi.vlo.config.VloConfig;
    88import eu.clarin.cmdi.vlo.dao.DaoLocator;
    9 import java.io.InputStreamReader;
    10 import java.io.StringWriter;
    119import java.io.UnsupportedEncodingException;
    1210import java.net.MalformedURLException;
     
    1917import java.util.List;
    2018import java.util.regex.Pattern;
    21 import javax.xml.transform.stream.StreamSource;
    22 import net.sf.saxon.s9api.Processor;
    23 import net.sf.saxon.s9api.Serializer;
    24 import net.sf.saxon.s9api.XdmNode;
    25 import net.sf.saxon.s9api.XsltCompiler;
    26 import net.sf.saxon.s9api.XsltExecutable;
    27 import net.sf.saxon.s9api.XsltTransformer;
    2819import org.apache.solr.common.SolrDocument;
    2920import org.apache.wicket.Application;
     
    6152import org.apache.wicket.util.encoding.UrlDecoder;
    6253import org.apache.wicket.util.encoding.UrlEncoder;
     54import org.apache.wicket.util.string.StringValue;
    6355import org.slf4j.Logger;
    6456import org.slf4j.LoggerFactory;
     
    7567    public static final String feedbackfromURL = VloConfig.getFeedbackFromUrl();
    7668
    77     private final URL xslFile = getClass().getResource("/eu/clarin/cmdi/vlo/pages/cmdi2xhtml.xsl");
    7869    private final ResourceReference XSL_CSS_REFERENCE = new PackageResourceReference(getClass(), "cmdi.css");
    7970
     
    8172    public ShowResultPage(final PageParameters currentParam) {
    8273        super(currentParam);
     74
     75        final StringValue docIdParam = getPageParameters().get(PARAM_DOC_ID);
     76        if (docIdParam == null) {
     77            throw new RuntimeException("No document id was specified. Cannot construct result page.");
     78        }
    8379        //Document ID is assumed to have been encoded (typcially in DocumentLinkPanel) decode here
    8480        final String docId = UrlDecoder.QUERY_INSTANCE.decode(
    85                 getPageParameters().get(PARAM_DOC_ID).toString(),
     81                docIdParam.toString(),
    8682                Application.get().getRequestCycleSettings().getResponseRequestEncoding()); // get current character set from request cycle
    8783        SolrDocument solrDocument = DaoLocator.getSearchResultsDao().getSolrDocument(docId);
     84
    8885        if (solrDocument != null) {
    8986            final SearchPageQuery query = new SearchPageQuery(currentParam);
     
    558555
    559556    private void createCompleteCmdiView(final SolrDocument solrDocument) {
    560         StringWriter strWriter = new StringWriter();
    561 
    562         final Processor proc = new Processor(false);
    563         final XsltCompiler comp = proc.newXsltCompiler();
    564 
     557        final String completeMetadataField = solrDocument.getFirstValue(FacetConstants.FIELD_COMPLETE_METADATA).toString();
    565558        try {
    566             final XsltExecutable exp = comp.compile(new StreamSource(xslFile.getFile()));
    567             final XdmNode source = proc.newDocumentBuilder().build(
    568                     new StreamSource(new InputStreamReader(new URL(solrDocument.getFirstValue(FacetConstants.FIELD_COMPLETE_METADATA).toString()).openStream())));
    569             final Serializer out = new Serializer();
    570             out.setOutputProperty(Serializer.Property.METHOD, "html");
    571             out.setOutputProperty(Serializer.Property.INDENT, "yes");
    572             out.setOutputProperty(Serializer.Property.ENCODING, "UTF-8");
    573             out.setOutputWriter(strWriter);
    574             final XsltTransformer trans = exp.load();
    575 
    576             trans.setInitialContextNode(source);
    577             trans.setDestination(out);
    578             trans.transform();
    579         } catch (Exception e) {
    580             LOG.error("Couldn't create CMDI metadata: ", e);
    581             strWriter = new StringWriter().append("<b>Could not load complete CMDI metadata</b>");
    582         }
    583 
    584         completeCmdiLabel = new Label("completeCmdi", strWriter.toString());
    585         completeCmdiLabel.setEscapeModelStrings(false);
     559            final CmdiXsltModel cmdiXsltModel = new CmdiXsltModel(new URL(completeMetadataField));
     560            completeCmdiLabel = new Label("completeCmdi", cmdiXsltModel);
     561            completeCmdiLabel.setEscapeModelStrings(false);
     562        } catch (MalformedURLException ex) {
     563            LOG.error("Could not create CMDI view, malformed URL: {}", completeMetadataField, ex);
     564            completeCmdiLabel = new Label("<b>Could not read metadata</b>");
     565        }
    586566    }
    587567
Note: See TracChangeset for help on using the changeset viewer.