以编程方式生成BPEL文件?

far*_*bry 7 java eclipse eclipse-plugin bpel

有没有办法在Java中以编程方式生成BPEL?

我尝试使用BPEL Eclipse Designer API编写此代码:

 Process process = null; 
 try {



        Resource.Factory.Registry reg =Resource.Factory.Registry.INSTANCE;

        Map<String, Object> m = reg.getExtensionToFactoryMap();

        m.put("bpel", new BPELResourceFactoryImpl());//it works with XMLResourceFactoryImpl()



         //create resource

         URI uri =URI.createFileURI("myBPEL2.bpel");



         ResourceSet rSet = new ResourceSetImpl();

          Resource bpelResource = rSet.createResource(uri);



          //create/populate process

          process = BPELFactory.eINSTANCE.createProcess();

          process.setName("myBPEL");

          Sequence mySeq = BPELFactory.eINSTANCE.createSequence();

          mySeq.setName("mainSequence");

          process.setActivity(mySeq);



          //save resource

          bpelResource.getContents().add(process);

          Map<String,String> map= new HashMap<String, String>();
          map.put("bpel", "http://docs.oasis-open.org/wsbpel/2.0/process/executable");
          map.put("tns", "http://matrix.bpelprocess");
          map.put("xsd", "http://www.w3.org/2001/XMLSchema");
          bpelResource.save(map);

    }



    catch (Exception e) {

          e.printStackTrace();

    }


}
Run Code Online (Sandbox Code Playgroud)

但我收到一个错误:

INamespaceMap cannot be attached to an eObject ...

西蒙读到这条消息:

我知道在Eclipse之外使用BPEL模型可能是可取的,但我们从未想过它.因此,这不受支持

还有其他API可以提供帮助吗?

far*_*bry 2

添加必要的类来处理相关性后,已使用统一框架 API解决了这个问题。@Daniel 所说的 BPELUnit 似乎是另一种选择。