Commit 6452c02a authored by Lionel Seinturier's avatar Lionel Seinturier

Refactor to decrease the dependency to Juliac.

parent a7318f66
......@@ -124,13 +124,14 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
* for choosing interface source code generator.
*/
String signature = it.getFcItfSignature();
Class<?> cl = jc.loadClass(signature);
final String signature = it.getFcItfSignature();
final Class<?> cl = jc.loadClass(signature);
final String pkgRoot = jc.getJuliacConfig().getPkgRoot();
if( itname.endsWith("-controller") || itname.equals("component") ) {
pcg =
new InterfaceImplementationClassGenerator(
jc,it, cl, membraneDesc, false );
jc,it, cl, pkgRoot, membraneDesc, false );
}
else {
if( it.isFcClientItf() ) {
......@@ -145,12 +146,12 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
*/
pcg =
new ClientInterfaceClassGenerator(
jc,it,cl,membraneDesc,false);
jc,it,cl,pkgRoot,membraneDesc,false);
}
else {
pcg =
new ServerInterfaceClassGenerator(
jc,it,cl,membraneDesc,false);
jc,it,cl,pkgRoot,membraneDesc,false);
}
}
......@@ -165,8 +166,9 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
protected void generateInterfaceImpl( InterfaceType it, String ctrlDesc )
throws IOException {
String signature = it.getFcItfSignature();
Class<?> cl = jc.loadClass(signature);
final String signature = it.getFcItfSignature();
final Class<?> cl = jc.loadClass(signature);
final String pkgRoot = jc.getJuliacConfig().getPkgRoot();
String itname = it.getFcItfName();
if( itname.endsWith("-controller") || itname.equals("component") ) {
......@@ -181,7 +183,8 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
* for Julia control interfaces.
*/
SourceCodeGeneratorItf cg =
new InterfaceImplementationClassGenerator(jc,it,cl,null,false);
new InterfaceImplementationClassGenerator(
jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
}
else {
......@@ -192,7 +195,7 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
// Server (input) interface implementation
SourceCodeGeneratorItf cg =
new ServerInterfaceClassGenerator(jc,it,cl,null,false);
new ServerInterfaceClassGenerator(jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
if( it.isFcClientItf() ) {
......@@ -202,12 +205,13 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
* since client interface implementations extend the server
* interface implementation corresponding to the same type.
*/
cg = new ClientInterfaceClassGenerator(jc,it,cl,null,false);
cg = new ClientInterfaceClassGenerator(
jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
}
// ServiceReference implementation
cg = new ServiceReferenceClassGenerator(jc,it,cl,null,false);
cg = new ServiceReferenceClassGenerator(jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
// ServiceReference and input interface implementations for callbacks
......@@ -217,14 +221,17 @@ extends org.objectweb.fractal.juliac.opt.comp.FCCompCtrlSourceCodeGenerator {
"org.oasisopen.sca.annotation.Callback",
"org.osoa.sca.annotations.Callback");
if( annot != null ) {
Class<?> cbcl = AnnotationHelper.getAnnotationParamValue(annot,"value");
Class<?> cbcl =
AnnotationHelper.getAnnotationParamValue(annot,"value");
InterfaceType cbit =
new BasicInterfaceType(
"callback", cbcl.getName(), false, false, false );
cg = new ServiceReferenceClassGenerator(jc,cbit,cbcl,null,false);
cg = new ServiceReferenceClassGenerator(
jc,cbit,cbcl,pkgRoot,null,false);
jc.generateSourceCode(cg);
cg = new CallBackInterfaceClassGenerator(jc,cbit,cbcl,null,false);
cg = new CallBackInterfaceClassGenerator(
jc,cbit,cbcl,pkgRoot,null,false);
jc.generateSourceCode(cg);
}
}
......
......@@ -49,10 +49,10 @@ extends AbstractProxyClassGenerator {
public CallBackInterfaceClassGenerator() {}
public CallBackInterfaceClassGenerator(
Juliac jc, InterfaceType it, Class<?> cl, MembraneDesc<?> membraneDesc,
boolean mergeable ) {
Juliac jc, InterfaceType it, Class<?> cl, String pkgRoot,
MembraneDesc<?> membraneDesc, boolean mergeable ) {
super(jc,it,cl,membraneDesc,mergeable);
super(jc,it,cl,pkgRoot,membraneDesc,mergeable);
}
/**
......
......@@ -48,10 +48,10 @@ public class ClientInterfaceClassGenerator
extends ServerInterfaceClassGenerator {
public ClientInterfaceClassGenerator(
Juliac jc, InterfaceType it, Class<?> cl, MembraneDesc<?> membraneDesc,
boolean mergeable ) {
Juliac jc, InterfaceType it, Class<?> cl, String pkgRoot,
MembraneDesc<?> membraneDesc, boolean mergeable ) {
super(jc,it,cl,membraneDesc,mergeable);
super(jc,it,cl,pkgRoot,membraneDesc,mergeable);
}
/**
......@@ -71,7 +71,7 @@ extends ServerInterfaceClassGenerator {
*/
SourceCodeGeneratorItf cg =
new ServerInterfaceClassGenerator(
jc,it,proxycl,membraneDesc,mergeable);
jc,it,proxycl,pkgRoot,membraneDesc,mergeable);
String name = cg.getTargetTypeName();
/*
......@@ -116,7 +116,7 @@ extends ServerInterfaceClassGenerator {
"getServiceReference", null, null );
SourceCodeGeneratorItf cg =
new ServiceReferenceClassGenerator(
jc,it,this.proxycl,membraneDesc,mergeable);
jc,it,this.proxycl,pkgRoot,membraneDesc,mergeable);
String srclname = cg.getTargetTypeName();
mv.visit (" return new ");
mv.visit (srclname);
......
......@@ -101,9 +101,10 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
public ProxyClassGeneratorItf getInterfaceClassGenerator(
InterfaceType it, MembraneDesc<?> membraneDesc ) {
String signature = it.getFcItfSignature();
Class<?> cl = jc.loadClass(signature);
final String signature = it.getFcItfSignature();
final Class<?> cl = jc.loadClass(signature);
final String pkgRoot = jc.getJuliacConfig().getPkgRoot();
ProxyClassGeneratorItf pcg = null;
String itname = it.getFcItfName();
......@@ -115,7 +116,7 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
if( itname.endsWith("-controller") || itname.equals("component") ) {
pcg =
new InterfaceImplementationClassGenerator(
jc,it,cl,membraneDesc,false);
jc,it,cl,pkgRoot,membraneDesc,false);
}
else {
if( it.isFcClientItf() ) {
......@@ -130,12 +131,12 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
*/
pcg =
new ClientInterfaceClassGenerator(
jc,it,cl,membraneDesc,false);
jc,it,cl,pkgRoot,membraneDesc,false);
}
else {
pcg =
new ServerInterfaceClassGenerator(
jc,it,cl,membraneDesc,false);
jc,it,cl,pkgRoot,membraneDesc,false);
}
}
......@@ -150,8 +151,9 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
protected void generateInterfaceImpl( InterfaceType it, String ctrlDesc )
throws IOException {
String signature = it.getFcItfSignature();
Class<?> cl = jc.loadClass(signature);
final String signature = it.getFcItfSignature();
final Class<?> cl = jc.loadClass(signature);
final String pkgRoot = jc.getJuliacConfig().getPkgRoot();
String itname = it.getFcItfName();
if( itname.endsWith("-controller") || itname.equals("component") ) {
......@@ -166,7 +168,8 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
* for Julia control interfaces.
*/
SourceCodeGeneratorItf cg =
new InterfaceImplementationClassGenerator(jc,it,cl,null,false);
new InterfaceImplementationClassGenerator(
jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
}
else {
......@@ -177,7 +180,7 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
// Server (input) interface implementation
SourceCodeGeneratorItf cg =
new ServerInterfaceClassGenerator(jc,it,cl,null,false);
new ServerInterfaceClassGenerator(jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
if( it.isFcClientItf() ) {
......@@ -187,12 +190,14 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
* since client interface implementations extend the server
* interface implementation corresponding to the same type.
*/
cg = new ClientInterfaceClassGenerator(jc,it,cl,null,false);
cg = new ClientInterfaceClassGenerator(
jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
}
// ServiceReference implementation
cg = new ServiceReferenceClassGenerator(jc,it,cl,null,false);
cg = new ServiceReferenceClassGenerator(
jc,it,cl,pkgRoot,null,false);
jc.generateSourceCode(cg);
// ServiceReference and input interface implementations for callbacks
......@@ -207,10 +212,12 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
InterfaceType cbit =
new BasicInterfaceType(
"callback", cbcl.getName(), false, false, false );
cg = new ServiceReferenceClassGenerator(jc,cbit,cbcl,null,false);
cg = new ServiceReferenceClassGenerator(
jc,cbit,cbcl,pkgRoot,null,false);
jc.generateSourceCode(cg);
cg = new CallBackInterfaceClassGenerator(jc,cbit,cbcl,null,false);
cg = new CallBackInterfaceClassGenerator(
jc,cbit,cbcl,pkgRoot,null,false);
jc.generateSourceCode(cg);
}
}
......
......@@ -50,10 +50,10 @@ extends AbstractInterceptorSourceCodeGenerator {
}
public SCAContentInterceptorSourceCodeGenerator(
Juliac jc, InterfaceType it, Class<?> cl, MembraneDesc<?> membraneDesc,
boolean mergeable ) {
Juliac jc, InterfaceType it, Class<?> cl, String pkgRoot,
MembraneDesc<?> membraneDesc, boolean mergeable ) {
super(jc,it,cl,membraneDesc,mergeable);
super(jc,it,cl,pkgRoot,membraneDesc,mergeable);
}
/**
......
......@@ -58,10 +58,10 @@ extends AbstractInterceptorSourceCodeGenerator {
}
public SCAIntentInterceptorSourceCodeGenerator(
Juliac jc, InterfaceType it, Class<?> cl, MembraneDesc<?> membraneDesc,
boolean mergeable ) {
Juliac jc, InterfaceType it, Class<?> cl, String pkgRoot,
MembraneDesc<?> membraneDesc, boolean mergeable ) {
super(jc,it,cl,membraneDesc,mergeable);
super(jc,it,cl,pkgRoot,membraneDesc,mergeable);
}
/**
......
......@@ -46,10 +46,10 @@ extends AbstractInterceptorSourceCodeGenerator {
}
public SCATinfiInterceptorSourceCodeGenerator(
Juliac jc, InterfaceType it, Class<?> cl, MembraneDesc<?> membraneDesc,
boolean mergeable ) {
Juliac jc, InterfaceType it, Class<?> cl, String pkgRoot,
MembraneDesc<?> membraneDesc, boolean mergeable ) {
super(jc,it,cl,membraneDesc,mergeable);
super(jc,it,cl,pkgRoot,membraneDesc,mergeable);
}
/**
......
......@@ -44,10 +44,10 @@ public class ServerInterfaceClassGenerator
extends InterfaceImplementationClassGenerator {
public ServerInterfaceClassGenerator(
Juliac jc, InterfaceType it, Class<?> cl, MembraneDesc<?> membraneDesc,
boolean mergeable ) {
Juliac jc, InterfaceType it, Class<?> cl, String pkgRoot,
MembraneDesc<?> membraneDesc, boolean mergeable ) {
super(jc,it,cl,membraneDesc,mergeable);
super(jc,it,cl,pkgRoot,membraneDesc,mergeable);
}
/**
......
......@@ -62,10 +62,10 @@ extends AbstractProxyClassGenerator {
public ServiceReferenceClassGenerator() {}
public ServiceReferenceClassGenerator(
Juliac jc, InterfaceType it, Class<?> cl, MembraneDesc<?> membraneDesc,
boolean mergeable ) {
Juliac jc, InterfaceType it, Class<?> cl, String pkgRoot,
MembraneDesc<?> membraneDesc, boolean mergeable ) {
super(jc,it,cl,membraneDesc,mergeable);
super(jc,it,cl,pkgRoot,membraneDesc,mergeable);
}
/**
......@@ -233,12 +233,12 @@ extends AbstractProxyClassGenerator {
"callback",callbackClass.getName(),false,false,false);
SourceCodeGeneratorItf cg =
new CallBackInterfaceClassGenerator(
jc,cbit,callbackClass,null,mergeable);
jc,cbit,callbackClass,pkgRoot,null,mergeable);
String cbitfclname = cg.getTargetTypeName();
cg =
new ServiceReferenceClassGenerator(
jc,cbit,callbackClass,null,mergeable);
jc,cbit,callbackClass,pkgRoot,null,mergeable);
String cbcrclname = cg.getTargetTypeName();
mv.visit (" "+ComponentInterface.class.getName()+" ci = (");
......
......@@ -142,9 +142,9 @@ extends ClassGenerator {
* Return the name of the class generated by this generator.
*/
public String getTargetTypeName() {
String targetClassName = contentClassName+SUFFIX;
String rootedTargetClassName = jc.getRootedClassName(targetClassName);
return rootedTargetClassName;
final String pkgRoot = jc.getJuliacConfig().getPkgRoot();
final String targetClassName = pkgRoot + contentClassName + SUFFIX;
return targetClassName;
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment