AppsBean.java
上传用户:jnhyscl
上传日期:2010-03-08
资源大小:345k
文件大小:2k
- package shiponline;
- import javax.ejb.*;
- import com.borland.dx.dataset.*;
- import com.borland.dx.ejb.*;
- public class AppsBean implements SessionBean {
- SessionContext sessionContext;
- transient VaoPortHome vaoPortHome;
- transient javax.naming.Context context;
- transient ServerDataModuleLocal serverDataModule;
- public void ejbCreate() throws CreateException {
- lookup();
- }
- public void ejbCreateMethod1() throws CreateException {
- /**@todo Complete this method*/
- }
- public void ejbRemove() {
- /**@todo Complete this method*/
- }
- public void ejbActivate() {
- lookup();
- }
- public void ejbPassivate() {
- /**@todo Complete this method*/
- }
- public void setSessionContext(SessionContext sessionContext) {
- this.sessionContext = sessionContext;
- }
- public int addVaoPort(DataSetData[] dataArray, String code, String name){
- try{
- /*
- try{
- vaoPortHome.findPortCode(code);
- return 1;
- }catch (ObjectNotFoundException ex){
- }
- try{
- vaoPortHome.findByPortName(name);
- return 2;
- }catch(ObjectNotFoundException exc){
- }
- */
- serverDataModule.addVaoPort(dataArray);
- return 3;
- }catch(Exception e){
- return 4;
- }
- }
- public void lookup(){
- try {
- context = getInitialContext();
- ServerDataModuleLocalHome home = (ServerDataModuleLocalHome) context.lookup("java:comp/env/ServerDataModule");
- serverDataModule = home.create();
- vaoPortHome = (VaoPortHome) context.lookup("java:comp/env/VaoPort");
- }
- catch (Exception ex) {
- System.out.println("ll"+ex);
- }
- }
- private javax.naming.Context getInitialContext() {
- try {
- if (context == null) {
- context = new javax.naming.InitialContext();
- }
- return context;
- }
- catch (Exception ex) {
- throw new EJBException(ex);
- }
- }
- public DataSetData[] providePort(RowData[] parameterArray, RowData[] masterArray) {
- System.out.println("ssssssssssssssssssssssss");
- return serverDataModule.providePort(parameterArray, masterArray);
- }
- public DataSetData[] addNewPort(){
- System.out.println("cccccc2");
- return serverDataModule.addNewPort();
- }
- }