1 22 package org.jboss.dependency.plugins; 23 24 import java.util.Map ; 25 26 import org.jboss.dependency.plugins.spi.action.ControllerContextAction; 27 import org.jboss.dependency.spi.ControllerContext; 28 import org.jboss.dependency.spi.ControllerContextActions; 29 import org.jboss.dependency.spi.ControllerState; 30 31 37 public class AbstractControllerContextActions implements ControllerContextActions 38 { 39 40 private Map <ControllerState, ControllerContextAction> actions; 41 42 public AbstractControllerContextActions(Map <ControllerState, ControllerContextAction> actions) 43 { 44 this.actions = actions; 45 } 46 47 public void install(ControllerContext context, ControllerState fromState, ControllerState toState) throws Throwable 48 { 49 ControllerContextAction action = getAction(context, toState); 50 if (action != null) 51 action.install(context); 52 } 53 54 public void uninstall(ControllerContext context, ControllerState fromState, ControllerState toState) 55 { 56 ControllerContextAction action = getAction(context, fromState); 57 if (action != null) 58 action.uninstall(context); 59 } 60 61 68 protected ControllerContextAction getAction(ControllerContext context, ControllerState state) 69 { 70 return actions.get(state); 71 } 72 } 73 | Popular Tags |