public class EnrollmentCartEJB implements javax.ejb.SessionBean
{
private SessionContext ctx;
private HashSet cart;
/* callback methods */
public void setSessionContext(SessionContext ctx) {
this.ctx = ctx; }
pubic void ejbCreate() throws CreateException {
cart = new HasSet(); }
public void ejbActivate() {}
public void ejbPassivate() {}
public void ejbRemove() {}
/* implement all business methods as defined in the component
interface*/
public void addCourses(String[] courseIds) {
if(couseIds == null)
return;
for(int i=0; i<courseIDs.length; i++)
cart.add(courseIds[i]);
}
public Collection getCourses() {
return cart; }
public void empty() {
cart.clear(); }