[sword-cvs] sword/bindings/corba/java/src/org/crosswire/sword/orb SwordOrb.java,1.1,1.2
sword@www.crosswire.org
sword@www.crosswire.org
Sun, 4 May 2003 01:40:16 -0700
- Previous message: [sword-cvs] sword/bindings/corba/orbitcpp sword-impl.hpp,1.2,1.3 swordorb-impl.cpp,1.2,1.3
- Next message: [sword-cvs] sword/bindings/corba/java swordorb.jpx,1.1,1.2 swordorb.jpx.local,1.1,1.2 testclient,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/local/cvsroot/sword/bindings/corba/java/src/org/crosswire/sword/orb
In directory www:/tmp/cvs-serv15451/bindings/corba/java/src/org/crosswire/sword/orb
Modified Files:
SwordOrb.java
Log Message:
Index: SwordOrb.java
===================================================================
RCS file: /usr/local/cvsroot/sword/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SwordOrb.java 4 May 2003 08:04:31 -0000 1.1
--- SwordOrb.java 4 May 2003 08:40:13 -0000 1.2
***************
*** 5,21 ****
import java.io.BufferedReader;
import java.io.StringWriter;
! class SwordOrb extends Object {
static org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[]{}, null);
- static SwordOrb runningOrb = null;
String ior = null;
! private static SWMgr attach() {
SWMgr retVal = null;
try {
! if (runningOrb != null) {
! org.omg.CORBA.Object obj = orb.string_to_object(runningOrb.ior);
! retVal = SWMgrHelper.narrow(obj);
! }
}
catch(org.omg.CORBA.SystemException e) {
--- 5,21 ----
import java.io.BufferedReader;
import java.io.StringWriter;
+ import javax.servlet.http.HttpSession;
+ import javax.servlet.http.HttpSessionBindingListener;
+ import javax.servlet.http.HttpSessionBindingEvent;
! class SwordOrb extends Object implements HttpSessionBindingListener {
static org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[]{}, null);
String ior = null;
! private SWMgr attach() {
SWMgr retVal = null;
try {
! org.omg.CORBA.Object obj = orb.string_to_object(ior);
! retVal = SWMgrHelper.narrow(obj);
}
catch(org.omg.CORBA.SystemException e) {
***************
*** 25,38 ****
}
! private SwordOrb(String ior) {
! this.ior = ior;
}
protected void finalize() throws Throwable {
System.out.println("finalizing");
! try { if (runningOrb != null) getSWMgrInstance().terminate(); } catch (Exception e) {} // we know this doesn't return property cuz we killed the orb! :)
}
! private static void startOrb() {
try {
java.lang.Process p = Runtime.getRuntime().exec("./swordorbserver");
--- 25,50 ----
}
! public SwordOrb() {
}
+
+ // this doesn't seem to work. Never seems to get called for me
protected void finalize() throws Throwable {
System.out.println("finalizing");
! try {
! getSWMgrInstance().terminate();
! }
! catch (Exception e) {} // we know this doesn't return property cuz we killed the orb! :)
}
! public void valueBound(HttpSessionBindingEvent httpSessionBindingEvent) {}
! public void valueUnbound(HttpSessionBindingEvent httpSessionBindingEvent) {
! try {
! getSWMgrInstance().terminate();
! }
! catch (Exception e) {} // we know this doesn't return property cuz we killed the orb! :)
! }
!
! private void startOrb() {
try {
java.lang.Process p = Runtime.getRuntime().exec("./swordorbserver");
***************
*** 45,54 ****
line = input.readLine();
// retVal = p.waitFor();
! runningOrb = new SwordOrb(line);
}
catch (Exception e) {e.printStackTrace();}
}
! public static SWMgr getSWMgrInstance() {
SWMgr retVal = null;
try {
--- 57,66 ----
line = input.readLine();
// retVal = p.waitFor();
! ior = line;
}
catch (Exception e) {e.printStackTrace();}
}
! public SWMgr getSWMgrInstance() {
SWMgr retVal = null;
try {
***************
*** 65,79 ****
}
- public static void main(String args[]) {
- SWMgr mgr = SwordOrb.getSWMgrInstance();
! System.out.println("PrefixPath: " + mgr.getPrefixPath());
! System.out.println("ConfigPath: " + mgr.getConfigPath());
! ModInfo[] modInfoList = mgr.getModInfoList();
! System.out.println("sequence size: " + modInfoList.length);
! for (int i = 0; i < modInfoList.length; i++) {
! System.out.println(modInfoList[i].name + ": " + modInfoList[i].type + ": " + modInfoList[i].lang);
! }
}
--- 77,101 ----
}
! public static SWMgr getSWMgrInstance(HttpSession session) {
! SwordOrb orb = (SwordOrb)session.getAttribute("SwordOrb");
! if (orb == null) {
! orb = new SwordOrb();
! session.setAttribute("SwordOrb", orb);
! }
! return orb.getSWMgrInstance();
! }
!
!
! public static void main(String args[]) {
! SWMgr mgr = new SwordOrb().getSWMgrInstance();
+ System.out.println("PrefixPath: " + mgr.getPrefixPath());
+ System.out.println("ConfigPath: " + mgr.getConfigPath());
+ ModInfo[] modInfoList = mgr.getModInfoList();
+ System.out.println("sequence size: " + modInfoList.length);
+ for (int i = 0; i < modInfoList.length; i++) {
+ System.out.println(modInfoList[i].name + ": " + modInfoList[i].type + ": " + modInfoList[i].lang);
+ }
}
- Previous message: [sword-cvs] sword/bindings/corba/orbitcpp sword-impl.hpp,1.2,1.3 swordorb-impl.cpp,1.2,1.3
- Next message: [sword-cvs] sword/bindings/corba/java swordorb.jpx,1.1,1.2 swordorb.jpx.local,1.1,1.2 testclient,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]