Changeset 1007
- Timestamp:
- 12/22/10 13:27:06 (13 years ago)
- Location:
- vlo/trunk/vlo_webapp
- Files:
-
- 15 added
- 25 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
vlo/trunk/vlo_webapp/pom.xml
r996 r1007 38 38 <version>1.2.14</version> 39 39 </dependency> 40 <!-- TESTS -->41 40 <dependency> 42 41 <groupId>junit</groupId> … … 74 73 <version>2.5.6</version> 75 74 </dependency> 76 77 75 <dependency> 78 76 <groupId>com.ximpleware</groupId> … … 98 96 <includes> 99 97 <include>**/*.html</include> 98 <include>**/*.properties</include> 100 99 </includes> 101 100 </resource> -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/Configuration.java
r770 r1007 12 12 private final static Configuration INSTANCE = new Configuration(); 13 13 14 public static final String CONFIG_FILE = "applicationContext.xml"; 15 14 16 private String solrUrl; 15 17 … … 17 19 18 20 private String[] facetFields;// = new String[] { "origin", "organisation", "continent", "genre", "country", "subject", "language" }; 21 22 private String handleServerUrl; //"http://hdl.handle.net/" 19 23 20 24 private Configuration() { … … 54 58 this.facetFields = facetFields; 55 59 } 60 61 public String getHandleServerUrl() { 62 return handleServerUrl; 63 } 64 65 public void setHandleServerUrl(String handleServerUrl) { 66 this.handleServerUrl = handleServerUrl; 67 } 68 69 56 70 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/FacetConstants.java
r988 r1007 1 package eu.clarin.cmdi.vlo .dao;1 package eu.clarin.cmdi.vlo; 2 2 3 3 public class FacetConstants { … … 6 6 public static final String FIELD_ID = "id"; 7 7 public static final String FIELD_ORIGIN = "origin"; 8 public static final String FIELD_FILENAME = "fileName"; 8 public static final String FIELD_RESOURCE_TYPE = "resourceType"; 9 //The _ facets are not meant to be shown to users. 10 public static final String FIELD_FILENAME = "_fileName"; 11 public static final String FIELD_RESOURCE = "_resourceRef"; 12 public static final String FIELD_DATA_ROOT = "_dataRoot"; 13 14 //Normalized mimeTypes 15 public static final String RESOURCE_TYPE_AUDIO = "audio"; 16 public static final String RESOURCE_TYPE_VIDEO = "video"; 17 public static final String RESOURCE_TYPE_TEXT = "text"; 18 public static final String RESOURCE_TYPE_IMAGE = "image"; 19 public static final String RESOURCE_TYPE_ANNOTATION = "annotation"; 9 20 10 21 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/VloApplication.java
r759 r1007 17 17 18 18 public VloApplication() { 19 BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml"});19 BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { Configuration.CONFIG_FILE }); 20 20 factory.getBean("configuration"); //Use Configuration.getInstance to get the Configuration just loading the instance here. 21 21 searchResults = new SearchResultsDao(); -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/dao/SearchResultsDao.java
r967 r1007 7 7 import org.apache.solr.client.solrj.response.QueryResponse; 8 8 import org.apache.solr.common.SolrDocumentList; 9 10 import eu.clarin.cmdi.vlo.FacetConstants; 9 11 10 12 public class SearchResultsDao extends SolrDao { -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIData.java
r992 r1007 5 5 6 6 import org.apache.solr.common.SolrInputDocument; 7 import org.slf4j.Logger; 8 import org.slf4j.LoggerFactory; 7 9 8 10 public class CMDIData { 9 11 private final static Logger LOG = LoggerFactory.getLogger(CMDIData.class); 10 12 private static final String METADATA_TYPE = "Metadata"; 13 private static final String DATA_RESOURCE_TYPE = "Resource"; 11 14 private String id; 12 private List< String> resources = new ArrayList<String>();15 private List<Resource> metaDataResources = new ArrayList<Resource>(); 13 16 private SolrInputDocument doc; 17 private List<Resource> dataResources = new ArrayList<Resource>(); 14 18 15 19 public SolrInputDocument getSolrDocument() { … … 30 34 } 31 35 32 public List< String> getResources() {33 return resources;36 public List<Resource> getDataResources() { 37 return dataResources; 34 38 } 35 39 36 public void addResource(String resource, String type) { 40 public List<Resource> getMetadataResources() { 41 return metaDataResources; 42 } 43 44 public void addResource(String resource, String type, String mimeType) { 37 45 if (METADATA_TYPE.equals(type)) { 38 resources.add(resource); 46 metaDataResources.add(new Resource(resource, mimeType)); 47 } else if (DATA_RESOURCE_TYPE.equals(type)) { 48 dataResources.add(new Resource(resource, mimeType)); 49 } else { 50 LOG.warn("Found unsupported resource it will be ignored: type=" + type + ", name=" + resource); 39 51 } 40 52 } 41 53 42 54 public void setId(String id) { 43 55 this.id = id; … … 47 59 return id; 48 60 } 61 49 62 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIDigester.java
r996 r1007 15 15 16 16 import org.w3c.dom.Document; 17 import org.w3c.dom.NamedNodeMap; 17 18 import org.w3c.dom.Node; 18 19 import org.w3c.dom.NodeList; … … 20 21 import org.xml.sax.SAXException; 21 22 22 23 23 /** 24 * @deprecated 25 * Dom parsing implementation, use the @see CMDIParserVTDXML it is much faster. 26 * Keeping this for now just in case we run into issues with the vlt parsing. 27 * patdui 15 December 2010 24 * @deprecated Dom parsing implementation, use the @see CMDIParserVTDXML it is much faster. Keeping this for now just in case we run into 25 * issues with the vlt parsing. patdui 15 December 2010 28 26 */ 29 27 public class CMDIDigester implements CMDIDataProcessor { … … 62 60 Node resourceNode = nodes.item(i); 63 61 Node ref = (Node) xpath.evaluate("ResourceRef/text()", resourceNode, XPathConstants.NODE); 64 Node type = (Node) xpath.evaluate("ResourceType/text()", resourceNode, XPathConstants.NODE); 65 if (ref != null && type != null) { 66 result.addResource(ref.getNodeValue(), type.getNodeValue()); 62 Node nodeType = (Node) xpath.evaluate("ResourceType", resourceNode, XPathConstants.NODE); 63 if (ref != null && nodeType != null) { 64 String mimeType = null; 65 NamedNodeMap attributes = nodeType.getAttributes(); 66 if (attributes != null) { 67 Node n = attributes.getNamedItem("mimetype"); 68 if (n != null) { 69 mimeType = n.getNodeValue(); 70 } 71 } 72 String type = nodeType.getTextContent(); 73 result.addResource(ref.getNodeValue(), type, mimeType); 67 74 } 68 75 } … … 76 83 private void matchDocumentField(CMDIData result, FacetConfiguration facetConfig, Document doc, XPath xpath) 77 84 throws XPathExpressionException { 78 NodeList nodes = (NodeList) xpath.evaluate(facetConfig.getPattern(), doc, XPathConstants.NODESET); 85 List<String> patterns = facetConfig.getPatterns(); 86 for (String pattern : patterns) { 87 boolean matchedPattern = matchPattern(result, facetConfig, doc, xpath, pattern); 88 if (matchedPattern) { 89 break; 90 } 91 } 92 } 93 94 private boolean matchPattern(CMDIData result, FacetConfiguration facetConfig, Document doc, XPath xpath, String pattern) 95 throws XPathExpressionException { 96 boolean matchedPattern = false; 97 NodeList nodes = (NodeList) xpath.evaluate(pattern, doc, XPathConstants.NODESET); 79 98 if (nodes != null) { 99 matchedPattern = true; 80 100 for (int i = 0; i < nodes.getLength(); i++) { 81 101 result.addDocField(facetConfig.getName(), nodes.item(i).getNodeValue(), facetConfig.isCaseInsensitive()); 82 102 } 83 103 } // else do nothing it is perfectly acceptable that not all data is in a cmdi file so not everything will be matched. E.G xpath expression evaluation CMDI session files will never match on CMD corpus files. 104 return matchedPattern; 84 105 } 85 106 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/CMDIParserVTDXML.java
r996 r1007 2 2 3 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.IOException; 4 6 import java.util.List; 5 7 8 import org.apache.commons.io.IOUtils; 9 6 10 import com.ximpleware.AutoPilot; 7 import com.ximpleware. NavException;11 import com.ximpleware.VTDException; 8 12 import com.ximpleware.VTDGen; 9 13 import com.ximpleware.VTDNav; 10 import com.ximpleware.XPathEvalException;11 import com.ximpleware.XPathParseException;12 14 13 15 public class CMDIParserVTDXML implements CMDIDataProcessor { … … 18 20 } 19 21 20 public CMDIData process(File file) throws XPathParseException, XPathEvalException, NavException {22 public CMDIData process(File file) throws VTDException, IOException { 21 23 CMDIData result = null; 22 24 VTDGen vg = new VTDGen(); 23 if (vg.parseFile(file.getAbsolutePath(), true)) { 24 VTDNav nav = vg.getNav(); 25 result = new CMDIData(); 26 AutoPilot id = new AutoPilot(nav); 27 id.selectXPath(facetMapping.getIdMapping()); 28 result.setId(id.evalXPathToString()); 29 processResources(result, nav); 30 processFacets(result, nav); 31 return result; 32 } 25 vg.setDoc(IOUtils.toByteArray(new FileInputStream(file))); 26 vg.parse(true); 27 VTDNav nav = vg.getNav(); 28 result = new CMDIData(); 29 AutoPilot id = new AutoPilot(nav); 30 id.selectXPath(facetMapping.getIdMapping()); 31 result.setId(id.evalXPathToString()); 32 processResources(result, nav); 33 processFacets(result, nav); 33 34 return result; 34 35 } 35 36 36 private void processResources(CMDIData result, VTDNav nav) throws XPathParseException, XPathEvalException, NavException {37 private void processResources(CMDIData result, VTDNav nav) throws VTDException { 37 38 AutoPilot resourceProxy = new AutoPilot(nav); 38 39 resourceProxy.selectXPath("/CMD/Resources/ResourceProxyList/ResourceProxy"); … … 41 42 AutoPilot resourceType = new AutoPilot(nav); 42 43 resourceType.selectXPath("ResourceType"); 44 AutoPilot resourceMimeType = new AutoPilot(nav); 45 resourceMimeType.selectXPath("ResourceType/@mimetype"); 43 46 while (resourceProxy.evalXPath() != -1) { 44 47 String ref = resourceRef.evalXPathToString(); 45 48 String type = resourceType.evalXPathToString(); 49 String mimeType = resourceMimeType.evalXPathToString(); 46 50 if (ref != "" && type != "") { 47 result.addResource(ref, type );51 result.addResource(ref, type, mimeType); 48 52 } 49 53 } 50 54 } 51 55 52 private void processFacets(CMDIData result, VTDNav nav) throws XPathParseException, XPathEvalException, NavException {56 private void processFacets(CMDIData result, VTDNav nav) throws VTDException { 53 57 List<FacetConfiguration> facetList = facetMapping.getFacets(); 54 58 for (FacetConfiguration config : facetList) { 55 AutoPilot ap = new AutoPilot(nav); 56 ap.selectXPath(config.getPattern()); 57 int index = ap.evalXPath(); 58 while (index != -1) { 59 if (nav.getTokenType(index) == VTDNav.TOKEN_ATTR_NAME) { 60 //if it is an attribute you need to add 1 to the index to get the right value 61 index++; 59 List<String> patterns = config.getPatterns(); 60 for (String pattern : patterns) { 61 boolean matchedPattern = matchPattern(result, nav, config, pattern); 62 if (matchedPattern) { 63 break; 62 64 } 63 String value = nav.toString(index);64 result.addDocField(config.getName(), value, config.isCaseInsensitive());65 index = ap.evalXPath();66 65 } 67 66 } 68 67 } 68 69 private boolean matchPattern(CMDIData result, VTDNav nav, FacetConfiguration config, String pattern) throws VTDException { 70 boolean matchedPattern = false; 71 AutoPilot ap = new AutoPilot(nav); 72 ap.selectXPath(pattern); 73 int index = ap.evalXPath(); 74 while (index != -1) { 75 matchedPattern = true; 76 if (nav.getTokenType(index) == VTDNav.TOKEN_ATTR_NAME) { 77 //if it is an attribute you need to add 1 to the index to get the right value 78 index++; 79 } 80 String value = nav.toString(index); 81 result.addDocField(config.getName(), value, config.isCaseInsensitive()); 82 index = ap.evalXPath(); 83 } 84 return matchedPattern; 85 } 69 86 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/FacetConfiguration.java
r995 r1007 1 1 package eu.clarin.cmdi.vlo.importer; 2 3 import java.util.ArrayList; 4 import java.util.Collections; 5 import java.util.List; 2 6 3 7 public class FacetConfiguration { 4 8 5 9 private String name; 6 private String pattern;7 10 private boolean caseInsensitive= false; 11 private List<String> patterns = new ArrayList<String>(); 8 12 9 13 public void setCaseInsensitive(boolean caseValue) { … … 15 19 } 16 20 17 public void setPattern (String pattern) {18 this.pattern = pattern;21 public void setPatterns(List<String> patterns) { 22 this.patterns = patterns; 19 23 } 20 24 21 public String getPattern() { 22 return pattern; 25 public void setPattern(String pattern) { 26 this.patterns = Collections.singletonList(pattern); 27 } 28 29 public List<String> getPatterns() { 30 return patterns; 23 31 } 24 32 … … 33 41 @Override 34 42 public String toString() { 35 return "name="+name+", pattern="+pattern ;43 return "name="+name+", pattern="+patterns; 36 44 } 37 45 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/ImporterConfig.java
r996 r1007 4 4 5 5 public class ImporterConfig { 6 7 public static final String CONFIG_FILE = "importerConfig.xml"; 6 8 7 9 private boolean deleteAllFirst = false; -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/importer/MetadataImporter.java
r996 r1007 17 17 import org.springframework.context.support.ClassPathXmlApplicationContext; 18 18 19 import eu.clarin.cmdi.vlo.CommonUtils; 19 20 import eu.clarin.cmdi.vlo.Configuration; 20 import eu.clarin.cmdi.vlo. dao.FacetConstants;21 import eu.clarin.cmdi.vlo.FacetConstants; 21 22 22 23 @SuppressWarnings("serial") 23 public finalclass MetadataImporter {24 public class MetadataImporter { 24 25 25 26 private final static Logger LOG = LoggerFactory.getLogger(MetadataImporter.class); 26 27 private static Throwable serverError; 27 private finalStreamingUpdateSolrServer solrServer;28 private StreamingUpdateSolrServer solrServer; 28 29 29 30 private Set<String> processedIds = new HashSet<String>(); 30 pr ivateList<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();31 protected List<SolrInputDocument> docs = new ArrayList<SolrInputDocument>(); 31 32 private final ImporterConfig config; 32 33 … … 36 37 private int nrOfFilesWithoutId = 0; 37 38 38 public MetadataImporter(ImporterConfig config) throws MalformedURLException{39 public MetadataImporter(ImporterConfig config) { 39 40 this.config = config; 40 String solrUrl = Configuration.getInstance().getSolrUrl();41 LOG.info("Initializing Solr Server on " + solrUrl);42 solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) {43 @Override44 public void handleError(Throwable ex) {45 super.handleError(ex);46 serverError = ex;47 }48 };49 41 } 50 42 51 private void startImport() { 43 void startImport() throws MalformedURLException { 44 initSolrServer(); 52 45 List<DataRoot> dataRoots = config.getDataRoots(); 53 46 for (DataRoot dataRoot : dataRoots) { … … 86 79 } finally { 87 80 try { 88 solrServer.commit(); 81 if (solrServer != null) 82 solrServer.commit(); 89 83 } catch (SolrServerException e) { 90 84 LOG.error("cannot commit:\n", e); … … 97 91 LOG.info("Found " + nrOfFilesWithoutId + " file(s) without an id."); 98 92 LOG.info("Update of " + nrOFDocumentsUpdated + " took " + took + " secs. Total nr of files analyzed " + nrOfFilesAnalyzed); 93 } 94 95 protected void initSolrServer() throws MalformedURLException { 96 String solrUrl = Configuration.getInstance().getSolrUrl(); 97 LOG.info("Initializing Solr Server on " + solrUrl); 98 solrServer = new StreamingUpdateSolrServer(solrUrl, 1000, 2) { 99 @Override 100 public void handleError(Throwable ex) { 101 super.handleError(ex); 102 serverError = ex; 103 } 104 }; 99 105 } 100 106 … … 112 118 updateDocument(solrDocument, cmdiData, file, origin); 113 119 } 114 List< String> resources = cmdiData.getResources();115 for ( StringcmdiResource : resources) {116 File resourceFile = new File(file.getParentFile(), cmdiResource );120 List<Resource> resources = cmdiData.getMetadataResources(); 121 for (Resource cmdiResource : resources) { 122 File resourceFile = new File(file.getParentFile(), cmdiResource.getResourceName()); 117 123 if (resourceFile.exists()) { 118 124 processCmdi(resourceFile, origin, processor); … … 121 127 LOG.error("Found nonexistent resource file (" + cmdiResource + ") in cmdi: " + file); 122 128 } 123 124 129 } 125 130 } … … 133 138 } else { 134 139 solrDocument.addField(FacetConstants.FIELD_ORIGIN, origin); 140 solrDocument.addField(FacetConstants.FIELD_DATA_ROOT, origin); 135 141 solrDocument.addField(FacetConstants.FIELD_ID, cmdiData.getId()); 136 solrDocument.addField(FacetConstants.FIELD_FILENAME, file.toString()); 142 solrDocument.addField(FacetConstants.FIELD_FILENAME, file.getAbsolutePath()); 143 List<Resource> resources = cmdiData.getDataResources(); 144 for (Resource resource : resources) { 145 String mimeType = resource.getMimeType(); 146 if (mimeType == null) { 147 mimeType = "unknown"; 148 } 149 solrDocument.addField(FacetConstants.FIELD_RESOURCE_TYPE, CommonUtils.normalizeMimeType(mimeType)); 150 solrDocument.addField(FacetConstants.FIELD_RESOURCE, mimeType + "," + resource.getResourceName()); 151 } 137 152 docs.add(solrDocument); 138 153 if (docs.size() == 1000) { … … 142 157 } 143 158 144 pr ivatevoid sendDocs() throws SolrServerException, IOException {159 protected void sendDocs() throws SolrServerException, IOException { 145 160 LOG.info("Sending " + docs.size() + " docs to solr server. Total number of docs updated till now: " + nrOFDocumentsUpdated); 146 161 nrOFDocumentsUpdated += docs.size(); … … 157 172 */ 158 173 public static void main(String[] args) throws MalformedURLException { 159 BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "applicationContext.xml", "importerConfig.xml"});174 BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { Configuration.CONFIG_FILE, ImporterConfig.CONFIG_FILE }); 160 175 factory.getBean("configuration"); 161 176 ImporterConfig config = (ImporterConfig) factory.getBean("importerConfig", ImporterConfig.class); -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/AlphabeticalPanel.html
r948 r1007 2 2 <div class="alphaNavigation"> 3 3 <ul> 4 <li> Quick navigation to: </li>4 <li><wicket:message key="quickNavTo" >[quick navigation]</wicket:message>: </li> 5 5 <li wicket:id="alphabeticalView"> 6 6 <a wicket:id="refLink"><span wicket:id="character">[character]</span></a> -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/BasePage.java
r949 r1007 9 9 public BasePage(PageParameters parameters) { 10 10 super(parameters); 11 11 12 12 add(new BookmarkablePageLink("homeLink", FacetedSearchPage.class)); 13 13 } 14 14 15 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/DocumentAttributesDataProvider.java
r750 r1007 10 10 import org.apache.wicket.model.Model; 11 11 12 import eu.clarin.cmdi.vlo.dao.DaoLocator;13 14 12 public class DocumentAttributesDataProvider extends SortableDataProvider<DocumentAttribute> { 15 13 … … 18 16 private transient DocumentAttributeList attributeList; 19 17 20 public DocumentAttributesDataProvider(String docId) { 21 SolrDocument solrDocument = DaoLocator.getSearchResultsDao().getSolrDocument(docId); 18 public DocumentAttributesDataProvider(SolrDocument solrDocument) { 22 19 if (solrDocument != null) { 23 20 attributeList = new DocumentAttributeList(solrDocument.getFieldValuesMap()); -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/DocumentLinkPanel.java
r967 r1007 7 7 import org.apache.wicket.model.IModel; 8 8 9 import eu.clarin.cmdi.vlo. dao.FacetConstants;9 import eu.clarin.cmdi.vlo.FacetConstants; 10 10 11 11 public class DocumentLinkPanel extends Panel { -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetBoxPanel.html
r920 r1007 10 10 <td width="50%" class="column"> 11 11 <span wicket:id="facetList"> <span wicket:id="facetLinks"></span></span> 12 <a href="#" wicket:id="showMore"> more...</a>12 <a href="#" wicket:id="showMore"><wicket:message key="more">[more]</wicket:message>...</a> 13 13 </td> 14 14 </tr> -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetBoxPanel.java
r770 r1007 5 5 import org.apache.solr.client.solrj.response.FacetField; 6 6 import org.apache.solr.client.solrj.response.FacetField.Count; 7 import org.apache.solr.common.SolrDocument;8 7 import org.apache.wicket.PageParameters; 9 import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;10 8 import org.apache.wicket.markup.html.WebMarkupContainer; 11 9 import org.apache.wicket.markup.html.basic.Label; … … 18 16 19 17 public class FacetBoxPanel extends Panel { 20 18 21 19 private static final int MAX_NR_OF_FACET_VALUES = 5; 22 20 private static final long serialVersionUID = 1L; … … 31 29 32 30 @SuppressWarnings("serial") 33 public FacetBoxPanel create(final SearchPageQuery query , final AjaxFallbackDefaultDataTable<SolrDocument> searchResultList) {31 public FacetBoxPanel create(final SearchPageQuery query) { 34 32 final FacetField facetField = (FacetField) getDefaultModelObject(); 35 33 facetModel = new FacetModel(facetField); … … 63 61 PageParameters pageParameters = query.getPageParameters(); 64 62 pageParameters.add(ShowAllFacetValuesPage.SELECTED_FACET_PARAM, facetField.getName()); 65 add(new BookmarkablePageLink("showMore", ShowAllFacetValuesPage.class, pageParameters) { //TODO PD when nr of facet values is 6 show all instead of 5+more63 add(new BookmarkablePageLink("showMore", ShowAllFacetValuesPage.class, pageParameters) { 66 64 67 65 public boolean isVisible() { -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetedSearchPage.html
r969 r1007 12 12 <div id="searchmodule"> 13 13 <input type="text" wicket:id="searchQuery" /> 14 <button wicket:id="searchSubmit"> search</button>14 <button wicket:id="searchSubmit"><wicket:message key="search">[search]</wicket:message></button> 15 15 </div> 16 16 </form> -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/FacetedSearchPage.java
r967 r1007 20 20 import org.apache.wicket.model.CompoundPropertyModel; 21 21 import org.apache.wicket.model.IModel; 22 import org.apache.wicket.model.Model; 22 import org.apache.wicket.model.ResourceModel; 23 24 import eu.clarin.cmdi.vlo.Resources; 23 25 24 26 public class FacetedSearchPage extends BasePage { … … 26 28 private static final long serialVersionUID = 1L; 27 29 28 private AjaxFallbackDefaultDataTable<SolrDocument> searchResultList;29 30 private SearchPageQuery query; 30 31 … … 73 74 @Override 74 75 protected void populateItem(Item<FacetField> item) { 75 item.add(new FacetBoxPanel("facetBox", item.getModel()).create(query , searchResultList));76 item.add(new FacetBoxPanel("facetBox", item.getModel()).create(query)); 76 77 } 77 78 … … 88 89 private void addSearchResults() { 89 90 List<IColumn<SolrDocument>> columns = new ArrayList<IColumn<SolrDocument>>(); 90 columns.add(new AbstractColumn<SolrDocument>(new Model<String>("Results")) {91 columns.add(new AbstractColumn<SolrDocument>(new ResourceModel(Resources.RESULTS)) { 91 92 92 93 @Override … … 95 96 } 96 97 }); 97 searchResultList = new AjaxFallbackDefaultDataTable("searchResults", columns, new SolrDocumentDataProvider(query.getSolrQuery()98 .getCopy()), 10);99 98 AjaxFallbackDefaultDataTable<SolrDocument> searchResultList = new AjaxFallbackDefaultDataTable("searchResults", columns, 99 new SolrDocumentDataProvider(query.getSolrQuery().getCopy()), 10); 100 100 101 add(searchResultList); 101 102 } -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/SearchPageQuery.java
r967 r1007 13 13 14 14 import eu.clarin.cmdi.vlo.Configuration; 15 import eu.clarin.cmdi.vlo. dao.FacetConstants;15 import eu.clarin.cmdi.vlo.FacetConstants; 16 16 17 17 public class SearchPageQuery implements Serializable { -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowAllFacetValuesPage.html
r940 r1007 11 11 </tr> 12 12 </table> 13 <div class="message"> Subcategories in<span class="facet" wicket:id="category"></span>:</div>13 <div class="message"><wicket:message key="subcategoriesIn">[Subcategories]</wicket:message> <span class="facet" wicket:id="category"></span>:</div> 14 14 <div wicket:id="alphaPanel"></div> 15 15 </div> -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.html
r967 r1007 1 1 <!doctype html public "-//W3C//DTD HTML 3.2 Final//EN"> 2 2 <html> 3 <head></head> 4 <body> 5 <wicket:extend> 6 <div class="endgame"> 7 <br> 8 <div><a wicket:id="backLink" href="#">back to results</a> | <a wicket:id="openBrowserLink" href="#">open in original context</a> 9 <p /> 10 </div> 11 <br><br> 12 <div class="prevNextLabels"> 13 <a wicket:id="prev">prev</a> 14 <a wicket:id="next">next</a> 15 </div> 16 <div class="resultAttributes"><table wicket:id="attributesTable"/></div> 17 </div> 18 </wicket:extend> 3 <head></head> 4 <body> 5 <wicket:extend> 6 <div class="endgame"><br> 7 <div><a wicket:id="backLink" href="#"><wicket:message key="backToResult">[back]</wicket:message></a> | <a wicket:id="openBrowserLink" 8 href="#"><wicket:message key="openInOriginalContext" >[open]</wicket:message></a> 9 <p /> 10 </div> 11 <br> 12 <br> 13 <div class="prevNextLabels"><a wicket:id="prev"><wicket:message key="prev" /></a> <a wicket:id="next"><wicket:message key="next" /></a> 14 </div> 15 <div class="resultAttributes"> 16 <table wicket:id="attributesTable" /> 17 </div> 18 <div class="resourceList"><span><wicket:message key="resources">[Resources]</wicket:message>:</span> 19 <table> 20 <tr class="resourceItem" wicket:id="resourceList"></tr> 21 </table> 22 </div> 23 </div> 24 </wicket:extend> 19 25 </body> 20 26 </html> -
vlo/trunk/vlo_webapp/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java
r968 r1007 1 1 package eu.clarin.cmdi.vlo.pages; 2 3 import java.util.Collection; 2 4 3 5 import org.apache.solr.common.SolrDocument; … … 12 14 import org.apache.wicket.markup.ComponentTag; 13 15 import org.apache.wicket.markup.MarkupStream; 16 import org.apache.wicket.markup.html.WebMarkupContainer; 14 17 import org.apache.wicket.markup.html.basic.Label; 15 18 import org.apache.wicket.markup.html.basic.MultiLineLabel; … … 17 20 import org.apache.wicket.markup.html.link.ExternalLink; 18 21 import org.apache.wicket.markup.repeater.Item; 22 import org.apache.wicket.markup.repeater.RepeatingView; 19 23 import org.apache.wicket.model.IModel; 20 import org.apache.wicket.model. Model;24 import org.apache.wicket.model.ResourceModel; 21 25 import org.apache.wicket.protocol.http.WicketURLEncoder; 22 26 23 27 import eu.clarin.cmdi.vlo.Configuration; 28 import eu.clarin.cmdi.vlo.FacetConstants; 29 import eu.clarin.cmdi.vlo.Resources; 24 30 import eu.clarin.cmdi.vlo.StringUtils; 25 31 import eu.clarin.cmdi.vlo.dao.DaoLocator; 26 import eu.clarin.cmdi.vlo.dao.FacetConstants;27 32 28 33 public class ShowResultPage extends BasePage { … … 39 44 add(new ExternalLink("openBrowserLink", Configuration.getInstance().getIMDIBrowserUrl(handle))); 40 45 addPrevNextLabels(docId, query); 41 addAttributesTable(docId); 46 SolrDocument solrDocument = DaoLocator.getSearchResultsDao().getSolrDocument(docId); 47 addAttributesTable(solrDocument); 48 addResourceLinks(solrDocument); 42 49 } 43 50 44 private void addAttributesTable(final S tring docId) {45 DocumentAttributesDataProvider attributeProvider = new DocumentAttributesDataProvider( docId);51 private void addAttributesTable(final SolrDocument solrDocument) { 52 DocumentAttributesDataProvider attributeProvider = new DocumentAttributesDataProvider(solrDocument); 46 53 DataTable table = new DataTable("attributesTable", createAttributesColumns(), attributeProvider, 250); 47 54 table.setTableBodyCss("attributesTbody"); … … 54 61 IColumn[] columns = new IColumn[2]; 55 62 56 columns[0] = new PropertyColumn(new Model<String>("Field"), "field") {63 columns[0] = new PropertyColumn(new ResourceModel(Resources.FIELD), "field") { 57 64 58 65 @Override … … 61 68 } 62 69 }; 63 columns[1] = new AbstractColumn<DocumentAttribute>(new Model<String>("Value")) {70 columns[1] = new AbstractColumn<DocumentAttribute>(new ResourceModel(Resources.VALUE)) { 64 71 65 72 @Override … … 95 102 add(prev); 96 103 } else { 97 add(new Label("prev","prev"));104 add(new WebMarkupContainer("prev")); 98 105 } 99 106 if (index < (docIdList.size() - 1) && index >= 0) { … … 102 109 add(next); 103 110 } else { 104 add(new Label("next", "next")); 111 add(new WebMarkupContainer("next")); 112 } 113 } 114 115 private void addResourceLinks(SolrDocument solrDocument) { 116 RepeatingView repeatingView = new RepeatingView("resourceList"); 117 add(repeatingView); 118 if (solrDocument.containsKey(FacetConstants.FIELD_RESOURCE)) { 119 Collection<Object> resources = solrDocument.getFieldValues(FacetConstants.FIELD_RESOURCE); 120 for (Object resource : resources) { 121 String[] split = resource.toString().split(",", 2); 122 String mimeType = split[0]; 123 String resourceLink = split[1]; 124 repeatingView.add(new ResourceLinkPanel(repeatingView.newChildId(), mimeType, resourceLink)); 125 } 126 } else { 127 repeatingView.add(new Label(repeatingView.newChildId(), new ResourceModel(Resources.NO_RESOURCE_FOUND))); 105 128 } 106 129 } -
vlo/trunk/vlo_webapp/src/main/resources/applicationContext.xml
r957 r1007 8 8 <!-- <property name="solrUrl" value="http://catalog.clarin.eu:8080/vlo_solr" />--> 9 9 <property name="IMDIBrowserUrl" value="http://corpus1.mpi.nl/ds/imdi_browser?openpath=" /> 10 <property name="handleServerUrl" value="http://hdl.handle.net/" /> 10 11 <property name="facetFields"> 11 12 <!-- The possible values of facets are defined in the schema.xml of the solr_server installation. … … 20 21 <value>subject</value> 21 22 <value>language</value> 23 <value>resourceType</value> 22 24 <!-- <value>year</value>--> 23 25 </list> -
vlo/trunk/vlo_webapp/src/main/resources/importerConfig.xml
r996 r1007 11 11 <property name="originName" value="OLAC Metadata Providers" /> 12 12 <property name="rootFile" 13 value="/Users/patdui/data/snapshots2/olac-cmdi-20101 105/_corpusstructure/collection_root.cmdi" />13 value="/Users/patdui/data/snapshots2/olac-cmdi-20101214/_corpusstructure/collection_root.cmdi" /> 14 14 <property name="facetMapping" ref="olacMapping"></property> 15 15 </bean> … … 121 121 </bean> 122 122 <bean class="eu.clarin.cmdi.vlo.importer.DataRoot"> 123 <property name="originName" value="CLARIN LRT " />123 <property name="originName" value="CLARIN LRT inventory" /> 124 124 <property name="rootFile" 125 125 value="/Users/patdui/data/snapshots2/lrt-20101117/_corpusstructure/collection_lrt_inventory.cmdi" /> … … 130 130 </bean> 131 131 132 <!-- 133 Mapping of facets to XPATH expressions. The facets should correspond to the facets described in the 134 solr/conf/schema.xml file of the SOLR Server installation 135 --> 136 137 <bean id="imdiMapping" class="eu.clarin.cmdi.vlo.importer.FacetMapping"> <!-- add year? --> 132 <!-- Mapping of facets to XPATH expressions. The facets should correspond to the facets described in the--> 133 <!-- solr/conf/schema.xml file of the SOLR Server installation--> 134 135 <bean id="imdiMapping" class="eu.clarin.cmdi.vlo.importer.FacetMapping"> <!-- add year? --> 138 136 <property name="idMapping" value="/CMD/Header/MdSelfLink/text()" /> 139 137 <property name="facets"> … … 196 194 <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration"> 197 195 <property name="name" value="country" /> 198 <property name="pattern" value="/CMD/Components/OLAC-DcmiTerms/spatial/text()" /> 199 <!-- 200 /CMD/Components/OLAC-DcmiTerms/spatial[@dcterms-type="ISO3166"] -> country 201 /CMD/Components/OLAC-DcmiTerms/coverage[@dcterms-type="ISO3166"] -> country 202 --> 196 <property name="patterns"> 197 <list> 198 <value>/CMD/Components/OLAC-DcmiTerms/spatial[@dcterms-type="ISO3166"]/text()</value> 199 <value>/CMD/Components/OLAC-DcmiTerms/coverage[@dcterms-type="ISO3166"]/text()</value> 200 </list> 201 </property> 203 202 </bean> 204 203 <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration"> 205 204 <property name="name" value="language" /> 206 <property name="pattern" value="/CMD/Components/OLAC-DcmiTerms/language/@olac-language" /> 205 <property name="patterns"> 206 <list> 207 <value>/CMD/Components/OLAC-DcmiTerms/language/@olac-language</value> 208 <value>/CMD/Components/OLAC-DcmiTerms/subject/@olac-language</value> 209 </list> 210 </property> 207 211 </bean> 208 212 <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration"> … … 219 223 <property name="pattern" value="/CMD/Components/OLAC-DcmiTerms/description/text()" /> 220 224 </bean> 221 <!-- 222 <entry key="continent"> <value>CMD/Components/olac</value> </entry>--> 223 <!-- <entry key="subject">--> 224 <!-- <value>CMD/Components/OLAC-DcmiTerms/subject</value> --> 225 <!-- [@dcterms-type="LCSH"] --> 226 <!-- </entry>--> 225 <bean class="eu.clarin.cmdi.vlo.importer.FacetConfiguration"> 226 <property name="name" value="subject" /> 227 <property name="patterns"> 228 <list> 229 <value>/CMD/Components/OLAC-DcmiTerms/subject/@olac-linguistic-field</value> 230 <value>/CMD/Components/OLAC-DcmiTerms/subject[@dcterms-type="LCSH"]/text()</value> 231 </list> 232 </property> 233 <property name="caseInsensitive" value="true" /> 234 </bean> 227 235 </list> 228 236 </property> -
vlo/trunk/vlo_webapp/src/test/java/eu/clarin/cmdi/vlo/importer/CMDIDataProcessorTest.java
r996 r1007 6 6 7 7 import java.io.File; 8 import java.io.IOException;9 8 import java.util.ArrayList; 10 9 import java.util.Collection; … … 12 11 import java.util.List; 13 12 14 import org.apache.commons.io.FileUtils;15 13 import org.apache.solr.common.SolrInputDocument; 16 import org.junit.AfterClass;17 import org.junit.BeforeClass;18 14 import org.junit.Test; 19 import org.springframework.beans.factory.BeanFactory; 20 import org.springframework.context.support.ClassPathXmlApplicationContext; 21 22 public class CMDIDataProcessorTest { 23 24 private static File testDir; 15 16 public class CMDIDataProcessorTest extends ImporterTestcase { 25 17 26 18 private CMDIDataProcessor getDataParser(FacetMapping map) { … … 77 69 CMDIData data = processor.process(cmdiFile); 78 70 assertEquals("test-hdl:1839/00-0000-0000-0000-0001-D", data.getId()); 79 List< String> resources = data.getResources();71 List<Resource> resources = data.getMetadataResources(); 80 72 assertEquals(3, resources.size()); 73 Resource res = resources.get(0); 74 assertEquals("../acqui_data/Corpusstructure/acqui.imdi.cmdi", res.getResourceName()); 75 assertEquals(null, res.getMimeType()); 76 assertEquals(0, data.getDataResources().size()); 81 77 SolrInputDocument doc = data.getSolrDocument(); 82 78 assertNull(doc); … … 97 93 content += " <ResourceProxyList>\n"; 98 94 content += " <ResourceProxy id=\"d314e408\">\n"; 99 content += " <ResourceType >Resource</ResourceType>\n";95 content += " <ResourceType mimetype=\"video/x-mpeg1\" >Resource</ResourceType>\n"; 100 96 content += " <ResourceRef>../Media/elan-example1.mpg</ResourceRef>\n"; 101 97 content += " </ResourceProxy>\n"; 102 98 content += " <ResourceProxy id=\"d314e471\">\n"; 103 content += " <ResourceType >Resource</ResourceType>\n";104 content += " <ResourceRef>../Media/elan-example1.mp 4</ResourceRef>\n";99 content += " <ResourceType mimetype=\"audio/mpeg\" >Resource</ResourceType>\n"; 100 content += " <ResourceRef>../Media/elan-example1.mp3</ResourceRef>\n"; 105 101 content += " </ResourceProxy>\n"; 106 102 content += " </ResourceProxyList>\n"; … … 373 369 CMDIData data = processor.process(cmdiFile); 374 370 assertEquals("test-hdl:1839/00-0000-0000-0009-294C-9", data.getId()); 375 List< String> resources = data.getResources();371 List<Resource> resources = data.getMetadataResources(); 376 372 assertEquals(0, resources.size()); 373 List<Resource> dataResources = data.getDataResources(); 374 assertEquals(2, dataResources.size()); 375 Resource res = dataResources.get(0); 376 assertEquals("../Media/elan-example1.mpg", res.getResourceName()); 377 assertEquals("video/x-mpeg1", res.getMimeType()); 378 res = dataResources.get(1); 379 assertEquals("../Media/elan-example1.mp3", res.getResourceName()); 380 assertEquals("audio/mpeg", res.getMimeType()); 377 381 SolrInputDocument doc = data.getSolrDocument(); 378 382 assertNotNull(doc); … … 463 467 CMDIData data = processor.process(cmdiFile); 464 468 assertEquals("test-hdl:1839/00-0000-0000-0009-294C-9", data.getId()); 465 List< String> resources = data.getResources();469 List<Resource> resources = data.getMetadataResources(); 466 470 assertEquals(0, resources.size()); 467 471 SolrInputDocument doc = data.getSolrDocument(); … … 518 522 content += " <language olac-language=\"x-sil-CHN\"/>\n"; 519 523 content += " <language>Chinese</language>\n"; 520 content += " <subject >Kuna</subject>\n";524 content += " <subject olac-linguistic-field=\"testSubject\">Kuna</subject>\n"; 521 525 content += " <type olac-linguistic-type=\"Transcription\"/>\n"; 522 526 content += " </OLAC-DcmiTerms>\n"; … … 528 532 CMDIData data = processor.process(cmdiFile); 529 533 assertEquals("oai:ailla.utexas.edu:1", data.getId()); 530 List< String> resources = data.getResources();534 List<Resource> resources = data.getMetadataResources(); 531 535 assertEquals(0, resources.size()); 536 List<Resource> dataResources = data.getDataResources(); 537 assertEquals(0, dataResources.size()); 532 538 SolrInputDocument doc = data.getSolrDocument(); 533 539 assertNotNull(doc); 534 assertEquals( 3, doc.getFieldNames().size());540 assertEquals(4, doc.getFieldNames().size()); 535 541 assertEquals(null, doc.getFieldValue("name")); 536 542 assertEquals(null, doc.getFieldValue("continent")); … … 540 546 assertEquals(null, doc.getFieldValue("organisation")); 541 547 assertEquals("transcription", doc.getFieldValue("genre")); 542 // assertEquals("Kuna", doc.getFieldValue("subject"));548 assertEquals("testsubject", doc.getFieldValue("subject")); 543 549 Collection<Object> fieldValues = doc.getFieldValues("description"); 544 550 assertEquals(3, fieldValues.size()); … … 555 561 + "Kuna in origin. All are woven together and a moral is provided. Pedro Arias performed " 556 562 + "this story before a gathered audience in the morning..\n ", descriptions.get(2).toString()); 563 } 564 565 @Test 566 public void testOlacMultiFacets() throws Exception { 567 String content = ""; 568 content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 569 content += "<CMD>\n"; 570 content += " <Components>\n"; 571 content += " <OLAC-DcmiTerms>\n"; 572 content += " <subject olac-linguistic-field=\"testSubject\">Kuna</subject>\n"; 573 content += " <subject dcterms-type=\"LCSH\">testSubjectFallback</subject>\n"; 574 content += " <spatial dcterms-type=\"ISO3166\">testCountry1</spatial>\n"; 575 content += " <coverage dcterms-type=\"ISO3166\">testCountry2</coverage>\n"; 576 content += " <language olac-language=\"language1\">test1</language>\n"; 577 content += " <subject olac-language=\"language2\">test2</subject>\n"; 578 content += " </OLAC-DcmiTerms>\n"; 579 content += " </Components>\n"; 580 content += "</CMD>\n"; 581 582 File cmdiFile = createCmdiFile("testOlac", content); 583 CMDIDataProcessor processor = getDataParser(getOlacFacetMap()); 584 CMDIData data = processor.process(cmdiFile); 585 SolrInputDocument doc = data.getSolrDocument(); 586 assertEquals(1, doc.getFieldValues("subject").size()); 587 assertEquals("testsubject", doc.getFieldValue("subject")); 588 assertEquals(1, doc.getFieldValues("country").size()); 589 assertEquals("testCountry1", doc.getFieldValue("country")); 590 assertEquals(1, doc.getFieldValues("language").size()); 591 assertEquals("language1", doc.getFieldValue("language")); 592 593 content = ""; 594 content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 595 content += "<CMD>\n"; 596 content += " <Components>\n"; 597 content += " <OLAC-DcmiTerms>\n"; 598 content += " <subject dcterms-type=\"LCSH\">testSubjectFallback</subject>\n"; 599 content += " <coverage dcterms-type=\"ISO3166\">testCountry2</coverage>\n"; 600 content += " <subject olac-language=\"language2\">test2</subject>\n"; 601 content += " </OLAC-DcmiTerms>\n"; 602 content += " </Components>\n"; 603 content += "</CMD>\n"; 604 605 cmdiFile = createCmdiFile("testOlac", content); 606 processor = getDataParser(getOlacFacetMap()); 607 data = processor.process(cmdiFile); 608 doc = data.getSolrDocument(); 609 assertEquals(1, doc.getFieldValues("subject").size()); 610 assertEquals("testsubjectfallback", doc.getFieldValue("subject")); 611 assertEquals(1, doc.getFieldValues("country").size()); 612 assertEquals("testCountry2", doc.getFieldValue("country")); 613 assertEquals(1, doc.getFieldValues("language").size()); 614 assertEquals("language2", doc.getFieldValue("language")); 615 616 content = ""; 617 content += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 618 content += "<CMD>\n"; 619 content += " <Components>\n"; 620 content += " <OLAC-DcmiTerms>\n"; 621 content += " <subject dcterms-type=\"LCSH\">testSubjectFallback</subject>\n"; 622 content += " <subject olac-linguistic-field=\"testSubject\">Kuna</subject>\n"; 623 content += " <coverage dcterms-type=\"ISO3166\">testCountry2</coverage>\n"; 624 content += " <spatial dcterms-type=\"ISO3166\">testCountry1</spatial>\n"; 625 content += " <subject olac-language=\"language2\">test2</subject>\n"; 626 content += " <language olac-language=\"language1\">test1</language>\n"; 627 content += " </OLAC-DcmiTerms>\n"; 628 content += " </Components>\n"; 629 content += "</CMD>\n"; 630 631 cmdiFile = createCmdiFile("testOlac", content); 632 processor = getDataParser(getOlacFacetMap()); 633 data = processor.process(cmdiFile); 634 doc = data.getSolrDocument(); 635 assertEquals(1, doc.getFieldValues("subject").size()); 636 assertEquals("testsubject", doc.getFieldValue("subject")); 637 assertEquals(1, doc.getFieldValues("country").size()); 638 assertEquals("testCountry1", doc.getFieldValue("country")); 639 assertEquals(1, doc.getFieldValues("language").size()); 640 assertEquals("language1", doc.getFieldValue("language")); 557 641 } 558 642 … … 593 677 CMDIData data = processor.process(cmdiFile); 594 678 assertEquals("collection_ATILF_Resources.cmdi", data.getId()); 595 List< String> resources = data.getResources();679 List<Resource> resources = data.getMetadataResources(); 596 680 assertEquals(9, resources.size()); 681 Resource res = resources.get(0); 682 assertEquals("ATILF_Resources/0/oai_atilf_inalf_fr_0001.xml.cmdi", res.getResourceName()); 683 assertEquals(null, res.getMimeType()); 684 assertEquals(0, data.getDataResources().size()); 597 685 SolrInputDocument doc = data.getSolrDocument(); 598 686 assertNull(doc); 599 687 List<Resource> dataResources = data.getDataResources(); 688 assertEquals(0, dataResources.size()); 600 689 } 601 690 … … 641 730 CMDIData data = processor.process(cmdiFile); 642 731 assertEquals("clarin.eu:lrt:433", data.getId()); 643 List< String> resources = data.getResources();732 List<Resource> resources = data.getMetadataResources(); 644 733 assertEquals(0, resources.size()); 734 List<Resource> dataResources = data.getDataResources(); 735 assertEquals(0, dataResources.size()); 645 736 SolrInputDocument doc = data.getSolrDocument(); 646 737 assertNotNull(doc); … … 657 748 } 658 749 659 private FacetMapping getOlacFacetMap() {660 BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "importerConfig.xml" });661 FacetMapping facetMapping = (FacetMapping) factory.getBean("olacMapping");662 return facetMapping;663 }664 665 private FacetMapping getIMDIFacetMap() {666 BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "importerConfig.xml" });667 FacetMapping facetMapping = (FacetMapping) factory.getBean("imdiMapping");668 return facetMapping;669 }670 671 private FacetMapping getLrtFacetMap() {672 BeanFactory factory = new ClassPathXmlApplicationContext(new String[] { "importerConfig.xml" });673 FacetMapping facetMapping = (FacetMapping) factory.getBean("lrtMapping");674 return facetMapping;675 }676 677 private File createCmdiFile(String name, String content) throws IOException {678 File file = File.createTempFile(name, "cmdi", testDir);679 FileUtils.writeStringToFile(file, content, "UTF-8");680 return file;681 }682 683 @AfterClass684 public static void cleanup() {685 FileUtils.deleteQuietly(testDir);686 }687 688 @BeforeClass689 public static void setup() {690 final String baseTempPath = System.getProperty("java.io.tmpdir");691 testDir = new File(baseTempPath + File.separator + "testRegistry_" + System.currentTimeMillis());692 testDir.mkdir();693 testDir.deleteOnExit();694 }695 696 750 }
Note: See TracChangeset
for help on using the changeset viewer.