Package org.uengine.util

Examples of org.uengine.util.SystemLauncher


    previewForm.setName("preview");
       
    edit.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {

        SystemLauncher launcher = new SystemLauncher(){
          public void completed(){
          }
         
          public void write(String line){
            //Do nothing....
          }
        };
       
       
       
        //TODO: 1. 서버에 있는 Form html을 읽어서 file로 저장.
        //FIXME: production 버전을 갖고 와야함
        FormActivity formActivity = (FormActivity) getActivity();
        HtmlFormContext formContext = (HtmlFormContext) formActivity.getVariableForHtmlFormContext().getDefaultValue();
       
        String formDefID[] = formContext.getFormDefId().split("@");


        openedForm = new OpenedForm();
        openedForm.formDefVerId = formDefID[1];
        openedForm.formName = formDefID[0].replaceAll("[\\[||\\]]","");
        openedForm.launcher = launcher; //may result huge memory resident in the static variable "openedForms"
       
        String fileName = openedForm.formName + ".jsp";
        String tempFilePath = System.getProperty("temp.path", "C:\\uengine\\");

        File newFile = new File(tempFilePath);
        if(!newFile.exists()){
          newFile.mkdirs();
        }
       
        tempFilePath = tempFilePath + File.separatorChar + fileName;

        openedForm.localFilePath = tempFilePath;
   
        InputStream is;
        try {
          is = ProcessDesigner.getInstance().getClientProxy().showFormDefinitionWithVersionId(formDefID[1]);
          File outFile = new File(tempFilePath);
          BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile));
          /*if(is!=null){
            byte [] buf = new byte[1024];
            int len;
            while ((len = is.read(buf)) > 0) {
              bos.write(buf, 0, len);
            }
            is.close();
              }
          bos.close();*/
         
          if(is!=null)
            org.uengine.util.UEngineUtil.copyStream(is, bos);
         
          openedForm.lastModified = outFile.lastModified();
          //openedForm.
         
        } catch (Exception e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
        String tool = System.getProperty("form.editor", "notepad");
       
        //review: this command will work only in Windows
        launcher.run(
          "cmd /c \"" + tool + "\" " + tempFilePath
        );
       
        openedForms.put(openedForm.formName, openedForm);
       
View Full Code Here


  protected void executeActivity(ProcessInstance instance) throws Exception {

    final ProcessInstance thisInstance = instance;
   
    final Vector outStrings =new Vector();
    SystemLauncher sl =new SystemLauncher(){
      public void write(String out){
        outStrings.add(out);
      }

      /* (non-Javadoc)
       * @see org.uengine.util.SystemLauncher#completed()
       */
      /**
       * TODO This will hold the process instance object that occurs big memory consumption.
       */
      @Override
      public void completed() {
        try {
          fireComplete(thisInstance);
        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
     
     
    };
   
    String aed = getDefaultDirectory();
   
    if(!aed.endsWith("\\") && !aed.endsWith("/")) aed = aed +System.getProperty("file.separator");
   
    String command = "cmd /c "+System.getProperty(aed+getApplicationPath(),aed+getApplicationPath());
    for (int i = 0; i < getArguments().length; i++) {
      String pvName = getArguments()[i].getVariable() !=null? getArguments()[i].getVariable().getName():"";
      if(UEngineUtil.isNotEmpty(pvName))
        command+= " "+instance.get("",pvName);
    }
   
    sl.run(command);
   
    String outString =null;
    for (int i = 0; i < outStrings.size(); i++) {
      outString +=(String)outStrings.get(i);
      instance.addDebugInfo(outString);
View Full Code Here

TOP

Related Classes of org.uengine.util.SystemLauncher

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.