1 22 package org.jboss.beans.metadata.plugins; 23 24 import java.util.Collections ; 25 import java.util.Iterator ; 26 import java.util.List ; 27 import java.util.ArrayList ; 28 29 import org.jboss.beans.metadata.spi.*; 30 import org.jboss.dependency.spi.ControllerState; 31 import org.jboss.util.JBossObject; 32 import org.jboss.util.JBossStringBuilder; 33 34 40 public class AbstractClassLoaderMetaData extends JBossObject implements ClassLoaderMetaData, BeanMetaDataFactory 41 { 42 43 protected ValueMetaData classloader; 44 45 48 public AbstractClassLoaderMetaData() 49 { 50 } 51 52 57 public AbstractClassLoaderMetaData(ValueMetaData classloader) 58 { 59 this.classloader = classloader; 60 } 61 62 67 public void setClassLoader(ValueMetaData classloader) 68 { 69 this.classloader = classloader; 70 flushJBossObjectCache(); 71 } 72 73 public ValueMetaData getClassLoader() 74 { 75 return classloader; 76 } 77 78 public List <BeanMetaData> getBeans() 79 { 80 if (classloader instanceof BeanMetaDataFactory) 81 { 82 return ((BeanMetaDataFactory)classloader).getBeans(); 83 } 84 else if (classloader instanceof BeanMetaData) 85 { 86 return Collections.singletonList((BeanMetaData)classloader); 87 } 88 return new ArrayList <BeanMetaData>(); 89 } 90 91 public void initialVisit(MetaDataVisitor visitor) 92 { 93 visitor.setContextState(ControllerState.DESCRIBED); 94 visitor.initialVisit(this); 95 } 96 97 public void describeVisit(MetaDataVisitor vistor) 98 { 99 vistor.describeVisit(this); 101 } 102 103 public Iterator <? extends MetaDataVisitorNode> getChildren() 104 { 105 if (classloader != null) 106 return Collections.singletonList(classloader).iterator(); 107 return null; 108 } 109 110 public void toString(JBossStringBuilder buffer) 111 { 112 buffer.append("classloader=").append(classloader); 113 } 114 115 public void toShortString(JBossStringBuilder buffer) 116 { 117 buffer.append(classloader); 118 } 119 } 120 | Popular Tags |