Examples of CasProcessorRunInSeperateProcess


Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

   */
  protected void addApplicationInfo(CasProcessorConfiguration aCasProcessorConfiguration,
          CpeCasProcessor aCasProcessor) throws ResourceConfigurationException {
    try {
      if (aCasProcessor instanceof CpeLocalCasProcessor) {
        CasProcessorRunInSeperateProcess rip = ((CpeLocalCasProcessor) aCasProcessor)
                .getRunInSeperateProcess();
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "Operating System is::::" + System.getProperty("os.name"));
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
        }
        executable = rip.getExecutable().getExecutable();
        List envList = rip.getExecutable().getEnvs();

        exec = new Execute();

        Properties sysEnv = null;
        try {
          sysEnv = SystemEnvReader.getEnvVars();
          if (System.getProperty("DEBUG") != null) {
            printSysEnvironment();
          }
        } catch (Throwable e) {
          e.printStackTrace();
        }

        if (envList != null) {
          // Make sure the env array has sufficient capacity
          environment.clear();
          // First copy all env vars from the CPE Descriptor treating PATH and CLASSPATH as special
          // cases
          int i = 0; // need this here so that we know where to append vars from the env Property
          // object
          for (; envList != null && i < envList.size(); i++) {
            CasProcessorRuntimeEnvParam envType = (CasProcessorRuntimeEnvParam) envList.get(i);
            String key = envType.getEnvParamName();
            String value = envType.getEnvParamValue();

            // Special Cases for PATH and CLASSPATH
            if (key.equalsIgnoreCase("PATH")) {
              String path = getEnvVarValue(key);
              if (path != null) {
                environment.add(key + "=" + value + System.getProperty("path.separator") + path);
              } else {
                environment.add(key + "=" + value + System.getProperty("path.separator"));
              }
              continue;
            }

            if (key.equalsIgnoreCase("CLASSPATH") && sysEnv != null) {
              String classpath = getEnvVarValue(key);
              if (classpath != null) {
                environment.add(key + "=" + value + System.getProperty("path.separator")
                        + classpath);
              } else {
                environment.add(key + "=" + value + System.getProperty("path.separator"));
              }
              continue;
            }
            environment.add(key + "=" + value);
          }

          // Now, copy all env vars from the current environment
          if (sysEnv != null) {
            Enumeration envKeys = sysEnv.keys();

            while (envKeys.hasMoreElements()) {
              String key = (String) envKeys.nextElement();
              // Skip those vars that we've already setup above
              if (key.equalsIgnoreCase("PATH") || key.equalsIgnoreCase("CLASSPATH")) {
                continue;
              }
              environment.add(key + "=" + sysEnv.getProperty(key));
            }
          }
          String[] envArray = new String[environment.size()];
          environment.toArray(envArray);
          exec.setEnvironment(envArray);
        }
        CasProcessorExecArg[] args = rip.getExecutable().getAllCasProcessorExecArgs();
        for (int i = 0; args != null && i < args.length; i++) {
          argList.add(args[i]);
        }

      }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

   */
  protected void addApplicationInfo(CasProcessorConfiguration aCasProcessorConfiguration,
          CpeCasProcessor aCasProcessor) throws ResourceConfigurationException {
    try {
      if (aCasProcessor instanceof CpeLocalCasProcessor) {
        CasProcessorRunInSeperateProcess rip = ((CpeLocalCasProcessor) aCasProcessor)
                .getRunInSeperateProcess();
        if (UIMAFramework.getLogger().isLoggable(Level.FINEST)) {
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "Operating System is::::" + System.getProperty("os.name"));
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
          UIMAFramework.getLogger(this.getClass()).log(Level.FINEST,
                  "+++++++++++++++++++++++++++++++++++++++++++++++++");
        }
        executable = rip.getExecutable().getExecutable();
        List<CasProcessorRuntimeEnvParam> descrptrEnvVars = rip.getExecutable().getEnvs();

        exec = new Execute();

        try {
          sysEnvVars = SystemEnvReader.getEnvVars();
          if (System.getProperty("DEBUG") != null) {
            printSysEnvironment();
          }
        } catch (Throwable e) {
          e.printStackTrace();
        }

        environment.clear();
        boolean pathDone = false;
        boolean classpathDone = false;
       
        if (descrptrEnvVars != null) {

          // First copy all env vars from the CPE Descriptor treating PATH and CLASSPATH as special
          // cases
         
          for (CasProcessorRuntimeEnvParam descrptrEv : descrptrEnvVars) {
            String key = descrptrEv.getEnvParamName();
            String value = descrptrEv.getEnvParamValue();

            // Special Cases for PATH and CLASSPATH
            if (key.equalsIgnoreCase("PATH")) {
              String path = getSysEnvVarValue(key);
              if (path != null) {
                environment.add(key + "=" + value + System.getProperty("path.separator") + path);
              } else {
                environment.add(key + "=" + value + System.getProperty("path.separator"));
              }
              pathDone = true;
              continue;
            }

            if (key.equalsIgnoreCase("CLASSPATH")) {
              String classpath = getSysEnvVarValue(key);
              if (classpath != null) {
                environment.add(key + "=" + value + System.getProperty("path.separator")
                        + classpath);
              } else {
                environment.add(key + "=" + value + System.getProperty("path.separator"));
              }
              classpathDone = true;
              continue;
            }
            environment.add(key + "=" + value);
          }

        }
        // Now, copy all env vars from the current environment
        if (sysEnvVars != null) {
          Enumeration envKeys = sysEnvVars.keys();

          while (envKeys.hasMoreElements()) {
            String key = (String) envKeys.nextElement();
            // Skip those vars that we've already setup above
            if ((key.equalsIgnoreCase("PATH") && pathDone) ||
                (key.equalsIgnoreCase("CLASSPATH") && classpathDone)) {
              continue;
            }
            environment.add(key + "=" + sysEnvVars.getProperty(key));
          }
        }
        String[] envArray = new String[environment.size()];
        environment.toArray(envArray);
        exec.setEnvironment(envArray);
       
        CasProcessorExecArg[] args = rip.getExecutable().getAllCasProcessorExecArgs();
        for (int i = 0; args != null && i < args.length; i++) {
          argList.add(args[i]);
        }

      }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

    }
  }

  private CasProcessorRunInSeperateProcess getBaseRunInSeperateProcess()
          throws CpeDescriptorException {
    CasProcessorRunInSeperateProcess sepProcess = getRunInSeperateProcess();
    if (sepProcess == null) {
      sepProcess = CpeDescriptorFactory.produceRunInSeperateProcess();
      CasProcessorExecutable exe = CpeDescriptorFactory.produceCasProcessorExecutable();
      exe.setExecutable("default");
      sepProcess.setExecutable(exe);
      setRunInSeperateProcess(sepProcess);
    }
    return sepProcess;
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

    }
    return sepProcess;
  }

  public void addExecArg(String aArgValue) throws CpeDescriptorException {
    CasProcessorRunInSeperateProcess sepProcess = getBaseRunInSeperateProcess();
    CasProcessorExecutable exe = sepProcess.getExecutable();
    CasProcessorExecArg execArg = CpeDescriptorFactory.produceCasProcessorExecArg();
    execArg.setArgValue(aArgValue);
    exe.addCasProcessorExecArg(execArg);
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

    execArg.setArgValue(aArgValue);
    exe.addCasProcessorExecArg(execArg);
  }

  public void removeExecArg(int aIndex) throws CpeDescriptorException {
    CasProcessorRunInSeperateProcess rip = getRunInSeparateProcess();
    if (rip != null) {
      CasProcessorExecutable exe = rip.getExecutable();
      if (exe != null) {
        exe.removeCasProcessorExecArg(aIndex);
      }
    }
  }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

    }
  }

  public List getExecArgs() throws CpeDescriptorException {
    ArrayList list = new ArrayList();
    CasProcessorRunInSeperateProcess rip = getRunInSeparateProcess();
    if (rip != null) {
      CasProcessorExecutable exe = rip.getExecutable();
      if (exe != null) {
        CasProcessorExecArg[] args = exe.getAllCasProcessorExecArgs();
        for (int i = 0; args != null && i < args.length; i++) {
          list.add(args[i]);
        }
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

    return list;
  }

  protected void addDefaults() throws CpeDescriptorException {
    if (getRunInSeperateProcess() == null) {
      CasProcessorRunInSeperateProcess sepProcess = CpeDescriptorFactory
              .produceRunInSeperateProcess();
      CasProcessorExecutable exe = CpeDescriptorFactory.produceCasProcessorExecutable();
      exe.setExecutable("default");

      sepProcess.setExecutable(exe);
      setRunInSeperateProcess(sepProcess);
    }
    if (getDeploymentParams() == null) {
      CasProcessorDeploymentParams deployParams = CpeDescriptorFactory.produceDeployParams();
      CasProcessorDeploymentParam param = CpeDescriptorFactory.produceDeployParam();
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

   * (non-Javadoc)
   *
   * @see org.apache.uima.collection.metadata.CpeLocalCasProcessor#isJava()
   */
  public boolean isJava() throws CpeDescriptorException {
    CasProcessorRunInSeperateProcess rip = getRunInSeparateProcess();
    if (rip != null) {
      CasProcessorExecutable exe = rip.getExecutable();
      if (exe != null) {
        return (exe.getExecutable().equalsIgnoreCase("java"));
      }
    }
    return false;
View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

   *
   * Adds a new env key to the list of env keys. If a kay with a given key name exists the new key
   * value replaces the old.
   */
  public void addExecEnv(String aEnvKeyName, String aEnvKeyValue) throws CpeDescriptorException {
    CasProcessorRunInSeperateProcess rip = getRunInSeparateProcess();
    if (rip != null) {
      CasProcessorExecutable exe = rip.getExecutable();
      if (exe != null) {
        ArrayList envs = exe.getEnvs();
        NameValuePair nvp;
        boolean replacedExisiting = false;

View Full Code Here

Examples of org.apache.uima.collection.metadata.CasProcessorRunInSeperateProcess

    // }
  }

  public List getExecEnv() throws CpeDescriptorException {
    CasProcessorRunInSeperateProcess rip = getRunInSeparateProcess();
    if (rip != null) {
      CasProcessorExecutable exe = rip.getExecutable();
      if (exe != null) {
        return exe.getEnvs();
      }
    }
    return new ArrayList(); // empty list
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.