1 22 package org.jboss.kernel.plugins.deployment; 23 24 import java.util.ArrayList ; 25 import java.util.List ; 26 27 import org.jboss.beans.metadata.spi.BeanMetaData; 28 import org.jboss.beans.metadata.spi.BeanMetaDataFactory; 29 import org.jboss.beans.metadata.spi.ClassLoaderMetaData; 30 import org.jboss.kernel.spi.dependency.KernelControllerContext; 31 import org.jboss.kernel.spi.deployment.KernelDeployment; 32 import org.jboss.util.JBossObject; 33 import org.jboss.util.JBossStringBuilder; 34 import org.jboss.util.collection.CollectionsFactory; 35 36 42 public class AbstractKernelDeployment extends JBossObject implements KernelDeployment 43 { 44 45 protected String name; 46 47 48 protected boolean installed; 49 50 51 protected List <KernelControllerContext> installedContexts = CollectionsFactory.createCopyOnWriteList(); 52 53 54 protected List <BeanMetaDataFactory> beanFactories; 55 56 57 protected ClassLoaderMetaData classLoader; 58 59 62 public AbstractKernelDeployment() 63 { 64 } 65 66 72 @SuppressWarnings ("unchecked") 73 public void setBeans(List beans) 74 { 75 this.beanFactories = beans; 76 flushJBossObjectCache(); 77 } 78 79 84 public void setBeanFactories(List <BeanMetaDataFactory> beanFactories) 85 { 86 this.beanFactories = beanFactories; 87 flushJBossObjectCache(); 88 } 89 90 public String getName() 91 { 92 return name; 93 } 94 95 public void setName(String name) 96 { 97 this.name = name; 98 flushJBossObjectCache(); 99 } 100 101 public boolean isInstalled() 102 { 103 return installed; 104 } 105 106 public void setInstalled(boolean installed) 107 { 108 this.installed = installed; 109 flushJBossObjectCache(); 110 } 111 112 public void addInstalledContext(KernelControllerContext context) 113 { 114 installedContexts.add(context); 115 flushJBossObjectCache(); 116 } 117 118 public List <KernelControllerContext> getInstalledContexts() 119 { 120 return installedContexts; 121 } 122 123 public void removeInstalledContext(KernelControllerContext context) 124 { 125 installedContexts.remove(context); 126 flushJBossObjectCache(); 127 } 128 129 public List <BeanMetaData> getBeans() 130 { 131 if (beanFactories == null || beanFactories.size() == 0) 132 return null; 133 List <BeanMetaData> result = new ArrayList <BeanMetaData>(beanFactories.size()); 134 for (int i = 0; i < beanFactories.size(); ++i) 135 { 136 BeanMetaDataFactory factory = beanFactories.get(i); 137 List <BeanMetaData> beans = factory.getBeans(); 138 result.addAll(beans); 139 } 140 return result; 141 } 142 143 public List <BeanMetaDataFactory> getBeanFactories() 144 { 145 return beanFactories; 146 } 147 148 public ClassLoaderMetaData getClassLoader() 149 { 150 return classLoader; 151 } 152 153 158 public void setClassLoader(ClassLoaderMetaData classLoader) 159 { 160 this.classLoader = classLoader; 161 } 162 163 public void toString(JBossStringBuilder buffer) 164 { 165 buffer.append("name=").append(name); 166 buffer.append(" installed=").append(installed); 167 if (classLoader != null) 168 buffer.append(" classLoader=").append(classLoader); 169 if (beanFactories != null) 170 buffer.append(" beanFactories=").append(beanFactories); 171 } 172 173 public void toShortString(JBossStringBuilder buffer) 174 { 175 buffer.append(name); 176 } 177 } | Popular Tags |