You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by mb...@apache.org on 2007/03/21 17:54:27 UTC

svn commit: r520947 - /incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java

Author: mbaessler
Date: Wed Mar 21 09:54:26 2007
New Revision: 520947

URL: http://svn.apache.org/viewvc?view=rev&rev=520947
Log:
UIMA-354

add an API at the PackageBrowser to return the UIMA datapath setting for the current component.
The datapath that is returned must be specified by using the key "uima.datapath".

JIRA ticket https://issues.apache.org/jira/browse/UIMA-351

Modified:
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java?view=diff&rev=520947&r1=520946&r2=520947
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/tools/PackageBrowser.java Wed Mar 21 09:54:26 2007
@@ -23,11 +23,13 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.Properties;
 import java.util.TreeSet;
 import java.util.jar.JarFile;
 
 import org.apache.uima.pear.util.FileUtil;
 import org.apache.uima.pear.util.StringUtil;
+import org.apache.uima.resource.RelativePathResolver;
 import org.xml.sax.SAXException;
 
 /**
@@ -380,5 +382,27 @@
    */
   public boolean isArchived() {
     return _archived;
+  }
+
+  /**
+   * Returns the UIMA datapath setting for the component. 
+   * 
+   * The datapath of the component must be specified as environment variable with the key 
+   * <code>uima.datapath</code>.
+   * 
+   * @return the datapath setting for the component or null if the datapath is not specified.
+   * 
+   * @throws IOException
+   *            If any I/O exception occurred while reading the component meta data.
+   */
+  public String getComponentDataPath() throws IOException {
+
+    //get all environment variables that are specified for the current pear file
+    Properties pearEnvProps = InstallationController.buildTableOfEnvVars(this
+            .getInstallationDescriptor());
+
+    //return the uima datapath setting if available. If not return null
+    return (String) pearEnvProps.get(RelativePathResolver.UIMA_DATAPATH_PROP);
+
   }
 }