Package org.apache.uima.pear.tools

Examples of org.apache.uima.pear.tools.PackageBrowser


   */
  private static void runCVD() {
    try {

      // create PackageBrowser object
      PackageBrowser pkgBrowser = new PackageBrowser(new File(mainComponentRootPath));

      // get pear descriptor
      String pearDesc = pkgBrowser.getComponentPearDescPath();

      // start CVD
      MainFrame frame = CVD.createMainFrame();
     
      // Prevent CVD from shutting down JVM after exit
View Full Code Here


        // should check whether a different mapper has already unpacked it
        // but for now we just unpack in a different location for every mapper
        TaskAttemptID attempt = TaskAttemptID.forName(conf
                .get("mapred.task.id"));
        installDir = new File(pearFile.getParentFile(), attempt.toString());
        PackageBrowser instPear = PackageInstaller.installPackage(installDir,
                pearFile, true);

        // get the resources required for the AnalysisEngine
        org.apache.uima.resource.ResourceManager rsrcMgr = UIMAFramework
                .newDefaultResourceManager();

        // Create analysis engine from the installed PEAR package using
        // the created PEAR specifier
        XMLInputSource in;
        try {
            in = new XMLInputSource(instPear.getComponentPearDescPath());

            ResourceSpecifier specifier = UIMAFramework.getXMLParser()
                    .parseResourceSpecifier(in);

            tae = UIMAFramework.produceAnalysisEngine(specifier, rsrcMgr, null);
View Full Code Here

        storeshortnames = config.getBoolean("uima.store.short.names", true);

        File pearFile = new File(urlPEAR.getPath());

        PackageBrowser instPear = PackageInstaller.installPackage(
                pearFile.getParentFile(), pearFile, true);

        // get the resources required for the AnalysisEngine
        org.apache.uima.resource.ResourceManager rsrcMgr = UIMAFramework
                .newDefaultResourceManager();

        // Create analysis engine from the installed PEAR package using
        // the created PEAR specifier
        XMLInputSource in;
        try {
            in = new XMLInputSource(instPear.getComponentPearDescPath());

            ResourceSpecifier specifier = UIMAFramework.getXMLParser()
                    .parseResourceSpecifier(in);

            tae = UIMAFramework.produceAnalysisEngine(specifier, rsrcMgr, null);
View Full Code Here

    public void setConf(Configuration conf) {
        long initStart = System.currentTimeMillis();
        config = conf;
        storeshortnames = config.getBoolean("uima.store.short.names", true);
        File pearFile = new File(urlPEAR.getPath());
        PackageBrowser instPear = PackageInstaller.installPackage(
                pearFile.getParentFile(), pearFile, true);

        // get the resources required for the AnalysisEngine
        org.apache.uima.resource.ResourceManager rsrcMgr = UIMAFramework
                .newDefaultResourceManager();

        // Create analysis engine from the installed PEAR package using
        // the created PEAR specifier
        XMLInputSource in;
        try {
            in = new XMLInputSource(instPear.getComponentPearDescPath());

            ResourceSpecifier specifier = UIMAFramework.getXMLParser()
                    .parseResourceSpecifier(in);

            tae = UIMAFramework.produceAnalysisEngine(specifier, rsrcMgr, null);
View Full Code Here

        // should check whether a different mapper has already unpacked it
        // but for now we just unpack in a different location for every mapper
        TaskAttemptID attempt = TaskAttemptID.forName(conf
                .get("mapred.task.id"));
        installDir = new File(pearFile.getParentFile(), attempt.toString());
        PackageBrowser instPear = PackageInstaller.installPackage(installDir,
                pearFile, true);

        // get the resources required for the AnalysisEngine
        org.apache.uima.resource.ResourceManager rsrcMgr = UIMAFramework
                .newDefaultResourceManager();

        // Create analysis engine from the installed PEAR package using
        // the created PEAR specifier
        XMLInputSource in;
        try {
            in = new XMLInputSource(instPear.getComponentPearDescPath());

            ResourceSpecifier specifier = UIMAFramework.getXMLParser()
                    .parseResourceSpecifier(in);

            tae = UIMAFramework.produceAnalysisEngine(specifier, rsrcMgr, null);
View Full Code Here

    File pearFile2 = JUnitExtension.getFile(pear2);
    Assert.assertNotNull(pearFile2);

    // Install PEAR packages
    PackageBrowser instPear1 = PackageInstaller
            .installPackage(this.tempInstallDir, pearFile1, true);

    // check pear PackageBrowser object
    Assert.assertNotNull(instPear1);

    PackageBrowser instPear2 = PackageInstaller
            .installPackage(this.tempInstallDir, pearFile2, true);

    // check pear PackageBrowser object
    Assert.assertNotNull(instPear2);

    // create aggregate analysis engine descriptor
    AnalysisEngineDescription desc = UIMAFramework.getResourceSpecifierFactory()
            .createAnalysisEngineDescription();
    desc.setPrimitive(false);

    // import pear specifiers
    Import impPear1 = UIMAFramework.getResourceSpecifierFactory().createImport();
    File import1 = new File(instPear1.getComponentPearDescPath());
    impPear1.setLocation(import1.toURI().getPath());

    // import main pear descriptor
    Import impPear2 = UIMAFramework.getResourceSpecifierFactory().createImport();
    File import2 = new File(instPear2.getComponentPearDescPath());
    impPear2.setLocation(import2.toURI().getPath());

    // add delegates as imports
    Map delegates = desc.getDelegateAnalysisEngineSpecifiersWithImports();
    delegates.put("Pear1", impPear1);
View Full Code Here

    try {
      // get installed pear root directory - specified as URI of the descriptor
      File pearRootDir = new File(pearRootDirPath);

      // create pear package browser to get the pear meta data
      PackageBrowser pkgBrowser = new PackageBrowser(pearRootDir);

      // get pear env variables and set them as system properties
      Properties props = pkgBrowser.getComponentEnvVars();
      Iterator keyIterator = props.keySet().iterator();
      Properties systemProps = System.getProperties();
      while (keyIterator.hasNext()) {
        String key = (String) keyIterator.next();
        String value = (String) props.get(key);

        // log warning if system property already exist and does not have the same value
        if (systemProps.containsKey(key)) {
          String systemPropValue = (String) systemProps.get(key);
          if (!systemPropValue.equals(value)) {
            UIMAFramework.getLogger(this.getClass()).logrb(
                    Level.WARNING,
                    this.getClass().getName(),
                    "initialize",
                    LOG_RESOURCE_BUNDLE,
                    "UIMA_pear_runtime_system_var_already_set__WARNING",
                    new Object[] { (key + "=" + systemPropValue), (key + "=" + value),
                        pkgBrowser.getRootDirectory().getName() });
          }
        }
        // set new system property
        System.setProperty(key, value);

        UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
                "initialize", LOG_RESOURCE_BUNDLE, "UIMA_pear_runtime_set_system_var__CONFIG",
                new Object[] { key + "=" + value, pkgBrowser.getRootDirectory().getName() });

      }
      ResourceManager applicationRM = this.getResourceManager();
      String classPath = pkgBrowser.buildComponentClassPath();
      String dataPath = pkgBrowser.getComponentDataPath();
      StringPair sp = new StringPair(classPath, dataPath);
      ResourceManager innerRM;
     
      Map c1 = (Map)cachedResourceManagers.get(applicationRM);
      if (null == c1) {
        innerRM = createRM(sp, pkgBrowser);
        cachedResourceManagers.put(applicationRM, createRMmap(sp, innerRM));
      } else {
        innerRM = (ResourceManager)c1.get(sp);
        if (null == innerRM) {
          innerRM = createRM(sp, pkgBrowser);
          c1.put(sp, innerRM);
          UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
              "initialize", LOG_RESOURCE_BUNDLE, "UIMA_pear_runtime_add_RM_map",
              new Object[] {sp.classPath, sp.dataPath});
        }       
      }
     
      // Create an XML input source from the specifier file
      XMLInputSource in = new XMLInputSource(pkgBrowser.getInstallationDescriptor()
              .getMainComponentDesc());

      // Parse the resource specifier
      ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
View Full Code Here

   */
  private void runCVD() {
    try {

      // create PackageBrowser object
      PackageBrowser pkgBrowser = new PackageBrowser(new File(mainComponentRootPath));

      // get pear descriptor
      String pearDesc = pkgBrowser.getComponentPearDescPath();

      // start CVD
      MainFrame frame = CVD.createMainFrame();
     
      // Prevent CVD from shutting down JVM after exit
View Full Code Here

TOP

Related Classes of org.apache.uima.pear.tools.PackageBrowser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.