1 22 package org.jboss.kernel.plugins.dependency; 23 24 import org.jboss.dependency.spi.Controller; 25 import org.jboss.dependency.spi.ControllerContext; 26 import org.jboss.dependency.spi.ControllerState; 27 import org.jboss.dependency.plugins.AbstractDependencyItem; 28 import org.jboss.util.JBossStringBuilder; 29 30 35 public class ClassContextDependencyItem extends AbstractDependencyItem 36 { 37 public ClassContextDependencyItem(Object name, Class demandClass, ControllerState whenRequired, ControllerState dependentState) 38 { 39 super(name, demandClass, whenRequired, dependentState); 40 } 41 42 public boolean resolve(Controller controller) 43 { 44 ControllerContext context = controller.getInstalledContext(getIDependOn()); 45 if (context != null) 46 { 47 setIDependOn(context.getName()); 48 addDependsOnMe(controller, context); 49 setResolved(true); 50 } 51 else 52 { 53 setResolved(false); 54 } 55 return isResolved(); 56 } 57 58 public void unresolved(Controller controller) 59 { 60 setIDependOn(null); 61 super.unresolved(controller); 62 } 63 64 public void toString(JBossStringBuilder buffer) 65 { 66 super.toString(buffer); 67 buffer.append(" demandClass=").append(getIDependOn()); 68 } 69 70 public void toShortString(JBossStringBuilder buffer) 71 { 72 buffer.append(getName()).append(" demands ").append(getIDependOn()); 73 } 74 75 } 76 77 78 | Popular Tags |