[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [bpel-dev] Using BPELReader Class
|
Simon D Moser a écrit :
Hi Damien,
Hello,
**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;
}
Thank you very much, it works a lot better.
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.
Yes, I had to change the path just like you said.
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.
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.
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