1.1 --- a/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/InformationProcessor.java Tue Oct 07 23:40:29 2003 +0200
1.2 +++ b/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/InformationProcessor.java Tue Oct 07 23:46:24 2003 +0200
1.3 @@ -10,11 +10,17 @@
1.4 import java.io.Reader;
1.5 import java.io.StringReader;
1.6 import java.net.MalformedURLException;
1.7 +import java.rmi.Naming;
1.8 +import java.rmi.NotBoundException;
1.9 +import java.rmi.RemoteException;
1.10 import java.util.Vector;
1.11
1.12 import org.apache.xmlrpc.XmlRpcClient;
1.13 import org.apache.xmlrpc.XmlRpcException;
1.14
1.15 +import isac.browserdialog.BDialog;
1.16 +import isac.session.OManager;
1.17 +import isac.session.SDialog;
1.18 /**
1.19 * @author gismo
1.20 *
1.21 @@ -44,7 +50,66 @@
1.22 return null;
1.23 }
1.24
1.25 - static protected String loadString(String function, Vector parameter){
1.26 + static protected String rpcLogin(String username, String password){
1.27 + SDialog sd = getSDialog();
1.28 + try {
1.29 + return (String)(sd.login(username, password).elementAt(0));
1.30 + } catch (RemoteException e) {
1.31 + // TODO Auto-generated catch block
1.32 + e.printStackTrace();
1.33 + }
1.34 + return null;
1.35 + }
1.36 +
1.37 + private static BDialog getBDialog(String session){
1.38 + String name = "//localhost/isac-ObjectManager";
1.39 + try{
1.40 + System.out.println("connect to ObjectManager"+name);
1.41 + Object lookup = Naming.lookup(name);
1.42 + return ((OManager)lookup).getBrowserDialog(session);
1.43 + }
1.44 + catch(RemoteException exc){
1.45 + System.err.println("no rmiregistry runing on server "+name+
1.46 + " no connection possible --- try later");
1.47 + System.err.println("serverCom exception: " + exc.getMessage());
1.48 + // exc.printStackTrace();
1.49 + }
1.50 + catch(NotBoundException exc){
1.51 + System.err.println("servercom: notboundexc: "+ exc.getMessage());
1.52 + System.err.println("server not found - try to connect to Proxy");
1.53 + }
1.54 + catch(java.net.MalformedURLException exc){
1.55 + System.err.println("servercom: MalformedURLException: "+ exc.getMessage());
1.56 + exc.printStackTrace();
1.57 + }
1.58 + return null;
1.59 + }
1.60 + private static SDialog getSDialog(){
1.61 + String name= "//localhost/isac-ObjectManager";
1.62 + try {
1.63 + System.out.println("connect to ObjectManager: "+name);
1.64 + Object lookup = Naming.lookup(name);
1.65 + return ((OManager) lookup).getSessionDialog();
1.66 + }
1.67 + catch(RemoteException exc){
1.68 + System.err.println("no rmiregistry runing on server "+name+
1.69 + " no connection possible --- try later");
1.70 + System.err.println("serverCom exception: " + exc.getMessage());
1.71 + // exc.printStackTrace();
1.72 + }
1.73 + catch(NotBoundException exc){
1.74 + System.err.println("servercom: notboundexc: "+ exc.getMessage());
1.75 + System.err.println("server not found - try to connect to Proxy");
1.76 + }
1.77 + catch(java.net.MalformedURLException exc){
1.78 + System.err.println("servercom: MalformedURLException: "+ exc.getMessage());
1.79 + exc.printStackTrace();
1.80 + }
1.81 + return null;
1.82 +}
1.83 +
1.84 +
1.85 + static protected String loadnString(String function, Vector parameter){
1.86 XmlRpcClient bdialog;
1.87 String xmlsource="";
1.88 try {
1.89 @@ -84,8 +149,29 @@
1.90 return return_vect;
1.91 }
1.92
1.93 + static protected String loadHierarchy(String session, String type){
1.94 + BDialog bd = getBDialog(session);
1.95 + try {
1.96 + return bd.loadHierarchy(type);
1.97 + } catch (RemoteException e) {
1.98 + // TODO Auto-generated catch block
1.99 + e.printStackTrace();
1.100 + }
1.101 + return "<DESCRIPTION> not found </DESCRIPTION>";
1.102 + }
1.103
1.104 - static protected Reader loadKEObject(String function, Vector parameter){
1.105 + static protected String loadXML(String session, String type, String content_id){
1.106 + BDialog bd = getBDialog(session);
1.107 + try {
1.108 + return bd.loadContent(type, content_id);
1.109 + } catch (RemoteException e) {
1.110 + // TODO Auto-generated catch block
1.111 + e.printStackTrace();
1.112 + }
1.113 + return "<DESCRIPTION> not found </DESCRIPTION>";
1.114 + }
1.115 +
1.116 + static protected Reader loadsKEObject(String function, Vector parameter){
1.117 XmlRpcClient bdialog;
1.118 String xmlsource="";
1.119 try {
1.120 @@ -108,6 +194,20 @@
1.121 return new StringReader(xmlsource);
1.122 }
1.123
1.124 + public static String rpcGetUsername(String session_id){
1.125 + SDialog sd = getSDialog();
1.126 + try {
1.127 + String username;
1.128 + if((username=sd.getUsername(session_id)).equals(""))
1.129 + return null;
1.130 + return username;
1.131 + } catch (RemoteException e) {
1.132 + // TODO Auto-generated catch block
1.133 + e.printStackTrace();
1.134 + }
1.135 + return null;
1.136 + }
1.137 +
1.138 /**
1.139 * @param session_id
1.140 * @return
2.1 --- a/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/LoadContent.java Tue Oct 07 23:40:29 2003 +0200
2.2 +++ b/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/LoadContent.java Tue Oct 07 23:46:24 2003 +0200
2.3 @@ -8,6 +8,7 @@
2.4
2.5 import java.io.IOException;
2.6 import java.io.InputStream;
2.7 +import java.io.StringReader;
2.8 import java.net.MalformedURLException;
2.9 import java.net.URL;
2.10 import java.util.StringTokenizer;
2.11 @@ -88,8 +89,8 @@
2.12 return;
2.13 }
2.14 out = arg1.getWriter();
2.15 -
2.16 - xmlSource = new StreamSource(InformationProcessor.loadKEObject("BDialog.loadContent", parameter));
2.17 + xmlSource = new StreamSource(new StringReader(InformationProcessor.loadXML(session, command, contentfile)));
2.18 +// xmlSource = new StreamSource(InformationProcessor.loadKEObject("BDialog.loadContent", parameter));
2.19 xslSource = new StreamSource(loadTextFile(SIMPLE_PBL_NODE));
2.20 // }
2.21 // Perform the transformation, sending the output to the response.
3.1 --- a/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/LoadFile.java Tue Oct 07 23:40:29 2003 +0200
3.2 +++ b/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/LoadFile.java Tue Oct 07 23:46:24 2003 +0200
3.3 @@ -8,6 +8,7 @@
3.4
3.5 import java.io.IOException;
3.6 import java.io.InputStream;
3.7 +import java.io.StringReader;
3.8 import java.util.StringTokenizer;
3.9 import java.util.Vector;
3.10
3.11 @@ -73,9 +74,11 @@
3.12 parameter.add(session_id);
3.13 parameter.add(type);
3.14 Vector result;
3.15 - Source xmlSource = new StreamSource(InformationProcessor.
3.16 - loadKEObject("BDialog.loadHierarchy",
3.17 - parameter));
3.18 + Source xmlSource = new StreamSource(new StringReader(InformationProcessor.
3.19 + loadHierarchy(session_id, type)));
3.20 +// Source xmlSource = new StreamSource(InformationProcessor.
3.21 +// loadKEObject("BDialog.loadHierarchy",
3.22 +// parameter));
3.23
3.24 // Perform the transformation, sending the output to the response.
3.25 java.io.PrintWriter out = response.getWriter();
3.26 @@ -91,9 +94,11 @@
3.27 parameter.add(session_id);
3.28 parameter.add(type);
3.29 Vector result;
3.30 - Source xmlSource = new StreamSource(InformationProcessor.
3.31 - loadKEObject("BDialog.loadHierarchy",
3.32 - parameter));
3.33 + Source xmlSource = new StreamSource(new StringReader(InformationProcessor.
3.34 + loadHierarchy(session_id,type)));
3.35 +// Source xmlSource = new StreamSource(InformationProcessor.
3.36 +// loadKEObject("BDialog.loadHierarchy",
3.37 +// parameter));
3.38
3.39 // Perform the transformation, sending the output to the response.
3.40 java.io.PrintWriter out = response.getWriter();
3.41 @@ -134,7 +139,7 @@
3.42 +" ";
3.43
3.44 String username;
3.45 - if((username=InformationProcessor.getUsername(session_id))==null)
3.46 + if((username=InformationProcessor.rpcGetUsername(session_id))==null)
3.47 headercontent+="not logged in";
3.48 else
3.49 headercontent+=" welcome <b>"+username+"</b>";
4.1 --- a/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/LoadHierarchy.java Tue Oct 07 23:40:29 2003 +0200
4.2 +++ b/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/LoadHierarchy.java Tue Oct 07 23:46:24 2003 +0200
4.3 @@ -8,6 +8,7 @@
4.4
4.5 import java.io.IOException;
4.6 import java.io.InputStream;
4.7 +import java.io.StringReader;
4.8 import java.net.MalformedURLException;
4.9 import java.net.URL;
4.10 import java.util.StringTokenizer;
4.11 @@ -80,9 +81,11 @@
4.12 parameter.add(type);
4.13 Vector result;
4.14 Source xslSource=null;
4.15 - Source xmlSource = new StreamSource(InformationProcessor.
4.16 - loadKEObject("BDialog.loadHierarchy",
4.17 - parameter));
4.18 + Source xmlSource = new StreamSource(new StringReader(InformationProcessor.
4.19 + loadHierarchy(session, type)));
4.20 +// Source xmlSource = new StreamSource(InformationProcessor.
4.21 +// loadKEObject("BDialog.loadHierarchy",
4.22 +// parameter));
4.23 if(type.equals("pbl"))
4.24 xslSource = new StreamSource(loadTextFile(PBLTREE_XSL));
4.25 else if(type.equals("met"))
5.1 --- a/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/Login.java Tue Oct 07 23:40:29 2003 +0200
5.2 +++ b/src/java/BrowserServlet/WEB-INF/src/isac/BrowserServlet/Login.java Tue Oct 07 23:46:24 2003 +0200
5.3 @@ -46,7 +46,7 @@
5.4 response.setContentType("text/html");
5.5 String user = request.getParameter("user");
5.6 String pass = request.getParameter("password");
5.7 - String session_id = InformationProcessor.login(user, pass);
5.8 + String session_id = InformationProcessor.rpcLogin(user, pass);
5.9 out.println("<html><head>"+
5.10 "<script language=\"Javascript\">"+
5.11 "function NeueSeite()"+