1 package mircoders.producer;
8 import mir.entity.adapter.*;
9 import mircoders.entity.*;
12 public class ContentMarkingProducerNode implements ProducerNode {
13 private String contentKey;
15 public ContentMarkingProducerNode(String aContentKey) {
16 contentKey = aContentKey;
19 public void produce(Map aValueMap, String aVerb, PrintWriter aLogger) throws ProducerFailure {
24 data = ParameterExpander.findValueForKey( aValueMap, contentKey );
26 if (! (data instanceof EntityAdapter)) {
27 throw new ProducerFailure("ContentMarkingProducerNode: value of '"+contentKey+"' is not an EntityAdapter, but an " + data.getClass().getName(), null);
30 entity = ((EntityAdapter) data).getEntity();
31 if (! (entity instanceof EntityContent)) {
32 throw new ProducerFailure("ContentMarkingProducerNode: value of '"+contentKey+"' is not a content EntityAdapter, but a " + entity.getClass().getName() + " adapter", null);
35 ((EntityContent) entity).setProduced(true);
38 aLogger.println("Error while marking content: " + t.getMessage());
39 t.printStackTrace(aLogger);
41 throw new ProducerFailure(t.getMessage(), t);
45 public Set buildVerbSet() {