
juliac.generated.ContainerBindingControllerImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fractal-bf-testing-fixtures-juliac Show documentation
Show all versions of fractal-bf-testing-fixtures-juliac Show documentation
Integration tests fixtures with Juliac
The newest version!
package juliac.generated;
import org.objectweb.fractal.api.control.BindingController;
import org.objectweb.fractal.julia.control.binding.ChainedIllegalBindingException;
import org.objectweb.fractal.julia.control.lifecycle.ChainedIllegalLifeCycleException;
import org.objectweb.fractal.julia.ChainedNoSuchInterfaceException;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.julia.ComponentInterface;
import org.objectweb.fractal.api.type.ComponentType;
import org.objectweb.fractal.julia.control.binding.ContentBindingController;
import org.objectweb.fractal.api.control.ContentController;
import org.objectweb.fractal.julia.Controller;
import org.objectweb.fractal.julia.loader.Generated;
import org.objectweb.fractal.api.control.IllegalBindingException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.julia.InitializationContext;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.julia.Interceptor;
import org.objectweb.fractal.api.Interface;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.api.control.LifeCycleController;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.api.control.SuperController;
import org.objectweb.fractal.api.Type;
/**
* @see org.objectweb.fractal.julia.BasicControllerMixin
* @see org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin
* @see org.objectweb.fractal.julia.UseComponentMixin
* @see org.objectweb.fractal.julia.control.binding.InterceptorBindingMixin
* @see org.objectweb.fractal.julia.control.binding.CheckBindingMixin
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin
* @see org.objectweb.fractal.julia.control.content.UseSuperControllerMixin
* @see org.objectweb.fractal.julia.control.binding.ContentBindingMixin
* @see org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin
* @see org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin
*/
public class ContainerBindingControllerImpl implements BindingController , Controller , Generated {
/**
* @see org.objectweb.fractal.julia.UseComponentMixin#weaveableC
*/
public Component weaveableC;
/**
* @see org.objectweb.fractal.julia.BasicControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
private void initFcController$3(final InitializationContext ic) throws InstantiationException {
}
/**
* @see org.objectweb.fractal.julia.control.content.UseSuperControllerMixin#weaveableSC
*/
public SuperController weaveableSC;
/**
* @see org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin#weaveableOptLC
*/
public LifeCycleController weaveableOptLC;
/**
* @see org.objectweb.fractal.julia.UseComponentMixin#weaveableOptC
*/
public Component weaveableOptC;
/**
* @see org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin#fcContent
*/
public Object fcContent;
/**
* @see org.objectweb.fractal.julia.control.binding.CheckBindingMixin#bindFc(java.lang.String,java.lang.Object)
*/
private void bindFc$0(final String clientItfName, final Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
if ((lookupFc(clientItfName)) != null) {
throw new ChainedIllegalBindingException(null , weaveableOptC , null , clientItfName , null , "Already bound");
}
bindFc$1(clientItfName ,serverItf);
}
/**
* @see org.objectweb.fractal.julia.control.content.UseSuperControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
private void initFcController$0(final InitializationContext ic) throws InstantiationException {
weaveableSC = ((SuperController)(ic.getInterface("super-controller")));
initFcController$1(ic);
}
/**
* @see org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
public void initFcController(final InitializationContext ic) throws InstantiationException {
weaveableOptLC = ((LifeCycleController)(ic.getOptionalInterface("lifecycle-controller")));
initFcController$0(ic);
}
/**
* @see org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin#unbindFc(java.lang.String)
*/
public void unbindFc(final String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
if ((weaveableOptLC) != null) {
String state = weaveableOptLC.getFcState();
if (!(LifeCycleController.STOPPED.equals(state))) {
throw new ChainedIllegalLifeCycleException(null , weaveableOptC , "The component is not stopped");
}
}
unbindFc$0(clientItfName);
}
/**
* @see org.objectweb.fractal.julia.UseComponentMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
private void initFcController$1(final InitializationContext ic) throws InstantiationException {
weaveableC = ((Component)(ic.getInterface("component")));
weaveableOptC = weaveableC;
initFcController$2(ic);
}
/**
* @see org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
private void initFcController$2(final InitializationContext ic) throws InstantiationException {
fcContent = ic.content;
Component owner = ((Component)(ic.getOptionalInterface("component")));
if (owner != null) {
try {
owner = ((Component)(owner.getFcInterface("component")));
if ((fcContent) == (this)) {
if ((this) instanceof ContentBindingController) {
((ContentBindingController)(this)).bindFcContent("component" ,owner);
}
} else if ((fcContent) instanceof BindingController) {
((BindingController)(fcContent)).bindFc("component" ,owner);
}
} catch (Exception ignored) {
}
}
initFcController$3(ic);
}
/**
* @see org.objectweb.fractal.julia.control.binding.InterceptorBindingMixin#lookupFc(java.lang.String)
*/
private Object lookupFc$0(final String clientItfName) throws NoSuchInterfaceException {
Object o = lookupFc$1(clientItfName);
if (o instanceof Interceptor) {
o = ((Interceptor)(o)).getFcItfDelegate();
}
return o;
}
/**
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin#lookupFc(java.lang.String)
*/
public Object lookupFc(final String clientItfName) throws NoSuchInterfaceException {
ComponentType compType = ((ComponentType)(weaveableC.getFcType()));
InterfaceType clientItfType;
try {
clientItfType = compType.getFcInterfaceType(clientItfName);
} catch (NoSuchInterfaceException e) {
throw new ChainedNoSuchInterfaceException(null , weaveableC , clientItfName);
}
checkFcClientInterface(clientItfType);
return lookupFc(clientItfType ,clientItfName);
}
/**
* @see org.objectweb.fractal.julia.control.binding.ContentBindingMixin#bindFc(org.objectweb.fractal.api.type.InterfaceType,java.lang.String,java.lang.Object)
*/
public void bindFc(final InterfaceType clientItfType, final String clientItfName, final Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
checkFcLocalBinding(clientItfType ,clientItfName ,serverItf);
bindFc$0(clientItfType ,clientItfName ,serverItf);
}
private void initFcController$4(InitializationContext ic) throws InstantiationException {
}
/**
* @see org.objectweb.fractal.julia.control.binding.CheckBindingMixin#unbindFc(java.lang.String)
*/
private void unbindFc$1(final String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
if ((lookupFc(clientItfName)) == null) {
throw new ChainedIllegalBindingException(null , weaveableOptC , null , clientItfName , null , "Not bound");
}
unbindFc$2(clientItfName);
}
/**
* @see org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin#listFc()
*/
public String[] listFc() {
if ((fcContent) == (this)) {
if ((this) instanceof ContentBindingController) {
return ((ContentBindingController)(this)).listFcContent();
}
} else if ((fcContent) instanceof BindingController) {
return ((BindingController)(fcContent)).listFc();
}
return new String[0];
}
/**
* @see org.objectweb.fractal.julia.control.binding.InterceptorBindingMixin#bindFc(java.lang.String,java.lang.Object)
*/
private void bindFc$1(final String clientItfName, final Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
Object o = weaveableC.getFcInterface(clientItfName);
if (o instanceof ComponentInterface) {
Object next = ((ComponentInterface)(o)).getFcItfImpl();
if (next instanceof Interceptor) {
((Interceptor)(next)).setFcItfDelegate(serverItf);
o = next;
} else {
((ComponentInterface)(o)).setFcItfImpl(serverItf);
o = serverItf;
}
} else {
o = serverItf;
}
bindFc$2(clientItfName ,o);
}
/**
* @see org.objectweb.fractal.julia.control.binding.ContentBindingMixin#checkFcLocalBinding(org.objectweb.fractal.api.type.InterfaceType,java.lang.String,java.lang.Object)
*/
public void checkFcLocalBinding(final InterfaceType clientItfType, final String clientItfName, final Object serverItf) throws IllegalBindingException {
Interface sItf;
Component sComp;
try {
sItf = ((Interface)(serverItf));
sComp = sItf.getFcItfOwner();
} catch (ClassCastException e) {
return ;
}
Component[] cParents = weaveableSC.getFcSuperComponents();
String msg;
if (!(clientItfType.isFcClientItf())) {
ContentController cc;
try {
cc = ((ContentController)(weaveableC.getFcInterface("content-controller")));
} catch (NoSuchInterfaceException e) {
return ;
}
Component[] cSubComps = cc.getFcSubComponents();
for (int i = 0 ; i < (cSubComps.length) ; ++i) {
if (cSubComps[i].equals(sComp)) {
return ;
}
}
Component thisComp;
try {
thisComp = ((Component)(weaveableC.getFcInterface("component")));
} catch (NoSuchInterfaceException e) {
throw new ChainedIllegalBindingException(e , weaveableC , sItf.getFcItfOwner() , clientItfName , sItf.getFcItfName() , "Cannot get the Component interface of the client component");
}
if ((sComp.equals(thisComp)) && (sItf.isFcInternalItf())) {
return ;
}
msg = "Invalid export binding";
} else if (sItf.isFcInternalItf()) {
for (int i = 0 ; i < (cParents.length) ; ++i) {
if (sComp.equals(cParents[i])) {
return ;
}
}
msg = "Invalid import binding";
} else {
SuperController sCompSC;
try {
sCompSC = ((SuperController)(sComp.getFcInterface("super-controller")));
} catch (NoSuchInterfaceException e) {
return ;
}
Component[] sParents = sCompSC.getFcSuperComponents();
for (int i = 0 ; i < (cParents.length) ; ++i) {
for (int j = 0 ; j < (sParents.length) ; ++j) {
if (cParents[i].equals(sParents[j])) {
return ;
}
}
}
msg = "Not a local binding";
}
throw new ChainedIllegalBindingException(null , weaveableC , sItf.getFcItfOwner() , clientItfName , sItf.getFcItfName() , msg);
}
/**
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin#bindFc(java.lang.String,java.lang.Object)
*/
public void bindFc(final String clientItfName, final Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
ComponentType compType = ((ComponentType)(weaveableC.getFcType()));
InterfaceType cItfType;
try {
cItfType = compType.getFcInterfaceType(clientItfName);
} catch (NoSuchInterfaceException e) {
throw new ChainedNoSuchInterfaceException(null , weaveableC , clientItfName);
}
checkFcClientInterface(cItfType);
ContentController cc;
try {
cc = ((ContentController)(weaveableC.getFcInterface("content-controller")));
} catch (NoSuchInterfaceException e) {
cc = null;
}
if (cItfType.isFcClientItf()) {
weaveableC.getFcInterface(clientItfName);
} else {
cc.getFcInternalInterface(clientItfName);
}
Interface sItf;
InterfaceType sItfType;
try {
sItf = ((Interface)(serverItf));
sItfType = ((InterfaceType)(sItf.getFcItfType()));
} catch (ClassCastException e) {
bindFc(cItfType ,clientItfName ,serverItf);
return ;
}
if (sItfType.isFcClientItf()) {
throw new ChainedIllegalBindingException(null , weaveableC , sItf.getFcItfOwner() , clientItfName , sItf.getFcItfName() , "Cannot bind two client interfaces together");
}
try {
Class s = Class.forName(sItfType.getFcItfSignature());
Class c = Class.forName(cItfType.getFcItfSignature());
if (!(c.isAssignableFrom(s))) {
throw new ChainedIllegalBindingException(null , weaveableC , sItf.getFcItfOwner() , clientItfName , sItf.getFcItfName() , "The server interface type is not a subtype of the client interface type");
}
} catch (ClassNotFoundException ignored) {
}
if ((!(cItfType.isFcOptionalItf())) && (sItfType.isFcOptionalItf())) {
throw new ChainedIllegalBindingException(null , weaveableC , ((Interface)(serverItf)).getFcItfOwner() , clientItfName , ((Interface)(serverItf)).getFcItfName() , "A mandatory interface cannot be bound to an optional interface");
}
bindFc(cItfType ,clientItfName ,sItf);
}
/**
* @see org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin#lookupFc(java.lang.String)
*/
private Object lookupFc$1(final String clientItfName) throws NoSuchInterfaceException {
if ((fcContent) == (this)) {
ContentBindingController cbc = ((ContentBindingController)(this));
return cbc.lookupFcContent(clientItfName);
} else {
BindingController bc = ((BindingController)(fcContent));
return bc.lookupFc(clientItfName);
}
}
private void unbindFc$4(String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
}
/**
* @see org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin#bindFc(java.lang.String,java.lang.Object)
*/
private void bindFc$2(final String clientItfName, final Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
if ((fcContent) == (this)) {
((ContentBindingController)(this)).bindFcContent(clientItfName ,serverItf);
} else {
((BindingController)(fcContent)).bindFc(clientItfName ,serverItf);
}
}
/**
* @see org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin#unbindFc(java.lang.String)
*/
private void unbindFc$3(final String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
if ((fcContent) == (this)) {
((ContentBindingController)(this)).unbindFcContent(clientItfName);
} else {
((BindingController)(fcContent)).unbindFc(clientItfName);
}
}
/**
* @see org.objectweb.fractal.julia.control.binding.InterceptorBindingMixin#unbindFc(java.lang.String)
*/
private void unbindFc$2(final String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
Object o = weaveableC.getFcInterface(clientItfName);
if (o instanceof ComponentInterface) {
Object next = ((ComponentInterface)(o)).getFcItfImpl();
if (next instanceof Interceptor) {
((Interceptor)(next)).setFcItfDelegate(null);
} else {
((ComponentInterface)(o)).setFcItfImpl(null);
}
}
unbindFc$3(clientItfName);
}
/**
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin#unbindFc(java.lang.String)
*/
private void unbindFc$0(final String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
ComponentType compType = ((ComponentType)(weaveableC.getFcType()));
InterfaceType clientItfType;
try {
clientItfType = compType.getFcInterfaceType(clientItfName);
} catch (NoSuchInterfaceException e) {
throw new ChainedNoSuchInterfaceException(null , weaveableC , clientItfName);
}
checkFcClientInterface(clientItfType);
unbindFc(clientItfType ,clientItfName);
}
private void bindFc$1(InterfaceType clientItfType, String clientItfName, Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
}
/**
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin#lookupFc(org.objectweb.fractal.api.type.InterfaceType,java.lang.String)
*/
public Object lookupFc(final InterfaceType clientItfType, final String clientItfName) throws NoSuchInterfaceException {
return lookupFc$0(clientItfName);
}
/**
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin#bindFc(org.objectweb.fractal.api.type.InterfaceType,java.lang.String,java.lang.Object)
*/
private void bindFc$0(final InterfaceType clientItfType, final String clientItfName, final Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
bindFc$0(clientItfName ,serverItf);
}
/**
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin#unbindFc(org.objectweb.fractal.api.type.InterfaceType,java.lang.String)
*/
public void unbindFc(final InterfaceType clientItfType, final String clientItfName) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
unbindFc$1(clientItfName);
}
/**
* @see org.objectweb.fractal.julia.control.binding.TypeBindingMixin#checkFcClientInterface(org.objectweb.fractal.api.type.InterfaceType)
*/
private void checkFcClientInterface(InterfaceType itfType) throws NoSuchInterfaceException {
try {
weaveableC.getFcInterface("content-controller");
String name = itfType.getFcItfName();
if ((!(name.equals("component"))) && (!(name.endsWith("-controller")))) {
return ;
}
} catch (NoSuchInterfaceException e) {
if (itfType.isFcClientItf()) {
return ;
}
}
throw new ChainedNoSuchInterfaceException(null , weaveableC , itfType.getFcItfName());
}
private Object lookupFc$2(String clientItfName) throws NoSuchInterfaceException {
return null;
}
private void bindFc$3(String clientItfName, Object serverItf) throws NoSuchInterfaceException, IllegalBindingException, IllegalLifeCycleException {
}
public String getFcGeneratorParameters() {
return "(org.objectweb.fractal.juliac.spoon.MixinClassGenerator juliac.generated.ContainerBindingControllerImpl org.objectweb.fractal.julia.BasicControllerMixin org.objectweb.fractal.julia.control.binding.ContainerBindingControllerMixin org.objectweb.fractal.julia.UseComponentMixin org.objectweb.fractal.julia.control.binding.InterceptorBindingMixin org.objectweb.fractal.julia.control.binding.CheckBindingMixin org.objectweb.fractal.julia.control.binding.TypeBindingMixin org.objectweb.fractal.julia.control.content.UseSuperControllerMixin org.objectweb.fractal.julia.control.binding.ContentBindingMixin org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin org.objectweb.fractal.julia.control.binding.LifeCycleBindingMixin)";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy