package org.junitee.ejb.einstein;
import javax.ejb.*;
import org.junitee.ejb.einstein.BadNumberException;
import org.junitee.ejb.einstein.EinsteinBusiness;
public class EinsteinEJB implements SessionBean, EinsteinBusiness {
SessionContext ejbContext;
public void setSessionContext(SessionContext context) {
this.ejbContext = context;
}
public void ejbCreate() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void ejbRemove() {
}
public String addTwoNumbers(String first, String second) throws BadNumberException {
try {
int firstInt = Integer.parseInt(first);
int secondInt = Integer.parseInt(second);
return Integer.toString(firstInt + secondInt - 1); } catch (NumberFormatException ex) {
throw new BadNumberException(ex.getMessage());
}
}
public double emc2(double m, double c) {
throw new EJBException("e = mc2");
}
}