Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Service Oriented Architecture Tools Platform (STP) » Open BPMN model in main method
Open BPMN model in main method [message #593840] Thu, 20 September 2007 14:04 Go to next message
Eclipse UserFriend
Originally posted by: anders.ottosson3.telia.com

Is there a way to open a bpmn-model in a standalone main method? Since
I'm a n00b at Eclipse BPMN/GMF/EMF I have tried the FAQ (from EMF)
examples with no luck, the result is always:
---
Exception in thread "main"
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'version'
not found. (file:/C:/src/test/BPMN/credit_report.bpmn, 2, 175)...
---

The code I have tried with is:
....
ResourceSet resourceSet = new ResourceSetImpl();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "bpmn",
new BpmnResourceFactoryImpl());

BpmnPackageImpl.eINSTANCE.eClass();
Resource resource = resourceSet.getResource(URI.createFileURI(fileName),
true);

try {
resource.load(null);
} catch (Exception e) {
e.printStackTrace();
}
....

I have added the following jars to the classpath:
org.eclipse.core.runtime_3.2.0.v20060603.jar
org.eclipse.emf.common_2.3.0.v200709042200.jar
org.eclipse.emf.ecore.change_2.3.0.v200709042200.jar
org.eclipse.emf.ecore.xmi_2.3.1.v200709042200.jar
org.eclipse.emf.ecore_2.3.1.v200709042200.jar
org.eclipse.stp.bpmn.diagram_1.0.0.061.jar
org.eclipse.stp.bpmn.edit_1.0.0.061.jar
org.eclipse.stp.bpmn_1.0.0.061.jar

Any help would be greatly appreciated!

Regards
Anders Ottosson
Re: Open BPMN model in main method [message #593884 is a reply to message #593840] Thu, 20 September 2007 15:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: atoulme.intalio.com

Hi Anders,

off the top of my head, untested and all:

TransactionalEditingDomain domain =
GMFEditingDomainFactory.INSTANCE.createEditingDomain();

ResourceSet resourceSet = domain.getResourceSet();

Resource res =
resourceSet.getResource(URI.createPlatformURI(file.getFullPa th()), true);

and then you are done.

Couple of notes:

the URI and the path depend of your environement. The platform URI is
handy for things inside the workspace. You might have to do some
trial/error tests there.

Doing a getResource('', true) loads the resource. No need to load it
explicitly afterwards.

The domain takes care of the bpmn editing domain and will resolve the
model, as it is declared in the plugin.xml. No need to register it, I think.

I haven't touched that particular part of our code for some time, so
please proceed with caution :).

I hope this helps. Feel free to ask on the EMF newsgroup if that doesn't
work. Ed is always very helpful (and fast !).

Antoine


Anders Ottosson wrote:
> Is there a way to open a bpmn-model in a standalone main method? Since
> I'm a n00b at Eclipse BPMN/GMF/EMF I have tried the FAQ (from EMF)
> examples with no luck, the result is always:
> ---
> Exception in thread "main"
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'version'
> not found. (file:/C:/src/test/BPMN/credit_report.bpmn, 2, 175)...
> ---
>
> The code I have tried with is:
> ...
> ResourceSet resourceSet = new ResourceSetImpl();
> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "bpmn",
> new BpmnResourceFactoryImpl());
>
> BpmnPackageImpl.eINSTANCE.eClass();
> Resource resource = resourceSet.getResource(URI.createFileURI(fileName),
> true);
>
> try {
> resource.load(null);
> } catch (Exception e) {
> e.printStackTrace();
> }
> ...
>
> I have added the following jars to the classpath:
> org.eclipse.core.runtime_3.2.0.v20060603.jar
> org.eclipse.emf.common_2.3.0.v200709042200.jar
> org.eclipse.emf.ecore.change_2.3.0.v200709042200.jar
> org.eclipse.emf.ecore.xmi_2.3.1.v200709042200.jar
> org.eclipse.emf.ecore_2.3.1.v200709042200.jar
> org.eclipse.stp.bpmn.diagram_1.0.0.061.jar
> org.eclipse.stp.bpmn.edit_1.0.0.061.jar
> org.eclipse.stp.bpmn_1.0.0.061.jar
>
> Any help would be greatly appreciated!
>
> Regards
> Anders Ottosson


--
Intalio, the Open Source BPMS Company

<a href="http://www.intalio.com">http://www.intalio.com</a>
<a href="http://bpms.intalio.com">Community website</a>
Re: Open BPMN model in main method [message #593905 is a reply to message #593884] Thu, 20 September 2007 20:01 Go to previous message
Eclipse UserFriend
Originally posted by: anders.ottosson3.telia.com

Thanks for the answer, I will try this in the morning when my head
clears up a bit...

Thanks
/Anders

Antoine Toulme wrote:
> Hi Anders,
>
> off the top of my head, untested and all:
>
> TransactionalEditingDomain domain =
> GMFEditingDomainFactory.INSTANCE.createEditingDomain();
>
> ResourceSet resourceSet = domain.getResourceSet();
>
> Resource res =
> resourceSet.getResource(URI.createPlatformURI(file.getFullPa th()), true);
>
> and then you are done.
>
> Couple of notes:
>
> the URI and the path depend of your environement. The platform URI is
> handy for things inside the workspace. You might have to do some
> trial/error tests there.
>
> Doing a getResource('', true) loads the resource. No need to load it
> explicitly afterwards.
>
> The domain takes care of the bpmn editing domain and will resolve the
> model, as it is declared in the plugin.xml. No need to register it, I
> think.
>
> I haven't touched that particular part of our code for some time, so
> please proceed with caution :).
>
> I hope this helps. Feel free to ask on the EMF newsgroup if that doesn't
> work. Ed is always very helpful (and fast !).
>
> Antoine
>
>
> Anders Ottosson wrote:
>> Is there a way to open a bpmn-model in a standalone main method? Since
>> I'm a n00b at Eclipse BPMN/GMF/EMF I have tried the FAQ (from EMF)
>> examples with no luck, the result is always:
>> ---
>> Exception in thread "main"
>> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
>> org.eclipse.emf.ecore.xmi.FeatureNotFoundException: Feature 'version'
>> not found. (file:/C:/src/test/BPMN/credit_report.bpmn, 2, 175)...
>> ---
>>
>> The code I have tried with is:
>> ...
>> ResourceSet resourceSet = new ResourceSetImpl();
>> Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap( ).put( "bpmn",
>> new BpmnResourceFactoryImpl());
>>
>> BpmnPackageImpl.eINSTANCE.eClass();
>> Resource resource =
>> resourceSet.getResource(URI.createFileURI(fileName), true);
>>
>> try {
>> resource.load(null);
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>> ...
>>
>> I have added the following jars to the classpath:
>> org.eclipse.core.runtime_3.2.0.v20060603.jar
>> org.eclipse.emf.common_2.3.0.v200709042200.jar
>> org.eclipse.emf.ecore.change_2.3.0.v200709042200.jar
>> org.eclipse.emf.ecore.xmi_2.3.1.v200709042200.jar
>> org.eclipse.emf.ecore_2.3.1.v200709042200.jar
>> org.eclipse.stp.bpmn.diagram_1.0.0.061.jar
>> org.eclipse.stp.bpmn.edit_1.0.0.061.jar
>> org.eclipse.stp.bpmn_1.0.0.061.jar
>>
>> Any help would be greatly appreciated!
>>
>> Regards
>> Anders Ottosson
>
>
Previous Topic:Migration of STP Source Code to Subversion
Next Topic:Cannot access SOA Preferences pages
Goto Forum:
  


Current Time: Wed Apr 24 16:33:13 GMT 2024

Powered by FUDForum. Page generated in 0.03631 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top