1 23 24 package org.objectweb.fractal.julia.control.lifecycle; 25 26 import org.objectweb.fractal.api.Component; 27 import org.objectweb.fractal.api.NoSuchInterfaceException; 28 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 29 import org.objectweb.fractal.api.control.LifeCycleController; 30 31 40 41 public abstract class ContainerLifeCycleMixin 42 implements LifeCycleCoordinator 43 { 44 45 49 private ContainerLifeCycleMixin () { 50 } 51 52 56 64 65 public boolean setFcStarted () throws IllegalLifeCycleException { 66 synchronized (this) { 67 if (_super_setFcStarted()) { 68 setFcContentState(true); 69 return true; 70 } 71 return false; 72 } 73 } 74 75 83 84 public boolean setFcStopped () throws IllegalLifeCycleException { 85 synchronized (this) { 86 if (_super_setFcStopped()) { 87 setFcContentState(false); 88 return true; 89 } 90 return false; 91 } 92 } 93 94 105 106 public void setFcContentState (final boolean started) 107 throws IllegalLifeCycleException 108 { 109 Object content; 110 try { 111 content = _this_weaveableOptC.getFcInterface("/content"); 112 } catch (NullPointerException e) { 113 return; 114 } catch (NoSuchInterfaceException e) { 115 return; 116 } 117 if (content == this) { 118 if (this instanceof ContentLifeCycleController) { 120 if (started) { 121 ((ContentLifeCycleController)this).startFcContent(); 122 } else { 123 ((ContentLifeCycleController)this).stopFcContent(); 124 } 125 } 126 } else if (content instanceof LifeCycleController) { 127 if (started) { 128 ((LifeCycleController)content).startFc(); 129 } else { 130 ((LifeCycleController)content).stopFc(); 131 } 132 } 133 } 134 135 139 144 145 public Component _this_weaveableOptC; 146 147 155 156 public abstract boolean _super_setFcStarted () 157 throws IllegalLifeCycleException; 158 159 167 168 public abstract boolean _super_setFcStopped () 169 throws IllegalLifeCycleException; 170 } 171 | Popular Tags |