Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » [oaw] Problem invoking JavaMetamodel from plugin
[oaw] Problem invoking JavaMetamodel from plugin [message #375678] Wed, 13 December 2006 13:48 Go to next message
Eclipse UserFriend
Originally posted by: tobiasbuhr.gmx.de

Hi all,

I try to invoke a workflow from a eclipse plugin via
WorkflowRunner.run(). All types, that are some kind of

<metaModel id="mm_my"
class="org.openarchitectureware.type.emf.EmfMetaModel">
<metaModelPackage value="my.MyPackage"/>
</metaModel>

are recognized correctly, but self created Java-Classes, that I try to
access with the JavaMetaModel

<metaModel id="mm_java"
class="org.openarchitectureware.type.impl.java.JavaMetaModel "/>

are not recognized:

---

2212 [main] ERROR org.openarchitectureware.workflow.WorkflowRunner -
Couldn't resolve type for 'mypackage::MyObject'. Did you forget to
configure the corresponding metamodel?:in my.ext on line 24 'Boolean
doSomething(mypackage::MyObject o)'
org.openarchitectureware.expression.EvaluationException: Couldn't
resolve type for 'mypackage::MyObject'. Did you forget to configure the
corresponding metamodel?:in my.ext on line 24 'Boolean
doSomething(mypackage::MyObject o)' at
org.openarchitectureware.xtend.ast.Extension.init(Extension. java:145)

---

If I start the workflow in the Eclipse-Platform via "Run ->
WorkflowRunner" everything goes fine.

Examining the executed WorkflowRunner.main() method, I took a look at
the resource loaders. I played around a little with them, but I did not
get it right (main method uses ResourceLoaderDefaultImpl but if I do so,
oaw stuff won't be found). Currently (with all non JavaMetamodels beeing
recognized correctly), I have to use the follwing line for having all
stuff (oaw, metamodels) loaded correctly (as it was posted often here):

ResourceLoaderFactory.setCurrentThreadResourceLoader(new
ResourceLoaderImpl(getClass().getClassLoader()));

---

Does anybody know something (loading own resources correctly, how to use
JavaMetaModels from own code)???

Thanks, Tobias
Re: [oaw] Problem invoking JavaMetamodel from plugin [message #375682 is a reply to message #375678] Mon, 18 December 2006 07:46 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Tobias,

Java classes need to be accessible through your classloader.
I assume you tried to use a class contained in your eclipse project?
Those classes are not in classpath of the eclipse runtime.

In order to start such a workflow you need to use the launch API.
I don't know how to invoke it programmatically (we use the extension point).

hope that helps,
Sven


Tobias Buhr wrote:
> Hi all,
>
> I try to invoke a workflow from a eclipse plugin via
> WorkflowRunner.run(). All types, that are some kind of
>
> <metaModel id="mm_my"
> class="org.openarchitectureware.type.emf.EmfMetaModel">
> <metaModelPackage value="my.MyPackage"/>
> </metaModel>
>
> are recognized correctly, but self created Java-Classes, that I try to
> access with the JavaMetaModel
>
> <metaModel id="mm_java"
> class="org.openarchitectureware.type.impl.java.JavaMetaModel "/>
>
> are not recognized:
>
> ---
>
> 2212 [main] ERROR org.openarchitectureware.workflow.WorkflowRunner -
> Couldn't resolve type for 'mypackage::MyObject'. Did you forget to
> configure the corresponding metamodel?:in my.ext on line 24 'Boolean
> doSomething(mypackage::MyObject o)'
> org.openarchitectureware.expression.EvaluationException: Couldn't
> resolve type for 'mypackage::MyObject'. Did you forget to configure the
> corresponding metamodel?:in my.ext on line 24 'Boolean
> doSomething(mypackage::MyObject o)' at
> org.openarchitectureware.xtend.ast.Extension.init(Extension. java:145)
>
> ---
>
> If I start the workflow in the Eclipse-Platform via "Run ->
> WorkflowRunner" everything goes fine.
>
> Examining the executed WorkflowRunner.main() method, I took a look at
> the resource loaders. I played around a little with them, but I did not
> get it right (main method uses ResourceLoaderDefaultImpl but if I do so,
> oaw stuff won't be found). Currently (with all non JavaMetamodels beeing
> recognized correctly), I have to use the follwing line for having all
> stuff (oaw, metamodels) loaded correctly (as it was posted often here):
>
> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
> ResourceLoaderImpl(getClass().getClassLoader()));
>
> ---
>
> Does anybody know something (loading own resources correctly, how to use
> JavaMetaModels from own code)???
>
> Thanks, Tobias
Re: [oaw] Problem invoking JavaMetamodel from plugin [message #375685 is a reply to message #375682] Tue, 19 December 2006 11:20 Go to previous message
Eclipse UserFriend
Originally posted by: tobiasbuhr.gmx.de

Sven Efftinge wrote:

> Java classes need to be accessible through your classloader.
> I assume you tried to use a class contained in your eclipse project?
> Those classes are not in classpath of the eclipse runtime.
>
> In order to start such a workflow you need to use the launch API.
> I don't know how to invoke it programmatically (we use the extension
> point).

thanks Sven, the way you described, it works :-)

WorkflowLaunchShortcut workflowLaunchShortcut = new
WorkflowLaunchShortcut();
workflowLaunchShortcut.launch(currentSelection, "run");

where currentSelection is one on a workflow file.

Thus I want to programmatically set up the input model file, and need
the result of the transformation in memory for further processing, it
will get little ugly I think.. (have to pass it back via extension that
wraps java method)

Nevertheless, I am happy to invoke oaw ;-) from my plugin now,

best regards, Tobias
(copy to openarchitecureware.org forum)
Re: [oaw] Problem invoking JavaMetamodel from plugin [message #560581 is a reply to message #375678] Mon, 18 December 2006 07:46 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Tobias,

Java classes need to be accessible through your classloader.
I assume you tried to use a class contained in your eclipse project?
Those classes are not in classpath of the eclipse runtime.

In order to start such a workflow you need to use the launch API.
I don't know how to invoke it programmatically (we use the extension point).

hope that helps,
Sven


Tobias Buhr wrote:
> Hi all,
>
> I try to invoke a workflow from a eclipse plugin via
> WorkflowRunner.run(). All types, that are some kind of
>
> <metaModel id="mm_my"
> class="org.openarchitectureware.type.emf.EmfMetaModel">
> <metaModelPackage value="my.MyPackage"/>
> </metaModel>
>
> are recognized correctly, but self created Java-Classes, that I try to
> access with the JavaMetaModel
>
> <metaModel id="mm_java"
> class="org.openarchitectureware.type.impl.java.JavaMetaModel "/>
>
> are not recognized:
>
> ---
>
> 2212 [main] ERROR org.openarchitectureware.workflow.WorkflowRunner -
> Couldn't resolve type for 'mypackage::MyObject'. Did you forget to
> configure the corresponding metamodel?:in my.ext on line 24 'Boolean
> doSomething(mypackage::MyObject o)'
> org.openarchitectureware.expression.EvaluationException: Couldn't
> resolve type for 'mypackage::MyObject'. Did you forget to configure the
> corresponding metamodel?:in my.ext on line 24 'Boolean
> doSomething(mypackage::MyObject o)' at
> org.openarchitectureware.xtend.ast.Extension.init(Extension. java:145)
>
> ---
>
> If I start the workflow in the Eclipse-Platform via "Run ->
> WorkflowRunner" everything goes fine.
>
> Examining the executed WorkflowRunner.main() method, I took a look at
> the resource loaders. I played around a little with them, but I did not
> get it right (main method uses ResourceLoaderDefaultImpl but if I do so,
> oaw stuff won't be found). Currently (with all non JavaMetamodels beeing
> recognized correctly), I have to use the follwing line for having all
> stuff (oaw, metamodels) loaded correctly (as it was posted often here):
>
> ResourceLoaderFactory.setCurrentThreadResourceLoader(new
> ResourceLoaderImpl(getClass().getClassLoader()));
>
> ---
>
> Does anybody know something (loading own resources correctly, how to use
> JavaMetaModels from own code)???
>
> Thanks, Tobias
Re: [oaw] Problem invoking JavaMetamodel from plugin [message #560586 is a reply to message #375682] Tue, 19 December 2006 11:20 Go to previous message
Eclipse UserFriend
Originally posted by: tobiasbuhr.gmx.de

Sven Efftinge wrote:

> Java classes need to be accessible through your classloader.
> I assume you tried to use a class contained in your eclipse project?
> Those classes are not in classpath of the eclipse runtime.
>
> In order to start such a workflow you need to use the launch API.
> I don't know how to invoke it programmatically (we use the extension
> point).

thanks Sven, the way you described, it works :-)

WorkflowLaunchShortcut workflowLaunchShortcut = new
WorkflowLaunchShortcut();
workflowLaunchShortcut.launch(currentSelection, "run");

where currentSelection is one on a workflow file.

Thus I want to programmatically set up the input model file, and need
the result of the transformation in memory for further processing, it
will get little ugly I think.. (have to pass it back via extension that
wraps java method)

Nevertheless, I am happy to invoke oaw ;-) from my plugin now,

best regards, Tobias
(copy to openarchitecureware.org forum)
Previous Topic:[oaw] Problem invoking JavaMetamodel from plugin
Next Topic:Is it possible to use GMF without underlying EMF model?
Goto Forum:
  


Current Time: Thu Apr 25 04:57:17 GMT 2024

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

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

Back to the top