svn commit: r1711942 [1/2] - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 12:19:46 2015
New Revision: 1711942

URL: http://svn.apache.org/viewvc?rev=1711942&view=rev
Log:
[UIMA-4663] update built-in JCas cover objects for v3

Added:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/JavaObjectArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyList.java
Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/BooleanArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/ByteArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/DoubleArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyFSList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyFloatList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyIntegerList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyStringList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FloatArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FloatList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/LongArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyFSList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyFloatList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyIntegerList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyStringList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/ShortArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/Sofa.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/StringArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/StringList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/TOP.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/BooleanArray.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/BooleanArray.java?rev=1711942&r1=1711941&r2=1711942&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/BooleanArray.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/BooleanArray.java
 Mon Nov  2 12:19:46 2015
@@ -20,11 +20,13 @@
 package org.apache.uima.jcas.cas;
 
 import org.apache.uima.cas.BooleanArrayFS;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.TypeImpl;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.JCasRegistry;
 
 /** JCas class model for BooleanArray */
-public final class BooleanArray extends TOP implements BooleanArrayFS {
+public final class BooleanArray extends TOP implements CommonPrimitiveArray, 
BooleanArrayFS {
   /**
* Each cover class when loaded sets an index. Used in the JCas typeArray to 
go from the cover
* class or class instance to the corresponding instance of the _Type class
@@ -43,13 +45,14 @@ public final class BooleanArray extends
 return typeIndexID;
   }
 
+  /* local data */
+  private final boolean[] theArray;
+
+ 
   // never called. Here to disable default constructor
+  @SuppressWarnings("unused")
   private BooleanArray() {
-  }
-
- /* Internal - Constructor used by generator */
-  public BooleanArray(int addr, TOP_Type type) {
-super(addr, type);
+theArray = null;
   }
 
   /**
@@ -58,79 +61,79 @@ public final class BooleanArray extends
* @param length of array
*/
   public BooleanArray(JCas jcas, int length) {
-this(jcas.getLowLevelCas().ll_createBooleanArray(length), 
jcas.getType(typeIndexID));
+super(jcas);
+theArray = n

svn commit: r1711942 [2/2] - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/

2015-11-02 Thread schor
Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyStringList.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyStringList.java?rev=1711942&r1=1711941&r2=1711942&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyStringList.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyStringList.java
 Mon Nov  2 12:19:46 2015
@@ -19,10 +19,14 @@
 
 package org.apache.uima.jcas.cas;
 
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.impl.TypeSystemImpl;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.JCasRegistry;
 
-public class NonEmptyStringList extends StringList {
+public class NonEmptyStringList extends StringList implements NonEmptyList {
 
   public final static int typeIndexID = 
JCasRegistry.register(NonEmptyStringList.class);
 
@@ -32,56 +36,62 @@ public class NonEmptyStringList extends
 return typeIndexID;
   }
 
-  // Never called. Disable default constructor
-  protected NonEmptyStringList() {
+  private final static int head_featCode;
+  private final static int tail_featCode;
+  
+  static {
+TypeSystemImpl tsi = TypeSystemImpl.staticTsi;
+TypeImpl listType = tsi.getType(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST);
+
+head_featCode = 
listType.getFeatureByBaseName(CAS.FEATURE_BASE_NAME_HEAD).getCode();
+tail_featCode = 
listType.getFeatureByBaseName(CAS.FEATURE_BASE_NAME_TAIL).getCode();
   }
 
- /* Internal - Constructor used by generator */
-  public NonEmptyStringList(int addr, TOP_Type type) {
-super(addr, type);
+  /* local data */
+  private String _F_head;
+  private StringList _F_tail;
+  
+  // Never called. Disable default constructor
+  protected NonEmptyStringList() {
   }
 
   public NonEmptyStringList(JCas jcas) {
 super(jcas);
   }
 
-  // *--*
+  /**
+   * used by generator
+   * Make a new AnnotationBase
+   * @param c -
+   * @param t -
+   */
+
+  public NonEmptyStringList(TypeImpl t, CASImpl c) {
+super(t, c);
+  }
+  
+// *--*
   // * Feature: head
   /* getter for head * */
-  public String getHead() {
-if (NonEmptyStringList_Type.featOkTst
-&& ((NonEmptyStringList_Type) jcasType).casFeat_head == null)
-  this.jcasType.jcas.throwFeatMissing("head", 
"uima.cas.NonEmptyStringList");
-return jcasType.ll_cas.ll_getStringValue(addr,
-((NonEmptyStringList_Type) jcasType).casFeatCode_head);
-  }
+  public String getHead() { return _F_head; }
 
   /* setter for head * */
   public void setHead(String v) {
-if (NonEmptyStringList_Type.featOkTst
-&& ((NonEmptyStringList_Type) jcasType).casFeat_head == null)
-  this.jcasType.jcas.throwFeatMissing("head", 
"uima.cas.NonEmptyStringList");
-jcasType.ll_cas.ll_setStringValue(addr, ((NonEmptyStringList_Type) 
jcasType).casFeatCode_head,
-v);
+_F_head = v;  
+// no corruption check - can't be a key
+_casView.maybeLogUpdate(this, head_featCode);
   }
 
   // *--*
   // * Feature: tail
   /* getter for tail * */
-  public StringList getTail() {
-if (NonEmptyStringList_Type.featOkTst
-&& ((NonEmptyStringList_Type) jcasType).casFeat_tail == null)
-  this.jcasType.jcas.throwFeatMissing("tail", 
"uima.cas.NonEmptyStringList");
-return (StringList) 
(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr,
-((NonEmptyStringList_Type) jcasType).casFeatCode_tail)));
-  }
+  public StringList getTail() { return _F_tail; }
 
   /* setter for tail * */
-  public void setTail(StringList v) {
-if (NonEmptyStringList_Type.featOkTst
-&& ((NonEmptyStringList_Type) jcasType).casFeat_tail == null)
-  this.jcasType.jcas.throwFeatMissing("tail", 
"uima.cas.NonEmptyStringList");
-jcasType.ll_cas.ll_setRefValue(addr, ((NonEmptyStringList_Type) 
jcasType).casFeatCode_tail,
-jcasType.ll_cas.ll_getFSRef(v));
+  public void setTail(CommonList v) {
+_F_tail = (StringList) v;
+// no corruption check - can't be a key
+_casView.maybeLogUpdate(this, tail_featCode);
   }
+
 }

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/ShortArray.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/ShortArray.java?rev=1711942&r1=1711941&r2=1711942&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/ShortArray.java
 (original)
+++ 

svn commit: r1711946 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas: CommonArray.java CommonList.java CommonPrimitiveArray.java EmptyList.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 12:39:21 2015
New Revision: 1711946

URL: http://svn.apache.org/viewvc?rev=1711946&view=rev
Log:
[UIMA-4663] add interfaces representing common operations among groups of JCas 
classes.

Added:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonPrimitiveArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyList.java

Added: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java?rev=1711946&view=auto
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java
 (added)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java
 Mon Nov  2 12:39:21 2015
@@ -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.jcas.cas;
+
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+
+/**
+ * This class is the super class of arrays of Feature Structures
+ */
+public interface CommonArray {
+  
+  int size();
+  
+  void copyValuesFrom(CommonArray v);
+}

Added: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java?rev=1711946&view=auto
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java
 (added)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java
 Mon Nov  2 12:39:21 2015
@@ -0,0 +1,137 @@
+/*
+ * 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.jcas.cas;
+
+import java.util.IdentityHashMap;
+import java.util.Set;
+
+import org.apache.uima.cas.CASRuntimeException;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas;
+
+/**
+ * This class is the super class of list nodes (both empty and non empty)
+ */
+public abstract class CommonList extends TOP {
+
+   // Never called.
+   protected CommonList() { // Disable default constructor
+   }
+
+   public CommonList(JCas jcas) {
+   super(jcas);
+   }
+   
+  /**
+   * used by generator
+   * Make a new AnnotationBase
+   * @param c -
+   * @param t -
+   */
+
+  public CommonList(TypeImpl t, CASImpl c) {
+super(t, c);
+  }
+
+  /**
+   * Get the nth node.
+   * @param i -
+   * @return the nth node, which may be an "empty" node
+   */
+   public CommonList getNthNode(int i) {
+ if (this instanceof EmptyList) {
+   throw new 
CASRuntimeException(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, 

svn commit: r1712071 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 16:36:37 2015
New Revision: 1712071

URL: http://svn.apache.org/viewvc?rev=1712071&view=rev
Log:
[UIMA-4679] give messages for missing setters/ getters (except Sofa setters).

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java?rev=1712071&r1=1712070&r2=1712071&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
 Mon Nov  2 16:36:37 2015
@@ -26,15 +26,16 @@ import java.lang.invoke.LambdaMetafactor
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.uima.UIMARuntimeException;
 import org.apache.uima.cas.BuiltinTypeKinds;
 import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASException;
 import org.apache.uima.cas.CASRuntimeException;
 import org.apache.uima.cas.Feature;
-import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.function.JCas_getter_boolean;
 import org.apache.uima.cas.function.JCas_getter_byte;
 import org.apache.uima.cas.function.JCas_getter_double;
@@ -168,13 +169,14 @@ public class FSClassRegistry {
 TypeImpl ti = tsi.getType(CAS.TYPE_NAME_SOFA);
 jcasClassesInfoForBuiltins[ti.getCode()] = createJCasClassInfo(Sofa.class, 
ti); 
 
+reportErrors();
   }
+
+  static private ThreadLocal> errorSet = new 
ThreadLocal>();
   
   // the loaded JCas cover classes, generators, setters, and getters.  index 
is typecode; value is JCas cover class which may belong to a supertype.
   private final JCasClassInfo[] jcasClassesInfo; 
-   
-  //  
-  // 
+
   /**
* install the default (non-JCas) generator for all types in the type system 
and the
* JCas style generators for the built-in types
@@ -210,6 +212,8 @@ public class FSClassRegistry {
 if (isDoUserJCasLoading) {
   maybeLoadJCasAndSubtypes(ts, ts.topType, 
jcasClassesInfo[TypeSystemImpl.topTypeCode]);
 }
+
+reportErrors();
   }
 
   private void maybeLoadJCasAndSubtypes(TypeSystemImpl ts, TypeImpl ti, 
JCasClassInfo copyDownDefault_jcasClassInfo) {
@@ -222,7 +226,7 @@ public class FSClassRegistry {
 if (!isBuiltin) {
   clazz = maybeLoadJCas(ti.getName(), ti.getClass().getClassLoader()); 
   if (null != clazz && TOP.class.isAssignableFrom(clazz)) {
-jcasClassInfo = createJCasClassInfo(clazz, ti);
+jcasClassInfo = createJCasClassInfo(clazz, ti);  // side effect - 
creates method handles for getters/setters
 ts.setJCasRegisteredType(Misc.getStaticIntField(clazz, "typeIndexID"), 
ti);
   }
   jcasClassesInfo[typecode] = jcasClassInfo;  // sets new one or default 
one
@@ -300,20 +304,20 @@ public class FSClassRegistry {
*   boolean, byte, short, int, long, float, double, String, FeatureStructure
*   
*/
+  // static for setting up builtin values
   private static Object createGetterOrSetter(Class jcasClass, FeatureImpl 
fi, boolean isGetter) {
 
 TypeImpl range = fi.getRangeImpl();
 
 try {
   /* get an early-bound getter
-  /* find special invokes a specific method in a specific class, without 
looking at the 
-   * runtime class */
+  /* Instead of findSpecial, we use findVirtual, in case the method is 
overridden by a subtype loaded later */
   MethodHandle mh = lookup.findVirtual(
   jcasClass,  // class having the method code for the getter 
   fi.getGetterSetterName(isGetter), // the name of the method for the 
getter 
   isGetter ? methodType(range.javaClass)
: methodType(void.class, range.javaClass) // return value, 
e.g. int.class, xyz.class, FeatureStructureImplC.class
-  );
+);
   
   // getter methodtype is return_type, FeatureStructure.class
   //   return_type is int, byte, etc. primitive (except string/substring), 
or
@@ -359,15 +363,25 @@ public class FSClassRegistry {
 return isGetter ? (JCas_getter_double) 
callSite.getTarget().invokeExact() 
 : (JCas_setter_double) 
callSite.getTarget().invokeExact();
   } else {
-return isGetter ? (JCas_getter_generic) 
callSite.getTarget().invokeExact() 
-: (JCas_setter_generic) 
callSite.getTarget().invokeExact();
+return isGetter ? (JCas_getter_generic) 
callSite.getTarget().invokeExact() 
+

svn commit: r1712073 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas: JCas.java impl/JCasImpl.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 16:38:23 2015
New Revision: 1712073

URL: http://svn.apache.org/viewvc?rev=1712073&view=rev
Log:
[UIMA-4663][UIMA-4679]

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java?rev=1712073&r1=1712072&r2=1712073&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/JCas.java
 Mon Nov  2 16:38:23 2015
@@ -118,21 +118,21 @@ public interface JCas extends AbstractCa
*/
   public abstract Feature getRequiredFeature(Type t, String s) throws 
CASException;
 
-  /*
-   * Internal Use - look up a feature-name-string in the CAS type system and 
returns the Cas Feature
-   * object. If the feature isn't found, adds an exception to the errorSet but 
doesn't throw
-   * 
-   * DE suffix means "Deferred Exception"
-   */
-
-  public abstract Feature getRequiredFeatureDE(Type t, String s, String 
rangeName, boolean featOkTst);
-
-  /*
-   * Internal Use. 
-   */
-  public abstract void checkArrayBounds(int fsRef, int pos);
+//  /*
+//   * Internal Use - look up a feature-name-string in the CAS type system and 
returns the Cas Feature
+//   * object. If the feature isn't found, adds an exception to the errorSet 
but doesn't throw
+//   * 
+//   * DE suffix means "Deferred Exception"
+//   */
+//
+//  public abstract Feature getRequiredFeatureDE(Type t, String s, String 
rangeName, boolean featOkTst);
 
 //  /*
+//   * Internal Use. 
+//   */
+//  public abstract void checkArrayBounds(int fsRef, int pos);
+//
+//  /*
 //   * Internal Use - throw missing feature exception at runtime.
 //   */
 //  public void throwFeatMissing(String feat, String type);

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java?rev=1712073&r1=1712072&r2=1712073&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasImpl.java
 Mon Nov  2 16:38:23 2015
@@ -24,17 +24,11 @@ package org.apache.uima.jcas.impl;
 // * Compatibility removes at some point: TypeSystemInit and it's caller
 
 import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Map;
-import java.util.WeakHashMap;
 
 import org.apache.uima.cas.AbstractCas;
 import org.apache.uima.cas.AbstractCas_ImplBase;
@@ -56,26 +50,19 @@ import org.apache.uima.cas.SofaID;
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.TypeSystem;
 import org.apache.uima.cas.impl.CASImpl;
-import org.apache.uima.cas.impl.FSClassRegistry;
-import org.apache.uima.cas.impl.FSGenerator;
-import org.apache.uima.cas.impl.FeatureStructureImpl;
 import org.apache.uima.cas.impl.LowLevelCAS;
 import org.apache.uima.cas.impl.LowLevelException;
 import org.apache.uima.cas.impl.LowLevelIndexRepository;
-import org.apache.uima.cas.impl.TypeImpl;
 import org.apache.uima.cas.impl.TypeSystemImpl;
 import org.apache.uima.cas.text.AnnotationIndex;
 import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.JCasRegistry;
 import org.apache.uima.jcas.JFSIndexRepository;
-import org.apache.uima.jcas.cas.AnnotationBase;
 import org.apache.uima.jcas.cas.FSArray;
 import org.apache.uima.jcas.cas.FloatArray;
 import org.apache.uima.jcas.cas.IntegerArray;
 import org.apache.uima.jcas.cas.Sofa;
 import org.apache.uima.jcas.cas.StringArray;
 import org.apache.uima.jcas.cas.TOP;
-import org.apache.uima.jcas.cas.TOP_Type;
 import org.apache.uima.jcas.tcas.Annotation;
 
 // *
@@ -84,209 +71,95 @@ import org.apache.uima.jcas.tcas.Annotat
 
 /*
  * 
- * Overview 
- * 
+ * Overview 
+ * 
  * This design uses classes for types, not Interfaces. JCas CAS types are 
represented in a running
- * server by a collection of classes A set of 2 classes for each loaded 
equivalent-to-CAS type Foo
- * (Class) Foo_Type

svn commit: r1712074 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl: JCasHashMap.java JCasHashMapSubMap.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 16:39:08 2015
New Revision: 1712074

URL: http://svn.apache.org/viewvc?rev=1712074&view=rev
Log:
[UIMA-4663] remove JCasHashMap

Removed:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMap.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/impl/JCasHashMapSubMap.java



svn commit: r1712075 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/Annotation.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 16:41:42 2015
New Revision: 1712075

URL: http://svn.apache.org/viewvc?rev=1712075&view=rev
Log:
[UIMA-4663] update built-in Annotation for v3

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/Annotation.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/Annotation.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/Annotation.java?rev=1712075&r1=1712074&r2=1712075&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/Annotation.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/Annotation.java
 Mon Nov  2 16:41:42 2015
@@ -20,11 +20,13 @@
 package org.apache.uima.jcas.tcas;
 
 import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.impl.TypeSystemImpl;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.JCasRegistry;
 import org.apache.uima.jcas.cas.AnnotationBase;
-import org.apache.uima.jcas.cas.TOP_Type;
 
 /**
  * the JCas class model for the CAS type uima.cas.Annotation. It defines two 
integer valued features
@@ -40,19 +42,41 @@ public class Annotation extends Annotati
   public int getTypeIndexID() {
 return typeIndexID;
   }
+  
+  // static values OK for built-ins
+  private final static int begin_featCode;
+  private final static int end_featCode;
+
+  static {
+TypeSystemImpl tsi = TypeSystemImpl.staticTsi;
+TypeImpl annotType = tsi.annotType;
+begin_featCode = 
annotType.getFeatureByBaseName(CAS.FEATURE_BASE_NAME_BEGIN).getCode();
+end_featCode   = annotType.getFeatureByBaseName(CAS.FEATURE_BASE_NAME_END  
).getCode();
+  }
+
+  /* local data */
+  private int _F_begin;
+  private int _F_end;
 
   // Never called. Disable default constructor
   protected Annotation() {
   }
 
- /* Internal - Constructor used by generator */
-  public Annotation(int addr, TOP_Type type) {
-super(addr, type);
-  }
-
   public Annotation(JCas jcas) {
 super(jcas);
   }
+  
+  /**
+   * used by generator
+   * Make a new AnnotationBase
+   * @param c -
+   * @param t -
+   */
+
+  public Annotation(TypeImpl t, CASImpl c) {
+super(t, c);
+  }
+
 
   // *--*
   // * Feature: begin
@@ -60,22 +84,13 @@ public class Annotation extends Annotati
   /*
* getter for begin - gets beginning of span of annotation
*/
-  public int getBegin() {
-// not needed - is built in
-//if (Annotation_Type.featOkTst && ((Annotation_Type) 
jcasType).casFeat_begin == null)
-//  this.jcasType.jcas.throwFeatMissing("begin", "uima.tcas.Annotation");
-return ((Annotation_Type)jcasType).getBegin(addr);
-//return jcasType.ll_cas.ll_getIntValue(addr, ((Annotation_Type) 
jcasType).casFeatCode_begin);
-  }
+  public int getBegin() { return _F_begin; }
 
   /*
* setter for begin - sets beginning of span of annotation
*/
-  public void setBegin(int v) {
-// not needed - is built in
-//if (Annotation_Type.featOkTst && ((Annotation_Type) 
jcasType).casFeat_begin == null)
-//  this.jcasType.jcas.throwFeatMissing("begin", "uima.tcas.Annotation");
-jcasType.ll_cas.ll_setIntValue(addr, ((Annotation_Type) 
jcasType).casFeatCode_begin, v);
+  public void setBegin(int v) { 
+_casView.setWithCheckAndJournal(this, begin_featCode, () -> _F_begin = v);
   }
 
   // *--*
@@ -85,22 +100,13 @@ public class Annotation extends Annotati
   /*
* getter for end - gets ending of span of annotation
*/
-  public int getEnd() {
-// not needed - is built in
-//if (Annotation_Type.featOkTst && ((Annotation_Type) 
jcasType).casFeat_end == null)
-//  this.jcasType.jcas.throwFeatMissing("end", "uima.tcas.Annotation");
-return ((Annotation_Type)jcasType).getEnd(addr);
-//return jcasType.ll_cas.ll_getIntValue(addr, ((Annotation_Type) 
jcasType).casFeatCode_end);
-  }
+  public int getEnd() { return _F_end; }
 
   /*
* setter for end - sets ending of span of annotation
*/
   public void setEnd(int v) {
-// not needed - is built in
-//if (Annotation_Type.featOkTst && ((Annotation_Type) 
jcasType).casFeat_end == null)
-//  this.jcasType.jcas.throwFeatMissing("end", "uima.tcas.Annotation");
-jcasType.ll_cas.ll_setIntValue(addr, ((Annotation_Type) 
jcasType).casFeatCode_end, v);
+_casView.setWithCheckAndJournal(this,  end_featCode,  () -> _F_end = v);
   }
 
   /**
@@ -120,8 +126,7 @@ public class Annotation extends Annotati
*/
   public String getCoveredText() {
 
-final CAS casView = this.getView();
-final String text = casView.getDocumentText();
+

svn commit: r1712078 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas: Annotation_Type.java package.html

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 16:42:28 2015
New Revision: 1712078

URL: http://svn.apache.org/viewvc?rev=1712078&view=rev
Log:
[UIMA-4663] remove unneeded _Type class, unused package.html

Removed:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/Annotation_Type.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/tcas/package.html



svn commit: r1712088 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src: main/java/org/apache/uima/internal/util/IntHashSet.java test/java/org/apache/uima/internal/util/IntHashSetTest.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 17:15:23 2015
New Revision: 1712088

URL: http://svn.apache.org/viewvc?rev=1712088&view=rev
Log:
[UIMA-4682] reuse removed slots, add tests

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/IntHashSet.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/internal/util/IntHashSetTest.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/IntHashSet.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/IntHashSet.java?rev=1712088&r1=1712087&r2=1712088&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/IntHashSet.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/IntHashSet.java
 Mon Nov  2 17:15:23 2015
@@ -22,7 +22,7 @@ package org.apache.uima.internal.util;
 import java.util.Arrays;
 import java.util.NoSuchElementException;
 
-import org.apache.uima.jcas.impl.JCasHashMap;
+import org.apache.uima.util.Misc;
 
 /**
  * A set of non-zero ints. 
@@ -55,6 +55,10 @@ public class IntHashSet implements Posit
   
   public static final int SIZE_NEEDING_4_BYTES = 256 * 256 - 2;  
   public static final float DEFAULT_LOAD_FACTOR = 0.66F;
+  
+  private static final int REMOVED4 = Integer.MIN_VALUE;
+  private static final int REMOVED2 = Short.MIN_VALUE;
+  
   // set to true to collect statistics for tuning
   // you have to also put a call to showHistogram() at the end of the run
   private static final boolean TUNE = false;
@@ -79,6 +83,8 @@ public class IntHashSet implements Posit
   private int size; // number of elements in the table
   private int nbrRemoved; // number of removed elements (coded as removed)
   
+  private int removedPositionToUse = -1;
+  
   // offset only used with keys2.  values stored are key - offset
   //   intent is to have them fit into short data type.
   //   If the offset is 100,000, then the keys range from 10 - 32766 to 
10 + 32767, includes "0"
@@ -227,7 +233,7 @@ public class IntHashSet implements Posit
 // switch to 4
 if (TUNE) {System.out.println("Switching to 4 byte keys, Capacity 
increasing from " + oldCapacity + " to " + newCapacity);}
 for (short adjKey : oldKeys) {
-  if (adjKey != 0 && adjKey != Short.MIN_VALUE) {
+  if (adjKey != 0 && adjKey != REMOVED2) {
 addInner4(getRawFromAdjKey(adjKey));
   }
 }
@@ -235,7 +241,7 @@ public class IntHashSet implements Posit
   } else {
 if (TUNE) {System.out.println("Keeping 2 byte keys, Capacity 
increasing from " + oldCapacity + " to " + newCapacity);}
 for (short adjKey : oldKeys) {
-  if (adjKey != 0 && adjKey != Short.MIN_VALUE) {
+  if (adjKey != 0 && adjKey != REMOVED2) {
 addInner2(adjKey);
   }
 }
@@ -246,7 +252,7 @@ public class IntHashSet implements Posit
   if (TUNE) {System.out.println("Capacity increasing from " + oldCapacity 
+ " to " + newCapacity);}
   newTableKeepSize(newCapacity, true);
   for (int key : oldKeys) {
-if (key != 0 && key != Integer.MIN_VALUE) {
+if (key != 0 && key != REMOVED4) {
   addInner4(key);
 }
   }
@@ -321,25 +327,35 @@ public class IntHashSet implements Posit
   * @return the probeAddr in keys array - might have a 0 value, or the key 
value if found
   */
   private int findPosition(final int adjKey) {
+return findPosition(adjKey, false);
+  } 
+  
+  private int findPosition(final int adjKey, final boolean includeRemoved) {
 if (adjKey == 0) {
   throw new IllegalArgumentException("0 is an invalid key");
 }
 
-final int hash = JCasHashMap.hashInt(adjKey);
+final int hash = Misc.hashInt(adjKey);
 int nbrProbes = 1;
 int probeDelta = 1;
 int probeAddr;
+removedPositionToUse = -1;
 
 if (keys4 == null) {
   final short[] localKeys2 = keys2;
   final int bitMask = localKeys2.length - 1;
   probeAddr = hash & bitMask;
-  while (true) {
+
+   while (true) {
 final int testKey = localKeys2[probeAddr];
+if (includeRemoved && (removedPositionToUse == -1) && (testKey == 
REMOVED2)) {
+  nbrRemoved --;  // because caller will use this as a slot for adding
+  removedPositionToUse = probeAddr;
+}
 if (testKey == 0 || testKey == adjKey) {
-  break;
+   break;
 }
-nbrProbes++;
+nbrProbes++; 
 probeAddr = bitMask & (probeAddr + (probeDelta++));
   }
 } else {
@@ -348,6 +364,10 @@ public class IntHashSet implements Posit
   probeAddr = hash & bitMask;
   while (true) {
 final int 

svn commit: r1712101 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util: ComparableFSIterator.java ComparableIntPointerIterator.java Int2IntHashMap.jav

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 18:07:34 2015
New Revision: 1712101

URL: http://svn.apache.org/viewvc?rev=1712101&view=rev
Log:
[UIMA-4664] name change for 1 class, remove unused class

Added:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ComparableFSIterator.java
Removed:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ComparableIntPointerIterator.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/Int2IntHashMap.java

Added: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ComparableFSIterator.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ComparableFSIterator.java?rev=1712101&view=auto
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ComparableFSIterator.java
 (added)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ComparableFSIterator.java
 Mon Nov  2 18:07:34 2015
@@ -0,0 +1,40 @@
+/*
+ * 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.internal.util;
+
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.cas.TOP;
+
+/**
+ * Interface for a comparable FSIterator. 
+ * 
+ * This allows two iterators to be compared with each other.  Two IntIterators 
are compared according to the
+ * element that would be returned by the next call to next().
+ * 
+ * The purpose of this is for keeping multiple iterators, one for each subtype 
of a type, in a sorted order,
+ * when desiring to iterate over a type and its subtypes, in a combined merged 
order.
+ * 
+ * The comparable part is only needed for iterators over Sorted indexes. 
Iterators over Bags and Sets have no ordering requirement.
+ * 
+ */
+public interface ComparableFSIterator extends 
FSIterator, Comparable> {
+
+}




svn commit: r1712104 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 18:11:52 2015
New Revision: 1712104

URL: http://svn.apache.org/viewvc?rev=1712104&view=rev
Log:
[UIMA-4674] add utility support in Misc, including hash method, printing 
support, getting method handles for protected things

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java?rev=1712104&r1=1712103&r2=1712104&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java
 Mon Nov  2 18:11:52 2015
@@ -19,8 +19,24 @@
 
 package org.apache.uima.util;
 
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.function.Consumer;
+
+import org.apache.uima.cas.impl.TypeImpl;
+
 public class Misc {
 
+  public final static MethodHandles.Lookup UIMAlookup = MethodHandles.lookup();
+  
   /**
* 
* @param name of property
@@ -31,7 +47,202 @@ public class Misc {
   public static boolean getNoValueSystemProperty(String name) {
 return !System.getProperty(name, "false").equals("false");
   }
+  /**
+   * For standardized prettyprinting, to string.
+   * Adds a collection of things (toString) separated by , and surrounded by [ 
 ], to a StringBuilder
+   * @param sb where the formatted collection results are appended to 
+   * @param c the collection
+   * @return the StringBuilder for chaining
+   */
+  public static  StringBuilder addElementsToStringBuilder(StringBuilder sb, 
Collection c){
+sb.append('[');
+String[] prefix = new String[] {""};
+c.stream().forEachOrdered(item -> {
+   sb.append(prefix[0]);
+   sb.append(item.toString());
+   prefix[0] = ", ";
+});
+sb.append(']');
+return sb;
+  }
+  
+  /**
+   * For standardized prettyprinting, to string
+   * Adds a collection of things (running an appender to append the result to 
the same sb) separated by , and surrounded by [  ], to a StringBuilder
+   * @param sb where the formatted collection results are appended to 
+   * @param c the collection
+   * @return the StringBuilder for chaining
+   */
+  public static StringBuilder addElementsToStringBuilder(StringBuilder sb, 
Collection c, Consumer appender){
+sb.append('[');
+String[] prefix = new String[] {""};
+c.stream().forEachOrdered(item -> {
+   sb.append(prefix[0]);
+   appender.accept(item);
+   prefix[0] = ", ";
+});
+sb.append(']');
+return sb;
+  }  
   
+  /**
+   * Writes a byte array output stream to a file
+   * @param baos the array to write
+   * @param name the name of the file
+   */
+  public static void toFile(ByteArrayOutputStream baos, String name) {
+try (FileOutputStream fos = new FileOutputStream(name)) {
+  baos.writeTo(fos);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+
+  /**
+   * Writes a byte array output stream to a file
+   * @param baos the array to write
+   * @param name the file
+   */
+  public static void toFile(ByteArrayOutputStream baos, File file) {
+try (FileOutputStream fos = new FileOutputStream(file)) {
+  baos.writeTo(fos);
+} catch (IOException e) {
+  throw new RuntimeException(e);
+}
+  }
+  
+  /**
+   * For multi-core machine "tuning" - the number of cores
+   */
+  public static final int numberOfCores = 
Runtime.getRuntime().availableProcessors();
+  
+  /**
+   * Convert an int argument to the next higher power of 2 if not already a 
power of 2
+   * @param i the value to convert 
+   * @return the next higher power of 2, or i if it is already a power of 2
+   */
+  static public int nextHigherPowerOf2(int i) {
+return (i < 1) ? 1 : Integer.highestOneBit(i) << ( (Integer.bitCount(i) == 
1 ? 0 : 1));
+  }
+  
+  /**
+   * Given a class, a lookup context, and a protected method and its arg 
classes,
+   * return the method handle for that method.
+   * 
+   * Using that method handle is slow, but converting it to a lambda makes for
+   * JIT-able fast access.
+   * 
+   * @param clazz
+   * @param methodHandleAccessContext
+   * @param protectedMethod
+   * @param args
+   * @return
+   */
+  static public MethodHandle getProtectedMethodHandle(Class clazz, Lookup 
methodHandleAccessContext, String protectedMethod, Class ... args) {
+try {
+  Meth

svn commit: r1712105 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima: ./ cas/admin/ cas/impl/ pear/

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 18:12:47 2015
New Revision: 1712105

URL: http://svn.apache.org/viewvc?rev=1712105&view=rev
Log:
[UIMA-4674] update exception method property files

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/admin/admin_errors.properties

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/impl/annot_impl.properties

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/cas/impl/ll_runtimeException.properties

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/pear/pear_messages.properties

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties?rev=1712105&r1=1712104&r2=1712105&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/resources/org/apache/uima/UIMAException_Messages.properties
 Mon Nov  2 18:12:47 2015
@@ -59,6 +59,8 @@ illegal_adding_of_new_meta_info = Illega
 
 illegal_update_indexed_fs = Illegal update of indexed Feature Structure 
feature used as an key in one or more indices
 
+INTERNAL_ERROR = An internal error occurred, please report to the Apache UIMA 
project; nested exception if present: {0}
+
 #--
 #UIMA_IllegalStateException
 #--  
@@ -530,13 +532,17 @@ NON_CREATABLE_TYPE = Can''t create FS of
 ILLEGAL_ARRAY_SIZE = Array size must be >= 0.
 INAPPROP_TYPE = Expected value of type "{0}", but found "{1}".
 INAPPROP_FEAT = Feature "{0}" is not defined for type "{1}".
+INAPPROP_FEAT_X = Feature is not defined for type.
 INAPPROP_RANGE = Trying to access value of feature "{0}" as "{1}", but range 
of feature is "{2}".
+SET_REF_FROM_STRING_NOT_SUPPORTED = Setting a reference value "{0}" from a 
string is not supported.
 PRIMITIVE_VAL_FEAT = Trying to access value of feature "{0}" as feature 
structure, but is primitive type.
 TYPESYSTEM_NOT_LOCKED = Error accessing type system: the type system has not 
been committed.
 ILLEGAL_STRING_VALUE = Error setting string value: string "{0}" is not valid 
for a value of type "{1}".
 UNKNOWN_CONSTRAINT_TYPE = Error applying FS constraint: no type "{0}" in 
current type system.
 UNKNOWN_CONSTRAINT_FEAT = Error applying FS constraint: no feature "{0}" in 
current type system.
 CHILD_INDEX_OOB = Error accessing child node in tree, index out of range.
+JCAS_CAS_NOT_V3 = JCas Class "{0}" is missing required constructor; likely 
cause is wrong version (UIMA version 3 or later JCas required).
+JCAS_MISSING_FIELD_ACCESSOR = JCas Class "{0}" is missing required field 
accessor, or access not permitted, for field "{1}" during {2} operation.
 JCAS_CAS_MISMATCH = CAS type system doesn''t match JCas Type definition for 
type "{0}".
 JCAS_TYPE_NOT_IN_CAS = JCas type "{0}" used in Java code,  but was not 
declared in the XML type descriptor.
 JCAS_UNKNOWN_TYPE_NOT_IN_CAS = Unknown JCas type used in Java code but was not 
declared or imported in the XML descriptor for this component.
@@ -567,5 +573,11 @@ INVALID_MARKER = Marker is invalid.
 MULTIPLE_CREATE_MARKER = CreateMarker called multiple times for one CAS.  This 
implementation only supports one call.
 DESERIALIZING_BINARY_INVALID_HEADER = While deserializing binary CAS, found 
invalid header.
 DESERIALIZING_COMPRESSED_BINARY_UNSUPPORTED = Using the reinit method to 
deserialize a binary CAS serialized with compressed serialization not supported 
for this case.
-DEREF_FS_OTHER_CAS = Dereferencing a FeatureStructure of a CAS in a different 
CAS's context. This can happen if you try to set a feature structure reference 
to a value of a feature structure belonging to an entirely different CAS. FS = 
"{0}", CAS = "{1}".
+DEREF_FS_OTHER_CAS = Dereferencing a FeatureStructure of a CAS in a different 
CAS''s context. This can happen if you try to set a feature structure reference 
to a value of a feature structure belonging to an entirely different CAS. FS = 
"{0}", CAS = "{1}".
 ILLEGAL_FEAT_SET = While a FeatureStructure was in the index, an illegal 
attempt was made to modify Feature "{0}" which is used as a key in one or more 
indices; the Feature Structure being modified was "{1}".
+ILLEGAL_SOFAREF_MODIFICATION = Sofa reference in AnnotationBase may not be 
modified.
+NOT_SUPPORTED_NO_HEAP_IN_UIMA_V3 = This method depends on having a CAS Heap 
design, and is not support in UIMA Version 3 and l

svn commit: r1712106 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/lang: LanguagePair.java LanguagePair_Type.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 18:14:55 2015
New Revision: 1712106

URL: http://svn.apache.org/viewvc?rev=1712106&view=rev
Log:
[UIMA-4666] redo some JCas gen'd classes needed for test cases

Removed:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/lang/LanguagePair_Type.java
Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/lang/LanguagePair.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/lang/LanguagePair.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/lang/LanguagePair.java?rev=1712106&r1=1712105&r2=1712106&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/lang/LanguagePair.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/lang/LanguagePair.java
 Mon Nov  2 18:14:55 2015
@@ -1,109 +1,139 @@
-/*
- * 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.lang;
 
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.cas.TOP;
-import org.apache.uima.jcas.cas.TOP_Type;
+   
+/* Apache UIMA v3 - First created by JCasGen Mon Oct 19 15:16:52 EDT 2015 */
 
-/* comment 7 of 14 */
-public class LanguagePair extends TOP {
+package org.apache.lang;
 
-  public final static int typeIndexID = 
org.apache.uima.jcas.JCasRegistry.register(LanguagePair.class);
+import java.util.List;
 
-  public final static int type = typeIndexID;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.FeatureImpl;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas; 
+import org.apache.uima.jcas.JCasRegistry;
 
-  public int getTypeIndexID() {
-return typeIndexID;
-  }
-
-  // Never called. Disable default constructor
-  protected LanguagePair() {
-  }
+import org.apache.uima.jcas.cas.TOP;
 
- /* Internal - Constructor used by generator */
-  public LanguagePair(int addr, TOP_Type type) {
-super(addr, type);
-  }
 
+/** 
+ * Updated by JCasGen Mon Oct 19 15:16:52 EDT 2015
+ * XML source: 
C:/au/svnCheckouts/branches/uimaj/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/generatedx.xml
+ * @generated */
+public class LanguagePair extends TOP {
+  /** @generated
+   * @ordered 
+   */
+  @SuppressWarnings ("hiding")
+  public final static int typeIndexID = 
JCasRegistry.register(LanguagePair.class);
+  /** @generated
+   * @ordered 
+   */
+  @SuppressWarnings ("hiding")
+  public final static int type = typeIndexID;
+  /** @generated
+   * @return index of the type  
+   */
+  @Override
+  public  int getTypeIndexID() {return typeIndexID;}
+ 
+
+  /* *
+   *Local Data   *
+   * */ 
+   private String _F_lang1;  // 
+   private String _F_lang2;  // 
+   private String _F_description;  // 
+   
+//   private final int lang1_featCode;
+//   private final int lang2_featCode;
+//   private final int description_featCode;
+ 
+   /** Never called.  Disable default constructor
+   * @generated */
+  protected LanguagePair() {}
+
+  /** Internal - constructor used by generator 
+   * @generated
+   * @param casImpl the CAS this Feature Structure belongs to
+   * @param type the type of this Feature Structure 
+   */
+  public LanguagePair(TypeImpl type, CASImpl casImpl) {
+super(type, casImpl);
+readObject();
+  }
+  
+  /** @generated
+   * @param jcas JCas to which this Feature Structure belongs 
+   */
   public LanguagePair(JCas jcas) {
 super(jcas);
-  }
+readObject();   
+  } 
 
-  /**
-   *  Write your own initialization here 
-   * 
-   * @generated modifiable
+  /** 
+   * 
+   * Write your own initialization here
+   * 
+   *
+   * @generated modifiable 
+   */
+  private void readObject() {/*default - does nothing empty block */}
+ 
+ 
+
+  //*--*
+  //* Feature: lang1
+
+  /** getter for lang1 - gets 
+   * @generated
+   * @return value of the feature 
+   */
+  public String getLang1() { return _F_lang1;}
+
+  

svn commit: r1712109 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 18:17:37 2015
New Revision: 1712109

URL: http://svn.apache.org/viewvc?rev=1712109&view=rev
Log:
[UIMA-4677] test case for FS ID management

Added:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java

Added: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java?rev=1712109&view=auto
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java
 (added)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java
 Mon Nov  2 18:17:37 2015
@@ -0,0 +1,123 @@
+/*
+ * 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.cas.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASRuntimeException;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.test.CASInitializer;
+import org.apache.uima.cas.test.CASTestSetup;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.TOP;
+
+import junit.framework.TestCase;
+
+public class Id2FSTest extends TestCase {
+
+  Id2FS id2fs;
+  CASImpl cas;
+  JCas jcas;
+  TypeSystem ts;
+
+  public void setUp() {
+try {
+  this.cas = (CASImpl) CASInitializer.initCas(new CASTestSetup());
+  this.jcas = cas.getJCas();
+  this.ts = this.cas.getTypeSystem();
+} catch (Exception e) {
+  assertTrue(false);
+}
+  }
+
+  public void testStuff() throws InterruptedException {
+// the normal cas APIs use the gc mode
+
+TOP fs1 = new TOP(jcas);
+
+int lastUsedId = fs1.get_id();
+assertEquals(fs1, cas.getFsFromId(lastUsedId));
+// make 20 more that could be gc'd
+
+for (int i = 0; i < 20; i++) {
+  new TOP(jcas);
+}
+   
+// verify they can be found by id #
+TOP fsh = null;
+for (int i = 0; i < 20; i++) {
+  TOP fs = cas.getFsFromId(i + 2);
+  if (i == 0) {  // hold onto one so gc doesn't get it
+fsh = fs;
+  }
+  assertEquals(fs._id, i + 2);  
+}
+
+// remove 19 of them
+System.gc();
+Thread.sleep(10);  // in case gc needs time to finish
+assertTrue(fsh == cas.getFsFromId(2));
+
+for (int i = 1; i < 20; i++) {
+  boolean caught = false;
+  try {
+TOP fs = cas.getFsFromId(i + 2);
+  } catch (CASRuntimeException e) {
+caught = true;
+  }
+  assertTrue(caught);
+  
+  caught = false;
+  try {
+TOP fs = cas.getFsFromId_checked(i + 2);
+  } catch (CASRuntimeException e) {
+caught = true;
+  }
+  assertTrue(caught);
+}
+
+Id2FS id2fs = new Id2FS(false);  // non gc mode
+cas.reset();
+fs1 = new TOP(jcas);
+
+id2fs.add(fs1);
+lastUsedId = fs1.get_id();
+assertEquals(fs1, id2fs.get(lastUsedId));
+
+for (int i = 0; i < 20; i++) {
+  id2fs.add(new TOP(jcas));
+}
+// verify they can be found by id #
+for (int i = 0; i < 20; i++) {
+  TOP fs = id2fs.get(i + 2);
+  assertEquals(fs._id, i + 2);  
+} 
+
+// remove 20 of them
+System.gc();
+Thread.sleep(10);  // in case gc needs time to finish 
+for (int i = 0; i < 20; i++) {
+  TOP fs = id2fs.get(i + 2);
+  assertEquals(fs._id, i + 2);
+}
+  }
+
+}




svn commit: r1712108 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasPoolTest.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 18:17:08 2015
New Revision: 1712108

URL: http://svn.apache.org/viewvc?rev=1712108&view=rev
Log:
[UIMA-4674] update ref to method moved to Misc class

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasPoolTest.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasPoolTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasPoolTest.java?rev=1712108&r1=1712107&r2=1712108&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasPoolTest.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/CasPoolTest.java
 Mon Nov  2 18:17:08 2015
@@ -25,9 +25,6 @@ import java.util.Properties;
 import java.util.Random;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.analysis_engine.AnalysisEngine;
 import org.apache.uima.analysis_engine.AnalysisEngineDescription;
@@ -37,14 +34,17 @@ import org.apache.uima.impl.ChildUimaCon
 import org.apache.uima.impl.RootUimaContext_impl;
 import org.apache.uima.impl.UimaContext_ImplBase;
 import org.apache.uima.internal.util.MultiThreadUtils;
-import org.apache.uima.internal.util.Utilities;
 import org.apache.uima.resource.CasManager;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.test.junit_extension.JUnitExtension;
 import org.apache.uima.util.InvalidXMLException;
+import org.apache.uima.util.Misc;
 import org.apache.uima.util.XMLInputSource;
 import org.apache.uima.util.XMLizable;
 
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
 
 public class CasPoolTest extends TestCase {
 
@@ -80,7 +80,7 @@ public class CasPoolTest extends TestCas
   public void testMultiThread() throws Exception {
 final Properties p = new Properties();
 p.put(UIMAFramework.CAS_INITIAL_HEAP_SIZE,  200);   
-int numberOfThreads = Math.min(50, Utilities.numberOfCores * 10);
+int numberOfThreads = Math.min(50, Misc.numberOfCores * 10);
 final int casPoolSize = numberOfThreads / 3 ;
 System.out.format("test CasPools with %d threads and %d CASes",
 numberOfThreads, casPoolSize);




svn commit: r1712113 - in /uima/sandbox/uima-ducc/trunk: uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/StateServices.java uima-ducc-sm/src/main/java/org/apache/uima/d

2015-11-02 Thread challngr
Author: challngr
Date: Mon Nov  2 19:07:56 2015
New Revision: 1712113

URL: http://svn.apache.org/viewvc?rev=1712113&view=rev
Log:
UIMA-4587 Add sync to properties store.  Adjust ping-only ServiceInstance 
start() signature.

Modified:

uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/StateServices.java

uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/PingOnlyServiceInstance.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/StateServices.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/StateServices.java?rev=1712113&r1=1712112&r2=1712113&view=diff
==
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/StateServices.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/persistence/services/StateServices.java
 Mon Nov  2 19:07:56 2015
@@ -149,7 +149,7 @@ public class StateServices implements IS
}
 
 // Try to write properties file, using a temp file as backup in case it 
fails.
-private boolean writeProperties(DuccId id, Properties props, File pfile, 
File pfile_tmp, String type)
+private synchronized boolean writeProperties(DuccId id, Properties props, 
File pfile, File pfile_tmp, String type)
 {

String methodName = "saveProperties";

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/PingOnlyServiceInstance.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/PingOnlyServiceInstance.java?rev=1712113&r1=1712112&r2=1712113&view=diff
==
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/PingOnlyServiceInstance.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/PingOnlyServiceInstance.java
 Mon Nov  2 19:07:56 2015
@@ -46,7 +46,7 @@ class PingOnlyServiceInstance
 // this.state = dwj.getJobState();
 // }
 
-long start(String spec, DuccProperties meta_props)
+long start(DuccProperties svc_props, DuccProperties meta_props)
 {
String methodName = "start";
 




svn commit: r1712117 - /uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java

2015-11-02 Thread challngr
Author: challngr
Date: Mon Nov  2 19:15:07 2015
New Revision: 1712117

URL: http://svn.apache.org/viewvc?rev=1712117&view=rev
Log:
UIMA-4587 Stop updating meta state after unregister.  Happens if state 
continues to arrive after unregister.

Modified:

uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java?rev=1712117&r1=1712116&r2=1712117&view=diff
==
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceSet.java
 Mon Nov  2 19:15:07 2015
@@ -842,8 +842,10 @@ public class ServiceSet
throws Exception
 {
// String methodName = "saveMetaProperties";
-// UIMA-4587 Why bypass, as state can still dribble in.
-// if ( isDeregistered() ) return;
+if ( isDeregistered() ) return;// we may have deleted 
the properties but stuff
+   // lingers out of our 
control.  no more updates
+   // which can leave junk 
in the registry directory
+   // for file-based 
registry.
 
 prepareMetaProperties();
 stateHandler.updateMetaProperties(id, meta_props);




svn commit: r1712120 - in /uima/sandbox/uima-ducc/trunk/src/main/admin: database.py db.py db_console

2015-11-02 Thread challngr
Author: challngr
Date: Mon Nov  2 19:20:33 2015
New Revision: 1712120

URL: http://svn.apache.org/viewvc?rev=1712120&view=rev
Log:
UIMA-4577 Remove unused code.

Removed:
uima/sandbox/uima-ducc/trunk/src/main/admin/database.py
uima/sandbox/uima-ducc/trunk/src/main/admin/db.py
uima/sandbox/uima-ducc/trunk/src/main/admin/db_console



svn commit: r1712124 - /uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java

2015-11-02 Thread degenaro
Author: degenaro
Date: Mon Nov  2 19:29:55 2015
New Revision: 1712124

URL: http://svn.apache.org/viewvc?rev=1712124&view=rev
Log:
UIMA-4684 DUCC daemons log-to-file should never give up

Modified:

uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java

Modified: 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java?rev=1712124&r1=1712123&r2=1712124&view=diff
==
--- 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java
 (original)
+++ 
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java
 Mon Nov  2 19:29:55 2015
@@ -18,10 +18,13 @@
 */
 package org.apache.uima.ducc.common.utils;
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.log4j.Appender;
 import org.apache.log4j.Category;
@@ -47,7 +50,7 @@ public class DuccLogger
 
 private static DuccLoggingThread log_thread = null;
 private static LinkedBlockingQueue events = null;
-private static boolean threaded = false;
+private static AtomicBoolean threaded = new AtomicBoolean(false);
 private static boolean watchdogStarted = false;
 
 private final static String DEFAULT_COMPONENT = "DUCC";
@@ -130,12 +133,13 @@ public class DuccLogger
 
 static public void setUnthreaded()
 {
-threaded = false;
+//threaded.set(true);
+System.out.println("setUnthreaded is not supported.");
 }
 
 static public void setThreaded()
 {
-threaded = false;;
+   threaded.set(true);
 }
 
 public DuccLogger(String claz, String component)
@@ -374,7 +378,7 @@ public class DuccLogger
 public void doAppend(Level level, String method, DuccId jobid, String msg, 
Throwable t)
 {
 DuccLoggingEvent ev = new DuccLoggingEvent(logger, component, level, 
method, jobid, msg, t, Thread.currentThread().getId(), 
Thread.currentThread().getName());
-if ( threaded ) {
+if ( threaded.get() ) {
 events.offer(ev);
 } else {
 doLog(ev);
@@ -384,7 +388,7 @@ public class DuccLogger
 public void doAppend(Level level, String method, DuccId jobid, String msg)
 {
 DuccLoggingEvent ev = new DuccLoggingEvent(logger, component, level, 
method, jobid, msg, null, Thread.currentThread().getId(), 
Thread.currentThread().getName());
-if ( threaded ) {
+if ( threaded.get() ) {
 events.offer(ev);
 } else {
 doLog(ev);
@@ -564,7 +568,7 @@ public class DuccLogger
  */
 public void shutdown()
 {
-if ( threaded ) {
+if ( threaded.get() ) {
 DuccLoggingEvent ev = new DuccLoggingEvent(null, null, null, null, 
null, null, null, 0, null);
 ev.done = true;
 events.offer(ev);
@@ -629,9 +633,17 @@ public class DuccLogger
 }
 } catch (Throwable t) {
 loggingError = null;
-System.out.println("Disabling logging due to logging exception.");
-disable_logger = true;
-throw new LoggingException("Error writing to DUCC logs", t);
+if( threaded.get() ) {
+   System.out.println("Disabling logging due to logging 
exception.");
+disable_logger = true;
+throw new LoggingException("Error writing to DUCC logs", t);
+}
+else {
+   StringWriter errors = new StringWriter();
+t.printStackTrace(new PrintWriter(errors));
+System.out.println(errors.toString());
+System.out.println("Unable to log due to logging exception.");
+}
 }
 }
 




svn commit: r1712126 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 19:48:23 2015
New Revision: 1712126

URL: http://svn.apache.org/viewvc?rev=1712126&view=rev
Log:
[UIMA-4670] add common default methods in for internationalization

Added:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java

Added: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java?rev=1712126&view=auto
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java
 (added)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/I18nExceptionI.java
 Mon Nov  2 19:48:23 2015
@@ -0,0 +1,107 @@
+/*
+ * 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;
+
+import java.util.Locale;
+
+import org.apache.uima.internal.util.I18nUtil;
+
+/**
+ * Like InternationalizedException, but is an interface with default methods.
+ * 
+ * This common set of default implementations are intended to be added to 
+ * sets of messages collected into exception classes, which implement this,
+ * and separately extend one of the 3 superclasses:
+ *   - Exception (for checked exceptions)
+ *   - RuntimeException (for unchecked exceptions)
+ *   - SaxException (for exceptions within XML parsing code
+ *   
+ */
+public interface I18nExceptionI {
+  
+String getResourceBundleName();   // like getMessageCatalog?
+String getMessageKey();
+Object[] getArguments();
+Throwable getCause();
+
+/** 
+ * Due to the fact that superclass definitions override any
+ * default methods, these next must be in the class definitions
+ * as they override other supertype methods.
+ */
+
+String getMessage();
+String getLocalizedMessage();
+
+///**
+// * @return The message of the exception. Useful for including the text 
in another exception.
+// */
+//default String getMessage() {
+//  return getLocalizedMessage(Locale.ENGLISH);
+//}
+//
+///**
+// * Gets the localized detail message for this exception. This uses the
+// * default Locale for this JVM. A Locale may be specified using
+// * {@link #getLocalizedMessage(Locale)}.
+// * 
+// * @return this exception's detail message, localized for the default 
Locale.
+// */
+//default String getLocalizedMessage() {
+//  return getLocalizedMessage(Locale.getDefault());
+//}
+
+/**
+ * Gets the localized detail message for this exception using the specified
+ * Locale.
+ * 
+ * @param aLocale
+ *   the locale to use for localizing the message
+ * 
+ * @return this exception's detail message, localized for the specified
+ * Locale.
+ */
+default String getLocalizedMessage(Locale aLocale) {
+   // check for null message
+   if (getMessageKey() == null)
+  return null;
+
+   return I18nUtil.localizeMessage(getResourceBundleName(), aLocale, 
getMessageKey(), getArguments());
+}
+
+/**
+ * Checks if this exception, or any of its root causes, has a particular 
UIMA
+ * message key. This allows checking for particular error condition in 
test cases
+ * 
+ * @param messageKey
+ *   to search for in the exception chain
+ * @return true if this exception or any of its root causes has a 
particular UIMA message key.
+ */
+default boolean hasMessageKey(String messageKey) {
+   if (messageKey.equals(this.getMessageKey())) {
+  return true;
+   }
+   Throwable cause = getCause();
+   if (cause != null && cause instanceof I18nExceptionI) {
+  return ((I18nExceptionI) cause).hasMessageKey(messageKey);
+   }
+   return false;
+}
+}




svn commit: r1712133 - /uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install

2015-11-02 Thread challngr
Author: challngr
Date: Mon Nov  2 20:03:01 2015
New Revision: 1712133

URL: http://svn.apache.org/viewvc?rev=1712133&view=rev
Log:
UIMA-4577 Remove obsolete 'database' module.

Modified:
uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install
URL: 
http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install?rev=1712133&r1=1712132&r2=1712133&view=diff
==
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install Mon Nov  2 
20:03:01 2015
@@ -37,8 +37,6 @@ from ducc_base import which
 
 from ducc import Ducc
 
-import database as db
-
 class PostInstall():
 
 def usage(self, msg):




svn commit: r1712141 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMASaxException.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:31:52 2015
New Revision: 1712141

URL: http://svn.apache.org/viewvc?rev=1712141&view=rev
Log:
[UIMA-4670] sax exception support 

Added:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMASaxException.java

Added: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMASaxException.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMASaxException.java?rev=1712141&view=auto
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMASaxException.java
 (added)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMASaxException.java
 Mon Nov  2 20:31:52 2015
@@ -0,0 +1,228 @@
+/*
+ * 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;
+
+import java.util.Locale;
+
+import org.xml.sax.SAXException;
+
+/**
+ * This is the superclass for all SaxExceptions in UIMA.
+ * It provides the link to common implementation in i18nExceptionI (via 
default methods), and
+ * extends SAXException.
+ * 
+ * It supplies a messages properties file 
org.apache.uima.UIMASaxException_Messages
+ */
+public class UIMASaxException extends SAXException implements I18nExceptionI {
+
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * The name of the {@link java.util.ResourceBundle ResourceBundle} 
containing the standard UIMA
+   * Exception messages.
+   */
+  public static final String STANDARD_MESSAGE_CATALOG = 
"org.apache.uima.UIMASaxException_Messages";
+
+  /**
+   * The base name of the resource bundle in which the message for this
+   * exception is located.
+   */
+  private String mResourceBundleName;
+
+  /**
+   * An identifier that maps to the message for this exception.
+   */
+  private String mMessageKey;
+
+  /**
+   * The arguments to this exception's message, if any. This allows an
+   * InternationalizedException to have a compound message, made
+   * up of multiple parts that are concatenated in a language-neutral way.
+   */
+  private Object[] mArguments;
+
+  /**
+   * The exception that caused this exception to occur.
+   */
+  private Throwable mCause;
+
+  /**
+   * Creates a new exception with a null message.
+   */
+  public UIMASaxException() {
+super();
+  }
+
+  /**
+   * Creates a new exception with the specified cause and a null message.
+   * 
+   * @param aCause
+   *  the original exception that caused this exception to be thrown, 
if any
+   */
+  public UIMASaxException(Exception aCause) {
+super(aCause);
+  }
+
+  /**
+   * Creates a new exception with a the specified message.
+   * 
+   * @param aResourceBundleName
+   *  the base name of the resource bundle in which the message for 
this exception is
+   *  located.
+   * @param aMessageKey
+   *  an identifier that maps to the message for this exception. The 
message may contain
+   *  placeholders for arguments as defined by the
+   *  {@link java.text.MessageFormat MessageFormat} class.
+   * @param aArguments
+   *  The arguments to the message. null may be used if 
the message has no
+   *  arguments.
+   */
+  public UIMASaxException(String aResourceBundleName, String aMessageKey, 
Object[] aArguments) {
+this(aResourceBundleName, aMessageKey, aArguments, null);
+  }
+
+  /**
+   * Creates a new exception with the specified message and cause.
+   * 
+   * @param aResourceBundleName
+   *  the base name of the resource bundle in which the message for 
this exception is
+   *  located.
+   * @param aMessageKey
+   *  an identifier that maps to the message for this exception. The 
message may contain
+   *  placeholders for arguments as defined by the
+   *  {@link java.text.MessageFormat MessageFormat} class.
+   * @param aArguments
+   *  The arguments to the message. null may be used if 
the message has no
+   *  arguments.
+   * @param aCause
+   *  the original exception that caused this exceptio

svn commit: r1712142 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima: UIMAException.java UIMARuntimeException.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:32:33 2015
New Revision: 1712142

URL: http://svn.apache.org/viewvc?rev=1712142&view=rev
Log:
[UIMA-4670] exception support 

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMAException.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMARuntimeException.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMAException.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMAException.java?rev=1712142&r1=1712141&r2=1712142&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMAException.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/UIMAException.java
 Mon Nov  2 20:32:33 2015
@@ -19,8 +19,13 @@
 
 package org.apache.uima;
 
+import java.util.Locale;
+
 /**
- * This is the superclass for all exceptions in UIMA.
+ * This is the superclass for all checked exceptions in UIMA.
+ * 
+ * It adds use of a "standard" bundle resource, if the subclasses don't define 
this.
+ * 
  * 
  * UIMAException extends {@link InternationalizedException} for 
internationalization
  * support. Since UIMA Exceptions are internationalized, the thrower does not 
supply a hardcoded
@@ -35,7 +40,7 @@ package org.apache.uima;
  * 
  * 
  */
-public class UIMAException extends InternationalizedException {
+public class UIMAException extends Exception implements I18nExceptionI {
 
   private static final long serialVersionUID = 7521732353239537026L;
 
@@ -46,6 +51,29 @@ public class UIMAException extends Inter
   public static final String STANDARD_MESSAGE_CATALOG = 
"org.apache.uima.UIMAException_Messages";
 
   /**
+   * The base name of the resource bundle in which the message for this
+   * exception is located.
+   */
+  private String mResourceBundleName;
+
+  /**
+   * An identifier that maps to the message for this exception.
+   */
+  private String mMessageKey;
+
+  /**
+   * The arguments to this exception's message, if any. This allows an
+   * InternationalizedException to have a compound message, made
+   * up of multiple parts that are concatenated in a language-neutral way.
+   */
+  private Object[] mArguments;
+
+  /**
+   * The exception that caused this exception to occur.
+   */
+  private Throwable mCause;
+
+  /**
* Creates a new exception with a null message.
*/
   public UIMAException() {
@@ -76,8 +104,8 @@ public class UIMAException extends Inter
*  The arguments to the message. null may be used if 
the message has no
*  arguments.
*/
-  public UIMAException(String aResourceBundleName, String aMessageKey, 
Object[] aArguments) {
-super(aResourceBundleName, aMessageKey, aArguments);
+  public UIMAException(String aResourceBundleName, String aMessageKey, Object 
... aArguments) {
+this(aResourceBundleName, aMessageKey, aArguments, null);
   }
 
   /**
@@ -98,7 +126,11 @@ public class UIMAException extends Inter
*/
   public UIMAException(String aResourceBundleName, String aMessageKey, 
Object[] aArguments,
   Throwable aCause) {
-super(aResourceBundleName, aMessageKey, aArguments, aCause);
+super();
+this.mResourceBundleName = aResourceBundleName;
+this.mMessageKey = aMessageKey;
+this.mArguments = aArguments;
+this.mCause = aCause;
   }
 
   /**
@@ -113,7 +145,7 @@ public class UIMAException extends Inter
*  arguments.
*/
   public UIMAException(String aMessageKey, Object[] aArguments) {
-super(STANDARD_MESSAGE_CATALOG, aMessageKey, aArguments);
+this(STANDARD_MESSAGE_CATALOG, aMessageKey, aArguments, null);
   }
 
   /**
@@ -131,6 +163,77 @@ public class UIMAException extends Inter
*  the original exception that caused this exception to be thrown, 
if any
*/
   public UIMAException(String aMessageKey, Object[] aArguments, Throwable 
aCause) {
-super(STANDARD_MESSAGE_CATALOG, aMessageKey, aArguments, aCause);
+this(STANDARD_MESSAGE_CATALOG, aMessageKey, aArguments, aCause);
+  }
+  
+  /**
+   * Gets the cause of this Exception.
+   * 
+   * @return the Throwable that caused this Exception to occur, if any. Returns
+   * null if there is no such cause.
+   */
+  public Throwable getCause() {
+ return mCause;
+  }
+
+  public synchronized Throwable initCause(Throwable cause) {
+ mCause = cause;
+ return this;
+  }
+  
+  /**
+   * Gets the base name of the resource bundle in which the message for this
+   * exception is located.
+   * 
+   * @return the resource bundle base name. May return null if
+   * this exception has no message.
+   */
+  public String getResourceBundleName() {
+ return mResourceBundleName;
+  }
+
+  /**
+   * Gets the identif

svn commit: r1712143 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/package.html

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:33:00 2015
New Revision: 1712143

URL: http://svn.apache.org/viewvc?rev=1712143&view=rev
Log:
[UIMA-4670] exception support javadocs

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/package.html

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/package.html
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/package.html?rev=1712143&r1=1712142&r2=1712143&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/package.html
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/package.html
 Mon Nov  2 20:33:00 2015
@@ -19,8 +19,27 @@
 ***
-->
 
-The main package for the Unstructured Information Management Middleware 
-Architecture.  The {@link org.apache.uima.UIMAFramework} class provides the 
primary 
-interface point for applications.
+
+Apache UIMA
+This package contains:
+
+The {@link org.apache.uima.UIMAFramework} class provides the primary 
interface point for applications.
+Most of the error / exception indirection classes (to allow IDEs to do 
auto-complete looking for messages).
+
+Internationalized Exceptions and Messages
+Internationalization is handled by the static methods in I18nUtil. 
 These are called by the Internationalized Exceptions, but may be also 
used for non-exception message localization.
+Exception messages are collected into classes.  These classes may be 
organized further into hierarchies, but the top of these extend one of the 
following 3 classes:
+
+Exception - for checked exceptions
+RuntimeException - for unchecked exceptions
+SaxException - for exceptions thrown during Sax related callbacks 
requiring SaxExceptions be thrown
+
+Common code for getting a localized message from arguments and message key 
and resource bundle are put in the interface I18nExceptionI as default methods. 
Using default methods allows shared methods to be used with different 
superclass chains.
+The individual classes:
+
+hold static public MSG_NAME = "prop-file-key-name" values, allow IDE 
search via completion, allows renaming via Eclipse refactorization
+Classes collect messages for some sub-section of the code
+Super class structure can supply common resource bundles
+
 
 




svn commit: r1712144 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:33:58 2015
New Revision: 1712144

URL: http://svn.apache.org/viewvc?rev=1712144&view=rev
Log:
[UIMA-4679] add better error checking for missing setters/getters

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java?rev=1712144&r1=1712143&r2=1712144&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
 Mon Nov  2 20:33:58 2015
@@ -52,6 +52,7 @@ import org.apache.uima.cas.function.JCas
 import org.apache.uima.cas.function.JCas_setter_int;
 import org.apache.uima.cas.function.JCas_setter_long;
 import org.apache.uima.cas.function.JCas_setter_short;
+import org.apache.uima.jcas.cas.AnnotationBase;
 import org.apache.uima.jcas.cas.Sofa;
 import org.apache.uima.jcas.cas.TOP;
 import org.apache.uima.util.Misc;
@@ -124,7 +125,10 @@ public class FSClassRegistry {
   
   private static final MethodType fsGeneratorType  = 
methodType(FeatureStructureImplC.class, TypeImpl.class, CASImpl.class);
   private static final MethodType fsGeneratorArrayType = 
methodType(FeatureStructureImplC.class, TypeImpl.class, CASImpl.class, 
int.class);
-  
+
+  // must preceed first (static) use
+  static private ThreadLocal> errorSet = new 
ThreadLocal>();
+
   public static class GetterSetter {
 final Object getter;
 final Object setter;
@@ -171,8 +175,6 @@ public class FSClassRegistry {
 
 reportErrors();
   }
-
-  static private ThreadLocal> errorSet = new 
ThreadLocal>();
   
   // the loaded JCas cover classes, generators, setters, and getters.  index 
is typecode; value is JCas cover class which may belong to a supertype.
   private final JCasClassInfo[] jcasClassesInfo; 
@@ -367,7 +369,10 @@ public class FSClassRegistry {
 : (JCas_setter_generic) 
callSite.getTarget().invokeExact();
   }
 } catch (NoSuchMethodException e) {
-  if (jcasClass == Sofa.class && !isGetter) {return null;}  // this one 
case is ok, setters blocked for sofa
+  if ((jcasClass == Sofa.class && !isGetter) ||
+  (jcasClass == AnnotationBase.class && !isGetter)) {
+return null;
+  }  
   // report missing setter or getter
   CASException casEx = new 
CASException(CASException.JCAS_FEATURENOTFOUND_ERROR, 
   jcasClass.getName(), 




svn commit: r1712145 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:35:15 2015
New Revision: 1712145

URL: http://svn.apache.org/viewvc?rev=1712145&view=rev
Log:
[UIMA-4667] complete connection of type system impl to cas instance

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1712145&r1=1712144&r2=1712145&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 Mon Nov  2 20:35:15 2015
@@ -351,8 +351,9 @@ public class CASImpl extends AbstractCas
 // unique ID for a created CAS view, not updated if CAS is reset and reused
 private final int casId = casIdProvider.incrementAndGet();
 
-private SharedViewData(CASImpl baseCAS) {
+private SharedViewData(CASImpl baseCAS, TypeSystemImpl tsi) {
   this.baseCAS = baseCAS;
+  this.tsi = tsi;
 }
   }
   
@@ -469,7 +470,7 @@ public class CASImpl extends AbstractCas
   // FSClassRegistry instances
 }
 
-this.svd = new SharedViewData(this);
+this.svd = new SharedViewData(this, ts);
 //this.svd.baseCAS = this;
 
 //this.svd.heap = new Heap(initialHeapSize);




svn commit: r1712147 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ObjHashSet.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:36:37 2015
New Revision: 1712147

URL: http://svn.apache.org/viewvc?rev=1712147&view=rev
Log:
no Jira - turn off debug message

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ObjHashSet.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ObjHashSet.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ObjHashSet.java?rev=1712147&r1=1712146&r2=1712147&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ObjHashSet.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/internal/util/ObjHashSet.java
 Mon Nov  2 20:36:37 2015
@@ -46,7 +46,7 @@ public class ObjHashSet implements Co
   public static final float DEFAULT_LOAD_FACTOR = 0.66F;
   // set to true to collect statistics for tuning
   // you have to also put a call to showHistogram() at the end of the run
-  private static final boolean TUNE = true;
+  private static final boolean TUNE = false;
 
   private final static FeatureStructureImplC REMOVED = new 
FeatureStructureImplC();
 




svn commit: r1712146 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl: FeatureStructureImplC.java TypeSystemImpl.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:36:03 2015
New Revision: 1712146

URL: http://svn.apache.org/viewvc?rev=1712146&view=rev
Log:
[UIMA-4674] missing cast, wrong Java class spec for some built-ins, wrong 
import for Annotator

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1712146&r1=1712145&r2=1712146&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
 Mon Nov  2 20:36:03 2015
@@ -644,7 +644,7 @@ public class FeatureStructureImplC imple
   CommonArray original = (CommonArray) this;
   CommonArray copy = _casView.createArray(_typeImpl.getCode(), 
original.size());
   copy.copyValuesFrom(original);  
-  return copy;
+  return (FeatureStructureImplC) copy;
 }
 
 FeatureStructureImplC fs = _casView.createFS(_typeImpl);

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1712146&r1=1712145&r2=1712146&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
 Mon Nov  2 20:36:03 2015
@@ -73,8 +73,11 @@ import org.apache.uima.jcas.cas.EmptyFlo
 import org.apache.uima.jcas.cas.EmptyIntegerList;
 import org.apache.uima.jcas.cas.EmptyStringList;
 import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.cas.FSList;
 import org.apache.uima.jcas.cas.FloatArray;
+import org.apache.uima.jcas.cas.FloatList;
 import org.apache.uima.jcas.cas.IntegerArray;
+import org.apache.uima.jcas.cas.IntegerList;
 import org.apache.uima.jcas.cas.JavaObjectArray;
 import org.apache.uima.jcas.cas.LongArray;
 import org.apache.uima.jcas.cas.NonEmptyFSList;
@@ -84,14 +87,15 @@ import org.apache.uima.jcas.cas.NonEmpty
 import org.apache.uima.jcas.cas.ShortArray;
 import org.apache.uima.jcas.cas.Sofa;
 import org.apache.uima.jcas.cas.StringArray;
+import org.apache.uima.jcas.cas.StringList;
 import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
 import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.util.Misc;
 
 import com.strobel.assembler.metadata.Buffer;
 import com.strobel.assembler.metadata.ITypeLoader;
 import com.strobel.decompiler.DecompilerSettings;
-import com.strobel.decompiler.languages.java.ast.Annotation;
 
 /**
  * Type system implementation.
@@ -456,28 +460,28 @@ public class TypeSystemImpl implements T
 listBaseType = new TypeImpl(CAS.TYPE_NAME_LIST_BASE, this, topType);
 
 // FS list
-fsListType = new TypeImpl(CAS.TYPE_NAME_FS_LIST, this, listBaseType);
+fsListType = new TypeImpl(CAS.TYPE_NAME_FS_LIST, this, listBaseType, 
FSList.class);
 fsEListType = new TypeImpl(CAS.TYPE_NAME_EMPTY_FS_LIST, this, fsListType, 
EmptyFSList.class);
 fsNeListType = new TypeImpl(CAS.TYPE_NAME_NON_EMPTY_FS_LIST, this, 
fsListType, NonEmptyFSList.class);
 addFeature(CAS.FEATURE_BASE_NAME_HEAD, fsNeListType, topType, true);
 addFeature(CAS.FEATURE_BASE_NAME_TAIL, fsNeListType, fsListType, true);
 
 // Float list
-floatListType = new TypeImpl(CAS.TYPE_NAME_FLOAT_LIST, this, listBaseType);
+floatListType = new TypeImpl(CAS.TYPE_NAME_FLOAT_LIST, this, listBaseType, 
FloatList.class);
 floatEListType = new TypeImpl(CAS.TYPE_NAME_EMPTY_FLOAT_LIST, this, 
floatListType, EmptyFloatList.class);
 floatNeListType = new TypeImpl(CAS.TYPE_NAME_NON_EMPTY_FLOAT_LIST, this, 
floatListType, NonEmptyFloatList.class);
 addFeature(CAS.FEATURE_BASE_NAME_HEAD, floatNeListType, floatType, false);
 addFeature(CAS.FEATURE_BASE_NAME_TAIL, floatNeListType, floatListType, 
true);
 
 // Integer list
-intListType = new TypeImpl(CAS.TYPE_NAME_INTEGER_LIST, this, listBaseType);
+intListType = new TypeImpl(CAS.TYPE_NAME_INTEGER_LIST, this, listBaseType, 
IntegerList.class);
 intEListType = new TypeImpl(CAS.TYPE_NAME_EMPTY_INTEGER_LIST, this, 
in

svn commit: r1712148 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:38:36 2015
New Revision: 1712148

URL: http://svn.apache.org/viewvc?rev=1712148&view=rev
Log:
[UIMA-4663] fix list hierarchy - convert some superclasses to interfaces with 
default methods, fix the argument types for some methods.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyFSList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyFloatList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/EmptyIntegerList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FSList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/FloatList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/IntegerList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyFSList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyFloatList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyIntegerList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/NonEmptyStringList.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/StringList.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java?rev=1712148&r1=1712147&r2=1712148&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java
 Mon Nov  2 20:38:36 2015
@@ -31,4 +31,6 @@ public interface CommonArray {
   int size();
   
   void copyValuesFrom(CommonArray v);
+  
+  int get_id();
 }

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java?rev=1712148&r1=1712147&r2=1712148&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonList.java
 Mon Nov  2 20:38:36 2015
@@ -23,40 +23,18 @@ import java.util.IdentityHashMap;
 import java.util.Set;
 
 import org.apache.uima.cas.CASRuntimeException;
-import org.apache.uima.cas.impl.CASImpl;
-import org.apache.uima.cas.impl.TypeImpl;
-import org.apache.uima.jcas.JCas;
 
 /**
  * This class is the super class of list nodes (both empty and non empty)
  */
-public abstract class CommonList extends TOP {
-
-   // Never called.
-   protected CommonList() { // Disable default constructor
-   }
-
-   public CommonList(JCas jcas) {
-   super(jcas);
-   }
-   
-  /**
-   * used by generator
-   * Make a new AnnotationBase
-   * @param c -
-   * @param t -
-   */
-
-  public CommonList(TypeImpl t, CASImpl c) {
-super(t, c);
-  }
+public interface CommonList {
 
   /**
* Get the nth node.
* @param i -
* @return the nth node, which may be an "empty" node
*/
-   public CommonList getNthNode(int i) {
+   default CommonList getNthNode(int i) {
  if (this instanceof EmptyList) {
throw new 
CASRuntimeException(CASRuntimeException.JCAS_GET_NTH_ON_EMPTY_LIST, 
"EmptyList");
}
@@ -77,25 +55,21 @@ public abstract class CommonList extends
}
}

-   public CommonList getNonEmptyNthNode(int i) {
+   default CommonList getNonEmptyNthNode(int i) {
  CommonList node = getNthNode(i);
 if (node instanceof EmptyList) {
throw new 
CASRuntimeException(CASRuntimeException.JCAS_GET_NTH_PAST_END, i);
 }
 return node;
}
-   
-   public abstract CommonList getTail();  // tail offset changes
-   
-   public abstract void setTail(CommonList v); // tail offset changes
-   
+   
/**
 * length of a list, handling list loops.
 * return

svn commit: r1712149 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:39:50 2015
New Revision: 1712149

URL: http://svn.apache.org/viewvc?rev=1712149&view=rev
Log:
[UIMA-4663] remove items related to heap initialization, change toString to 
work with subclasses

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java?rev=1712149&r1=1712148&r2=1712149&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/CasCreationUtils.java
 Mon Nov  2 20:39:50 2015
@@ -561,13 +561,6 @@ public class CasCreationUtils {
 } catch (InvalidXMLException e) {
   throw new ResourceInitializationException(e);
 }
-
-// get initial heap size
-String initialHeapSizeStr = null;
-if (aPerformanceTuningSettings != null) {
-  initialHeapSizeStr = aPerformanceTuningSettings
-  .getProperty(UIMAFramework.CAS_INITIAL_HEAP_SIZE);
-}
 
 // Check Jcas cache performance setting.  Defaults to true.
 boolean useJcasCache = true;
@@ -582,18 +575,11 @@ public class CasCreationUtils {
 // create CAS using either aTypeSystem or aTypeSystemDesc
 CASMgr casMgr;
 if (aTypeSystem != null) {
-  if (initialHeapSizeStr != null) {
-casMgr = CASFactory.createCAS(Integer.parseInt(initialHeapSizeStr), 
aTypeSystem, useJcasCache);
-  } else {
-casMgr = CASFactory.createCAS(aTypeSystem, useJcasCache);
-  }
+  casMgr = CASFactory.createCAS(aTypeSystem, useJcasCache);
 } else // no TypeSystem to reuse - create a new one
 {
-  if (initialHeapSizeStr != null) {
-casMgr = CASFactory.createCAS(Integer.parseInt(initialHeapSizeStr), 
useJcasCache);
-  } else {
-casMgr = CASFactory.createCAS(CASImpl.DEFAULT_INITIAL_HEAP_SIZE, 
useJcasCache);
-  }
+  casMgr = CASFactory.createCAS();
+ 
   // install type system
   setupTypeSystem(casMgr, aTypeSystemDesc);
   // Commit the type system
@@ -1784,7 +1770,7 @@ public class CasCreationUtils {
 
 @Override
 public String toString() {
-  return "MetaDataCacheKey [resourceSpecifier=" + resourceSpecifier + ", 
rmClassLoader="
+  return this.getClass().getSimpleName() + " [resourceSpecifier=" + 
resourceSpecifier + ", rmClassLoader="
   + rmClassLoader + ", rmDataPath=" + rmDataPath + "]";
 }
   }




svn commit: r1712150 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/BuiltinTypeKinds.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:40:35 2015
New Revision: 1712150

URL: http://svn.apache.org/viewvc?rev=1712150&view=rev
Log:
[UIMA-4665] new class for lists of various kinds of types

Added:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/BuiltinTypeKinds.java

Added: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/BuiltinTypeKinds.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/BuiltinTypeKinds.java?rev=1712150&view=auto
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/BuiltinTypeKinds.java
 (added)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/BuiltinTypeKinds.java
 Mon Nov  2 20:40:35 2015
@@ -0,0 +1,108 @@
+package org.apache.uima.cas;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.uima.util.Misc;
+
+public class BuiltinTypeKinds {
+  
+  private static final Set primitiveTypeNames = new HashSet();
+
+  public static final Set creatableArrays = new HashSet();
+  
+  public static final Set builtinLists = new HashSet();
+  
+  public static final Set nonCreatablePrimitives = new 
HashSet();
+
+  /**
+   *  These types can not be created with CAS.createFS().
+   *Arrays can be created using CAS.createArray  XYZ = Boolean, Byte, 
etc.
+   */
+  public static final Set nonCreatableTypesAndBuiltinArrays = new 
HashSet();
+  
+  /**
+   * These types are
+   *   - builtin, but could be extended by user 
+   *   - creatable - so they need a generator.
+   * -- non-creatable built-in types are not generated 
+   */
+  public static final Set creatableBuiltinJCas = new HashSet();
+
+  static {
+Misc.addAll(primitiveTypeNames, 
+CAS.TYPE_NAME_BOOLEAN,
+CAS.TYPE_NAME_BYTE,
+CAS.TYPE_NAME_SHORT,
+CAS.TYPE_NAME_INTEGER,
+CAS.TYPE_NAME_LONG,
+CAS.TYPE_NAME_FLOAT,
+CAS.TYPE_NAME_DOUBLE,
+CAS.TYPE_NAME_STRING,
+CAS.TYPE_NAME_JAVA_OBJECT
+);
+
+Misc.addAll(creatableArrays,  
+CAS.TYPE_NAME_BOOLEAN_ARRAY,
+CAS.TYPE_NAME_BYTE_ARRAY,
+CAS.TYPE_NAME_SHORT_ARRAY,
+CAS.TYPE_NAME_INTEGER_ARRAY,
+CAS.TYPE_NAME_LONG_ARRAY,
+CAS.TYPE_NAME_FLOAT_ARRAY,
+CAS.TYPE_NAME_DOUBLE_ARRAY,
+CAS.TYPE_NAME_STRING_ARRAY,
+CAS.TYPE_NAME_FS_ARRAY,
+CAS.TYPE_NAME_JAVA_OBJECT_ARRAY
+);
+
+Misc.addAll(builtinLists, 
+CAS.TYPE_NAME_EMPTY_FLOAT_LIST,
+CAS.TYPE_NAME_EMPTY_FS_LIST,
+CAS.TYPE_NAME_EMPTY_INTEGER_LIST,
+CAS.TYPE_NAME_EMPTY_STRING_LIST,
+CAS.TYPE_NAME_FLOAT_LIST,
+CAS.TYPE_NAME_FS_LIST,
+CAS.TYPE_NAME_INTEGER_LIST,
+CAS.TYPE_NAME_STRING_LIST,
+CAS.TYPE_NAME_NON_EMPTY_FLOAT_LIST,
+CAS.TYPE_NAME_NON_EMPTY_FS_LIST,
+CAS.TYPE_NAME_NON_EMPTY_INTEGER_LIST,
+CAS.TYPE_NAME_NON_EMPTY_STRING_LIST
+);
+ 
+Misc.addAll(nonCreatablePrimitives, 
+CAS.TYPE_NAME_BOOLEAN,
+CAS.TYPE_NAME_BYTE,
+CAS.TYPE_NAME_SHORT,
+CAS.TYPE_NAME_INTEGER,
+CAS.TYPE_NAME_LONG,
+CAS.TYPE_NAME_FLOAT,
+CAS.TYPE_NAME_DOUBLE,
+CAS.TYPE_NAME_STRING,
+CAS.TYPE_NAME_JAVA_OBJECT
+);
+
+nonCreatableTypesAndBuiltinArrays.addAll(nonCreatablePrimitives);
+nonCreatableTypesAndBuiltinArrays.addAll(creatableArrays);
+Misc.addAll(nonCreatableTypesAndBuiltinArrays, CAS.TYPE_NAME_SOFA);
+
+creatableBuiltinJCas.addAll(creatableArrays);
+creatableBuiltinJCas.addAll(builtinLists);
+Misc.addAll(creatableBuiltinJCas, 
+CAS.TYPE_NAME_TOP,
+CAS.TYPE_NAME_ANNOTATION_BASE,
+CAS.TYPE_NAME_ANNOTATION  
+);
+  }
+  
+  /*  public getters and predicates */
+
+  public static boolean primitiveTypeNames_contains(String name) {
+return primitiveTypeNames.contains(name);
+  }
+  
+  public static boolean nonCreatableTypesAndBuiltinArrays_contains(String 
name) {
+return nonCreatableTypesAndBuiltinArrays.contains(name);
+  }
+  
+}




svn commit: r1712152 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:50:46 2015
New Revision: 1712152

URL: http://svn.apache.org/viewvc?rev=1712152&view=rev
Log: (empty)

Removed:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CrossAnnotation_Type.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/Sentence_Type.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/StringSubtypeAnnotation_Type.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/Token_Type.java
Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CrossAnnotation.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/Sentence.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/StringSubtypeAnnotation.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/Token.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CrossAnnotation.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CrossAnnotation.java?rev=1712152&r1=1712151&r2=1712152&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CrossAnnotation.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CrossAnnotation.java
 Mon Nov  2 20:50:46 2015
@@ -19,55 +19,91 @@
 
 package org.apache.uima.cas.test;
 
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.cas.TOP_Type;
-import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.cas.impl.CASImpl;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.jcas.JCas; 
+import org.apache.uima.jcas.JCasRegistry;
 
-/**
- * An annotation holding another annotation.
- */
-public class CrossAnnotation extends Annotation {
+import org.apache.uima.jcas.tcas.Annotation;
 
-  public final static int typeIndexID = 
org.apache.uima.jcas.JCasRegistry.register(CrossAnnotation.class);
 
+/** 
+ * Updated by JCasGen Mon Nov 02 14:34:51 EST 2015
+ * XML source: 
C:/au/svnCheckouts/branches/uimaj/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/jcas/test/generatedx.xml
+ * @generated */
+public class CrossAnnotation extends Annotation {
+  /** @generated
+   * @ordered 
+   */
+  @SuppressWarnings ("hiding")
+  public final static int typeIndexID = 
JCasRegistry.register(CrossAnnotation.class);
+  /** @generated
+   * @ordered 
+   */
+  @SuppressWarnings ("hiding")
   public final static int type = typeIndexID;
-
-  public int getTypeIndexID() {
-return typeIndexID;
-  }
-
-  // Never called. Disable default constructor
-  protected CrossAnnotation() {
-//do nothing
-  }
-
- /* Internal - Constructor used by generator */
-  public CrossAnnotation(int addr, TOP_Type type) {
-super(addr, type);
-  }
-
+  /** @generated
+   * @return index of the type  
+   */
+  @Override
+  public  int getTypeIndexID() {return typeIndexID;}
+ 
+ 
+  /* *
+   *Local Data   *
+   * */ 
+  private Annotation _F_otherAnnotation;  // 
+ 
+  /** Never called.  Disable default constructor
+   * @generated */
+  protected CrossAnnotation() {/* intentionally empty block */}
+
+  /** Internal - constructor used by generator 
+   * @generated
+   * @param casImpl the CAS this Feature Structure belongs to
+   * @param type the type of this Feature Structure 
+   */
+  public CrossAnnotation(TypeImpl type, CASImpl casImpl) {
+super(type, casImpl);
+readObject();
+  }
+  
+  /** @generated
+   * @param jcas JCas to which this Feature Structure belongs 
+   */
   public CrossAnnotation(JCas jcas) {
 super(jcas);
-  }
+readObject();   
+  } 
 
-  // *--*
-  // * Feature: otherAnnotation
-  /* getter for otherAnnotation * */
-  public Annotation getOtherAnnotation() {
-if (CrossAnnotation_Type.featOkTst
-&& ((CrossAnnotation_Type) jcasType).casFeat_otherAnnotation == 
null)
-  this.jcasType.jcas.throwFeatMissing("otherAnnotation", 
"uima.tcas.CrossAnnotation");
-return (Annotation) 
(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr,
-((CrossAnnotation_Type) jcasType).casFeatCode_otherAnnotation)));
-  }
-
-  /* setter for otherAnnotation * */
+  /** 
+   * 
+   * Write your own initialization here
+   * 
+   *
+   * @generated modifiable 
+   */
+  private void readObject() {/*default - does nothing empty block */}
+ 
+ 
+
+  //*--*
+  //* Feature: otherAnnotation
+
+  /** getter for otherAnnotation - gets 
+   * @generated
+   * @return valu

svn propchange: r1712152 - svn:log

2015-11-02 Thread schor
Author: schor
Revision: 1712152
Modified property: svn:log

Modified: svn:log at Mon Nov  2 20:51:54 2015
--
--- svn:log (original)
+++ svn:log Mon Nov  2 20:51:54 2015
@@ -0,0 +1 @@
+[UIMA-4663] convert test JCas objects to v3, remove old _Type versions



svn commit: r1712153 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:53:01 2015
New Revision: 1712153

URL: http://svn.apache.org/viewvc?rev=1712153&view=rev
Log:
[UIMA-4663] update test cases for v3

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CASTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CASTestSetup.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/FilteredIteratorTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexComparitorTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IndexRepositoryTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/JcasSofaTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/NewPrimitiveTypesTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/SofaTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/StringArrayTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/TypeSystemTest.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java?rev=1712153&r1=1712152&r2=1712153&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
 Mon Nov  2 20:53:01 2015
@@ -22,8 +22,6 @@ package org.apache.uima.cas.test;
 import java.util.ArrayList;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASRuntimeException;
 import org.apache.uima.cas.FSIndexRepository;
@@ -31,11 +29,10 @@ import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.Feature;
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.TypeSystem;
-import org.apache.uima.cas.impl.FSIndexFlat;
-import org.apache.uima.cas.impl.FSIteratorWrapper;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.cas.text.AnnotationIndex;
-import org.apache.uima.jcas.tcas.Annotation;
+
+import junit.framework.TestCase;
 
 /**
  * Class comment for FilteredIteratorTest.java goes here.
@@ -259,8 +256,8 @@ public class AnnotationIteratorTest exte
 AnnotationIndex annotIndex = this.cas.getAnnotationIndex();
 AnnotationIndex sentIndex = 
this.cas.getAnnotationIndex(sentenceType);
 FSIterator it = annotIndex.iterator(true);  // a normal 
"ambiguous" iterator
-assertTrue((isSave) ? it instanceof FSIteratorWrapper : 
-  FSIndexFlat.enabled ? it instanceof FSIndexFlat.FSIteratorFlat : it 
instanceof FSIteratorWrapper);   
+//assertTrue((isSave) ? it instanceof FSIteratorWrapper : 
+//  FSIndexFlat.enabled ? it instanceof FSIndexFlat.FSIteratorFlat : it 
instanceof FSIteratorWrapper);   
 assertCount("Normal ambiguous annot iterator", annotCount, it);
 
 it = annotIndex.iterator(false);  // false means create an unambiguous 
iterator
@@ -323,8 +320,10 @@ public class AnnotationIteratorTest exte
 if (count > 0) {
   // test moveTo(fs) in middle, first, and last
   AnnotationFS posFs = fss.get(fssStart + (count >> 1));
-  it.moveTo(posFs);
-  assertEquals(msg, it.get().hashCode(), posFs.hashCode());
+//  //debug
+//  System.out.println(posFs.toString());
+   it.moveTo(posFs);
+   assertEquals(msg, it.get().hashCode(), posFs.hashCode());
   
   posFs = fss.get(fssStart);
   it.moveTo(posFs);

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CASTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CASTest.java?rev=1712153&r1=1712152&r2=1712153&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CASTest.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/CASTest.java
 Mon Nov  2 20:53:01 2015
@@ -19,17 +19,16 @@
 
 package org.apa

svn commit: r1712154 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/internal/util/UIMAClassLoaderTest.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:55:29 2015
New Revision: 1712154

URL: http://svn.apache.org/viewvc?rev=1712154&view=rev
Log:
no Jira - remove Assert.  - deprecated form

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/internal/util/UIMAClassLoaderTest.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/internal/util/UIMAClassLoaderTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/internal/util/UIMAClassLoaderTest.java?rev=1712154&r1=1712153&r2=1712154&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/internal/util/UIMAClassLoaderTest.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/internal/util/UIMAClassLoaderTest.java
 Mon Nov  2 20:55:29 2015
@@ -22,14 +22,14 @@ package org.apache.uima.internal.util;
 import java.io.File;
 import java.lang.reflect.Method;
 import java.net.URL;
-import java.util.Random;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.resource.ResourceManager;
 import org.apache.uima.test.junit_extension.JUnitExtension;
+import org.apache.uima.util.Misc;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
 
 /*
  * UIMA ClassLoader test
@@ -59,11 +59,11 @@ public class UIMAClassLoaderTest extends
   public void testSimpleRsrcMgrCLassLoaderCreation() throws Exception {
 ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();
 
-Assert.assertNull(rsrcMgr.getExtensionClassLoader());
+assertNull(rsrcMgr.getExtensionClassLoader());
 
 rsrcMgr.setExtensionClassPath("../this/is/a/simple/test.jar", false);
 ClassLoader cl = rsrcMgr.getExtensionClassLoader();
-Assert.assertNotNull(cl);
+assertNotNull(cl);
 //assertTrue(cl != cl.getClassLoadingLock("Aclass"));
 Class classOfLoader = cl.getClass().getSuperclass();
 while (!(classOfLoader.getName().equals("java.lang.ClassLoader"))) {
@@ -80,11 +80,11 @@ public class UIMAClassLoaderTest extends
   public void testAdvancedRsrcMgrCLassLoaderCreation() throws Exception {
 ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();
 
-Assert.assertNull(rsrcMgr.getExtensionClassLoader());
+assertNull(rsrcMgr.getExtensionClassLoader());
 
 rsrcMgr.setExtensionClassPath("../this/is/a/simple/test.jar", true);
 
-Assert.assertNotNull(rsrcMgr.getExtensionClassLoader());
+assertNotNull(rsrcMgr.getExtensionClassLoader());
 
   }
 
@@ -94,18 +94,18 @@ public class UIMAClassLoaderTest extends
 
 testClass = 
cl.loadClass("org.apache.uima.internal.util.ClassloadingTestClass");
 
-Assert.assertNotNull(testClass);
-Assert.assertEquals(cl, testClass.getClassLoader());
+assertNotNull(testClass);
+assertEquals(cl, testClass.getClassLoader());
 
 testClass = 
cl.loadClass("org.apache.uima.flow.impl.AnalysisSequenceCapabilityNode");
 
-Assert.assertNotNull(testClass);
-
Assert.assertEquals(this.getClass().getClassLoader(),testClass.getClassLoader());
+assertNotNull(testClass);
+assertEquals(this.getClass().getClassLoader(),testClass.getClassLoader());
   }
   
   public void testParallelClassLoading() throws Exception {
 final UIMAClassLoader cl = new UIMAClassLoader(this.testClassPath, 
this.getClass().getClassLoader());
-final Class[] loadedClasses = new Class[Utilities.numberOfCores];
+final Class[] loadedClasses = new Class[Misc.numberOfCores];
 
 MultiThreadUtils.Run2isb callable = new MultiThreadUtils.Run2isb() {
   @Override
@@ -114,9 +114,9 @@ public class UIMAClassLoaderTest extends
   }
 };
 
-MultiThreadUtils.tstMultiThread("MultiThreadLoading",  
Utilities.numberOfCores, 1, callable, MultiThreadUtils.emptyReset);
+MultiThreadUtils.tstMultiThread("MultiThreadLoading",  Misc.numberOfCores, 
1, callable, MultiThreadUtils.emptyReset);
 Class c = loadedClasses[0];
-for (int i = 1; i < Utilities.numberOfCores; i++) {
+for (int i = 1; i < Misc.numberOfCores; i++) {
   assertEquals(c, loadedClasses[i]);
 }
   }
@@ -128,14 +128,14 @@ public class UIMAClassLoaderTest extends
 
 testClass = 
cl.loadClass("org.apache.uima.internal.util.ClassloadingTestClass");
 
-Assert.assertNotNull(testClass);
-Assert.assertEquals(cl, testClass.getClassLoader());
+assertNotNull(testClass);
+assertEquals(cl, testClass.getClassLoader());
 

 testClass = 
cl.loadClass("org.apache.uima.flow.impl.AnalysisSequenceCapabilityNode");

-Assert.assertNotNull(testClass);
-
Assert.assertEquals(this.getClass().getClassLoader(),testClass.getClassLoader());
+assertNotNull(testClass);
+assertEquals(this.getClass

svn commit: r1712155 - /uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 20:59:32 2015
New Revision: 1712155

URL: http://svn.apache.org/viewvc?rev=1712155&view=rev
Log:
no Jira fix javadoc paragraph tagging

Modified:

uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java

Modified: 
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java?rev=1712155&r1=1712154&r2=1712155&view=diff
==
--- 
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java
 (original)
+++ 
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java
 Mon Nov  2 20:59:32 2015
@@ -126,7 +126,7 @@ public interface AnnotationIndexannot and
* b are of the same type, then the behavior is undefined.
* 
-   * 
+   *
* 
* For example, if you have an annotation S of type 
Sentence and an
* annotation P of type Paragraph that have the 
same span, and you
@@ -168,18 +168,18 @@ public interface AnnotationIndexannot, or
* if there are no annotations greater than the annot, the 
iterator is marked invalid.
* 
-   * The iterator will stop (become invalid) when
+   * The iterator will stop (become invalid) when
* it runs out of items in the index going forward or backwards, 
or
* while moving forward, it reaches a point where the annotation at that 
position has a 
* start is beyond the annot's end position, or
* while moving backwards, it reaches a position in front of its 
original starting position
* 
-   * 
+   *   
* Ignoring strict and ambiguous for a moment, 
* this is equivalent  to returning annotations b such that 
* annot < b using the standard annotation 
comparator, and
* annot.getEnd() >= b.getBegin(), and also bounded by 
the index itself.
-   * 
+   * 
* 
* A strict subiterator skips annotations where 
* annot.getEnd() < b.getEnd().




svn commit: r1712156 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 21:00:45 2015
New Revision: 1712156

URL: http://svn.apache.org/viewvc?rev=1712156&view=rev
Log:
no Jira - fix paragraph tags in javadoc

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java?rev=1712156&r1=1712155&r2=1712156&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/text/AnnotationIndex.java
 Mon Nov  2 21:00:45 2015
@@ -127,7 +127,6 @@ public interface AnnotationIndexb are of the same type, then the behavior is undefined.
* 
* 
-   * 
* For example, if you have an annotation S of type 
Sentence and an
* annotation P of type Paragraph that have the 
same span, and you
* have defined Paragraph before Sentence in your 
type priorities,
@@ -168,18 +167,18 @@ public interface AnnotationIndexannot, or
* if there are no annotations greater than the annot, the 
iterator is marked invalid.
* 
-   * The iterator will stop (become invalid) when
+   * The iterator will stop (become invalid) when
* it runs out of items in the index going forward or backwards, 
or
* while moving forward, it reaches a point where the annotation at that 
position has a 
* start is beyond the annot's end position, or
* while moving backwards, it reaches a position in front of its 
original starting position
* 
-   * 
+   * 
* Ignoring strict and ambiguous for a moment, 
* this is equivalent  to returning annotations b such that 
* annot < b using the standard annotation 
comparator, and
* annot.getEnd() >= b.getBegin(), and also bounded by 
the index itself.
-   * 
+   * 
* 
* A strict subiterator skips annotations where 
* annot.getEnd() < b.getEnd().




svn commit: r1712157 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src: main/java/org/apache/uima/cas/ main/java/org/apache/uima/cas/impl/ main/java/org/apache/uima/jcas/cas/ test/java/org/a

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 21:06:25 2015
New Revision: 1712157

URL: http://svn.apache.org/viewvc?rev=1712157&view=rev
Log:
[UIMA-4663] change get_id() to id()

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSsTobeAddedback.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelIterator.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_implTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngineManagementImplTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java?rev=1712157&r1=1712156&r2=1712157&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java
 Mon Nov  2 21:06:25 2015
@@ -353,6 +353,6 @@ public interface FeatureStructure {
* return the unique (to this CAS) id of this feature structure
*/
 
-  int get_id();
+  int id()();
   
 }

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1712157&r1=1712156&r2=1712157&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 Mon Nov  2 21:06:25 2015
@@ -1143,7 +1143,7 @@ public class CASImpl extends AbstractCas
* @param nbrOfConsecutive
*/
   private void logFSUpdate(FeatureStructureImplC fs, FeatureImpl fi, int 
arrayIndexStart, int nbrOfConsecutive) {
-if (this.svd.trackingMark != null && 
!this.svd.trackingMark.isNew(fs.get_id())) {
+if (this.svd.trackingMark != null && 
!this.svd.trackingMark.isNew(fs.id()())) {
   //log the FS
   
   //create or use last FsChange element
@@ -1926,7 +1926,7 @@ public class CASImpl extends AbstractCas
 Type ti = getTypeSystemImpl().ll_getTypeForCode(typeCode);
 TOP fs = createFS(ti);
 svd.cache_not_in_index = fs;
-return fs.get_id();
+return fs.id()();
   }
 
   public final int ll_createFS(int typeCode, boolean doCheck) {
@@ -1945,7 +1945,7 @@ public class CASImpl extends AbstractCas
* @see org.apache.uima.cas.impl.LowLevelCAS#ll_createArray(int, int)
*/
   public int ll_createArray(int typeCode, int arrayLength) {
-return createArray(typeCode, arrayLength).get_id();  
+return createArray(typeCode, arrayLength).id()();  
   }
 
   public int ll_createByteArray(int arrayLength) {
@@ -2010,7 +2010,7 @@ public class CASImpl extends AbstractCas
 if (null == fs) {
   return NULL;
 }
-return ((FeatureStructureImplC)fs).get_id();
+return ((FeatureStructureImplC)fs).id()();
   }
 
   @

svn commit: r1712167 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima: cas/ cas/impl/ jcas/cas/

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 21:46:49 2015
New Revision: 1712167

URL: http://svn.apache.org/viewvc?rev=1712167&view=rev
Log:
[UIMA-4663] change id()() to id() - bad change-all from earlier.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSsTobeAddedback.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LowLevelIterator.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/MarkerImpl.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/jcas/cas/CommonArray.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java?rev=1712167&r1=1712166&r2=1712167&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FeatureStructure.java
 Mon Nov  2 21:46:49 2015
@@ -353,6 +353,6 @@ public interface FeatureStructure {
* return the unique (to this CAS) id of this feature structure
*/
 
-  int id()();
+  int id();
   
 }

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1712167&r1=1712166&r2=1712167&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
 Mon Nov  2 21:46:49 2015
@@ -37,6 +37,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.Consumer;
+import java.util.function.IntSupplier;
+import java.util.function.Supplier;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.UIMARuntimeException;
@@ -1143,7 +1145,7 @@ public class CASImpl extends AbstractCas
* @param nbrOfConsecutive
*/
   private void logFSUpdate(FeatureStructureImplC fs, FeatureImpl fi, int 
arrayIndexStart, int nbrOfConsecutive) {
-if (this.svd.trackingMark != null && 
!this.svd.trackingMark.isNew(fs.id()())) {
+if (this.svd.trackingMark != null && 
!this.svd.trackingMark.isNew(fs.id())) {
   //log the FS
   
   //create or use last FsChange element
@@ -1208,7 +1210,6 @@ public class CASImpl extends AbstractCas
   /*
* Support code for JCas setters
*/
-   
   public void setWithCheckAndJournal(FeatureStructureImplC fs, int featCode, 
Runnable setter) {
 boolean wasRemoved = checkForInvalidFeatureSetting(fs, featCode);
 setter.run();
@@ -1218,6 +1219,22 @@ public class CASImpl extends AbstractCas
 maybeLogUpdate(fs, featCode);
   }
   
+  /**
+   * This method called by setters in JCas gen'd classes when 
+   * the setter must check for journaling and index corruption
+   * @param fs
+   * @param featCode
+   * @param setter
+   */
+  public void setWithCheckAndJournal(FeatureStructureImplC fs, IntSupplier 
featCodeSupplier, Runnable setter) {
+boolean wasRemoved = checkForInvalidFeatureSetting(fs, featCodeSupplier);
+setter.run();
+if (wasRemoved) {
+  maybeAddback(fs);
+}
+maybeLogUpdate(fs, featCodeSupplier.getAsInt());
+  }
+  
 //  public void setWithCheck(FeatureStructureImplC fs, FeatureImpl feat, 
Runnable setter) {
 //boolean wasRemoved = checkForInvalidFeatureSetting

svn commit: r1712168 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas: impl/Id2FSTest.java test/IteratorTest.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 21:48:37 2015
New Revision: 1712168

URL: http://svn.apache.org/viewvc?rev=1712168&view=rev
Log:
[UIMA-4663] change id()() to id() - bad change-all from earlier.

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java?rev=1712168&r1=1712167&r2=1712168&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/impl/Id2FSTest.java
 Mon Nov  2 21:48:37 2015
@@ -53,7 +53,7 @@ public class Id2FSTest extends TestCase
 
 TOP fs1 = new TOP(jcas);
 
-int lastUsedId = fs1.id()();
+int lastUsedId = fs1.id();
 assertEquals(fs1, cas.getFsFromId(lastUsedId));
 // make 20 more that could be gc'd
 
@@ -99,7 +99,7 @@ public class Id2FSTest extends TestCase
 fs1 = new TOP(jcas);
 
 id2fs.add(fs1);
-lastUsedId = fs1.id()();
+lastUsedId = fs1.id();
 assertEquals(fs1, id2fs.get(lastUsedId));
 
 for (int i = 0; i < 20; i++) {

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java?rev=1712168&r1=1712167&r2=1712168&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/IteratorTest.java
 Mon Nov  2 21:48:37 2015
@@ -515,7 +515,7 @@ public class IteratorTest extends TestCa
 assertEquals(setIndexOverTokens.size(), 20);
 int i = 0;
 for (FeatureStructure fs : setIndexOverTokens) {
-  expected[i++] = fs.id()();
+  expected[i++] = fs.id();
 }
 
 LowLevelIndexRepository llir = this.cas.ll_getIndexRepository();
@@ -528,7 +528,7 @@ public class IteratorTest extends TestCa
 assertEquals(setIndexOverSentences.size(), 20);
 i = 0;
 for (FeatureStructure fs : setIndexOverSentences) {
-  expected[i++] = fs.id()();
+  expected[i++] = fs.id();
 }
 
 setIndexForType = llir.ll_getIndex(CASTestSetup.ANNOT_SET_INDEX, 
((TypeImpl)sentenceType).getCode());
@@ -539,7 +539,7 @@ public class IteratorTest extends TestCa
 assertEquals(setIndex.size(), 60);
 i = 0;
 for (FeatureStructure fs : setIndex) {
-  expected[i++] = fs.id()();
+  expected[i++] = fs.id();
 }
 
 




svn commit: r1712174 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl: FsIndex_bag.java FsIndex_flat.java

2015-11-02 Thread schor
Author: schor
Date: Mon Nov  2 22:55:42 2015
New Revision: 1712174

URL: http://svn.apache.org/viewvc?rev=1712174&view=rev
Log:
no Jira fix bad syntax for method ref 

Modified:

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java

uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java?rev=1712174&r1=1712173&r2=1712174&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
 Mon Nov  2 22:55:42 2015
@@ -183,7 +183,7 @@ public class FsIndex_baghttp://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java?rev=1712174&r1=1712173&r2=1712174&view=diff
==
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java
 Mon Nov  2 22:55:42 2015
@@ -168,7 +168,7 @@ public class FsIndex_flat