Revision 7556
Added by ben leinfelder over 11 years ago
metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/SystemMetadataEventListener.java | ||
---|---|---|
107 | 107 |
} |
108 | 108 |
|
109 | 109 |
public void entryAdded(EntryEvent<Identifier, SystemMetadata> entryEvent) { |
110 |
// add to the index |
|
111 |
Identifier pid = entryEvent.getKey(); |
|
112 |
SystemMetadata systemMetadata = entryEvent.getValue(); |
|
113 |
|
|
114 |
String objectPath = objectPathMap.get(pid); |
|
115 |
InputStream data = null; |
|
116 |
try { |
|
117 |
data = new FileInputStream(objectPath); |
|
118 |
// TODO: pass the SM object |
|
119 |
solrIndex.insert(pid.getValue(), null, data); |
|
120 |
} catch (Exception e) { |
|
121 |
log.error(e.getMessage(), e); |
|
122 |
} |
|
110 |
// use the same implementation for insert/update for now |
|
111 |
this.entryUpdated(entryEvent); |
|
123 | 112 |
|
124 | 113 |
} |
125 | 114 |
|
126 | 115 |
public void entryEvicted(EntryEvent<Identifier, SystemMetadata> entryEvent) { |
127 |
// TODO Auto-generated method stub |
|
116 |
// remove from the index for now, this may be a temporary eviction |
|
117 |
this.entryRemoved(entryEvent); |
|
128 | 118 |
|
129 | 119 |
} |
130 | 120 |
|
131 | 121 |
public void entryRemoved(EntryEvent<Identifier, SystemMetadata> entryEvent) { |
132 |
// TODO Auto-generated method stub |
|
122 |
// remove from the index |
|
123 |
Identifier pid = entryEvent.getKey(); |
|
124 |
try { |
|
125 |
solrIndex.remove(pid.getValue()); |
|
126 |
} catch (Exception e) { |
|
127 |
// TODO: need to track errors, retry later |
|
128 |
log.error(e.getMessage(), e); |
|
129 |
} |
|
133 | 130 |
|
134 | 131 |
} |
135 | 132 |
|
136 | 133 |
public void entryUpdated(EntryEvent<Identifier, SystemMetadata> entryEvent) { |
137 |
// TODO Auto-generated method stub |
|
134 |
// add to the index |
|
135 |
Identifier pid = entryEvent.getKey(); |
|
136 |
SystemMetadata systemMetadata = entryEvent.getValue(); |
|
138 | 137 |
|
138 |
String objectPath = objectPathMap.get(pid); |
|
139 |
InputStream data = null; |
|
140 |
try { |
|
141 |
data = new FileInputStream(objectPath); |
|
142 |
solrIndex.insert(pid.getValue(), systemMetadata, data); |
|
143 |
} catch (Exception e) { |
|
144 |
// TODO: need to track errors, retry later |
|
145 |
log.error(e.getMessage(), e); |
|
146 |
} |
|
139 | 147 |
} |
140 | 148 |
|
141 | 149 |
} |
Also available in: Unified diff
use SystemMetadata parameter for inserting into SolrIndex