1 22 package org.jboss.ejb3; 23 24 import java.util.HashSet ; 25 26 import org.jboss.beans.metadata.plugins.AbstractDemandMetaData; 27 import org.jboss.beans.metadata.spi.DemandMetaData; 28 29 35 public class MCDependencyPolicy implements DependencyPolicy 36 { 37 protected HashSet <String > dependencies = new HashSet <String >(); 38 39 public void addDependency(String dependency) 40 { 41 dependencies.add(dependency); 42 } 43 44 public void addDatasource(String jndiName) 45 { 46 String ds = jndiName; 47 if (ds.startsWith("java:/")) 48 { 49 ds = ds.substring(6); 50 51 } 52 else if (ds.startsWith("java:")) 53 { 54 ds = ds.substring(5); 55 } 56 addDependency(ds); 57 } 58 59 public HashSet <DemandMetaData> getDependencies() 60 { 61 HashSet <DemandMetaData> set = new HashSet <DemandMetaData>(); 62 for (String depends : dependencies) 63 { 64 set.add(new AbstractDemandMetaData(depends)); 65 } 66 return set; 67 } 68 } 69 | Popular Tags |