Commit 0d24db34 authored by Lionel Seinturier's avatar Lionel Seinturier
Browse files

Simplify the management of interceptor source code generators.

parent 841e99bc
......@@ -180,11 +180,17 @@
)
(
# see org.ow2.frascati.tinfi.opt.oo.FCOOCtrlSourceCodeGenerator
#
# org.ow2.frascati.tinfi.opt.oo.InterceptorClassGenerator
# org.ow2.frascati.tinfi.opt.oo.SCATinfiInterceptorSourceCodeGenerator
# org.objectweb.fractal.juliac.proxy.LifeCycleSourceCodeGenerator
# org.ow2.frascati.tinfi.opt.oo.SCAContentInterceptorSourceCodeGenerator
# org.ow2.frascati.tinfi.opt.oo.SCAIntentInterceptorSourceCodeGenerator
#
# see org.ow2.frascati.tinfi.opt.oo.FCOOCtrlNoIntentSourceCodeGenerator
# org.ow2.frascati.tinfi.opt.oo.InterceptorNoIntentClassGenerator
# org.ow2.frascati.tinfi.opt.oo.SCATinfiInterceptorSourceCodeGenerator
# org.objectweb.fractal.juliac.proxy.LifeCycleSourceCodeGenerator
# org.ow2.frascati.tinfi.opt.oo.SCAContentInterceptorSourceCodeGenerator
)
org.objectweb.fractal.julia.asm.MergeClassGenerator
'optimizationLevel
......@@ -218,9 +224,13 @@
)
(
# see org.ow2.frascati.tinfi.opt.oo.FCOOCtrlSourceCodeGenerator
#
# org.ow2.frascati.tinfi.opt.oo.InterceptorClassGenerator
# org.ow2.frascati.tinfi.opt.oo.SCATinfiInterceptorSourceCodeGenerator
# org.ow2.frascati.tinfi.opt.oo.SCAIntentInterceptorSourceCodeGenerator
#
# see org.ow2.frascati.tinfi.opt.oo.FCOOCtrlNoIntentSourceCodeGenerator
# org.ow2.frascati.tinfi.opt.oo.InterceptorNoIntentClassGenerator
# org.ow2.frascati.tinfi.opt.oo.SCATinfiInterceptorSourceCodeGenerator
)
org.objectweb.fractal.julia.asm.MergeClassGenerator
'optimizationLevel
......
......@@ -81,10 +81,10 @@ extends FCOOCtrlSourceCodeGenerator {
InterceptorSourceCodeGeneratorItf[] iscgs = null;
boolean mergeable = false;
InterceptorSourceCodeGeneratorItf iscg =
new SCANoIntentInterceptorSourceCodeGenerator();
iscg.setMergeable(mergeable);
iscg.setJuliac(jc);
InterceptorSourceCodeGeneratorItf tiscg =
new SCATinfiInterceptorSourceCodeGenerator();
tiscg.setMergeable(mergeable);
tiscg.setJuliac(jc);
if( ctrldesc.equals(TinfiDomain.SCA_PRIMITIVE) ) {
......@@ -98,10 +98,10 @@ extends FCOOCtrlSourceCodeGenerator {
cscg.setMergeable(mergeable);
cscg.setJuliac(jc);
iscgs = new InterceptorSourceCodeGeneratorItf[]{lcscg,cscg,iscg};
iscgs = new InterceptorSourceCodeGeneratorItf[]{lcscg,cscg,tiscg};
}
else if( ctrldesc.equals(TinfiDomain.SCA_COMPOSITE) ) {
iscgs = new InterceptorSourceCodeGeneratorItf[]{iscg};
iscgs = new InterceptorSourceCodeGeneratorItf[]{tiscg};
}
else {
String msg = "Unsupported controller descriptor: "+ctrldesc;
......
......@@ -248,6 +248,11 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
InterceptorSourceCodeGeneratorItf[] iscgs = null;
boolean mergeable = false;
InterceptorSourceCodeGeneratorItf tiscg =
new SCATinfiInterceptorSourceCodeGenerator();
tiscg.setMergeable(mergeable);
tiscg.setJuliac(jc);
InterceptorSourceCodeGeneratorItf iscg =
new SCAIntentInterceptorSourceCodeGenerator();
iscg.setMergeable(mergeable);
......@@ -265,10 +270,10 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
cscg.setMergeable(mergeable);
cscg.setJuliac(jc);
iscgs = new InterceptorSourceCodeGeneratorItf[]{lcscg,cscg,iscg};
iscgs = new InterceptorSourceCodeGeneratorItf[]{tiscg,lcscg,cscg,iscg};
}
else if( ctrldesc.equals(TinfiDomain.SCA_COMPOSITE) ) {
iscgs = new InterceptorSourceCodeGeneratorItf[]{iscg};
iscgs = new InterceptorSourceCodeGeneratorItf[]{tiscg,iscg};
}
else {
String msg = "Unsupported controller descriptor: "+ctrldesc;
......
......@@ -24,12 +24,10 @@
package org.ow2.frascati.tinfi.opt.oo;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.Utils;
import org.objectweb.fractal.juliac.proxy.InterceptorSourceCodeGeneratorItf;
import org.objectweb.fractal.juliac.ucf.UnifiedClass;
import org.objectweb.fractal.juliac.ucf.UnifiedMethod;
import org.objectweb.fractal.juliac.visit.ClassSourceCodeVisitor;
import org.ow2.frascati.tinfi.TinfiComponentInterceptor;
/**
* This class generates interceptor classes. This generator differs from {@link
......@@ -47,30 +45,6 @@ extends org.objectweb.fractal.juliac.proxy.InterceptorClassGenerator {
super(iscgs,jc);
}
@Override
public String getSuperClassName() throws IllegalArgumentException {
StringBuffer sb = new StringBuffer();
sb.append(TinfiComponentInterceptor.class.getName());
sb.append('<');
String signature = it.getFcItfSignature();
sb.append(signature);
/*
* Add type parameters if any.
*/
UnifiedClass proxycl = jc.create(signature);
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
sb.append(s);
}
sb.append('>');
return sb.toString();
}
@Override
public void generateFieldImpl( ClassSourceCodeVisitor cv, UnifiedClass proxycl ) {
/*
......
......@@ -29,7 +29,6 @@ import java.lang.reflect.Modifier;
import org.objectweb.fractal.api.Interface;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.Utils;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator;
import org.objectweb.fractal.juliac.ucf.UnifiedClass;
......@@ -37,7 +36,6 @@ import org.objectweb.fractal.juliac.ucf.UnifiedMethod;
import org.objectweb.fractal.juliac.visit.BlockSourceCodeVisitor;
import org.objectweb.fractal.juliac.visit.ClassSourceCodeVisitor;
import org.objectweb.fractal.juliac.visit.MethodSourceCodeVisitor;
import org.ow2.frascati.tinfi.TinfiComponentInterceptor;
import org.ow2.frascati.tinfi.TinfiRuntimeException;
import org.ow2.frascati.tinfi.control.component.ReconfigurableComponentContext;
import org.ow2.frascati.tinfi.control.intent.IntentHandler;
......@@ -90,33 +88,6 @@ extends AbstractInterceptorSourceCodeGenerator {
}
}
/**
* @since 1.3
*/
@Override
public String getSuperClassName() {
StringBuffer sb = new StringBuffer();
sb.append(TinfiComponentInterceptor.class.getName());
sb.append('<');
String signature = it.getFcItfSignature();
sb.append(signature);
/*
* Add type parameters if any.
*/
UnifiedClass proxycl = jc.create(signature);
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
sb.append(s);
}
sb.append('>');
return sb.toString();
}
@Override
public void generateStaticParts( ClassSourceCodeVisitor cv, UnifiedClass proxycl ) {
......@@ -282,12 +253,6 @@ extends AbstractInterceptorSourceCodeGenerator {
@Override
public void generateMethodInitFcController( MethodSourceCodeVisitor mv, UnifiedClass proxycl ) {
mv.visitln(" initIntentHandlersMap(METHODS);");
mv.visitln(" super.initFcController(ic);");
}
@Override
public void generateMethodClone( MethodSourceCodeVisitor mv, UnifiedClass proxycl ) {
mv.visitln(" initFcClone(clone);");
}
@Override
......
......@@ -25,27 +25,28 @@ package org.ow2.frascati.tinfi.opt.oo;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.Utils;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
import org.objectweb.fractal.juliac.proxy.AbstractInterceptorSourceCodeGenerator;
import org.objectweb.fractal.juliac.ucf.UnifiedClass;
import org.objectweb.fractal.juliac.visit.MethodSourceCodeVisitor;
import org.ow2.frascati.tinfi.TinfiComponentInterceptor;
/**
* This class generates the source code of Tinfi interceptors which are
* associated with scaPrimitive and scaComposite membranes with no intent
* interceptors.
* This class generates the source code which is common to all Tinfi
* interceptors, whether or not an intent layer is used.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.1.1
* @since 1.3.1
*/
public class SCANoIntentInterceptorSourceCodeGenerator
public class SCATinfiInterceptorSourceCodeGenerator
extends AbstractInterceptorSourceCodeGenerator {
public SCANoIntentInterceptorSourceCodeGenerator() {
public SCATinfiInterceptorSourceCodeGenerator() {
super();
}
public SCANoIntentInterceptorSourceCodeGenerator(
public SCATinfiInterceptorSourceCodeGenerator(
InterfaceType it, MembraneDesc<?> membraneDesc, boolean mergeable,
Juliac jc ) {
......@@ -76,6 +77,30 @@ extends AbstractInterceptorSourceCodeGenerator {
}
}
@Override
public String getSuperClassName() throws IllegalArgumentException {
StringBuffer sb = new StringBuffer();
sb.append(TinfiComponentInterceptor.class.getName());
sb.append('<');
String signature = it.getFcItfSignature();
sb.append(signature);
/*
* Add type parameters if any.
*/
UnifiedClass proxycl = jc.create(signature);
String[] tpnames = proxycl.getTypeParameterNames();
if( tpnames.length != 0 ) {
String s = Utils.getTypeParameterNamesSignature(tpnames);
sb.append(s);
}
sb.append('>');
return sb.toString();
}
@Override
public void generateMethodInitFcController( MethodSourceCodeVisitor mv, UnifiedClass proxycl ) {
mv.visitln(" super.initFcController(ic);");
......
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