1 23 24 package org.objectweb.fractal.julia.control.binding; 25 26 import org.objectweb.fractal.api.Component; 27 import org.objectweb.fractal.api.NoSuchInterfaceException; 28 import org.objectweb.fractal.api.control.BindingController; 29 import org.objectweb.fractal.api.control.IllegalBindingException; 30 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 31 import org.objectweb.fractal.api.factory.InstantiationException; 32 33 import org.objectweb.fractal.julia.Controller; 34 import org.objectweb.fractal.julia.InitializationContext; 35 36 47 48 public abstract class ContainerBindingControllerMixin 49 implements Controller, BindingController 50 { 51 52 56 private ContainerBindingControllerMixin () { 57 } 58 59 63 66 67 public Object fcContent; 68 69 76 77 public void initFcController (final InitializationContext ic) 78 throws InstantiationException 79 { 80 fcContent = ic.content; 81 Component owner = (Component)ic.getOptionalInterface("component"); 82 if (owner != null) { 83 try { 84 owner = (Component)owner.getFcInterface("component"); 85 if (fcContent == this) { 86 if (this instanceof ContentBindingController) { 88 ((ContentBindingController)this).bindFcContent("component", owner); 89 } 90 } else if (fcContent instanceof BindingController) { 91 ((BindingController)fcContent).bindFc("component", owner); 92 } 93 } catch (Exception ignored) { 94 } 95 } 96 _super_initFcController(ic); 97 } 98 99 public String [] listFc () { 100 if (fcContent == this) { 101 if (this instanceof ContentBindingController) { 103 return ((ContentBindingController)this).listFcContent(); 104 } 105 } else if (fcContent instanceof BindingController) { 106 return ((BindingController)fcContent).listFc(); 107 } 108 return new String [0]; 109 } 110 111 public Object lookupFc (final String clientItfName) 112 throws NoSuchInterfaceException 113 { 114 if (fcContent == this) { 115 ContentBindingController cbc = (ContentBindingController)this; 117 return cbc.lookupFcContent(clientItfName); 118 } else { 119 BindingController bc = (BindingController)fcContent; 120 return bc.lookupFc(clientItfName); 121 } 122 } 123 124 public void bindFc (final String clientItfName, final Object serverItf) throws 125 NoSuchInterfaceException, 126 IllegalBindingException, 127 IllegalLifeCycleException 128 { 129 if (fcContent == this) { 130 ((ContentBindingController)this).bindFcContent(clientItfName, serverItf); 132 } else { 133 ((BindingController)fcContent).bindFc(clientItfName, serverItf); 134 } 135 } 136 137 public void unbindFc (final String clientItfName) throws 138 NoSuchInterfaceException, 139 IllegalBindingException, 140 IllegalLifeCycleException 141 { 142 if (fcContent == this) { 143 ((ContentBindingController)this).unbindFcContent(clientItfName); 145 } else { 146 ((BindingController)fcContent).unbindFc(clientItfName); 147 } 148 } 149 150 154 162 163 public abstract void _super_initFcController (InitializationContext ic) 164 throws InstantiationException ; 165 } 166 | Popular Tags |