Author: pkluegl
Date: Mon Jan  9 17:20:01 2012
New Revision: 1229263

URL: http://svn.apache.org/viewvc?rev=1229263&view=rev
Log:
UIMA-2321
added ResourceManager for resolving type systems

Modified:
    
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerBuilder.java
    
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerProjectUtils.java
    
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerSimpleBuilder.java

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerBuilder.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerBuilder.java?rev=1229263&r1=1229262&r2=1229263&view=diff
==============================================================================
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerBuilder.java
 (original)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerBuilder.java
 Mon Jan  9 17:20:01 2012
@@ -49,7 +49,6 @@ import org.eclipse.core.runtime.IProgres
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
 import org.eclipse.dltk.core.DLTKCore;
@@ -64,6 +63,7 @@ import org.eclipse.dltk.internal.core.bu
 import org.eclipse.dltk.internal.core.builder.Messages;
 import org.eclipse.dltk.internal.core.builder.SourceModuleBuildContext;
 import org.eclipse.dltk.internal.core.builder.StandardScriptBuilder;
+import org.eclipse.jface.preference.IPreferenceStore;
 
 public class TextMarkerBuilder extends StandardScriptBuilder {
 
@@ -259,7 +259,7 @@ public class TextMarkerBuilder extends S
 
     try {
       TextMarkerBuildOptions option = new TextMarkerBuildOptions(language, 
engines);
-      Preferences store = 
TextMarkerIdePlugin.getDefault().getPluginPreferences();
+      IPreferenceStore store = 
TextMarkerIdePlugin.getDefault().getPreferenceStore();
       
option.setImportByName(store.getBoolean(TextMarkerCorePreferences.BUILDER_IMPORT_BY_NAME));
       
option.setResolveImports(store.getBoolean(TextMarkerCorePreferences.BUILDER_RESOLVE_IMPORTS));
       builder.build(sm, typeSystemDest, engineDest, option, mainScript, 
scriptPaths, enginePaths);

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerProjectUtils.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerProjectUtils.java?rev=1229263&r1=1229262&r2=1229263&view=diff
==============================================================================
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerProjectUtils.java
 (original)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerProjectUtils.java
 Mon Jan  9 17:20:01 2012
@@ -155,10 +155,13 @@ public class TextMarkerProjectUtils {
   }
 
   public static void setProjectDataPath(IProject project, IFolder folder) 
throws CoreException {
+//    TODO: what about referenced projects?
     project.setPersistentProperty(new QualifiedName("", "CDEdataPath"), 
folder.getLocation()
             .toPortableString());
-
   }
+  
+  
+  
 
   public static String getDefaultInputLocation() {
     return "input";

Modified: 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerSimpleBuilder.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerSimpleBuilder.java?rev=1229263&r1=1229262&r2=1229263&view=diff
==============================================================================
--- 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerSimpleBuilder.java
 (original)
+++ 
uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-ide/src/main/java/org/apache/uima/textmarker/ide/core/builder/TextMarkerSimpleBuilder.java
 Mon Jan  9 17:20:01 2012
@@ -42,6 +42,8 @@ import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.TypeSystem;
 import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.ResourceManager;
+import org.apache.uima.resource.impl.ResourceManager_impl;
 import org.apache.uima.resource.metadata.Capability;
 import org.apache.uima.resource.metadata.ConfigurationParameterSettings;
 import org.apache.uima.resource.metadata.FsIndexDescription;
@@ -71,6 +73,8 @@ public class TextMarkerSimpleBuilder {
 
   private final String defaultTypeSystem;
 
+  private ResourceManager rm;
+  
   public TextMarkerSimpleBuilder(String defaultTypeSystem, String 
defaultEngine)
           throws InvalidXMLException, IOException {
     super();
@@ -82,12 +86,21 @@ public class TextMarkerSimpleBuilder {
     typeSystemDescription = uimaFactory.createTypeSystemDescription();
     analysisEngineDescription = 
UIMAFramework.getXMLParser().parseAnalysisEngineDescription(
             new XMLInputSource(new File(defaultEngine)));
+
   }
 
   public void build(DescriptorManager desc, String typeSystemOutput, String 
engineOutput,
           TextMarkerBuildOptions option, String mainScript, String[] 
scriptPaths,
           String[] enginePaths) throws SAXException, TextMarkerBuildException, 
InvalidXMLException,
           IOException, ResourceInitializationException {
+       
+    rm = new ResourceManager_impl();
+    String dataPath ="";
+    for (String string : enginePaths) {
+      dataPath += string + File.pathSeparator;
+    }
+    rm.setDataPath(dataPath);
+    
     Map<String, String> typeNameMap = new HashMap<String, String>();
     Capability capability = uimaFactory.createCapability();
     // String defaultTypeSystem2 = defaultTypeSystem.replaceAll("/", "\\\\");
@@ -163,7 +176,7 @@ public class TextMarkerSimpleBuilder {
     typeSystemDescription.setImports(newImports);
     if (option.isResolveImports()) {
       try {
-        typeSystemDescription.resolveImports();
+        typeSystemDescription.resolveImports(rm);
       } catch (InvalidXMLException e) {
         throw new TextMarkerBuildException("Failed to resolve imported Type 
Systems", e);
       }
@@ -394,7 +407,7 @@ public class TextMarkerSimpleBuilder {
     TypeSystemDescription tsdesc = 
UIMAFramework.getXMLParser().parseTypeSystemDescription(
             new XMLInputSource(file));
     if (option.isResolveImports()) {
-      tsdesc.resolveImports();
+      tsdesc.resolveImports(rm);
     }
     return tsdesc;
   }


Reply via email to