| Re: [bpel-dev] Using BPELReader Class |
Simon D Moser a Ãcrit :
Hi Damien,
Hello,Thank you very much, it works a lot better.
**assuming ** your file is in your eclipse runtime workspace, this can be
done much, much simpler :
  ÂIPath path = new Path(
"/home/damien/Workspaces/BPEL/org.example.loadbpel/bpel/ldiplom.bpel");
  ÂIFile bpelFile = ResourcesPlugin.getWorkspace().getRoot().getFile
(path);
  ÂloadBPEL(bpelFile);).
  Âprotected Process loadBPEL(IFile bpelFile) {
     ÂResourceSet fResourceSet = new BPELResourceSetImpl();
     ÂIPath fullProcessPath = bpelFile.getFullPath();
     ÂURI uri = URI.createPlatformResourceURI
(fullProcessPath.toString(), false);
     ÂbpelResource = fResourceSet.getResource(uri, true);
     ÂEcorePackage instance = EcorePackage.eINSTANCE;
     Âinstance.eAdapters();
     Âtry {
        ÂbpelResource.load(Collections.EMPTY_MAP);
        ÂEList<EObject> contents = bpelResource.getContents();
        Âif (!contents.isEmpty()) {
           Âreturn (Process) contents.get(0);
        Â}
     Â} catch (Exception e) {
        Âe.printStackTrace();
     Â}
     Âreturn null;
  Â}
Yes, I had to change the path just like you said.
The path might not be correct in my example - it might be that you must
only specify the path starting from your workspace root instead of having
the full path - give it a try.
Well, what I would really be interested in would be to build a standalone application that does not need Eclipse running. The idea is to be able to call it from the command line to integrate it in a compilation chain.
Alternatively, *if* you want to launch whatever you are doing using a
right-click menu on the bpel process, let me know, I can send you a sample
plug-in for that, too.
I tried to create a Java project instead of a plugin project but, obviously, I get a "Workspace is empty" exception :)
Best regards,
--Damien Thivolle          |   INRIA Rhone-Alpes / VASY
PHD Student            |   655, Avenue de l'Europe
damien.thivolle@xxxxxxxx     Â|   Montbonnot
http://www.inrialpes.fr/vasy   Â|   38 334 Saint Ismier Cedex France
_______________________________________________
bpel-dev mailing list
bpel-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/bpel-dev