src/java/isac/session/SessionDialog.java
changeset 2162 161819a0cbbc
parent 2133 4c9e512a37a1
child 2163 4642d95c621c
equal deleted inserted replaced
2161:9762fb3bd7fc 2162:161819a0cbbc
    21 
    21 
    22 import org.apache.log4j.Logger;
    22 import org.apache.log4j.Logger;
    23 import org.apache.xmlrpc.WebServer;
    23 import org.apache.xmlrpc.WebServer;
    24 
    24 
    25 /**
    25 /**
    26 <<<<<<< SessionDialog.java
       
    27  * @author Andreas Griesmayer
    26  * @author Andreas Griesmayer
    28 =======
       
    29  * @author gismo
       
    30  * 
       
    31  * To change the template for this generated type comment go to
       
    32  * Window>Preferences>Java>Code Generation>Code and Comments
       
    33 >>>>>>> 1.8
       
    34  */
    27  */
    35 public class SessionDialog extends UnicastRemoteObject implements SDialog,
    28 public class SessionDialog extends UnicastRemoteObject implements SDialog,
    36     Serializable {
    29     Serializable {
    37 
    30 
    38 	static Logger logger_ = Logger.getLogger(SessionDialog.class.getName());
    31 	static Logger logger_ = Logger.getLogger(SessionDialog.class.getName());
    39 
    32 
    40 	private Map dguide_map_ = new HashMap();
    33 	//private Map dguide_map_ = new HashMap();//WN0503 unused
    41 
    34 
    42   private int counter_;
    35   private int counter_;
    43 
    36 
    44   private static UMHandler um_handler_ = new UMHandler();
    37   private static UMHandler um_handler_ = new UMHandler();
    45 
    38 
    80    * @param username
    73    * @param username
    81    *          name of the user
    74    *          name of the user
    82    * @param pass
    75    * @param pass
    83    *          password
    76    *          password
    84    * @return vector with the sessionid as first and only element on success or
    77    * @return vector with the sessionid as first and only element on success or
    85    *         empty vector on filure
    78    *         empty vector on failure
    86    */
    79    */
    87   public Vector login(String username, String pass) {
    80   public Vector login(String username, String pass) {
    88     Vector return_val = new Vector();
    81     Vector return_val = new Vector();
    89     User user = UserManager.getUser(username, pass);
    82     User user = UserManager.getUser(username, pass);
    90     String sessionid = null;
    83     String sessionid = null;
   113    * returns the name of the user which owns the given session.
   106    * returns the name of the user which owns the given session.
   114    * 
   107    * 
   115    * @param session
   108    * @param session
   116    *          ID of the session for which the owner is requested
   109    *          ID of the session for which the owner is requested
   117    * @return the name of the owner of the session
   110    * @return the name of the owner of the session
       
   111    * TODO.WN050311 encapsulate User#getName !!!
   118    */
   112    */
   119   public String getUsername(String session) {
   113   public String getUsername(String session) {
   120     Iterator keys = sessionmap_.keySet().iterator();
   114     Iterator keys = sessionmap_.keySet().iterator();
   121     String username;
   115     String username;
   122     while (keys.hasNext()) {
   116     while (keys.hasNext()) {
   151 
   145 
   152   private static void init() {
   146   private static void init() {
   153     try {
   147     try {
   154       // Invoke me as <http://localhost:8080/RPC2>.
   148       // Invoke me as <http://localhost:8080/RPC2>.
   155       System.out.println("SessionDialog main");
   149       System.out.println("SessionDialog main");
   156       WebServer server = new WebServer(1050);
   150       WebServer server = new WebServer(1050);//WN0503 fixed port !
   157       server.setParanoid(false);
   151       server.setParanoid(false);
   158       //			server.addHandler("sample", new JavaServer());
   152       //			server.addHandler("sample", new JavaServer());
   159       server.addHandler("SDialog", getInstance());
   153       server.addHandler("SDialog", getInstance());
   160       server.addHandler(" WSDialog", dg_handler_);
   154       server.addHandler(" WSDialog", dg_handler_);
   161       // LK 04.09.02: new temorary user management
   155       // LK 04.09.02: new temorary user management