Project

General

Profile

« Previous | Next » 

Revision 9028

use refactored classes from cn-index-processor. still in flux, but improving to better handle non-xml files

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/resourcemap/ResourceMapSubprocessor.java
37 37
import org.apache.solr.common.params.SolrParams;
38 38
import org.apache.solr.schema.IndexSchema;
39 39
import org.apache.solr.servlet.SolrRequestParsers;
40
import org.dataone.cn.indexer.XPathDocumentParser;
40
import org.dataone.cn.indexer.XmlDocumentUtility;
41 41
import org.dataone.cn.indexer.convert.SolrDateConverter;
42
import org.dataone.cn.indexer.parser.AbstractDocumentSubprocessor;
42
import org.dataone.cn.indexer.parser.BaseXPathDocumentSubprocessor;
43 43
import org.dataone.cn.indexer.parser.IDocumentSubprocessor;
44 44
import org.dataone.cn.indexer.resourcemap.ResourceMap;
45 45
import org.dataone.cn.indexer.resourcemap.ResourceMapFactory;
......
63 63
 * The solr doc of the ResourceMap self only has the system metadata information.
64 64
 * The solr docs of the science metadata doc and data file have the resource map package information.
65 65
 */
66
public class ResourceMapSubprocessor extends AbstractDocumentSubprocessor implements IDocumentSubprocessor {
66
public class ResourceMapSubprocessor extends BaseXPathDocumentSubprocessor implements IDocumentSubprocessor {
67 67

  
68 68
    private static final String QUERY ="q=id:";
69 69
    private static final String QUERY2="q="+SolrElementField.FIELD_RESOURCEMAP+":";
......
82 82
    InputStream is) throws IOException, EncoderException, SAXException,
83 83
    XPathExpressionException, ParserConfigurationException, SolrServerException, NotImplemented, NotFound, UnsupportedType, OREParserException, ResourceMapException {
84 84
        SolrDoc resourceMapDoc = docs.get(identifier);
85
        Document doc = XPathDocumentParser.generateXmlDocument(is);
85
        Document doc = XmlDocumentUtility.generateXmlDocument(is);
86 86
		List<SolrDoc> processedDocs = processResourceMap(resourceMapDoc, doc );
87 87
        Map<String, SolrDoc> processedDocsMap = new HashMap<String, SolrDoc>();
88 88
        for (SolrDoc processedDoc : processedDocs) {
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SolrIndex.java
58 58
import org.apache.solr.schema.IndexSchema;
59 59
import org.dataone.cn.indexer.XMLNamespaceConfig;
60 60
import org.dataone.cn.indexer.convert.SolrDateConverter;
61
import org.dataone.cn.indexer.parser.AbstractDocumentSubprocessor;
61
import org.dataone.cn.indexer.parser.BaseXPathDocumentSubprocessor;
62 62
import org.dataone.cn.indexer.parser.IDocumentSubprocessor;
63 63
import org.dataone.cn.indexer.parser.SolrField;
64 64
import org.dataone.cn.indexer.solrhttp.SolrDoc;
......
154 154
     */
155 155
    public void setSubprocessors(List<IDocumentSubprocessor> subprocessorList) {
156 156
        for (IDocumentSubprocessor subprocessor : subprocessorList) {
157
        	if (subprocessor instanceof AbstractDocumentSubprocessor) {
158
        		((AbstractDocumentSubprocessor)subprocessor).initExpression(xpath);
157
        	if (subprocessor instanceof BaseXPathDocumentSubprocessor) {
158
        		((BaseXPathDocumentSubprocessor)subprocessor).initExpression(xpath);
159 159
        	}
160 160
        }
161 161
        this.subprocessors = subprocessorList;

Also available in: Unified diff