3

実行時に BPEL XML コードを生成する必要があります。今できる唯一の方法は、DOM API を使用して「素手」で XML ドキュメントを作成することです。しかし、ある種のオブジェクト モデルを組み込んで、そのような作業を容易にするフレームワークが必要です。

次のようになるはずです。

BPELProcessFactory.CreateProcess().addSequence

何でも知ってますか?

4

2 に答える 2

2

Eclipse BPEL デザイナープロジェクトは、BPEL 2.0のEMF モデルを提供します。生成されたコードを使用して、便利な API を使用してプログラムで BPEL コードを作成できます。

于 2011-03-03T21:57:12.663 に答える
0

誰かがこれに出くわした場合に備えて。

はい、これはBPEL Modelを使用して実行できます。

以下は、ごく単純な BPEL ファイルを生成するコードのサンプルです。

public Process createBPEL()
{
    Process process = null;
    BPELFactory factory = BPELFactory.eINSTANCE;

    try
    {
        ResourceSet rSet = new ResourceSetImpl();
        rSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
                .put("bpel", new BPELResourceFactoryImpl());
        File file = new File("myfile.bpel");
        file.createNewFile();
        String filePath = file.getAbsolutePath();
        System.out.println(filePath);
        AdapterRegistry.INSTANCE.registerAdapterFactory( BPELPackage.eINSTANCE, BasicBPELAdapterFactory.INSTANCE );
        Resource resource = rSet.createResource(URI.createFileURI(filePath));

        process = factory.createProcess();
        process.setName("FirstBPEL");
        Sequence seq = factory.createSequence();
        seq.setName("MainSequence");

        Receive recieve = factory.createReceive();
        PortType portType = new PortTypeProxy(URI.createURI("http://baseuri"), new QName("qname"));
        Operation operation = new OperationProxy(URI.createURI("http://localhost"), portType , "operation_name");
        recieve.setOperation(operation);

        Invoke invoke = factory.createInvoke();
        invoke.setOperation(operation);


        While whiles = factory.createWhile();
        If if_st = factory.createIf();

        List<Activity> activs = new ArrayList<Activity>();

        activs.add(recieve);
        activs.add(invoke);
        activs.add(if_st);
        activs.add(whiles);


        seq.getActivities().addAll(activs);

        process.setActivity(seq);

        resource.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("xsd", "http://www.w3.org/2001/XMLSchema");

        resource.save(map);
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }

    return process;
}

依存関係では、Eclipse インストール ディレクトリのpluginsフォルダーからプロジェクトのビルド パスに次の jar を追加する必要があります。

  • org.eclipse.bpel.model_*.jar
  • org.eclipse.wst.wsdl_*.jar
  • org.eclipse.emf.common_*.jar
  • org.eclipse.emf.ecore_*.jar
  • org.eclipse.emf.ecore.xmi_*.jar
  • javax.wsdl_*.jar
  • org.apache.xerces_*.jar
  • org.eclipse.bpel.common.model_*.jar
  • org.eclipse.xsd_*.jar
  • org.eclipse.core.resources_*.jar
  • org.eclipse.osgi_*.jar
  • org.eclipse.core.runtime_*.jar
  • org.eclipse.equinox.common_*.jar
  • org.eclipse.core.jobs_*.jar
  • org.eclipse.core.runtime.compatibility_*.jar
于 2016-06-21T11:06:57.287 に答える