You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/08/12 12:44:18 UTC
svn commit: r1157040 [9/23] - in
/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine: ./ .settings/
META-INF/ desc/ lib/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/uima/
src/main/java/org/a...
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordListExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordListExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordTableExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordTableExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordTableExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordTableExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.resource;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.textmarker.resource.TextMarkerTable;
+
+public class LiteralWordTableExpression extends WordTableExpression {
+
+ private final String text;
+
+ public LiteralWordTableExpression(String text) {
+ super();
+ if (text.startsWith("\'") && text.endsWith("\'")) {
+ text = text.substring(1, text.length() - 1);
+ }
+ this.text = stripEscapes(text); // hotfix for the escaping problem
+ }
+
+ public static String stripEscapes(String str) {
+ String result = str.replaceAll("\\\\\\\\", "\\\\");
+ return result.replaceAll("\\\\\\\"", "\\\"");
+ }
+
+ @Override
+ public TextMarkerTable getTable(TextMarkerStatement element) {
+ TextMarkerTable table = element.getEnvironment().getWordTable(getText());
+ return table;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordTableExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/LiteralWordTableExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordListExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordListExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordListExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordListExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.resource;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.textmarker.resource.TextMarkerWordList;
+
+public class ReferenceWordListExpression extends WordListExpression {
+
+ private String ref;
+
+ public ReferenceWordListExpression(String ref) {
+ super();
+ this.ref = ref;
+ }
+
+ @Override
+ public TextMarkerWordList getList(TextMarkerStatement element) {
+ return element.getEnvironment().getVariableValue(ref, TextMarkerWordList.class);
+ }
+
+ public String getRef() {
+ return ref;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordListExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordListExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordTableExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordTableExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordTableExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordTableExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.resource;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.textmarker.resource.TextMarkerTable;
+
+public class ReferenceWordTableExpression extends WordTableExpression {
+
+ private String ref;
+
+ public ReferenceWordTableExpression(String ref) {
+ super();
+ this.ref = ref;
+ }
+
+ @Override
+ public TextMarkerTable getTable(TextMarkerStatement element) {
+ return element.getEnvironment().getVariableValue(ref, TextMarkerTable.class);
+ }
+
+ public String getRef() {
+ return ref;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordTableExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/ReferenceWordTableExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordListExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordListExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordListExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordListExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.resource;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.resource.TextMarkerWordList;
+
+public abstract class WordListExpression extends TextMarkerExpression {
+
+ public abstract TextMarkerWordList getList(TextMarkerStatement element);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordListExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordListExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordTableExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordTableExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordTableExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordTableExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.resource;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.resource.TextMarkerTable;
+
+public abstract class WordTableExpression extends TextMarkerExpression {
+
+ public abstract TextMarkerTable getTable(TextMarkerStatement element);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordTableExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/resource/WordTableExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ComposedStringExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ComposedStringExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ComposedStringExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ComposedStringExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.string;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+
+
+public class ComposedStringExpression extends LiteralStringExpression {
+
+ private final List<StringExpression> epxressions;
+
+ public ComposedStringExpression(List<StringExpression> expressions) {
+ super();
+ this.epxressions = expressions;
+ }
+
+ @Override
+ public String getStringValue(TextMarkerStatement parent) {
+ StringBuilder result = new StringBuilder();
+ for (StringExpression each : getExpressions()) {
+ result.append(each.getStringValue(parent));
+ }
+ return result.toString();
+ }
+
+ public List<StringExpression> getExpressions() {
+ return epxressions;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ComposedStringExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ComposedStringExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/LiteralStringExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/LiteralStringExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/LiteralStringExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/LiteralStringExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.string;
+
+
+public abstract class LiteralStringExpression extends StringExpression {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/LiteralStringExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/LiteralStringExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ReferenceStringExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ReferenceStringExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ReferenceStringExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ReferenceStringExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.string;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+
+public class ReferenceStringExpression extends LiteralStringExpression {
+
+ private final String var;
+
+ public ReferenceStringExpression(String var) {
+ super();
+ this.var = var;
+ }
+
+ @Override
+ public String getStringValue(TextMarkerStatement parent) {
+ String variableValue = parent.getEnvironment().getVariableValue(getVar(), String.class);
+ return variableValue;
+ }
+
+ public String getVar() {
+ return var;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ReferenceStringExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/ReferenceStringExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/RemoveFunction.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/RemoveFunction.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/RemoveFunction.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/RemoveFunction.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.string;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+
+
+public class RemoveFunction extends StringFunctionExpression {
+
+ private List<StringExpression> list;
+
+ private String var;
+
+ public RemoveFunction(String v, List<StringExpression> list) {
+ super();
+ this.var = v;
+ this.list = list;
+ }
+
+ @Override
+ public String getStringValue(TextMarkerStatement parent) {
+ StringBuilder result = new StringBuilder();
+ String value = parent.getEnvironment().getVariableValue(var, String.class);
+ for (StringExpression each : list) {
+ String string = each.getStringValue(parent);
+ String[] split = value.split(string);
+ for (String r : split) {
+ result.append(r);
+ }
+ }
+ return result.toString();
+ }
+
+ public List<StringExpression> getList() {
+ return list;
+ }
+
+ public String getVar() {
+ return var;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/RemoveFunction.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/RemoveFunction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/SimpleStringExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/SimpleStringExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/SimpleStringExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/SimpleStringExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.string;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+
+public class SimpleStringExpression extends LiteralStringExpression {
+
+ private final String value;
+
+ public static String stripEscapes(String str) {
+ String result = str.replaceAll("\\\\\\\\", "\\\\");
+ return result.replaceAll("\\\\\\\"", "\\\"");
+ }
+
+ public SimpleStringExpression(String value) {
+ super();
+ if (value.startsWith("\"") && value.endsWith("\"")) {
+ value = value.substring(1, value.length() - 1);
+ }
+ this.value = stripEscapes(value); // hotfix for the escaping problem
+ }
+
+ @Override
+ public String getStringValue(TextMarkerStatement parent) {
+ return getValue();
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/SimpleStringExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/SimpleStringExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.string;
+
+import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+
+public abstract class StringExpression extends TextMarkerExpression {
+
+ public abstract String getStringValue(TextMarkerStatement parent);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.string;
+
+public abstract class StringFunctionExpression extends StringExpression {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionFactory.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionFactory.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.expression.string;
+
+import java.util.List;
+
+import org.antlr.runtime.Token;
+
+public class StringFunctionFactory {
+
+ public static StringExpression createRemoveFunction(Token var, List<StringExpression> list) {
+ String v = var == null ? "" : var.getText();
+ return new RemoveFunction(v, list);
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/string/StringFunctionFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/ReferenceTypeExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/ReferenceTypeExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/ReferenceTypeExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/ReferenceTypeExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.expression.type;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.textmarker.TextMarkerStatement;
+
+public class ReferenceTypeExpression extends TypeExpression {
+
+ private final String var;
+
+ public ReferenceTypeExpression(String varString) {
+ super();
+ this.var = varString;
+ }
+
+ @Override
+ public String toString() {
+ return getVar();
+ }
+
+ public String getVar() {
+ return var;
+ }
+
+ @Override
+ public Type getType(TextMarkerStatement parent) {
+ return parent.getEnvironment().getVariableValue(var, Type.class);
+ }
+
+ @Override
+ public String getStringValue(TextMarkerStatement parent) {
+ Type type = getType(parent);
+ return type != null ? type.getName() : "null";
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/ReferenceTypeExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/ReferenceTypeExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/SimpleTypeExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/SimpleTypeExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/SimpleTypeExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/SimpleTypeExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.expression.type;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.textmarker.TextMarkerStatement;
+
+public class SimpleTypeExpression extends TypeExpression {
+
+ private final Type type;
+
+ public SimpleTypeExpression(Type type) {
+ super();
+ this.type = type;
+ }
+
+ @Override
+ public Type getType(TextMarkerStatement parent) {
+ return type;
+ }
+
+ @Override
+ public String toString() {
+ return type.getShortName();
+ }
+
+ @Override
+ public String getStringValue(TextMarkerStatement parent) {
+ return type.getName();
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/SimpleTypeExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/SimpleTypeExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.expression.type;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.textmarker.TextMarkerStatement;
+import org.apache.uima.textmarker.expression.string.StringExpression;
+
+public abstract class TypeExpression extends StringExpression {
+
+ public abstract Type getType(TextMarkerStatement parent);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeFunctionExpression.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeFunctionExpression.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeFunctionExpression.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeFunctionExpression.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.expression.type;
+
+
+public abstract class TypeFunctionExpression extends TypeExpression {
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeFunctionExpression.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/expression/type/TypeFunctionExpression.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/DefaultEngineLoader.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/DefaultEngineLoader.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/DefaultEngineLoader.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/DefaultEngineLoader.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.io.IOException;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.XMLInputSource;
+
+public abstract class DefaultEngineLoader implements IEngineLoader {
+
+ public AnalysisEngine loadEngine(String location) throws InvalidXMLException,
+ ResourceInitializationException, IOException {
+ return loadEngineMyself(location);
+ }
+
+ protected AnalysisEngine loadEngineMyself(String location) throws IOException,
+ InvalidXMLException, ResourceInitializationException {
+ XMLInputSource in = new XMLInputSource(location);
+ ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
+ AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
+ return ae;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/DefaultEngineLoader.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/DefaultEngineLoader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/IEngineLoader.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/IEngineLoader.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/IEngineLoader.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/IEngineLoader.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.io.IOException;
+
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.InvalidXMLException;
+
+public interface IEngineLoader {
+
+ String[] getKnownEngines();
+
+ AnalysisEngine loadEngine(String location) throws InvalidXMLException,
+ ResourceInitializationException, IOException;
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/IEngineLoader.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/IEngineLoader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerActionExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerActionExtension.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerActionExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerActionExtension.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+
+import antlr.ANTLRException;
+
+public interface ITextMarkerActionExtension extends ITextMarkerExtension {
+
+ AbstractTextMarkerAction createAction(String name, List<TextMarkerExpression> args)
+ throws ANTLRException;
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerActionExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerActionExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerBooleanFunctionExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerBooleanFunctionExtension.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerBooleanFunctionExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerBooleanFunctionExtension.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.expression.bool.BooleanFunctionExpression;
+
+import antlr.ANTLRException;
+
+public interface ITextMarkerBooleanFunctionExtension extends ITextMarkerExtension {
+
+ BooleanFunctionExpression createBooleanFunction(String name, List<TextMarkerExpression> args)
+ throws ANTLRException;
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerBooleanFunctionExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerBooleanFunctionExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerConditionExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerConditionExtension.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerConditionExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerConditionExtension.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+
+import antlr.ANTLRException;
+
+public interface ITextMarkerConditionExtension extends ITextMarkerExtension {
+
+ AbstractTextMarkerCondition createCondition(String name, List<TextMarkerExpression> args)
+ throws ANTLRException;
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerConditionExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerConditionExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerExtension.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerExtension.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import org.apache.uima.textmarker.TextMarkerElement;
+import org.apache.uima.textmarker.verbalize.TextMarkerVerbalizer;
+
+public interface ITextMarkerExtension {
+
+ String[] getKnownExtensions();
+
+ Class<?>[] extensions();
+
+ String verbalize(TextMarkerElement element, TextMarkerVerbalizer verbalizer);
+
+ String verbalizeName(TextMarkerElement element);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerNumberFunctionExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerNumberFunctionExtension.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerNumberFunctionExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerNumberFunctionExtension.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.expression.number.NumberFunctionExpression;
+
+import antlr.ANTLRException;
+
+public interface ITextMarkerNumberFunctionExtension extends ITextMarkerExtension {
+
+ NumberFunctionExpression createNumberFunction(String name, List<TextMarkerExpression> args)
+ throws ANTLRException;
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerNumberFunctionExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerNumberFunctionExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerStringFunctionExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerStringFunctionExtension.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerStringFunctionExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerStringFunctionExtension.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.expression.string.StringFunctionExpression;
+
+import antlr.ANTLRException;
+
+public interface ITextMarkerStringFunctionExtension extends ITextMarkerExtension {
+
+ StringFunctionExpression createStringFunction(String name, List<TextMarkerExpression> args)
+ throws ANTLRException;
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerStringFunctionExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerStringFunctionExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerTypeFunctionExtension.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerTypeFunctionExtension.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerTypeFunctionExtension.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerTypeFunctionExtension.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.util.List;
+
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.expression.type.TypeFunctionExpression;
+
+import antlr.ANTLRException;
+
+public interface ITextMarkerTypeFunctionExtension extends ITextMarkerExtension {
+
+ TypeFunctionExpression createTypeFunction(String name, List<TextMarkerExpression> args)
+ throws ANTLRException;
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerTypeFunctionExtension.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/ITextMarkerTypeFunctionExtension.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerEngineLoader.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerEngineLoader.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerEngineLoader.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerEngineLoader.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.extensions;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.util.InvalidXMLException;
+
+public class TextMarkerEngineLoader extends DefaultEngineLoader {
+
+ private Map<String, IEngineLoader> loaders;
+
+ public TextMarkerEngineLoader() {
+ super();
+ loaders = new HashMap<String, IEngineLoader>();
+ }
+
+ @Override
+ public AnalysisEngine loadEngine(String location) throws InvalidXMLException,
+ ResourceInitializationException, IOException {
+ String name = getEngineName(location);
+ AnalysisEngine result = null;
+ IEngineLoader engineLoader = loaders.get(name);
+ if (engineLoader != null) {
+ result = engineLoader.loadEngine(location);
+ } else {
+ result = loadEngineMyself(location);
+ }
+ return result;
+ }
+
+ public void addLoader(String engine, IEngineLoader loader) {
+ loaders.put(engine, loader);
+ }
+
+ private String getEngineName(String location) {
+ File file = new File(location);
+ location = file.getName();
+ String[] split = location.split("[.]");
+ return split[split.length - 2];
+ }
+
+ public boolean isInitialized() {
+ return !loaders.isEmpty();
+ }
+
+ public String[] getKnownEngines() {
+ return loaders.keySet().toArray(new String[0]);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerEngineLoader.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerEngineLoader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerExternalFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerExternalFactory.java?rev=1157040&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerExternalFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerExternalFactory.java Fri Aug 12 10:44:04 2011
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.extensions;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.antlr.runtime.Token;
+import org.apache.uima.textmarker.action.AbstractTextMarkerAction;
+import org.apache.uima.textmarker.condition.AbstractTextMarkerCondition;
+import org.apache.uima.textmarker.expression.TextMarkerExpression;
+import org.apache.uima.textmarker.expression.bool.BooleanExpression;
+import org.apache.uima.textmarker.expression.number.NumberExpression;
+import org.apache.uima.textmarker.expression.string.StringExpression;
+import org.apache.uima.textmarker.expression.type.TypeExpression;
+
+import antlr.ANTLRException;
+
+public class TextMarkerExternalFactory {
+
+ private Map<String, ITextMarkerConditionExtension> conditionExtensions;
+
+ private Map<String, ITextMarkerActionExtension> actionExtensions;
+
+ private Map<String, ITextMarkerTypeFunctionExtension> typeFunctionExtensions;
+
+ private Map<String, ITextMarkerBooleanFunctionExtension> booleanFunctionExtensions;
+
+ private Map<String, ITextMarkerStringFunctionExtension> stringFunctionExtensions;
+
+ private Map<String, ITextMarkerNumberFunctionExtension> numberFunctionExtensions;
+
+ public TextMarkerExternalFactory() {
+ super();
+ conditionExtensions = new HashMap<String, ITextMarkerConditionExtension>();
+ actionExtensions = new HashMap<String, ITextMarkerActionExtension>();
+ booleanFunctionExtensions = new HashMap<String, ITextMarkerBooleanFunctionExtension>();
+ stringFunctionExtensions = new HashMap<String, ITextMarkerStringFunctionExtension>();
+ numberFunctionExtensions = new HashMap<String, ITextMarkerNumberFunctionExtension>();
+ typeFunctionExtensions = new HashMap<String, ITextMarkerTypeFunctionExtension>();
+ }
+
+ public AbstractTextMarkerCondition createExternalCondition(Token id,
+ List<TextMarkerExpression> args) throws ANTLRException {
+ String name = id.getText();
+ ITextMarkerConditionExtension extension = conditionExtensions.get(name);
+ if (extension != null) {
+ return extension.createCondition(name, args);
+ }
+ // Throw exception
+ return null;
+ }
+
+ public AbstractTextMarkerAction createExternalAction(Token id, List<TextMarkerExpression> args)
+ throws ANTLRException {
+ String name = id.getText();
+ ITextMarkerActionExtension extension = actionExtensions.get(name);
+ if (extension != null) {
+ return extension.createAction(name, args);
+ }
+ // Throw exception
+ return null;
+ }
+
+ public TypeExpression createExternalTypeFunction(Token id, List<TextMarkerExpression> args)
+ throws ANTLRException {
+ String name = id.getText();
+ ITextMarkerTypeFunctionExtension extension = typeFunctionExtensions.get(name);
+ if (extension != null) {
+ return extension.createTypeFunction(name, args);
+ }
+ // Throw exception
+ return null;
+ }
+
+ public BooleanExpression createExternalBooleanFunction(Token id, List<TextMarkerExpression> args)
+ throws ANTLRException {
+ String name = id.getText();
+ ITextMarkerBooleanFunctionExtension extension = booleanFunctionExtensions.get(name);
+ if (extension != null) {
+ return extension.createBooleanFunction(name, args);
+ }
+ // Throw exception
+ return null;
+ }
+
+ public StringExpression createExternalStringFunction(Token id, List<TextMarkerExpression> args)
+ throws ANTLRException {
+ String name = id.getText();
+ ITextMarkerStringFunctionExtension extension = stringFunctionExtensions.get(name);
+ if (extension != null) {
+ return extension.createStringFunction(name, args);
+ }
+ // Throw exception
+ return null;
+ }
+
+ public NumberExpression createExternalNumberFunction(Token id, List<TextMarkerExpression> args)
+ throws ANTLRException {
+ String name = id.getText();
+ ITextMarkerNumberFunctionExtension extension = numberFunctionExtensions.get(name);
+ if (extension != null) {
+ return extension.createNumberFunction(name, args);
+ }
+ // Throw exception
+ return null;
+ }
+
+ public void addExtension(String id, ITextMarkerExtension extension) {
+ if (extension instanceof ITextMarkerActionExtension) {
+ addActionExtension(id, (ITextMarkerActionExtension) extension);
+ } else if (extension instanceof ITextMarkerConditionExtension) {
+ addConditionExtension(id, (ITextMarkerConditionExtension) extension);
+ } else if (extension instanceof ITextMarkerBooleanFunctionExtension) {
+ addBooleanFunctionExtension(id, (ITextMarkerBooleanFunctionExtension) extension);
+ } else if (extension instanceof ITextMarkerStringFunctionExtension) {
+ addStringFunctionExtension(id, (ITextMarkerStringFunctionExtension) extension);
+ } else if (extension instanceof ITextMarkerNumberFunctionExtension) {
+ addNumberFunctionExtension(id, (ITextMarkerNumberFunctionExtension) extension);
+ } else if (extension instanceof ITextMarkerTypeFunctionExtension) {
+ addTypeFunctionExtension(id, (ITextMarkerTypeFunctionExtension) extension);
+ }
+ }
+
+ public void addConditionExtension(String id, ITextMarkerConditionExtension extension) {
+ conditionExtensions.put(id, extension);
+ }
+
+ public void addActionExtension(String id, ITextMarkerActionExtension extension) {
+ actionExtensions.put(id, extension);
+ }
+
+ public void addNumberFunctionExtension(String id, ITextMarkerNumberFunctionExtension extension) {
+ numberFunctionExtensions.put(id, extension);
+ }
+
+ public void addBooleanFunctionExtension(String id, ITextMarkerBooleanFunctionExtension extension) {
+ booleanFunctionExtensions.put(id, extension);
+ }
+
+ public void addStringFunctionExtension(String id, ITextMarkerStringFunctionExtension extension) {
+ stringFunctionExtensions.put(id, extension);
+ }
+
+ public void addTypeFunctionExtension(String id, ITextMarkerTypeFunctionExtension extension) {
+ typeFunctionExtensions.put(id, extension);
+ }
+
+ public boolean isInitialized() {
+ return !actionExtensions.isEmpty() || !conditionExtensions.isEmpty()
+ || !booleanFunctionExtensions.isEmpty() || !numberFunctionExtensions.isEmpty()
+ || !stringFunctionExtensions.isEmpty() || !typeFunctionExtensions.isEmpty();
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerExternalFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-engine/src/main/java/org/apache/uima/textmarker/extensions/TextMarkerExternalFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain