*** empty log message ***
authorrgradisc
Thu, 24 Jun 2004 21:27:53 +0200
changeset 1625ee9c502473eb
parent 1624 bbf722f0c111
child 1626 31eafcc6cd8e
*** empty log message ***
src/java/isac/bridge/BridgeMain.java
src/java/isac/bridge/BridgeRMI.java
src/java/isac/bridge/CalcIterator.java
src/java/isac/bridge/Clients2KernelServer.java
src/java/isac/bridge/IBridgeRMI.java
src/java/isac/bridge/Kernel2ClientsServer.java
src/java/isac/bridge/TransformXSLT.java
     1.1 --- a/src/java/isac/bridge/BridgeMain.java	Thu Jun 24 21:23:51 2004 +0200
     1.2 +++ b/src/java/isac/bridge/BridgeMain.java	Thu Jun 24 21:27:53 2004 +0200
     1.3 @@ -124,6 +124,7 @@
     1.4      this.show();
     1.5    }
     1.6  
     1.7 +  // Read Bridge properties from Files
     1.8    private void readProperties() {
     1.9      Properties p = new Properties();
    1.10      String prop;
    1.11 @@ -181,6 +182,7 @@
    1.12      }
    1.13    }
    1.14  
    1.15 +  //Start sml Threads and catch in- and output-streams
    1.16    private void startSMLThread() {
    1.17      SMLThread smlThread = new SMLThread(this, kernelExec, kernelArgs);
    1.18      thread_sml = new Thread(smlThread, "java_bridge_execution");
    1.19 @@ -195,7 +197,7 @@
    1.20      log(1, "SML output stream");
    1.21      //old IO:
    1.22      smlWriter = new PrintWriter(smlOutput, true);
    1.23 -    //NIO:
    1.24 +    //NIO (doesn't run for some reason)
    1.25      //    smlWriter =
    1.26      //      new PrintWriter(
    1.27      //        Channels.newWriter(Channels.newChannel(smlOutput), "ISO-8859-1"));
    1.28 @@ -236,17 +238,8 @@
    1.29      log(1, "No response from sml-kernel: restart");
    1.30      timeOutTimes.clear();
    1.31      log(1, "Trying to kill sml-kernel...");
    1.32 -    while (thread_sml.isAlive()) {
    1.33 -      /*       
    1.34 -      try {
    1.35 -        smlOutput.write(3);
    1.36 -        smlOutput.flush();
    1.37 -      } catch (IOException e) {        
    1.38 -        e.printStackTrace();
    1.39 -      }
    1.40 -      */
    1.41 -      thread_sml.interrupt();
    1.42 -      //log(1, "Trying to kill sml-kernel");
    1.43 +    while (thread_sml.isAlive()) {      
    1.44 +      thread_sml.interrupt();      
    1.45      }
    1.46      log(1, "Successfully killed sml-kernel");
    1.47  
    1.48 @@ -262,15 +255,15 @@
    1.49      restoreStateOfKernel();
    1.50    }
    1.51  
    1.52 -  // this method will be called when the sml kernel crashes   
    1.53 +  // This method restores the last consistent state of the kernel
    1.54 +  // It will be called when the sml kernel crashes   
    1.55    private void restoreStateOfKernel() {
    1.56      //test first if kernel is still responding:
    1.57      //if this is the case, no further restoring is needed
    1.58      //dummy call to test respondablity
    1.59      //it could be also work to send a SIGINT (^C in terminal)
    1.60 -    //to the sml-Kernel
    1.61 +    //to the not reacting sml-Kernel
    1.62      //But this is not possible in Java (only with C in JNI)    
    1.63 -    
    1.64      try {      
    1.65        while (!kernelResponding) {
    1.66          smlWriter.println("DEconstrCalcTree 0;");
    1.67 @@ -318,6 +311,7 @@
    1.68        */
    1.69    }
    1.70  
    1.71 +  //Here goes the future load balancing functionality
    1.72    //public void startNewKernel() {
    1.73    // implement load balancing	
    1.74    //}
     2.1 --- a/src/java/isac/bridge/BridgeRMI.java	Thu Jun 24 21:23:51 2004 +0200
     2.2 +++ b/src/java/isac/bridge/BridgeRMI.java	Thu Jun 24 21:27:53 2004 +0200
     2.3 @@ -264,11 +264,15 @@
     2.4      //javaCalcIDtoSmlCalcID.put(new Integer(javaCalcID), new Integer(smlCalcID));   
     2.5      return javaCalcID;
     2.6    }
     2.7 -
     2.8 +  
     2.9 +  /*
    2.10 +  // this function is no longer needed here,    
    2.11 +  // MathEngine handels the startSolving now
    2.12    public boolean startSolving(int calcID) {
    2.13      //TODO: check activeCalcHead for completeness
    2.14      return true;
    2.15    }
    2.16 +  */
    2.17  
    2.18    public CalcHead completeCalcHead(CalcHead calcHead, int completeItem) {
    2.19      ResponseWrapper wrapper =
     3.1 --- a/src/java/isac/bridge/CalcIterator.java	Thu Jun 24 21:23:51 2004 +0200
     3.2 +++ b/src/java/isac/bridge/CalcIterator.java	Thu Jun 24 21:27:53 2004 +0200
     3.3 @@ -167,6 +167,9 @@
     3.4      return false;
     3.5    }
     3.6  
     3.7 +  /**
     3.8 +  Reference the calcHead that belongs to the currently selected item
     3.9 +  */
    3.10    public boolean moveCalcHead() {
    3.11      return false;
    3.12    }
    3.13 @@ -196,7 +199,8 @@
    3.14      }
    3.15    }
    3.16  
    3.17 -  /* (non-Javadoc)
    3.18 +  /**
    3.19 +   * Returns the item that this iterator is currently referencing 
    3.20     * @see isac.wsdialog.ICalcIterator#getElement()
    3.21     */
    3.22    public ICalcElement getElement() {
    3.23 @@ -211,9 +215,10 @@
    3.24      return result;
    3.25    }
    3.26    
    3.27 -  /*
    3.28 -   * set the position of this iterator to the position of
    3.29 +  /**
    3.30 +   * Set the position of this iterator to the position of
    3.31     * another, given iterator
    3.32 +   * @param calcIterator the other iterator
    3.33     */
    3.34    void moveTo(CalcIterator calcIterator) {
    3.35      this.moveRoot();    
    3.36 @@ -239,6 +244,7 @@
    3.37      return thisPos;
    3.38    }
    3.39  
    3.40 +  // check whether the iterator is on a given position
    3.41    private boolean isOnPosition(Position pos) {
    3.42      Position thisPos = this.getPosition();
    3.43      if (thisPos == null || pos == null)
    3.44 @@ -248,7 +254,9 @@
    3.45      return true;
    3.46    }
    3.47  
    3.48 -  /* (non-Javadoc)
    3.49 +  /**
    3.50 +   * Clone this iterator. The result is a second, different
    3.51 +   * iterator referencing the same item as this iterator
    3.52     * @see isac.wsdialog.ICalcIterator#clone()
    3.53     */
    3.54    public Object clone() {
    3.55 @@ -258,8 +266,14 @@
    3.56      return clone;
    3.57    }
    3.58  
    3.59 -  /* (non-Javadoc)
    3.60 +  /**
    3.61 +   * Compare the referenced item of this iterator to the item of
    3.62 +   * a second, given iterator
    3.63 +   * @return Integer 
    3.64 +   * <p> 0 if the second iterator references the same item
    3.65 +   * <p>-1 otherwise
    3.66     * @see java.lang.Comparable#compareTo(java.lang.Object)
    3.67 +   * 
    3.68     */
    3.69    public int compareTo(Object o) {
    3.70      CalcIterator other = (CalcIterator)o;
     4.1 --- a/src/java/isac/bridge/Clients2KernelServer.java	Thu Jun 24 21:23:51 2004 +0200
     4.2 +++ b/src/java/isac/bridge/Clients2KernelServer.java	Thu Jun 24 21:27:53 2004 +0200
     4.3 @@ -12,18 +12,15 @@
     4.4  import java.net.Socket;
     4.5  
     4.6  /**
     4.7 - * Clients2KernelServer: handles the communication from clients to the kernel 
     4.8 - * (Knowledge Interpreter) == SML Kernel
     4.9 + * Clients2KernelServer: runs in its own thread and handles 
    4.10 + * the communication from clients to the kernel 
    4.11   * @author rgradisc
    4.12 - *
    4.13 - * To change the template for this generated type comment go to
    4.14 - * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    4.15   */
    4.16  public class Clients2KernelServer implements Runnable {
    4.17    private ServerSocket server = null;
    4.18    private BridgeMain bridge;
    4.19    
    4.20 - /**
    4.21 +  /**
    4.22    * Constructor: create a new Clients2KernelServer
    4.23    * @param bridge
    4.24    */
    4.25 @@ -32,7 +29,7 @@
    4.26    } 
    4.27  
    4.28    /**
    4.29 -  * Wait for clients to connect to bridge
    4.30 +  * Listen on socket: Wait for clients to connect to bridge
    4.31    */
    4.32    public void listenSocket() {
    4.33      ClientOutputWorker w;
     5.1 --- a/src/java/isac/bridge/IBridgeRMI.java	Thu Jun 24 21:23:51 2004 +0200
     5.2 +++ b/src/java/isac/bridge/IBridgeRMI.java	Thu Jun 24 21:27:53 2004 +0200
     5.3 @@ -20,8 +20,6 @@
     5.4  
     5.5    public int startSpecifying(Formalization f) throws RemoteException;
     5.6  
     5.7 -  public boolean startSolving(int calcID) throws RemoteException;
     5.8 -
     5.9    public CalcHead modifyCalcHead(CalcHead calcHead) throws RemoteException;
    5.10  
    5.11    public int setNextTactic(int id, Tactic tactic) throws RemoteException;
     6.1 --- a/src/java/isac/bridge/Kernel2ClientsServer.java	Thu Jun 24 21:23:51 2004 +0200
     6.2 +++ b/src/java/isac/bridge/Kernel2ClientsServer.java	Thu Jun 24 21:27:53 2004 +0200
     6.3 @@ -11,6 +11,12 @@
     6.4  import java.io.PrintWriter;
     6.5  import java.util.Vector;
     6.6  
     6.7 +/**
     6.8 + * This class runs in its own thread,
     6.9 + * fetches the output from the kernel, and
    6.10 + * sends it back to the clients
    6.11 + * @author richard
    6.12 + */
    6.13  public class Kernel2ClientsServer implements Runnable {
    6.14    //Start and end sequences to mark XML parts in SML output
    6.15    private static final String START_SEQ = "@@@@@begin@@@@@";
     7.1 --- a/src/java/isac/bridge/TransformXSLT.java	Thu Jun 24 21:23:51 2004 +0200
     7.2 +++ b/src/java/isac/bridge/TransformXSLT.java	Thu Jun 24 21:27:53 2004 +0200
     7.3 @@ -19,9 +19,8 @@
     7.4  /**
     7.5   * Utility class for easy transformation of XML files/strings via XSLT
     7.6   * @author rgradisc
     7.7 - *
     7.8 - * To change the template for this generated type comment go to
     7.9 - * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
    7.10 + * 
    7.11 + * Not needed by now
    7.12   */
    7.13  public class TransformXSLT {
    7.14