package businessLogic;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
import javax.mail.MessagingException;
+import common.AccountInterface;
import dataAccess.DB4oManager;
import domain.Account;
-public class AccountManager {
+public class AccountManager extends UnicastRemoteObject implements AccountInterface {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
private DB4oManager dbMngr;
- public AccountManager() {
+ public AccountManager() throws RemoteException {
try {
dbMngr = DB4oManager.getInstance();
} catch (Exception e) {
}
}
- public boolean addAccount(Account ac){
+ public boolean addAccount(Account ac) throws RemoteException {
if(this.dbMngr.addAccount(ac)){
try {
MailManager.getInstance().Send(ac.getOwner().getMailAccount(), "Entered into the system", "Congratulations");
} catch (MessagingException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
return true;
}
- public boolean removeAccount(Account ac){
+ public boolean removeAccount(Account ac)throws RemoteException {
if(this.dbMngr.removeAccount(ac))
return true;
return false;