|Re: Can not reference my own Service ("Unknown service...") [message #1225604 is a reply to message #1225515]
||Mon, 30 December 2013 09:11
|| Maxime Porhel
Registered: July 2009
Location: Nantes, France
Le 30/12/2013 03:56, Michael Lukaszczyk a écrit :|
> Hey there,
> (please take simultaneously a look at the screenshot to get an idea of
> my setup)
> ! I had to add whitespaces to the link since my account can´t post links !
> Screenshot: arrgh -.-" Can´t post links until I have at least 5
> messages. I´ll edit the link or post again when I have the permission
> right now I want to create a custom Service that for example just builds
> a String like the render methods in the EcoreService Class in the
> sirius...design package. I then reference it like in the ecore.odesign
> (I tried several classifiers for referencing:
> my.project.design.src.service.FooService, src.service.FooService,
> service.FooService, FooService,
> /my.project.design/src/service/FooService.java etc)
If you created a MyServices class in the my.sample.package package of
your sepecification project, you simply have to reference it with its
Java qualified name in the 'Qualified Class Name' property of the Java
Extension element created in your Viewpoint, ie:
my.sample.package.MyServices (see ).
> . Then I created some
> rules to draw a node based on EClass and display this node on the
> diagram canvas. The label of this node is supposed to be named via the
> service method. So I created a Square description with the Label
> Expression "service:fooService".
This is an accepted form (see )
But I get this error: Feature:
> labelExpression Unknown service fooService and the Label of the node is
> "invalid feature name". But it should be "foo" like you can see on the
> screenshot in FooService.java.
> Am I missing something? Do I have to make a special build? So the
> FooService will be found by sirius? Am I taking a wrong qualifier? I
> don´t get it.
You encountered one of the Service interpreter limitations documented in
"Intended limitations exist to be more efficient:
The services should be in the same bundle as the VSM and should be deployed"
You should deploy your VSM, ie launch a runtime to test the services.
I attached two sample projects SampleProjectWithService.zip and
SampleProjectWithService2.zip both contaiingn a sample service and some
node mappings which use this service. SampleProjectWithService.zip has
the particularity to define a third mapping which uses the service in an
Acceleo expression: it shows how to call a service in Acceleo expression
but it also has the side effect to make the service available without
deployment for the Service interpreter. The Acceleo interpreter is able
to find non deployed services but for a simple service call without
complex expression, it will be less efficient once deployed.
Powered by FUDForum
. Page generated in 0.02886 seconds