/** * @see org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin#stopFc() */ public void stopFc() throws org.objectweb.fractal.api.control.IllegalLifeCycleException { if ((fcState) == 2) { stopFc(new org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator[]{ getFcCoordinator() }); setFcState(false); } }
/** * @see org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin#setFcStarted() */ public boolean setFcStarted() throws org.objectweb.fractal.api.control.IllegalLifeCycleException { synchronized(this) { if (setFcStarted$0()) { setFcContentState(true); return true; } return false; } }
/** * @see org.objectweb.fractal.julia.control.lifecycle.ContainerLifeCycleMixin#setFcStopped() */ public boolean setFcStopped() throws org.objectweb.fractal.api.control.IllegalLifeCycleException { synchronized(this) { if (setFcStopped$0()) { setFcContentState(false); return true; } return false; } }
/** * @see org.objectweb.fractal.juliac.fraclet.control.lifecycle.FracletLifeCycleControllerMixin#setFcContentState(boolean) */ public void setFcContentState(final boolean started) throws org.objectweb.fractal.api.control.IllegalLifeCycleException { org.objectweb.fractal.fraclet.types.Step step = (started) ? org.objectweb.fractal.fraclet.types.Step.START : org.objectweb.fractal.fraclet.types.Step.STOP; java.util.List<java.lang.reflect.Method> methods = notifiables.get(step); for (final java.lang.reflect.Method method : methods) { org.objectweb.fractal.fraclet.annotations.Lifecycle lifecycle = method.getAnnotation(org.objectweb.fractal.fraclet.annotations.Lifecycle.class); org.objectweb.fractal.fraclet.types.Policy policy = lifecycle.policy(); if (policy.equals(org.objectweb.fractal.fraclet.types.Policy.SYNCHRONOUS)) { invoke(method); }else { new java.lang.Thread() { @java.lang.Override public void run() { try { invoke(method); } catch (org.objectweb.fractal.api.control.IllegalLifeCycleException ilce) { ilce.printStackTrace(); } } }.start(); } } setFcContentState$0(started); }
/** * @see org.objectweb.fractal.julia.control.lifecycle.TypeLifeCycleMixin#startFc() */ public void startFc() throws org.objectweb.fractal.api.control.IllegalLifeCycleException { org.objectweb.fractal.api.Component thisComponent; try { thisComponent = ((org.objectweb.fractal.api.Component) (weaveableC.getFcInterface("component"))); } catch (org.objectweb.fractal.api.NoSuchInterfaceException e) { throw new org.objectweb.fractal.julia.control.lifecycle.ChainedIllegalLifeCycleException(e, weaveableC, "Cannot start the component"); } java.util.List allSubComponents = org.objectweb.fractal.julia.control.content.Util.getAllSubComponents(thisComponent); for (int i = 0; i < (allSubComponents.size()); ++i) { org.objectweb.fractal.api.Component subComponent = ((org.objectweb.fractal.api.Component) (allSubComponents.get(i))); try { checkFcMandatoryInterfaces(subComponent); } catch (org.objectweb.fractal.api.control.IllegalBindingException e) { throw new org.objectweb.fractal.julia.control.lifecycle.ChainedIllegalLifeCycleException(e, weaveableC, "Cannot start the component"); } } startFc$0(); }
/** * @see org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin#decrementFcInvocationCounter() */ public void decrementFcInvocationCounter() { --(fcInvocationCounter); if ((fcInvocationCounter) == 0) { fcCoordinator.fcInactivated(getFcCoordinator()); } }
/** * @see org.objectweb.fractal.julia.UseComponentMixin#initFcController(org.objectweb.fractal.julia.InitializationContext) */ private void initFcController$1(final org.objectweb.fractal.julia.InitializationContext ic) throws org.objectweb.fractal.api.factory.InstantiationException { weaveableC = ((org.objectweb.fractal.api.Component) (ic.getInterface("component"))); weaveableOptC = weaveableC; initFcController$2(ic); }
public org.objectweb.fractal.api.Component newFcControllerInstantiation(org.objectweb.fractal.julia.InitializationContext ic) throws org.objectweb.fractal.api.factory.InstantiationException { Object ctrl = null; ic.controllers.add(ctrl = new juliac.generated.ComponentImpl()); org.objectweb.fractal.api.Component compctrl = (org.objectweb.fractal.api.Component)ctrl; ic.controllers.add(ctrl = new juliac.generated.ContainerBindingControllerImpl()); ic.controllers.add(ctrl = new juliac.generated.SuperControllerImpl()); ic.controllers.add(ctrl = new juliac.generated.LifeCycleControllerImpl()); ic.controllers.add(ctrl = new juliac.generated.NameControllerImpl()); return compctrl; }
/** * @see org.objectweb.fractal.juliac.fraclet.control.lifecycle.FracletLifeCycleControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext) */ public void initFcController(org.objectweb.fractal.julia.InitializationContext ic) throws org.objectweb.fractal.api.factory.InstantiationException { initFcController$0(ic); fcContent = ic.content; java.lang.Class<?> cl = fcContent.getClass(); for (org.objectweb.fractal.fraclet.types.Step step : org.objectweb.fractal.fraclet.types.Step.values()) { notifiables.put(step, new java.util.ArrayList<java.lang.reflect.Method>()); } java.lang.reflect.Method[] methods = org.objectweb.fractal.juliac.commons.lang.ClassHelper.getAllMethods(cl); methods = org.objectweb.fractal.juliac.commons.lang.reflect.MethodHelper.removeOverridden(methods); for (java.lang.reflect.Method method : methods) { org.objectweb.fractal.fraclet.annotations.Lifecycle lifecycle = method.getAnnotation(org.objectweb.fractal.fraclet.annotations.Lifecycle.class); if (lifecycle != null) { java.lang.Class<?>[] types = method.getParameterTypes(); if ((types.length) != 0) { final java.lang.String msg = ("Lifecycle callback method " + method) + " cannot declare parameters"; throw new org.objectweb.fractal.api.factory.InstantiationException(msg); } org.objectweb.fractal.fraclet.types.Step step = lifecycle.step(); java.util.List<java.lang.reflect.Method> ms = notifiables.get(step); ms.add(method); int mod = method.getModifiers(); if (java.lang.reflect.Modifier.isPrivate(mod)) { method.setAccessible(true); } } } }
/** * @see org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext) */ private void initFcController$0(final org.objectweb.fractal.julia.InitializationContext ic) throws org.objectweb.fractal.api.factory.InstantiationException { try { if (!((ic.getInterface("lifecycle-controller")) instanceof org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator)) { throw new java.lang.Exception(); } } catch (java.lang.Exception e) { try { ic.getInterface("/lifecycle-coordinator"); } catch (java.lang.Exception f) { throw new org.objectweb.fractal.julia.factory.ChainedInstantiationException(f, null, "The component must provide a LifeCycleCoordinator interface"); } } initFcController$1(ic); }
/** * @see org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin#setFcStopping(org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator) */ public void setFcStopping(final org.objectweb.fractal.julia.control.lifecycle.LifeCycleCoordinator coordinator) throws org.objectweb.fractal.api.control.IllegalLifeCycleException { synchronized(this) { fcState = 1; fcCoordinator = coordinator; if ((fcInvocationCounter) == 0) { fcCoordinator.fcInactivated(getFcCoordinator()); } } }
/** * @see org.objectweb.fractal.julia.control.lifecycle.BasicLifeCycleControllerMixin#incrementFcInvocationCounter() */ public void incrementFcInvocationCounter() { boolean ok; do { if ((fcState) == 0) { ok = false; }else if ((fcState) == 1) { if ((fcInvocationCounter) == 0) { ok = fcCoordinator.fcActivated(getFcCoordinator()); }else { ok = true; } }else { ok = true; } if (!ok) { try { wait(); } catch (final java.lang.InterruptedException e) { } } } while (!ok ); ++(fcInvocationCounter); }