try{
Context jndiContext = getInitialContext();
CabinHome cabinHome =
(CabinHome)jndiContext.lookup("CabinHome");
Vector vect = new Vector();
CabinPK pk = new CabinPK();
Cabin cabin;
for(int i = 1; ; i++){
pk.id = i;
try{
cabin = cabinHome.findByPrimaryKey(pk);
}catch(javax.ejb.FinderException fe){
break;
}
// check to see if the bed count and ship id match
if (cabin.getShip() == shipID &&
cabin.getBedCount() == bedCount){
String details =
i+","+cabin.getName()+","+cabin.getDeckLevel();
vect.addElement(details);
}
}
String [] list = new String[vect.size()];
vect.copyInto(list);
return list;
}catch(javax.naming.NamingException ne){
throw new RemoteException("Unable to locate CabinHome",ne);
}