Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Java Service Wrapper issues
[Acceleo] Java Service Wrapper issues [message #697193] Fri, 15 July 2011 18:24 Go to next message
David Sauter is currently offline David SauterFriend
Messages: 6
Registered: July 2011
Junior Member
I have getting the following pair of errors when attempting the example java service wrapper:
Invalid result for expression self.invoke('AcceleoServiceTest.service.Util', 'div(java.lang.Double, java.lang.Double)', Sequence {arg0, arg1}) at line 4 in Module utilQuery for query div(Real,Real). Last recorded value of self was org.eclipse.emf.ecore.impl.EPackageImpl@12875ac (name: Model) (nsURI: test, nsPrefix: ).

ERROR in (visitOperationCallExp): (Class AcceleoServiceTest.service.Util Couldn't be found in the classpath of the bundle containing module utilQuery.emtl.)

I am running Acceleo 3.1 under Eclipse Indigo

The enitre project consists of a generate.mtl template that uses the query, an EMF model with only a package in it as a stub and the query source/mtl. Everything else was created by the wizard that built the project as a standard Acceleo project.

What am I forgetting to do in order for the templates to be able to reference the Java file for an invoke? I have the package with the java file in it as both an inport and export package in the manifest.

Just so you have all the informaiton here's my MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Acceleo AcceleoServiceTest Module Runtime Plug-in
Bundle-SymbolicName: AcceleoServiceTest
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: AcceleoServiceTest.Activator
Bundle-Vendor: Eclipse Modeling Project
Require-Bundle: org.eclipse.core.runtime, 
 org.eclipse.emf.ecore,
 org.eclipse.emf.ecore.xmi,
 org.eclipse.ocl,
 org.eclipse.ocl.ecore,
 org.eclipse.acceleo.common;bundle-version="3.1.0",
 org.eclipse.acceleo.parser;bundle-version="3.1.0",
 org.eclipse.acceleo.model;bundle-version="3.1.0",
 org.eclipse.acceleo.profiler;bundle-version="3.1.0",
 org.eclipse.acceleo.engine;bundle-version="3.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Export-Package: AcceleoServiceTest.main,
 AcceleoServiceTest.service
Import-Package: AcceleoServiceTest.main,
 AcceleoServiceTest.service

Here's my generate.mtl
[comment encoding = UTF-8 /]
[**
 * The documentation of the module generate.
 */]
[module generate('http://www.eclipse.org/emf/2002/Ecore', 'platform:/resource/AcceleoServiceTest/model/test.ecore')]
[import AcceleoServiceTest::service::utilQuery /]


[**
 * The documentation of the template generateElement.
 * @param aEPackage
 */]
[template public generateElement(aEPackage : EPackage)]
[comment @main/]
[file (aEPackage.name, false, 'UTF-8')]
[2.1.div(1.7)/]
[/file]
[/template]

here's the service java file
/**
 * 
 */
package AcceleoServiceTest.service;

public class Util 
{
	public Double div (Double a, Double b)
	{
		return a/b;
	}
}


here's the generated utilQuery.mtl file
[comment encoding = Cp1252 /]
[module utilQuery('http://www.eclipse.org/acceleo/mtl/3.0', 'http://www.eclipse.org/emf/2002/Ecore')/]

[query public div(arg0 : Real, arg1 : Real) : Real
	= invoke('AcceleoServiceTest.service.Util', 'div(java.lang.Double, java.lang.Double)', Sequence{arg0, arg1}) /]

everything else is default.

I appologize for the intrusion of this request but time is of the essence on this. I'm trying to get a JET2 project converted to Acceleo. If someone can't help me get this working then does anyone know how to get JET2 to load multiple ecore files programaticly so it can be traversed and cross-referenced?

--
-----
David Sauter
Re: [Acceleo] Java Service Wrapper issues [message #698285 is a reply to message #697193] Tue, 19 July 2011 08:04 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi David,

First things first, you shouldn't have the package containing your service as both an "import package" and an "export package". "import-Package: x.y" means that this plugin should seek all classes contained in package "x.y" in another plugin which has the corresponding "export-package: x.y". Since you have both in one single plugin, I don't know how Eclipse behaves. The only thing you need here is
Export-Package: AcceleoServiceTest.main,
 AcceleoServiceTest.service

Remove the Import.

The rest seems fine. Does removing the import-package do the trick?

Laurent Goubet
Obeo
Previous Topic:running workflow from java
Next Topic:[Acceleo] Service class not found in the bundle containing module emtl
Goto Forum:
  


Current Time: Thu Mar 28 15:15:36 GMT 2024

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

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

Back to the top