📄 sessionbean.java~39~
字号:
package web;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import javax.rmi.*;
import javax.naming.*;
import com.borland.dx.dataset.*;
import dm.*;
import java.util.*;
import java.rmi.*;
import shiponline.*;
public class SessionBean {
private Apps apps;
private ClientDataModule clientDataModule;
public SessionBean() {
try {
jbInit();
Context context = getInitialContext();
Object object = context.lookup("Apps");
AppsHome home = (AppsHome) PortableRemoteObject.narrow(object, AppsHome.class);
apps = home.create();
clientDataModule.getSessionBeanConnection().setSessionBeanRemote(apps);
}
catch (Exception ex) {
System.out.print("ylf"+ex);
}
}
public Apps getApps() {
return apps;
}
private void jbInit() throws Exception {
clientDataModule = new ClientDataModule();
}
public ClientDataModule getClientDataModule() {
return clientDataModule;
}
public void addNewPort(){
clientDataModule.addNewPort();
}
public int addVaoPort(String code, String name) {
try {
DataSetData dataSetData = DataSetData.extractDataSetChanges(
clientDataModule.getPortDataSet());
return apps.addVaoPort(new DataSetData[] {dataSetData}
, code, name);
}
catch (Exception ex) {
ex.printStackTrace();
return 4;
}
}
private Context getInitialContext() throws Exception {
String hostname="fanhua02";
String url = "iiop://fanhua02:9090";
String user ="Guest";
String password ="GuestPassword";
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sybase.ejb.InitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password);
Thread curr=Thread.currentThread();
ClassLoader l=curr.getContextClassLoader();
ClassLoader c=l;
java.net.URL classPath = new java.net.URL("http",hostname,8080,"/classes/");
curr.setContextClassLoader(java.net.URLClassLoader.newInstance(new java.net.URL[]{classPath},l));
return new InitialContext(properties);
}
catch(Exception e) {
throw e;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -