📄 ejbutil.java
字号:
/**
* EJBUtil.java 07/01/2002,
* Author:
*
* Copyright (c) 2002 Censoft Corp.
* Beijing China
* All rights reserved.
*
* Modifier:
* Time:
***/
package com.gs.util;
/*import all the home objects of the ejbs.*/
import javax.naming.*;
import javax.rmi.*;
import com.gs.component.approve.ejb.*;
import com.gs.component.change.ejb.*;
import com.gs.component.enterprise.ejb.*;
/*import all the home objects of the ejbs.*/
/*import all the home objects of the ejbs.*/
import com.gs.component.mail.ejb.*;
import com.gs.component.sysadmin.ejb.*;
/**
* This is a utility class for obtaining EJB references.
*/
public final class EJBUtil {
public static SysAdminHome getSysAdminHome() throws javax.naming.
NamingException {
InitialContext initial = new InitialContext();
Object objref = initial.lookup(JNDINames.SYSADMIN_EJBHOME);
Debug.println("[EJBUtil]the narrowFrom is :" +
( (Class) objref.getClass()).getName() +
",the narrowTo is:" +
( (Class) SysAdminHome.class).getName());
return (SysAdminHome)
PortableRemoteObject.narrow(objref, SysAdminHome.class);
}
public static EnterpriseHome getEnterpriseHome() throws javax.naming.
NamingException {
InitialContext initial = new InitialContext();
Object objref = initial.lookup(JNDINames.ENTERPRISE_EJBHOME);
Debug.println("[EJBUtil]the narrowFrom is :" +
( (Class) objref.getClass()).getName() +
",the narrowTo is:" +
( (Class) EnterpriseHome.class).getName());
return (EnterpriseHome)
PortableRemoteObject.narrow(objref, EnterpriseHome.class);
}
public static MailHome getMailHome() throws javax.naming.NamingException {
InitialContext initial = new InitialContext();
Object objref = initial.lookup(JNDINames.MAIL_EJBHOME);
return (MailHome)
PortableRemoteObject.narrow(objref, MailHome.class);
}
public static ApproveHome getApproveHome() throws javax.naming.
NamingException {
InitialContext initial = new InitialContext();
Object objref = initial.lookup(JNDINames.APPROVE_EJBHOME);
return (ApproveHome)
PortableRemoteObject.narrow(objref, ApproveHome.class);
}
public static OperateHome getOperateHome() throws javax.naming.
NamingException {
InitialContext initial = new InitialContext();
Object objref = initial.lookup(JNDINames.OPERATE_EJBHOME);
return (OperateHome)
PortableRemoteObject.narrow(objref, OperateHome.class);
}
public static ChangeHome getChangeHome() throws javax.naming.
NamingException {
InitialContext initial = new InitialContext();
Object objref = initial.lookup(JNDINames.CHANGE_EJBHOME);
return (ChangeHome)
PortableRemoteObject.narrow(objref, ChangeHome.class);
}
public EJBUtil() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -