adminsession.java~26~

来自「一个J2EE四层架构的实例」· JAVA~26~ 代码 · 共 137 行

JAVA~26~
137
字号
package sqlaccounts;import javax.naming.*;import javax.rmi.PortableRemoteObject;import java.util.Collection;import java.util.Vector;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class AdminSession {  private Login loginer;  private String type;  private double bal;  private  String Id;  public  Collection   conType;  public  Vector    allVectorType;  public AdminSession()  {    try{      Context ctx = new InitialContext();      LoginHome home = (LoginHome)javax.rmi.PortableRemoteObject.narrow(ctx.lookup("Login"),LoginHome.class);      loginer = home.create();    }catch(Exception e){      System.out.println(e);    }  }  private void log(String s)  {    System.out.println(s);  }  public boolean login(String Id){    try{      return loginer.login(Id);    }catch(Exception e){      return false;    }  }  public boolean AddAmount(String id, String Type, double bal)  {    /**@todo Complete this method*/    try    {      return loginer.AddId(id, Type, bal);    }    catch(Exception e)    {      return false;    }  }  public boolean findByType(String Type)  {   try   {     conType=loginer.findByType(Type);     return true;    }    catch(Exception e)    {      return false;    }  } public Vector findAllByType(String Type){ try {   allVectorType=loginer.findByType(Type);    return allVectorType;  }  catch(Exception e)  {    return null;  }  }  public Collection findByType1(String Type)  {   try   {     conType=loginer.findByType(Type);     return conType;    }    catch(Exception e)    {      return null;    }  }  public boolean findOrCreateAccount(String id,  String accountType,double balance)  {    try    {      return loginer.findOrCreateAccount(id,  accountType,balance);    }    catch (Exception onfe)    {      return false;    }  }  public void setId(String id)  {    this.Id =id;  }  public String getId()  {    return Id;  }  public void setBal(double bal)  {    this.bal=bal;  }  public double getBal()  {    return bal;  }  public void setType(String type)  {    this.type=type;  }  public String getType()  {    return type;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?