Skip to content

Apache Lucene open-source search software

[SOLR-3902] - moved SentimentAnnotation to DummySentimentAnnotation (to avoid cofusion), moved out FieldMappingException from a dedicated exception package

Tommaso Teofilic65bdde36fac
diff --git a/solr/contrib/uima/src/java/org/apache/solr/uima/processor/exception/FieldMappingException.java b/solr/contrib/uima/src/java/org/apache/solr/uima/processor/FieldMappingException.java
similarity index 95%
rename from solr/contrib/uima/src/java/org/apache/solr/uima/processor/exception/FieldMappingException.java
rename to solr/contrib/uima/src/java/org/apache/solr/uima/processor/FieldMappingException.java
index 12eaf74a40d..d9b566aa683 100644
--- a/solr/contrib/uima/src/java/org/apache/solr/uima/processor/exception/FieldMappingException.java
+++ b/solr/contrib/uima/src/java/org/apache/solr/uima/processor/FieldMappingException.java
@@ -1,4 +1,4 @@
-package org.apache.solr.uima.processor.exception;
+package org.apache.solr.uima.processor;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java b/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java
index 8c7d4547bfe..242e1b8e444 100644
--- a/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java
+++ b/solr/contrib/uima/src/java/org/apache/solr/uima/processor/UIMAToSolrMapper.java
@@ -21,7 +21,6 @@ import java.util.Map;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.uima.processor.SolrUIMAConfiguration.MapField;
-import org.apache.solr.uima.processor.exception.FieldMappingException;
import org.apache.uima.cas.FSIterator;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
diff --git a/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml b/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml
index 315266dac35..0835304e091 100644
--- a/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml
+++ b/solr/contrib/uima/src/test-files/uima/DummySentimentAnalysisAEDescriptor.xml
@@ -29,7 +29,7 @@
<typeSystemDescription>
<types>
<typeDescription>
- <name>org.apache.solr.uima.ts.SentimentAnnotation</name>
+ <name>org.apache.solr.uima.ts.DummySentimentAnnotation</name>
<description/>
<supertypeName>uima.tcas.Annotation</supertypeName>
<features>
diff --git a/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml b/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml
index 0444bf8f7b1..1a7109d7519 100644
--- a/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml
+++ b/solr/contrib/uima/src/test-files/uima/solr/collection1/conf/solrconfig.xml
@@ -827,7 +827,7 @@
</lst>
</lst>
<lst name="type">
- <str name="name">org.apache.solr.uima.ts.SentimentAnnotation</str>
+ <str name="name">org.apache.solr.uima.ts.DummySentimentAnnotation</str>
<lst name="mapping">
<str name="feature">mood</str>
<str name="field">sentiment</str>
diff --git a/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java b/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java
index 04f1e59fc6e..5e0bb5d495f 100644
--- a/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java
+++ b/solr/contrib/uima/src/test/org/apache/solr/uima/processor/an/DummySentimentAnnotator.java
@@ -2,7 +2,7 @@ package org.apache.solr.uima.processor.an;
import java.util.Arrays;
-import org.apache.solr.uima.ts.SentimentAnnotation;
+import org.apache.solr.uima.ts.DummySentimentAnnotation;
import org.apache.uima.TokenAnnotation;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@ -38,24 +38,24 @@ public class DummySentimentAnnotator extends JCasAnnotator_ImplBase{
String tokenPOS = ((TokenAnnotation) annotation).getPosTag();
if ("jj".equals(tokenPOS)) {
if (Arrays.asList(positiveAdj).contains(annotation.getCoveredText())) {
- SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
- sentimentAnnotation.setMood("positive");
- sentimentAnnotation.addToIndexes();
+ DummySentimentAnnotation dummySentimentAnnotation = createSentimentAnnotation(jcas, annotation);
+ dummySentimentAnnotation.setMood("positive");
+ dummySentimentAnnotation.addToIndexes();
}
else if (Arrays.asList(negativeAdj).contains(annotation.getCoveredText())) {
- SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
- sentimentAnnotation.setMood("negative");
- sentimentAnnotation.addToIndexes();
+ DummySentimentAnnotation dummySentimentAnnotation = createSentimentAnnotation(jcas, annotation);
+ dummySentimentAnnotation.setMood("negative");
+ dummySentimentAnnotation.addToIndexes();
}
}
}
}
- private SentimentAnnotation createSentimentAnnotation(JCas jcas, Annotation annotation) {
- SentimentAnnotation sentimentAnnotation = new SentimentAnnotation(jcas);
- sentimentAnnotation.setBegin(annotation.getBegin());
- sentimentAnnotation.setEnd(annotation.getEnd());
- return sentimentAnnotation;
+ private DummySentimentAnnotation createSentimentAnnotation(JCas jcas, Annotation annotation) {
+ DummySentimentAnnotation dummySentimentAnnotation = new DummySentimentAnnotation(jcas);
+ dummySentimentAnnotation.setBegin(annotation.getBegin());
+ dummySentimentAnnotation.setEnd(annotation.getEnd());
+ return dummySentimentAnnotation;
}
}
diff --git a/solr/contrib/uima/src/test/org/apache/solr/uima/ts/SentimentAnnotation.java b/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation.java
similarity index 66%
rename from solr/contrib/uima/src/test/org/apache/solr/uima/ts/SentimentAnnotation.java
rename to solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation.java
index f3a5ad91ef6..836fb817efc 100644
--- a/solr/contrib/uima/src/test/org/apache/solr/uima/ts/SentimentAnnotation.java
+++ b/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation.java
@@ -14,11 +14,11 @@ import org.apache.uima.jcas.tcas.Annotation;
* Updated by JCasGen Fri Mar 04 13:08:40 CET 2011
* XML source: /Users/tommasoteofili/Documents/workspaces/lucene_workspace/lucene_dev/solr/contrib/uima/src/test/resources/DummySentimentAnalysisAEDescriptor.xml
* @generated */
-public class SentimentAnnotation extends Annotation {
+public class DummySentimentAnnotation extends Annotation {
/** @generated
* @ordered
*/
- public final static int typeIndexID = JCasRegistry.register(SentimentAnnotation.class);
+ public final static int typeIndexID = JCasRegistry.register(DummySentimentAnnotation.class);
/** @generated
* @ordered
*/
@@ -28,23 +28,23 @@ public class SentimentAnnotation extends Annotation {
/** Never called. Disable default constructor
* @generated */
- protected SentimentAnnotation() {}
+ protected DummySentimentAnnotation() {}
/** Internal - constructor used by generator
* @generated */
- public SentimentAnnotation(int addr, TOP_Type type) {
+ public DummySentimentAnnotation(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated */
- public SentimentAnnotation(JCas jcas) {
+ public DummySentimentAnnotation(JCas jcas) {
super(jcas);
readObject();
}
/** @generated */
- public SentimentAnnotation(JCas jcas, int begin, int end) {
+ public DummySentimentAnnotation(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
@@ -65,16 +65,16 @@ public class SentimentAnnotation extends Annotation {
/** getter for mood - gets
* @generated */
public String getMood() {
- if (SentimentAnnotation_Type.featOkTst && ((SentimentAnnotation_Type)jcasType).casFeat_mood == null)
+ if (DummySentimentAnnotation_Type.featOkTst && ((DummySentimentAnnotation_Type)jcasType).casFeat_mood == null)
jcasType.jcas.throwFeatMissing("mood", "org.apache.solr.uima.ts.SentimentAnnotation");
- return jcasType.ll_cas.ll_getStringValue(addr, ((SentimentAnnotation_Type)jcasType).casFeatCode_mood);}
+ return jcasType.ll_cas.ll_getStringValue(addr, ((DummySentimentAnnotation_Type)jcasType).casFeatCode_mood);}
/** setter for mood - sets
* @generated */
public void setMood(String v) {
- if (SentimentAnnotation_Type.featOkTst && ((SentimentAnnotation_Type)jcasType).casFeat_mood == null)
+ if (DummySentimentAnnotation_Type.featOkTst && ((DummySentimentAnnotation_Type)jcasType).casFeat_mood == null)
jcasType.jcas.throwFeatMissing("mood", "org.apache.solr.uima.ts.SentimentAnnotation");
- jcasType.ll_cas.ll_setStringValue(addr, ((SentimentAnnotation_Type)jcasType).casFeatCode_mood, v);}
+ jcasType.ll_cas.ll_setStringValue(addr, ((DummySentimentAnnotation_Type)jcasType).casFeatCode_mood, v);}
}
\ No newline at end of file
diff --git a/solr/contrib/uima/src/test/org/apache/solr/uima/ts/SentimentAnnotation_Type.java b/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation_Type.java
similarity index 77%
rename from solr/contrib/uima/src/test/org/apache/solr/uima/ts/SentimentAnnotation_Type.java
rename to solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation_Type.java
index 1ecc508768b..9b75982a25b 100644
--- a/solr/contrib/uima/src/test/org/apache/solr/uima/ts/SentimentAnnotation_Type.java
+++ b/solr/contrib/uima/src/test/org/apache/solr/uima/ts/DummySentimentAnnotation_Type.java
@@ -15,27 +15,27 @@ import org.apache.uima.jcas.tcas.Annotation_Type;
/**
* Updated by JCasGen Fri Mar 04 13:08:40 CET 2011
* @generated */
-public class SentimentAnnotation_Type extends Annotation_Type {
+public class DummySentimentAnnotation_Type extends Annotation_Type {
/** @generated */
protected FSGenerator getFSGenerator() {return fsGenerator;}
/** @generated */
private final FSGenerator fsGenerator =
new FSGenerator() {
public FeatureStructure createFS(int addr, CASImpl cas) {
- if (SentimentAnnotation_Type.this.useExistingInstance) {
+ if (DummySentimentAnnotation_Type.this.useExistingInstance) {
// Return eq fs instance if already created
- FeatureStructure fs = SentimentAnnotation_Type.this.jcas.getJfsFromCaddr(addr);
+ FeatureStructure fs = DummySentimentAnnotation_Type.this.jcas.getJfsFromCaddr(addr);
if (null == fs) {
- fs = new SentimentAnnotation(addr, SentimentAnnotation_Type.this);
- SentimentAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs);
+ fs = new DummySentimentAnnotation(addr, DummySentimentAnnotation_Type.this);
+ DummySentimentAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs);
return fs;
}
return fs;
- } else return new SentimentAnnotation(addr, SentimentAnnotation_Type.this);
+ } else return new DummySentimentAnnotation(addr, DummySentimentAnnotation_Type.this);
}
};
/** @generated */
- public final static int typeIndexID = SentimentAnnotation.typeIndexID;
+ public final static int typeIndexID = DummySentimentAnnotation.typeIndexID;
/** @generated
@modifiable */
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.apache.solr.uima.ts.SentimentAnnotation");
@@ -62,7 +62,7 @@ public class SentimentAnnotation_Type extends Annotation_Type {
/** initialize variables to correspond with Cas Type and Features
* @generated */
- public SentimentAnnotation_Type(JCas jcas, Type casType) {
+ public DummySentimentAnnotation_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());