Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
juliac.generated.ContentControllerImpl Maven / Gradle / Ivy
package juliac.generated;
import java.util.ArrayList;
import org.objectweb.fractal.api.control.BindingController;
import org.objectweb.fractal.julia.control.binding.ChainedIllegalBindingException;
import org.objectweb.fractal.julia.control.content.ChainedIllegalContentException;
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.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.IllegalContentException;
import org.objectweb.fractal.api.control.IllegalLifeCycleException;
import org.objectweb.fractal.julia.InitializationContext;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.api.Interface;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.api.control.LifeCycleController;
import java.util.List;
import java.util.Map;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import java.util.Set;
import org.objectweb.fractal.api.control.SuperController;
import org.objectweb.fractal.julia.control.content.SuperControllerNotifier;
import org.objectweb.fractal.api.Type;
/**
* @see org.objectweb.fractal.julia.BasicControllerMixin
* @see org.objectweb.fractal.julia.UseComponentMixin
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin
* @see org.objectweb.fractal.julia.control.content.CheckContentMixin
* @see org.objectweb.fractal.julia.control.content.TypeContentMixin
* @see org.objectweb.fractal.julia.control.content.BindingContentMixin
* @see org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin
* @see org.objectweb.fractal.julia.control.content.LifeCycleContentMixin
* @see org.objectweb.fractal.julia.control.content.SuperContentMixin
*/
public class ContentControllerImpl implements ContentController , 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$2(final InitializationContext ic) throws InstantiationException {
}
/**
* @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.content.LifeCycleContentMixin#removeFcSubComponent(org.objectweb.fractal.api.Component)
*/
private void removeFcSubComponent$0(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
if ((weaveableOptLC) != null) {
String state = weaveableOptLC.getFcState();
if (!(LifeCycleController.STOPPED.equals(state))) {
throw new ChainedIllegalLifeCycleException(null , weaveableOptC , "The component is not stopped");
}
}
removeFcSubComponent$1(subComponent);
}
/**
* @see org.objectweb.fractal.julia.control.content.SuperContentMixin#addFcSubComponent(org.objectweb.fractal.api.Component)
*/
public void addFcSubComponent(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
addFcSubComponent$0(subComponent);
SuperControllerNotifier scn = getFcSuperControllerNotifier(subComponent);
if (scn != null) {
try {
Component c = ((Component)(weaveableC.getFcInterface("component")));
scn.addedToFc(c);
} catch (NoSuchInterfaceException ignored) {
}
}
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#fcInternalInterfaces
*/
public Map fcInternalInterfaces;
/**
* @see org.objectweb.fractal.julia.control.content.CheckContentMixin#addFcSubComponent(org.objectweb.fractal.api.Component)
*/
private void addFcSubComponent$0(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
if (containsFcSubComponent(subComponent)) {
throw new ChainedIllegalContentException(null , weaveableC , subComponent , "Already a sub component");
}
Component thisComponent;
try {
thisComponent = ((Component)(weaveableC.getFcInterface("component")));
} catch (NoSuchInterfaceException e) {
throw new ChainedIllegalContentException(e , weaveableC , subComponent , "Cannot check this operation");
}
if (subComponent.equals(thisComponent)) {
throw new ChainedIllegalContentException(null , weaveableC , subComponent , "A component cannot be a sub component of itself");
}
List allSubComponents = org.objectweb.fractal.julia.control.content.Util.getAllSubComponents(subComponent);
for (int i = 0 ; i < (allSubComponents.size()) ; ++i) {
if (allSubComponents.get(i).equals(thisComponent)) {
throw new ChainedIllegalContentException(null , weaveableC , subComponent , "Would create a cycle in the component hierarchy");
}
}
addFcSubComponent$1(subComponent);
}
/**
* @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.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.content.TypeContentMixin#getFcInternalInterface(java.lang.String)
*/
public Object getFcInternalInterface(final String interfaceName) throws NoSuchInterfaceException {
ComponentType compType = ((ComponentType)(weaveableC.getFcType()));
InterfaceType itfType;
try {
itfType = compType.getFcInterfaceType(interfaceName);
} catch (NoSuchInterfaceException e) {
throw new ChainedNoSuchInterfaceException(null , weaveableC , interfaceName);
}
Object result;
try {
result = getFcInternalInterface$0(interfaceName);
} catch (NoSuchInterfaceException e) {
if (itfType.isFcCollectionItf()) {
String collectionName = "/collection/" + (itfType.getFcItfName());
result = getFcInternalInterface$0(collectionName);
result = ((ComponentInterface)(result)).clone();
((ComponentInterface)(result)).setFcItfName(interfaceName);
fcInternalInterfaces.put(interfaceName ,result);
} else {
throw e;
}
}
return result;
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#fcSubComponents
*/
public List fcSubComponents;
/**
* @see org.objectweb.fractal.julia.control.content.BindingContentMixin#removeFcSubComponent(org.objectweb.fractal.api.Component)
*/
private void removeFcSubComponent$1(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
try {
checkFcRemoveSubComponent(subComponent);
} catch (IllegalBindingException e) {
throw new ChainedIllegalContentException(e , weaveableOptC , subComponent , "Would create non local bindings");
}
removeFcSubComponent$2(subComponent);
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
private void initFcController$0(final InitializationContext ic) throws InstantiationException {
fcInternalInterfaces = ic.internalInterfaces;
initFcController$1(ic);
}
private void initFcController$3(InitializationContext ic) throws InstantiationException {
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#getFcInternalInterfaces()
*/
public Object[] getFcInternalInterfaces() {
if ((fcInternalInterfaces) == null) {
return new Object[0];
}
int size = 0;
String[] names = new String[fcInternalInterfaces.size()];
names = ((String[])(fcInternalInterfaces.keySet().toArray(names)));
for (int i = 0 ; i < (names.length) ; ++i) {
if ((names[i].charAt(0)) != '/') {
++size;
}
}
int index = 0;
Object[] itfs = new Object[size];
for (int i = 0 ; i < (names.length) ; ++i) {
if ((names[i].charAt(0)) != '/') {
itfs[index++] = fcInternalInterfaces.get(names[i]);
}
}
return itfs;
}
/**
* @see org.objectweb.fractal.julia.control.content.SuperContentMixin#removeFcSubComponent(org.objectweb.fractal.api.Component)
*/
public void removeFcSubComponent(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
removeFcSubComponent$0(subComponent);
SuperControllerNotifier scn = getFcSuperControllerNotifier(subComponent);
if (scn != null) {
try {
Component c = ((Component)(weaveableC.getFcInterface("component")));
scn.removedFromFc(c);
} catch (NoSuchInterfaceException ignored) {
}
}
}
/**
* @see org.objectweb.fractal.julia.control.content.BindingContentMixin#checkFcRemoveSubComponent(org.objectweb.fractal.api.Component)
*/
public void checkFcRemoveSubComponent(final Component subComponent) throws IllegalBindingException {
Component parent;
try {
parent = ((Component)(weaveableOptC.getFcInterface("component")));
if (parent == null) {
return ;
}
} catch (NoSuchInterfaceException e) {
return ;
}
BindingController bc;
try {
bc = ((BindingController)(subComponent.getFcInterface("binding-controller")));
} catch (NoSuchInterfaceException e) {
bc = null;
}
Object[] itfs = subComponent.getFcInterfaces();
for (int i = 0 ; i < (itfs.length) ; ++i) {
Interface itf;
InterfaceType itfType;
try {
itf = ((Interface)(itfs[i]));
itfType = ((InterfaceType)(itf.getFcItfType()));
} catch (ClassCastException e) {
continue;
}
if (itfType.isFcClientItf()) {
if (bc != null) {
Interface sItf;
try {
sItf = ((Interface)(bc.lookupFc(itf.getFcItfName())));
} catch (NoSuchInterfaceException e) {
continue;
} catch (ClassCastException e) {
continue;
}
if (sItf != null) {
checkFcLocalBinding(itf ,parent ,sItf ,null);
}
}
} else {
Object[] potentialClients;
try {
potentialClients = org.objectweb.fractal.julia.control.binding.Util.getFcPotentialClientsOf(itf).toArray();
} catch (Exception e) {
continue;
}
for (int j = 0 ; j < (potentialClients.length) ; ++j) {
Component c = ((Component)(potentialClients[j]));
List clientItfs;
try {
clientItfs = org.objectweb.fractal.julia.control.binding.Util.getFcClientItfsBoundTo(c ,itf);
} catch (Exception e) {
continue;
}
if ((clientItfs.size()) > 0) {
checkFcLocalBinding(((Interface)(clientItfs.get(0))) ,null ,itf ,parent);
}
}
}
}
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#getFcInternalInterface(java.lang.String)
*/
private Object getFcInternalInterface$0(final String interfaceName) throws NoSuchInterfaceException {
Object itf;
if ((fcInternalInterfaces) == null) {
itf = null;
} else {
itf = fcInternalInterfaces.get(interfaceName);
}
if (itf == null) {
throw new ChainedNoSuchInterfaceException(null , weaveableOptC , interfaceName);
}
return itf;
}
/**
* @see org.objectweb.fractal.julia.control.content.SuperContentMixin#getFcSuperControllerNotifier(org.objectweb.fractal.api.Component)
*/
private SuperControllerNotifier getFcSuperControllerNotifier(final Component c) {
try {
return ((SuperControllerNotifier)(c.getFcInterface("super-controller")));
} catch (Exception e) {
try {
return ((SuperControllerNotifier)(c.getFcInterface("/super-controller-notifier")));
} catch (NoSuchInterfaceException ignored) {
return null;
}
}
}
/**
* @see org.objectweb.fractal.julia.control.content.CheckContentMixin#removeFcSubComponent(org.objectweb.fractal.api.Component)
*/
private void removeFcSubComponent$2(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
if (!(containsFcSubComponent(subComponent))) {
throw new ChainedIllegalContentException(null , weaveableC , subComponent , "Not a sub component");
}
removeFcSubComponent$3(subComponent);
}
private Object getFcInternalInterface$1(String interfaceName) throws NoSuchInterfaceException {
return null;
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#getFcSubComponents()
*/
public Component[] getFcSubComponents() {
if ((fcSubComponents) == null) {
return new Component[0];
}
return ((Component[])(fcSubComponents.toArray(new Component[fcSubComponents.size()])));
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#addFcSubComponent(org.objectweb.fractal.api.Component)
*/
private void addFcSubComponent$1(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
if ((fcSubComponents) == null) {
fcSubComponents = new ArrayList();
}
fcSubComponents.add(subComponent);
}
/**
* @see org.objectweb.fractal.julia.control.content.CheckContentMixin#containsFcSubComponent(org.objectweb.fractal.api.Component)
*/
public boolean containsFcSubComponent(final Component subComponent) {
Component[] subComponents = getFcSubComponents();
for (int i = 0 ; i < (subComponents.length) ; ++i) {
if (subComponents[i].equals(subComponent)) {
return true;
}
}
return false;
}
/**
* @see org.objectweb.fractal.julia.control.content.BasicContentControllerMixin#removeFcSubComponent(org.objectweb.fractal.api.Component)
*/
private void removeFcSubComponent$3(final Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
if ((fcSubComponents) != null) {
fcSubComponents.remove(subComponent);
}
}
private void addFcSubComponent$2(Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
}
private void removeFcSubComponent$4(Component subComponent) throws IllegalContentException, IllegalLifeCycleException {
}
/**
* @see org.objectweb.fractal.julia.control.content.BindingContentMixin#checkFcLocalBinding(org.objectweb.fractal.api.Interface,org.objectweb.fractal.api.Component,org.objectweb.fractal.api.Interface,org.objectweb.fractal.api.Component)
*/
private void checkFcLocalBinding(final Interface cItf, final Component cId, final Interface sItf, final Component sId) throws IllegalBindingException {
Component client = cItf.getFcItfOwner();
Component server = sItf.getFcItfOwner();
if (client.equals(server)) {
return ;
}
SuperController cSc = null;
SuperController sSc = null;
try {
cSc = ((SuperController)(client.getFcInterface("super-controller")));
} catch (NoSuchInterfaceException ignored) {
}
try {
sSc = ((SuperController)(server.getFcInterface("super-controller")));
} catch (NoSuchInterfaceException ignored) {
}
if (cItf.isFcInternalItf()) {
if (cSc != null) {
Component[] sP = sSc.getFcSuperComponents();
for (int i = 0 ; i < (sP.length) ; ++i) {
Component p = sP[i];
if ((sId == null) || (!(p.equals(sId)))) {
if (p.equals(client)) {
return ;
}
}
}
} else {
return ;
}
} else {
if (sItf.isFcInternalItf()) {
if (cSc != null) {
Component[] cP = cSc.getFcSuperComponents();
for (int i = 0 ; i < (cP.length) ; ++i) {
Component p = cP[i];
if ((cId == null) || (!(p.equals(cId)))) {
if (p.equals(server)) {
return ;
}
}
}
} else {
return ;
}
} else {
if ((cSc != null) && (sSc != null)) {
Component[] cP = cSc.getFcSuperComponents();
Component[] sP = sSc.getFcSuperComponents();
for (int i = 0 ; i < (cP.length) ; ++i) {
Component p = cP[i];
if ((cId == null) || (!(p.equals(cId)))) {
for (int j = 0 ; j < (sP.length) ; ++j) {
Component q = sP[j];
if ((sId == null) || (!(q.equals(sId)))) {
if (p.equals(q)) {
return ;
}
}
}
}
}
} else {
return ;
}
}
}
throw new ChainedIllegalBindingException(null , weaveableOptC , sId , cItf.getFcItfName() , sItf.getFcItfName() , "Not a local binding");
}
public String getFcGeneratorParameters() {
return "(org.objectweb.fractal.juliac.spoon.MixinClassGenerator juliac.generated.ContentControllerImpl org.objectweb.fractal.julia.BasicControllerMixin org.objectweb.fractal.julia.UseComponentMixin org.objectweb.fractal.julia.control.content.BasicContentControllerMixin org.objectweb.fractal.julia.control.content.CheckContentMixin org.objectweb.fractal.julia.control.content.TypeContentMixin org.objectweb.fractal.julia.control.content.BindingContentMixin org.objectweb.fractal.julia.control.lifecycle.UseLifeCycleControllerMixin org.objectweb.fractal.julia.control.content.LifeCycleContentMixin org.objectweb.fractal.julia.control.content.SuperContentMixin)";
}
}