Revision 7815
Added by ben leinfelder almost 11 years ago
SolrIndex.java | ||
---|---|---|
58 | 58 |
import org.apache.solr.common.SolrDocument; |
59 | 59 |
import org.apache.solr.common.SolrDocumentList; |
60 | 60 |
import org.apache.solr.common.SolrInputDocument; |
61 |
import org.apache.solr.common.util.NamedList; |
|
62 |
|
|
63 | 61 |
import org.dataone.cn.indexer.XMLNamespaceConfig; |
64 | 62 |
import org.dataone.cn.indexer.parser.IDocumentSubprocessor; |
65 | 63 |
import org.dataone.cn.indexer.parser.SolrField; |
66 | 64 |
import org.dataone.cn.indexer.resourcemap.ResourceEntry; |
67 | 65 |
import org.dataone.cn.indexer.resourcemap.ResourceMap; |
68 | 66 |
import org.dataone.cn.indexer.solrhttp.SolrDoc; |
69 |
import org.dataone.cn.indexer.solrhttp.SolrElementAdd; |
|
70 | 67 |
import org.dataone.cn.indexer.solrhttp.SolrElementField; |
71 | 68 |
import org.dataone.service.exceptions.NotFound; |
72 | 69 |
import org.dataone.service.exceptions.NotImplemented; |
73 | 70 |
import org.dataone.service.exceptions.ServiceFailure; |
74 | 71 |
import org.dataone.service.exceptions.UnsupportedType; |
72 |
import org.dataone.service.types.v1.Event; |
|
75 | 73 |
import org.dataone.service.types.v1.Identifier; |
76 | 74 |
import org.dataone.service.types.v1.SystemMetadata; |
77 | 75 |
import org.dataone.service.util.TypeMarshaller; |
78 | 76 |
import org.jibx.runtime.JiBXException; |
79 | 77 |
import org.w3c.dom.Document; |
80 |
import org.w3c.dom.NameList; |
|
81 | 78 |
import org.xml.sax.SAXException; |
82 | 79 |
|
83 | 80 |
import edu.ucsb.nceas.metacat.index.event.EventlogFactory; |
... | ... | |
397 | 394 |
event.setDate(Calendar.getInstance().getTime()); |
398 | 395 |
Identifier pid = new Identifier(); |
399 | 396 |
pid.setValue(doc.getIdentifier()); |
400 |
event.setPid(pid);
|
|
397 |
event.setIdentifier(pid);
|
|
401 | 398 |
try { |
402 | 399 |
UpdateResponse response = solrServer.add(solrDoc); |
403 | 400 |
solrServer.commit(); |
... | ... | |
409 | 406 |
log.error("SolrIndex.insertToIndex - IndexEventLog can't log the index inserting event :"+e.getMessage()); |
410 | 407 |
}*/ |
411 | 408 |
} catch (SolrServerException e) { |
412 |
event.setType(IndexEvent.FAILUREINSERT);
|
|
409 |
event.setAction(Event.CREATE);
|
|
413 | 410 |
event.setDescription("Failed to insert the solr index for the id "+pid.getValue()+" since "+e.getMessage()); |
414 | 411 |
try { |
415 | 412 |
EventlogFactory.createIndexEventLog().write(event); |
... | ... | |
418 | 415 |
} |
419 | 416 |
throw e; |
420 | 417 |
} catch (IOException e) { |
421 |
event.setType(IndexEvent.FAILUREINSERT);
|
|
418 |
event.setAction(Event.CREATE);
|
|
422 | 419 |
event.setDescription("Failed to insert the solr index for the id "+pid.getValue()+" since "+e.getMessage()); |
423 | 420 |
try { |
424 | 421 |
EventlogFactory.createIndexEventLog().write(event); |
... | ... | |
628 | 625 |
event.setDate(Calendar.getInstance().getTime()); |
629 | 626 |
Identifier identifier = new Identifier(); |
630 | 627 |
identifier.setValue(pid); |
631 |
event.setPid(identifier);
|
|
628 |
event.setIdentifier(identifier);
|
|
632 | 629 |
try { |
633 | 630 |
solrServer.deleteById(pid); |
634 | 631 |
solrServer.commit(); |
... | ... | |
640 | 637 |
log.error("SolrIndex.removeFromIndex - IndexEventLog can't log the index deleting event :"+e.getMessage()); |
641 | 638 |
}*/ |
642 | 639 |
} catch (SolrServerException e) { |
643 |
event.setType(IndexEvent.FAILUREDELETE);
|
|
640 |
event.setAction(Event.DELETE);
|
|
644 | 641 |
event.setDescription("Failurely remove the solr index for the id "+identifier.getValue()+" since "+e.getMessage()); |
645 | 642 |
try { |
646 | 643 |
EventlogFactory.createIndexEventLog().write(event); |
... | ... | |
650 | 647 |
throw e; |
651 | 648 |
|
652 | 649 |
} catch (IOException e) { |
653 |
event.setType(IndexEvent.FAILUREDELETE);
|
|
650 |
event.setAction(Event.DELETE);
|
|
654 | 651 |
event.setDescription("Failurely remove the solr index for the id "+identifier.getValue()+" since "+e.getMessage()); |
655 | 652 |
try { |
656 | 653 |
EventlogFactory.createIndexEventLog().write(event); |
Also available in: Unified diff
refactor IndexEventLog a bit to simplify type/action information. prep for serializing IndexEvent objects to Metacat. https://projects.ecoinformatics.org/ecoinfo/issues/5944