1 22 package org.jboss.beans.metadata.plugins; 23 24 import java.util.Iterator ; 25 26 import org.jboss.beans.metadata.spi.DependencyMetaData; 27 import org.jboss.beans.metadata.spi.MetaDataVisitor; 28 import org.jboss.beans.metadata.spi.MetaDataVisitorNode; 29 import org.jboss.dependency.plugins.AbstractDependencyItem; 30 import org.jboss.dependency.spi.ControllerState; 31 import org.jboss.dependency.spi.DependencyItem; 32 import org.jboss.kernel.spi.dependency.KernelControllerContext; 33 import org.jboss.util.JBossObject; 34 import org.jboss.util.JBossStringBuilder; 35 36 42 public class AbstractDependencyMetaData extends JBossObject implements DependencyMetaData 43 { 44 45 protected Object dependency; 46 47 50 public AbstractDependencyMetaData() 51 { 52 } 53 54 59 public AbstractDependencyMetaData(Object dependency) 60 { 61 this.dependency = dependency; 62 } 63 64 69 public void setDependency(Object dependency) 70 { 71 this.dependency = dependency; 72 flushJBossObjectCache(); 73 } 74 75 public Object getDependency() 76 { 77 return dependency; 78 } 79 80 public void initialVisit(MetaDataVisitor visitor) 81 { 82 KernelControllerContext context = visitor.getControllerContext(); 83 DependencyItem item = new LifecycleDependencyItem(context.getName(), ControllerState.CREATE); 84 visitor.addDependency(item); 85 item = new LifecycleDependencyItem(context.getName(), ControllerState.START); 86 visitor.addDependency(item); 87 88 visitor.initialVisit(this); 89 } 90 91 public void describeVisit(MetaDataVisitor vistor) 92 { 93 vistor.describeVisit(this); 94 } 95 96 public Iterator <? extends MetaDataVisitorNode> getChildren() 97 { 98 return null; 99 } 100 101 public void toString(JBossStringBuilder buffer) 102 { 103 buffer.append("dependency=").append(dependency); 104 } 105 106 public void toShortString(JBossStringBuilder buffer) 107 { 108 buffer.append(dependency); 109 } 110 111 114 public class LifecycleDependencyItem extends AbstractDependencyItem 115 { 116 122 public LifecycleDependencyItem(Object name, ControllerState state) 123 { 124 super(name, dependency, state, state); 125 } 126 } 127 } 128 | Popular Tags |