1 19 20 25 26 package org.netbeans.modules.j2ee.dd.impl.common; 27 28 import org.netbeans.modules.schema2beans.BaseBean; 29 import org.netbeans.modules.schema2beans.Version; 30 import org.netbeans.modules.j2ee.dd.api.ejb.Entity; 31 import org.netbeans.modules.j2ee.dd.api.ejb.MessageDriven; 32 import org.netbeans.modules.j2ee.dd.api.ejb.Session; 33 import org.netbeans.modules.j2ee.dd.api.ejb.Ejb; 34 import org.netbeans.modules.j2ee.dd.api.common.VersionNotSupportedException; 35 36 public abstract class GetAllEjbs extends EnclosingBean { 37 38 public GetAllEjbs(java.util.Vector comps, Version version) { 39 super(comps, version); 40 } 41 42 public abstract Entity[] getEntity(); 43 public abstract MessageDriven[] getMessageDriven(); 44 public abstract Session[] getSession(); 45 46 public abstract int sizeSession(); 47 public abstract int sizeEntity(); 48 public abstract int sizeMessageDriven(); 49 public abstract int removeSession(Session s); 50 public abstract int removeEntity(Entity e); 51 public abstract int removeMessageDriven(MessageDriven m); 52 53 public void removeEjb(Ejb value){ 54 55 if(value instanceof Entity){ 56 removeEntity((Entity) value); 57 } 58 else if(value instanceof Session){ 59 removeSession((Session) value); 60 } 61 else if(value instanceof MessageDriven){ 62 removeMessageDriven((MessageDriven) value); 63 } 64 65 66 } 67 public Ejb[] getEjbs(){ 68 int sizeEntity = sizeEntity(); 69 int sizeSession = sizeSession(); 70 int sizeMessageDriven = sizeMessageDriven(); 71 int size = sizeEntity + sizeSession + sizeMessageDriven; 72 73 Ejb[] ejbs = new Ejb[size]; 74 Entity[] enBeans = getEntity(); 75 Session[] ssbeans = getSession(); 76 MessageDriven[] mdbeans = getMessageDriven(); 77 int addindex=0; 78 for(int i=0; i<sizeEntity ; i++){ 79 ejbs[addindex] = (Ejb)enBeans[i]; 80 addindex++; 81 } 82 for(int j=0; j<sizeSession ; j++){ 83 ejbs[addindex] = (Ejb)ssbeans[j]; 84 addindex++; 85 } 86 87 for(int j=0; j<sizeMessageDriven ; j++){ 88 ejbs[addindex] = (Ejb)mdbeans[j]; 89 addindex++; 90 } 91 return ejbs; 92 } 93 94 } 95 | Popular Tags |