/[cashew-s-editor]/cashews/src/nongnu/cashews/services/TypeChecker.java
ViewVC logotype

Diff of /cashews/src/nongnu/cashews/services/TypeChecker.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gnu_andrew, Sun May 8 12:03:41 2005 UTC revision 1.3 by gnu_andrew, Fri May 13 01:46:43 2005 UTC
# Line 25  import java.io.BufferedReader; Line 25  import java.io.BufferedReader;
25  import java.io.InputStreamReader;  import java.io.InputStreamReader;
26  import java.io.IOException;  import java.io.IOException;
27    
28  /* FIXME: COMMENTED OUT UNTIL IT WORKS WITHIN THE PROJECT  import java.net.MalformedURLException;
29  import org.apache.axis.client.Call;  import java.net.URISyntaxException;
30  import org.apache.axis.client.Service;  
31  */  import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
32    
33    import nongnu.cashews.language.grounding.MessagePart;
34    import nongnu.cashews.language.grounding.SoapMessage;
35    import nongnu.cashews.language.grounding.SoapOperation;
36    
37    import nongnu.cashews.soap.SoapClient;
38    
39  /**  /**
40   * A client implementation to call the type checking web service.   * A client implementation to call the type checking web service.
# Line 50  public class TypeChecker Line 56  public class TypeChecker
56     *     *
57     * @param args the command-line arguments.     * @param args the command-line arguments.
58     * @throws IOException if an I/O error occurs.     * @throws IOException if an I/O error occurs.
59       * @throws URISyntaxException if one of the operation URIs is invalid.
60       * @throws MalformedURLException if the endpoint URL is invalid.
61       * @throws InstantiationException if a needed class can't be instantiated.
62       * @throws IllegalAccessException if a needed class can't be accessed.
63       * @throws ClassNotFoundException if a needed class can't be found.
64     */     */
65    public static void main(String[] args)    public static void main(String[] args)
66      throws IOException      throws URISyntaxException, MalformedURLException, IOException,
67               InstantiationException, IllegalAccessException,
68               ClassNotFoundException
69    {    {
70      BufferedReader br =      BufferedReader br =
71        new BufferedReader(new InputStreamReader(System.in));        new BufferedReader(new InputStreamReader(System.in));
# Line 62  public class TypeChecker Line 75  public class TypeChecker
75            
76      expression = br.readLine();      expression = br.readLine();
77            
     /* FIXME: COMMENTED OUT UNTIL IT WORKS WITHIN THE PROJECT  
78         boolean flag = new TypeChecker().callService(expression);         boolean flag = new TypeChecker().callService(expression);
79                
80         if( flag == false )         if( flag == false )
81         System.out.println( "Invalid expression" );         System.out.println( "Invalid expression" );
82      */    
83    }    }
84    
85        
# Line 78  public class TypeChecker Line 90  public class TypeChecker
90     *     *
91     * @param expression the expression to supply to the service.     * @param expression the expression to supply to the service.
92     * @return true if the code typed correctly, false otherwise.     * @return true if the code typed correctly, false otherwise.
93       * @throws IOException if an I/O error occurs.
94       * @throws URISyntaxException if one of the operation URIs is invalid.
95       * @throws MalformedURLException if the endpoint URL is invalid.
96       * @throws InstantiationException if a needed class can't be instantiated.
97       * @throws IllegalAccessException if a needed class can't be accessed.
98       * @throws ClassNotFoundException if a needed class can't be found.
99     */     */
   /* FIXME: COMMENTED OUT UNTIL IT WORKS WITHIN THE PROJECT  
100    public boolean callService( String expression )    public boolean callService( String expression )
101        throws URISyntaxException, MalformedURLException, IOException,
102               InstantiationException, IllegalAccessException,
103               ClassNotFoundException
104    {    {
105      try      SoapOperation operation = new SoapOperation(TEST_ENDPOINT);
106        {      SoapMessage input = new SoapMessage(null, "typeCheckRequest");
107        MessagePart part1 = new MessagePart("expr");
108        part1.setName(null, "expr");
109        part1.setType(W3C_XML_SCHEMA_NS_URI, "string", "xsd");
110        input.addPart(part1);
111        operation.setInputMessage(input);
112        SoapClient client = new SoapClient();
113        Boolean b = (Boolean) client.call(operation, expression);
114        return b;
115        /* Axis code
116          Service  service = new Service();          Service  service = new Service();
117          Call call = (Call) service.createCall();          Call call = (Call) service.createCall();
118          call.setTargetEndpointAddress( new java.net.URL(TEST_ENDPOINT) );          call.setTargetEndpointAddress( new java.net.URL(TEST_ENDPOINT) );
# Line 110  public class TypeChecker Line 139  public class TypeChecker
139          e.printStackTrace();          e.printStackTrace();
140          return false;          return false;
141        }        }
142        */
143    }        }    
144    */  
145  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26