svn commit: r1233903 - in /uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons: plugin.xml src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java

2012-01-20 Thread pkluegl
Author: pkluegl
Date: Fri Jan 20 13:27:25 2012
New Revision: 1233903

URL: http://svn.apache.org/viewvc?rev=1233903view=rev
Log:
UIMA-2337
fixed reference of wrong feature for filtering. Renamed Selected Rules view to 
Covering Rules.

Modified:
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/plugin.xml

uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/plugin.xml
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/plugin.xml?rev=1233903r1=1233902r2=1233903view=diff
==
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/plugin.xml 
(original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/plugin.xml Fri Jan 
20 13:27:25 2012
@@ -525,7 +525,7 @@ under the License.
 
class=org.apache.uima.textmarker.explain.selection.ExplainSelectionView
 icon=icons/chart_organisation.png
 id=org.apache.uima.textmarker.explain.selection
-name=Selected Rules
+name=Covering Rules
   /view
   view
 category=org.apache.uima.textmarker.ide.ui

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java?rev=1233903r1=1233902r2=1233903view=diff
==
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java
 (original)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/explain/rulelist/RuleListViewPage.java
 Fri Jan 20 13:27:25 2012
@@ -102,7 +102,7 @@ public class RuleListViewPage extends Ap
 for (IExplainTreeNode each : children) {
   if (each instanceof RuleApplyNode) {
 RuleApplyNode ran = (RuleApplyNode) each;
-Feature f = ruleType.getFeatureByBaseName(ExplainConstants.ELEMENTS);
+Feature f = ruleType.getFeatureByBaseName(ExplainConstants.ELEMENT);
 if (f != null) {
   String v = ran.getFeatureStructure().getStringValue(f);
   if (manualFilter != null  !.equals(manualFilter)  
v.indexOf(manualFilter) == -1) {




svn commit: r1233969 - in /uima/uimaj/trunk/uimaj-core/src/test: java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_implTest.java resources/TextAnalysisEngineImplTest/TestPrimitiveOpe

2012-01-20 Thread schor
Author: schor
Date: Fri Jan 20 15:45:41 2012
New Revision: 1233969

URL: http://svn.apache.org/viewvc?rev=1233969view=rev
Log:
[UIMA-2350] add test case

Added:

uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveOperationalParmsDefaults.xml
   (with props)
Modified:

uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_implTest.java

Modified: 
uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_implTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_implTest.java?rev=1233969r1=1233968r2=1233969view=diff
==
--- 
uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_implTest.java
 (original)
+++ 
uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/analysis_engine/impl/AnalysisEngineDescription_implTest.java
 Fri Jan 20 15:45:41 2012
@@ -328,6 +328,16 @@ public class AnalysisEngineDescription_i
   JUnitExtension.handleException(e);
 }
   }
+ 
+  public void testDefaultingOperationalParameters() throws Exception {
+XMLInputSource in = new XMLInputSource(JUnitExtension
+
.getFile(TextAnalysisEngineImplTest/TestPrimitiveOperationalParmsDefaults.xml));
+AnalysisEngineDescription desc = 
UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in);
+OperationalProperties opProps = 
desc.getAnalysisEngineMetaData().getOperationalProperties();
+assertNotNull(opProps);
+assertEquals(true, opProps.getModifiesCas());
+assertEquals(false, opProps.isMultipleDeploymentAllowed());
+  }
 
   public void testSerialization() throws Exception {
 try {

Added: 
uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveOperationalParmsDefaults.xml
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveOperationalParmsDefaults.xml?rev=1233969view=auto
==
--- 
uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveOperationalParmsDefaults.xml
 (added)
+++ 
uima/uimaj/trunk/uimaj-core/src/test/resources/TextAnalysisEngineImplTest/TestPrimitiveOperationalParmsDefaults.xml
 Fri Jan 20 15:45:41 2012
@@ -0,0 +1,132 @@
+?xml version=1.0 encoding=UTF-8 ?
+!--
+ * 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.
+ --
+
+!-- For testing only. --
+
+taeDescription xmlns=http://uima.apache.org/resourceSpecifier;
+frameworkImplementationorg.apache.uima.java/frameworkImplementation
+primitivetrue/primitive
+annotatorImplementationNameorg.apache.uima.analysis_engine.impl.TestAnnotator2/annotatorImplementationName
+ 
+analysisEngineMetaData
+nameTest Primitive Operational Defaults/name
+descriptionFor testing only./description
+version1.0/version
+vendorThe Apache Software Foundation/vendor
+ 
+
+!-- TypeSystem Definition --
+typeSystemDescription
+types
+
+typeDescription
+namePerson/name
+descriptionA person./description
+supertypeNameuima.tcas.Annotation/supertypeName
+features
+  featureDescription
+nameGender/name
+descriptionGender of person./description
+rangeTypeNameuima.cas.String/rangeTypeName
+  /featureDescription
+/features
+/typeDescription
+
+typeDescription
+namePlace/name
+descriptionA place./description
+supertypeNameuima.tcas.Annotation/supertypeName
+features
+  featureDescription
+nameBigPlace/name
+descriptionBig Place within a Compound Place./description
+rangeTypeNameuima.cas.String/rangeTypeName
+  /featureDescription
+  featureDescription
+nameLittlePlace/name
+descriptionLittle Place within a Compound Place./description
+rangeTypeNameuima.cas.String/rangeTypeName
+  /featureDescription
+/features
+/typeDescription
+
+typeDescription
+nameOrg/name
+descriptionAn organization./description
+supertypeNameuima.tcas.Annotation/supertypeName
+/typeDescription
+
+/types
+/typeSystemDescription
+
+typePriorities
+  

svn commit: r1233979 - /uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java

2012-01-20 Thread cwiklik
Author: cwiklik
Date: Fri Jan 20 16:13:41 2012
New Revision: 1233979

URL: http://svn.apache.org/viewvc?rev=1233979view=rev
Log:
UIMA-2354 blocks receiving thread when invokeProcess() returns, to prevent it 
from getting another CAS while the previous CAS is still in-play

Modified:

uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java?rev=1233979r1=1233978r2=1233979view=diff
==
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/handler/input/ProcessRequestHandler_impl.java
 Fri Jan 20 16:13:41 2012
@@ -20,6 +20,7 @@
 package org.apache.uima.aae.handler.input;
 
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Semaphore;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.aae.SerializerCache;
@@ -52,6 +53,13 @@ import org.apache.uima.util.Level;
 
 public class ProcessRequestHandler_impl extends HandlerBase {
   private static final Class CLASS_NAME = ProcessRequestHandler_impl.class;
+  /*
+   * Declare a semaphore which is used to block UIMA AS aggregate receiving 
thread until 
+   * a CAS is fully processed. This semaphore prevents the receiving thread 
from grabbing
+   * another CAS from an input queue while a CAS it received previously is 
still 
+   * in-play. Fixes load balancing across multiple UIMA AS aggregate processes.
+   */
+  final ThreadLocalSemaphore threadCompletionMonitor = new 
ThreadLocalSemaphore();
 
   private Object mux = new Object();
 
@@ -225,7 +233,26 @@ public class ProcessRequestHandler_impl 
   // deserSharedData, casReferenceId);
   entry = getController().getInProcessCache().register(cas, 
aMessageContext, deserSharedData,
   casReferenceId, marker, acceptsDeltaCas);
-
+  
+  /*
+   * In UIMA AS Aggregate the receiving thread must be blocked until a CAS 
is fully
+   * processed. This is to prevent the receiving thread from grabbing 
another CAS
+   * breaking prefetch throttling. The receiving thread takes a CAS from 
service queue,
+   * deserializes CAS, asks the FC for the next step and enqueues the CAS
+   * onto delegate's queue. Once the enqueue completes, the thread is done
+   * and ready to get more CASes from the service queue. The receiving 
must 
+   * therefor be blocked right after it enqueues the CAS on delegates 
queue. 
+   * To that end, while handling a new CAS, create a shared semaphore and
+   * associate it with a current thread as ThreadLocal variable. Also, 
associate the
+   * same semaphore with a CAS so that when the CAS is sent back to the 
client the
+   * the receiving thread is unblocked.
+  */
+  if ( !getController().isPrimitive() ) {
+Semaphore semaphore = new Semaphore(0);
+//  threadCompletionMonitor is a ThreadLocal var
+threadCompletionMonitor.set(semaphore);
+entry.setThreadCompletionSemaphore(semaphore);
+  }
   long timeToDeserializeCAS = getController().getCpuTime() - t1;
   getController().incrementDeserializationTime(timeToDeserializeCAS);
   LongNumericStatistic statistic;
@@ -482,6 +509,26 @@ public class ProcessRequestHandler_impl 
 // *
 invokeProcess(entry.getCas(), inputCasReferenceId, casReferenceId, 
aMessageContext,
 newCASProducedBy);
+
+/**
+ * Below comments apply to UIMA AS aggregate only.
+ * CAS has been handed off to a delegate. Now block the receiving 
thread until
+ * the CAS is processed or there is a timeout or error. Fetch this 
thread's ThreadLocal
+ * semaphore to block the thread. It will be unblocked when the 
aggregate is done with
+ * the CAS.
+ */
+if (!getController().isPrimitive() ) {
+  Semaphore completionSemaphore = threadCompletionMonitor.get();
+  try {
+//  Block until the CAS is fully processed or there is an error
+completionSemaphore.acquire();
+  } catch( InterruptedException ex) {
+  } finally {
+//  remove ThreadLocal semaphore
+threadCompletionMonitor.remove();
+  }
+}
+
   } else {
 if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
   UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, 
CLASS_NAME.getName(),




svn commit: r1233982 - /uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java

2012-01-20 Thread cwiklik
Author: cwiklik
Date: Fri Jan 20 16:16:24 2012
New Revision: 1233982

URL: http://svn.apache.org/viewvc?rev=1233982view=rev
Log:
UIMA-2354 associate a semaphore with a CAS entry. This semaphore is shared with 
a receiving thread and used to unblock that thread when CAS processing is done

Modified:

uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java

Modified: 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java?rev=1233982r1=1233981r2=1233982view=diff
==
--- 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/aae/InProcessCache.java
 Fri Jan 20 16:16:24 2012
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.Stack;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Semaphore;
 
 import org.apache.uima.UIMAFramework;
 import org.apache.uima.aae.controller.ControllerLifecycle;
@@ -556,6 +557,23 @@ public class InProcessCache implements I
 // list. The delegates in this list will be called sequentially when
 // all delegates in parallel step respond.
 private List delayedSingleStepList = null;
+   //  shared semaphore that blocks UIMA AS aggregate receiving
+   //  thread after a CAS is handed off to the first delegate.
+   //  This stops the aggregate's receiving thread from taking
+   //  another CAS off the input queue while the current CAS is
+   //  still being processed. This semaphore is shared with a 
+   //  receiving thread which has a reference to the semaphore
+   //  via ThreadLocal var
+private Semaphore threadCompletionSemaphore;
+
+
+public Semaphore getThreadCompletionSemaphore() {
+  return threadCompletionSemaphore;
+}
+
+public void setThreadCompletionSemaphore(Semaphore 
threadCompletionSemaphore) {
+  this.threadCompletionSemaphore = threadCompletionSemaphore;
+}
 
 protected CacheEntry(CAS aCas, String aCasReferenceId, MessageContext 
aMessageAccessor,
 OutOfTypeSystemData aotsd) {




svn commit: r1234005 - /uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java

2012-01-20 Thread cwiklik
Author: cwiklik
Date: Fri Jan 20 17:05:13 2012
New Revision: 1234005

URL: http://svn.apache.org/viewvc?rev=1234005view=rev
Log:
UIMA-2309 in destroy(), remove __listenerRef.delegateStop(). It is a redundant 
call and not necessary

Modified:

uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java

Modified: 
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java
URL: 
http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java?rev=1234005r1=1234004r2=1234005view=diff
==
--- 
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java
 (original)
+++ 
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java
 Fri Jan 20 17:05:13 2012
@@ -956,8 +956,6 @@ public class UimaDefaultMessageListenerC
 try {
   if ( !__listenerRef.awaitingShutdown ) {
awaitingShutdown = true;
-// delegate stop request to Spring 
-  __listenerRef.delegateStop();
   if (taskExecutor != null  taskExecutor instanceof 
ThreadPoolTaskExecutor) {
//  Modify task executor to terminate idle threads. While 
the thread terminates
//  it calls destroy() method on the pinned instance of AE




svn commit: r1234078 - in /uima/uimacpp/trunk: docs/ src/cas/uima/ src/framework/uima/

2012-01-20 Thread bhavani
Author: bhavani
Date: Fri Jan 20 19:07:08 2012
New Revision: 1234078

URL: http://svn.apache.org/viewvc?rev=1234078view=rev
Log:
UIMA-2356 fix warnings generated by doxygen

Modified:
uima/uimacpp/trunk/docs/uimacpp.dox
uima/uimacpp/trunk/src/cas/uima/cas.hpp
uima/uimacpp/trunk/src/cas/uima/sofastream.hpp
uima/uimacpp/trunk/src/cas/uima/sofastreamhandler.hpp
uima/uimacpp/trunk/src/framework/uima/annotator_context.hpp
uima/uimacpp/trunk/src/framework/uima/assertmsg.h
uima/uimacpp/trunk/src/framework/uima/casiterator.hpp
uima/uimacpp/trunk/src/framework/uima/consoleui.hpp
uima/uimacpp/trunk/src/framework/uima/cp2ucnvrt.hpp
uima/uimacpp/trunk/src/framework/uima/dllfile.hpp
uima/uimacpp/trunk/src/framework/uima/engine.hpp
uima/uimacpp/trunk/src/framework/uima/envvar.hpp
uima/uimacpp/trunk/src/framework/uima/exceptions.hpp
uima/uimacpp/trunk/src/framework/uima/taespecifierbuilder.hpp
uima/uimacpp/trunk/src/framework/uima/unistrref.hpp

Modified: uima/uimacpp/trunk/docs/uimacpp.dox
URL: 
http://svn.apache.org/viewvc/uima/uimacpp/trunk/docs/uimacpp.dox?rev=1234078r1=1234077r2=1234078view=diff
==
--- uima/uimacpp/trunk/docs/uimacpp.dox (original)
+++ uima/uimacpp/trunk/docs/uimacpp.dox Fri Jan 20 19:07:08 2012
@@ -420,6 +420,7 @@ INPUT = \
  ../src/framework/uima/assertmsg.h \
  ../src/framework/uima/capability.hpp \
  ../src/cas/uima/cas.hpp \
+ ../src/framework/uima/casiterator.hpp \
  ../src/framework/uima/casdefinition.hpp \
  ../src/cas/uima/casexception.hpp \
  ../src/framework/uima/caswriter_abase.hpp \

Modified: uima/uimacpp/trunk/src/cas/uima/cas.hpp
URL: 
http://svn.apache.org/viewvc/uima/uimacpp/trunk/src/cas/uima/cas.hpp?rev=1234078r1=1234077r2=1234078view=diff
==
--- uima/uimacpp/trunk/src/cas/uima/cas.hpp (original)
+++ uima/uimacpp/trunk/src/cas/uima/cas.hpp Fri Jan 20 19:07:08 2012
@@ -149,7 +149,7 @@ namespace uima {
* liA set of @link PreDefTypes predefined types@endlink,
*   @link PreDefFeatures features@endlink,
*   @link PreDefIndexes indexes@endlink and
-   *   @link UtilFuncts functions@endlink
+   *   @link UtilFuncts Utility Functions@endlink
*   for text analysis.
* /ol
*/
@@ -243,7 +243,6 @@ namespace uima {
 /**
  * Add a copy of codecrString/code to the string heap.
  * @param crString the string to add
- * @param bIsPermanent indicate if the string should be permanent, i.e., 
has a lifetime longer than the document
  * @return an LString pointing to the new copy
  */
 int addString(icu::UnicodeString const  crString);
@@ -252,14 +251,12 @@ namespace uima {
  * Add a copy of codecpString/code to the string heap.
  * @param cpString a pointer to the string to copy (maynot be zero 
terminated)
  * @param uiLen number of Unicode code units (not bytes!) to copy
- * @param bIsPermanent indicate if the string should be permanent, i.e., 
has a lifetime longer than the document
  * @return an LString pointing to the new copy
  */
 int addString(UChar const * cpString, size_t uiLen);
 /**
  * Add a copy of codeuls/code to the string heap.
  * @param uls a pointer to the string to copy (maynot be zero terminated)
- * @param bIsPermanent indicate if the string should be permanent, i.e., 
has a lifetime longer than the document
  * @return an LString pointing to the new copy
  */
 int addString(const UnicodeStringRef  uls );
@@ -338,7 +335,7 @@ namespace uima {
 
 /**
  * Returns true if a CAS view.
- * @deprecated.
+ * @deprecated
  */
 inline bool isView() {
   return !isbaseCas;
@@ -370,7 +367,6 @@ namespace uima {
 /**
  * create an FS of type codecrType/code
  * @param crType the type of FS to create
- * @param bIsPermanent indicate if the feature structure should be 
permanent, i.e., has a lifetime longer than the document
  * @throws CouldNotCreateFSOfFinalTypeException
  * @return the created feature structure
  */
@@ -380,8 +376,6 @@ namespace uima {
  * create a feature structure of type FS Array.
  * Each of the uiSize elements in the array is a FeatureStructure.
  * @param uiSizethe size of the array
- * @param bIsPermanent  indicate if the data should be permanent,
- *  i.e., has a lifetime longer than the document
  */
 ArrayFS createArrayFS(size_t uiSize);
 
@@ -389,8 +383,6 @@ namespace uima {
  * create a feature structure of type FS Array.
  * Each of the uiSize elements in the array is a float.
  * @param uiSizethe size of the array
- * @param bIsPermanent  indicate if the data should be permanent,
- *  i.e., has a lifetime longer than the document
  */
 FloatArrayFS createFloatArrayFS(size_t 

svn commit: r1234089 - in /uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima: resource/metadata/impl/MetaDataObject_impl.java util/XMLParser.java util/XMLSerializer.java util/impl/SaxDeseriali

2012-01-20 Thread schor
Author: schor
Date: Fri Jan 20 19:33:07 2012
New Revision: 1234089

URL: http://svn.apache.org/viewvc?rev=1234089view=rev
Log:
[UIMA-239] support parsing UIMA descriptors in a mode that preserves comments 
and formatting whitespace.

Modified:

uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/MetaDataObject_impl.java

uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/XMLParser.java

uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/XMLSerializer.java

uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/SaxDeserializer_impl.java

uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/XMLParser_impl.java

Modified: 
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/MetaDataObject_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/MetaDataObject_impl.java?rev=1234089r1=1234088r2=1234089view=diff
==
--- 
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/MetaDataObject_impl.java
 (original)
+++ 
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/resource/metadata/impl/MetaDataObject_impl.java
 Fri Jan 20 19:33:07 2012
@@ -49,20 +49,25 @@ import org.apache.uima.util.InvalidXMLEx
 import org.apache.uima.util.NameClassPair;
 import org.apache.uima.util.XMLParser;
 import org.apache.uima.util.XMLSerializer;
+import org.apache.uima.util.XMLSerializer.CharacterValidatingContentHandler;
 import org.apache.uima.util.XMLizable;
+import org.w3c.dom.CharacterData;
 import org.w3c.dom.Comment;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
 import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
 import org.xml.sax.helpers.AttributesImpl;
 
 /**
  * Abstract base class for all MetaDataObjects in the reference 
implementation. Provides basic
- * support for getting and setting property values given their names, by 
storing all attribute
- * values in a HashMap keyed on attribute name.
+ * support for getting and setting property values given their names, using 
bean introspection and reflection.
  * p
  * Also provides the ability to write objects to XML and build objects from 
their DOM
  * representation, as required to implement the {@link XMLizable} interface, 
which is a
@@ -92,6 +97,13 @@ public abstract class MetaDataObject_imp
 
   private transient URL mSourceUrl;
   
+  // This is only used if we are capturing comments and ignorable whitespace 
in the XML
+  private transient Node infoset = null; // by default, set to null
+  
+  public void setInfoset(Node infoset) {
+this.infoset = infoset;
+  }
+
   /**
* Creates a new codeMetaDataObject_impl/code with null attribute values
*/
@@ -549,11 +561,7 @@ public abstract class MetaDataObject_imp
*  a Writer to which the XML string will be written
*/
   public void toXML(Writer aWriter) throws SAXException, IOException {
-XMLSerializer sax2xml = new XMLSerializer(aWriter);
-ContentHandler contentHandler = sax2xml.getContentHandler();
-contentHandler.startDocument();
-toXML(sax2xml.getContentHandler(), true);
-contentHandler.endDocument();
+toXML(new XMLSerializer(aWriter));
   }
 
   /**
@@ -563,11 +571,14 @@ public abstract class MetaDataObject_imp
*  an OutputStream to which the XML string will be written
*/
   public void toXML(OutputStream aOutputStream) throws SAXException, 
IOException {
-XMLSerializer sax2xml = new XMLSerializer(aOutputStream);
+toXML(new XMLSerializer(aOutputStream));
+  }
+  
+  private void toXML(XMLSerializer sax2xml) throws SAXException, IOException {
 ContentHandler contentHandler = sax2xml.getContentHandler();
 contentHandler.startDocument();
 toXML(sax2xml.getContentHandler(), true);
-contentHandler.endDocument();
+contentHandler.endDocument();
   }
 
   /**
@@ -583,7 +594,7 @@ public abstract class MetaDataObject_imp
   public void toXML(ContentHandler aContentHandler, boolean 
aWriteDefaultNamespaceAttribute)
   throws SAXException {
 XmlizationInfo inf = getXmlizationInfo();
-
+
 // write the element's start tag
 // get attributes (can be provided by subclasses)
 AttributesImpl attrs = getXMLAttributes();
@@ -595,16 +606,22 @@ public abstract class MetaDataObject_imp
 }
 
 // start element
-aContentHandler.startElement(inf.namespace, inf.elementTagName, 
inf.elementTagName, attrs);
-
-// write child elements
-for (int i = 0; i  inf.propertyInfo.length; i++) {
-  PropertyXmlInfo propInf = inf.propertyInfo[i];
-  writePropertyAsElement(propInf, 

svn commit: r1234090 - /uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeResourceManagerConfigurationImpl.java

2012-01-20 Thread schor
Author: schor
Date: Fri Jan 20 19:33:39 2012
New Revision: 1234090

URL: http://svn.apache.org/viewvc?rev=1234090view=rev
Log:
[UIMA-239] support parsing UIMA descriptors in a mode that preserves comments 
and formatting whitespace.

Modified:

uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeResourceManagerConfigurationImpl.java

Modified: 
uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeResourceManagerConfigurationImpl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeResourceManagerConfigurationImpl.java?rev=1234090r1=1234089r2=1234090view=diff
==
--- 
uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeResourceManagerConfigurationImpl.java
 (original)
+++ 
uima/uimaj/trunk/uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CpeResourceManagerConfigurationImpl.java
 Fri Jan 20 19:33:39 2012
@@ -65,6 +65,9 @@ public class CpeResourceManagerConfigura
   public void buildFromXMLElement(Element aElement, XMLParser aParser, 
ParsingOptions aOptions)
   throws InvalidXMLException {
 setHref(aElement.getAttribute(href));
+if (aOptions.preserveComments) {
+  setInfoset(aElement);
+}
   }
 
   /**




svn commit: r1234092 - in /uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors: MultiPageEditor.java ui/AbstractSection.java

2012-01-20 Thread schor
Author: schor
Date: Fri Jan 20 19:36:44 2012
New Revision: 1234092

URL: http://svn.apache.org/viewvc?rev=1234092view=rev
Log:
[UIMA-239] support parsing UIMA descriptors in a mode that preserves comments 
and formatting whitespace.

Modified:

uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java

uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/AbstractSection.java

Modified: 
uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java?rev=1234092r1=1234091r2=1234092view=diff
==
--- 
uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java
 (original)
+++ 
uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java
 Fri Jan 20 19:36:44 2012
@@ -154,6 +154,7 @@ import org.eclipse.ui.forms.widgets.Form
 import org.eclipse.ui.part.FileEditorInput;
 import org.eclipse.ui.texteditor.ITextEditor;
 import org.osgi.framework.Bundle;
+import org.w3c.dom.Node;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -205,6 +206,8 @@ public class MultiPageEditor extends For
   public final int INITIAL_SIZE_TYPE_COLLECTIONS = 20;
 
   public final int INITIAL_SIZE_FEATURE_COLLECTIONS = 40;
+  
+  public final boolean PRESERVE_COMMENTS = true;
 
   // **
 
@@ -222,6 +225,7 @@ public class MultiPageEditor extends For
 
   private TypeSystemDescription importedTypeSystemDescription = null;
 
+  private Node xmlInfoset = null;  // captures comments and ignorableWhitespace
   /**
* Key = unique ID of included AE in aggregate Value = 
AnalysisEngineSpecification or URISpecifier
* if remote This value is obtained from 
aeDescription.getDelegateAnalysisEngineSpecifiers() for
@@ -957,7 +961,7 @@ public class MultiPageEditor extends For
 // leaves isBadXML set, if it can't parse but isn't throwing
 isContextLoaded = false;
 try {
-  parseSource(input, filePathName);
+  parseSource(input, filePathName, PRESERVE_COMMENTS);
 } catch (MultilevelCancel e) {
   throw new PartInitException(Operation Cancelled);
 }
@@ -974,15 +978,15 @@ public class MultiPageEditor extends For
 
   private IUimaEditorExtension extensionEditor;
   
-  private void parseSource(XMLInputSource input, String filePathName) throws 
PartInitException {
+  private void parseSource(XMLInputSource input, String filePathName, boolean 
preserveComments) throws PartInitException {
 extensionEditor = null;
-parseSourceInner(input, filePathName);
+parseSourceInner(input, filePathName, preserveComments);
   }
   
-  private void parseSourceInner(XMLInputSource input, String filePathName) 
throws PartInitException {
+  private void parseSourceInner(XMLInputSource input, String filePathName, 
boolean preserveComments) throws PartInitException {
 XMLizable inputDescription = null;
 try {
-  inputDescription = AbstractSection.parseDescriptor(input);
+  inputDescription = AbstractSection.parseDescriptor(input, 
preserveComments);
   if (inputDescription instanceof AnalysisEngineDescription) {
 validateDescriptorType(DESCRIPTOR_AE);
 setAeDescription((AnalysisEngineDescription) inputDescription);
@@ -1039,7 +1043,7 @@ public class MultiPageEditor extends For
 // exception go away - so try reparsing.
 
 try {
-  parseSourceInner(new XMLInputSource(input.getURL()), 
filePathName);
+  parseSourceInner(new XMLInputSource(input.getURL()), 
filePathName, preserveComments);
 } catch (IOException e1) {
   Utility.popMessage(
   Internal Error,
@@ -1288,7 +1292,7 @@ public class MultiPageEditor extends For
 TypeSystemDescription oldTsdWithResolvedImports = 
mergedTypeSystemDescription;
 
 try {
-  parseSource(input, filePathName); // sets isBadXML to false if OK
+  parseSource(input, filePathName, true); // sets isBadXML to false if OK
 } catch (PartInitException e1) { // if user switched the kind of descriptor
   Utility.popMessage(Messages.getString(MultiPageEditor.20), 
//$NON-NLS-1$
   getMessagesToRootCause(e1), MessageDialog.ERROR);
@@ -1411,7 +1415,8 @@ public class MultiPageEditor extends For
 try {
   XMLSerializer xmlSerializer = new XMLSerializer(true);
   
xmlSerializer.setOutputProperty({http://xml.apache.org/xslt}indent-amount;, 
Integer.valueOf(
-  MultiPageEditorContributor.getXMLindent()).toString());
+MultiPageEditorContributor.getXMLindent()).toString());