0

I can't call a java wrapping service in Acceleo because it doesn't recognize parameters type. This is my simple test code: the main calls a query stored in Services.mtl, that calls the java service that just return the name of an object "Send"

Main.mtl

[file ('system.P', false, 'UTF-8')]
     [for (t : Send | aSystemBehavior.transitions)) ]
             [getName(t)/]
     [/for]
[/file]

Services.mtl

[query public getName(arg0 : Send) : String
    = invoke('myPackage.Services', 'getName(myPackage.Send)', Sequence{arg0})

/]

Services.java

public class Services 
{
   public String getName(Send t)
        {return t.getName();}
}

The Error Log shows:

Invalid result for expression self.invoke('myPakage.Services', 'getName(myPakage.Send)', Sequence {arg0}) at line 0 in Module services for query getName(Send). Last recorded value of self was org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1f00eb36 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@2c2aade3 (name: Send) (instanceClassName: null) (abstract: false, interface: false)). Problem found while generating the file system.P'.

If I use a String as parameter type instead of Send, everything works fine.

DeLac
  • 1,068
  • 13
  • 43

2 Answers2

0

Does the package containing the service "Services" has been exported? If not, open the file MANIFEST.MF, go in the runtime tab and add its package to the list of exported packages. Are you sure that your "Send" object has a name? This message only indicates that null was returned by the query getName.

sbegaudeau
  • 1,504
  • 13
  • 18
  • Yes, it's exported and it has a name, if I try to print it without java but with [t.name/] works (t is the object of type Send in the for) – DeLac Jun 03 '14 at 04:01
0

I don't have anymore this problem... I created a new Acceleo project from scratch, and it works. I am not sure what was the problem... maybe it's something about che choice of metamodels to import during the creation of the Module (I have to choose between run-tim and develop-time metamodel).

DeLac
  • 1,068
  • 13
  • 43