以编程方式生成BPEL文件? [英] Generating BPEL files programmatically?

查看:166
本文介绍了以编程方式生成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,新的BPELResourceFactoryImpl()); //它与XMLResourceFactoryImpl()一起使用



//创建资源

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



ResourceSet rSet = new ResourceSetImpl();

资源bpelResource = rSet.createResource(uri);



//创建/填充进程

process = BPELFactory.eINSTANCE.createProcess();

process.setName(myBPEL);

序列mySeq = BPELFactory.eINSTANCE.createSequence();

mySeq.setName(mainSequence);

process.setActivity(mySeq);



//保存资源

bpelResource.getContents()。add(process);

地图< 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(异常e){

e.printStackTrace();

}


}

但我收到一个错误:


INamespaceMap不能附加到eObject 。 ..


我读了此消息由Simon:


我知道使用BPEL模型日食可能是可取的,但这并不是我们的意图。因此,这不支持


有没有其他API可以帮助?

解决方案

这已经使用 unify框架API ,添加必需的类来处理关联。 @Daniel表示的BPELUnit似乎是另一种选择。


Is there a way to generate BPEL programmatically in Java?

I tried using the BPEL Eclipse Designer API to write this code:

 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();

    }


}

but I received an error:

INamespaceMap cannot be attached to an eObject ...

I read this message by Simon:

I understand that using the BPEL model outside of eclipse might be desirable, but it was never intended by us. Thus, this isn't supported

Is there any other API that can help?

解决方案

This has been solved using the unify framework API after adding the necessary classes to handle correlation. BPELUnit stated by @Daniel seems to be another alternative.

这篇关于以编程方式生成BPEL文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆