axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: xml-axis/java/test/functional TestTCPTransportSample.java
Date Thu, 15 Nov 2001 19:48:42 GMT
dug         01/11/15 11:48:42

  Modified:    java/samples/proxy ProxyService.java
               java/samples/transport FileTest.java
               java/samples/transport/tcp AdminClient.java GetQuote.java
               java/src/org/apache/axis/client Call.java Service.java
                        ServiceClient.java
               java/test/functional TestTCPTransportSample.java
  Log:
  Move engine from Call to Server so we don't create a new one
  on each operation we call.  Creating an engine is expensive.
  
  Revision  Changes    Path
  1.9       +2 -2      xml-axis/java/samples/proxy/ProxyService.java
  
  Index: ProxyService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/proxy/ProxyService.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ProxyService.java	2001/10/31 23:50:19	1.8
  +++ ProxyService.java	2001/11/15 19:48:42	1.9
  @@ -91,12 +91,12 @@
               // use the server's client engine in case anything has 
               // been deployed to it
               Service service = new Service();
  +            service.setEngine( msgContext.getAxisEngine().getClientEngine() );
               Call    call = (Call) service.createCall();
  -            call.setEngine( msgContext.getAxisEngine().getClientEngine() );
   
               SimpleTargetedChain c = new SimpleTargetedChain();
               c.setPivotHandler(new TCPSender());
  -	    call.getEngine().deployTransport("tcp", c);
  +	    service.getEngine().deployTransport("tcp", c);
       
               // add TCP for proxy testing
               call.addTransportPackage("samples.transport");
  
  
  
  1.19      +1 -1      xml-axis/java/samples/transport/FileTest.java
  
  Index: FileTest.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/FileTest.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- FileTest.java	2001/10/31 23:50:19	1.18
  +++ FileTest.java	2001/11/15 19:48:42	1.19
  @@ -35,7 +35,7 @@
           Service  service = new Service();
           Call     call    = (Call) service.createCall();
   
  -        AxisEngine engine = call.getEngine();
  +        AxisEngine engine = service.getEngine();
   
           // Manually deploy file sender and file transport for this example
           SimpleTargetedChain c = new SimpleTargetedChain();
  
  
  
  1.11      +1 -1      xml-axis/java/samples/transport/tcp/AdminClient.java
  
  Index: AdminClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/AdminClient.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AdminClient.java	2001/11/01 13:12:31	1.10
  +++ AdminClient.java	2001/11/15 19:48:42	1.11
  @@ -79,7 +79,7 @@
   
               SimpleTargetedChain c = new SimpleTargetedChain();
               c.setPivotHandler(new TCPSender());
  -            client.getCall().getEngine().deployTransport("tcp", c);
  +            client.getCall().getService().getEngine().deployTransport("tcp", c);
   
               System.out.println(client.process(args));
           }
  
  
  
  1.13      +1 -1      xml-axis/java/samples/transport/tcp/GetQuote.java
  
  Index: GetQuote.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/transport/tcp/GetQuote.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- GetQuote.java	2001/10/31 23:50:19	1.12
  +++ GetQuote.java	2001/11/15 19:48:42	1.13
  @@ -95,7 +95,7 @@
           
           SimpleTargetedChain c = new SimpleTargetedChain();
           c.setPivotHandler(new TCPSender());
  -        call.getEngine().deployTransport("tcp", c);
  +        service.getEngine().deployTransport("tcp", c);
           
           call.setTransport(new TCPTransport());
           
  
  
  
  1.43      +18 -39    xml-axis/java/src/org/apache/axis/client/Call.java
  
  Index: Call.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Call.java	2001/11/15 14:07:39	1.42
  +++ Call.java	2001/11/15 19:48:42	1.43
  @@ -55,7 +55,6 @@
   
   package org.apache.axis.client ;
   
  -import org.apache.axis.AxisEngine;
   import org.apache.axis.AxisFault;
   import org.apache.axis.Constants;
   import org.apache.axis.Message;
  @@ -138,7 +137,6 @@
       private String             encodingStyle   = null ;
       private XMLType            returnType      = null ;
   
  -    private AxisEngine         engine          = null ;
       private MessageContext     msgContext      = null ;
   
       // Collection of properties to store and put in MessageContext at
  @@ -158,7 +156,6 @@
       // A place to store any client-specified headers
       private Vector             myHeaders       = null;
   
  -
       public static final String NAMESPACE         = "namespace" ;
       public static final String SEND_TYPE_ATTR    = "send_type_attr" ;
       public static final String TIMEOUT           = "timeout" ;
  @@ -171,10 +168,6 @@
       private static Hashtable transports  = new Hashtable();
       private static boolean   initialized = false;
   
  -    private static FileProvider configProvider =
  -                           new FileProvider(Constants.CLIENT_CONFIG_FILE);
  -
  -
       /************************************************************************/
       /* Start of core JAX-RPC stuff                                          */
       /************************************************************************/
  @@ -184,7 +177,7 @@
        */
       public Call(Service service) {
           this.service = service ;
  -        setEngine( new AxisClient(configProvider) );
  +        msgContext = new MessageContext( service.getEngine() );
           if ( !initialized ) initialize();
       }
   
  @@ -658,6 +651,7 @@
                   return( this.invoke(ns,operationName,getParamList(params)) );
           }
           catch( Exception exp ) {
  +exp.printStackTrace();
               if ( exp instanceof AxisFault ) throw (AxisFault) exp ;
   
               throw new AxisFault( JavaUtils.getMessage("errorInvoking00", "\n" + exp) );
  @@ -786,33 +780,6 @@
       }
   
       /**
  -     * Change the AxisEngine being used by this Call object.  This should
  -     * be called right away after creating the Call object since any
  -     * values in the old msgContext object associated with the old engine
  -     * will NOT be carried over to the new msgContext of this new engine.
  -     *
  -     * Note: Not part of JAX-RPC specification.
  -     *
  -     * @param newEngine the new AxisEngine to use
  -     */
  -    public void setEngine(AxisEngine newEngine) {
  -        engine = newEngine ;
  -        msgContext = new MessageContext( engine );
  -    }
  -
  -    /**
  -     * Returns the current AxisEngine being used by this Call object.
  -     *
  -     * Note: Not part of JAX-RPC specification.
  -     *
  -     * @return AxisEngine the current AxisEngine
  -     */
  -    public AxisEngine getEngine() {
  -        return( engine );
  -    }
  -
  -
  -    /**
        * Convert the list of objects into RPCParam's based on the paramNames,
        * paramTypes and paramModes variables.  If those aren't set then just
        * return what was passed in.
  @@ -1163,7 +1130,7 @@
        * Note: Not part of JAX-RPC specification.
        */
       public void setOption(String name, Object value) {
  -        engine.setOption(name, value);
  +        service.getEngine().setOption(name, value);
       }
       
       /**
  @@ -1238,7 +1205,7 @@
   
           // set up transport if there is one
           if (transport != null) {
  -            transport.setupMessageContext(msgContext, this, this.engine);
  +            transport.setupMessageContext(msgContext, this, service.getEngine());
           }
           else
               msgContext.setTransportName( transportName );
  @@ -1259,7 +1226,7 @@
           }
   
           try {
  -            engine.invoke( msgContext );
  +            service.getEngine().invoke( msgContext );
   
               if (transport != null)
                   transport.processReturnedMessageContext(msgContext);
  @@ -1283,10 +1250,22 @@
        *
        * Note: Not part of JAX-RPC specification.
        *
  -     * @return a Vector of RPCParams
  +     * @return Vector of RPCParams
        */
       public Vector getOutputParams()
       {
           return this.outParams;
  +    }
  +
  +    /**
  +     * Get the Service object associated with this Call object.
  +     *
  +     * Note: Not part of JAX-RPC specification.
  +     *
  +     * @return Service the Service object this Call object is associated with
  +     */
  +    public Service getService()
  +    {
  +        return this.service;
       }
   }
  
  
  
  1.22      +35 -0     xml-axis/java/src/org/apache/axis/client/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Service.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Service.java	2001/11/12 16:43:11	1.21
  +++ Service.java	2001/11/15 19:48:42	1.22
  @@ -59,7 +59,10 @@
   import com.ibm.wsdl.extensions.soap.SOAPBody;
   import com.ibm.wsdl.extensions.soap.SOAPOperation;
   import com.ibm.wsdl.xml.WSDLReader;
  +import org.apache.axis.Constants;
  +import org.apache.axis.AxisEngine;
   import org.apache.axis.encoding.XMLType;
  +import org.apache.axis.configuration.FileProvider;
   import org.apache.axis.transport.http.HTTPConstants;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.XMLUtils;
  @@ -100,10 +103,14 @@
    */
   
   public class Service implements javax.xml.rpc.Service {
  +    private AxisEngine          engine         = null ;
       private URL                 wsdlLocation   = null ;
       private Definition          wsdlDefinition = null ;
       private javax.wsdl.Service  wsdlService    = null ;
   
  +    private static FileProvider configProvider =
  +                           new FileProvider(Constants.CLIENT_CONFIG_FILE);
  +
       Definition getWSDLDefinition() {
           return( wsdlDefinition );
       }
  @@ -122,6 +129,7 @@
       public Service() throws JAXRPCException { 
           this.wsdlLocation   = null ;
           this.wsdlDefinition = null ;
  +        setEngine( new AxisClient(configProvider) );
       }
   
       /**
  @@ -133,6 +141,7 @@
        * @throws JAXRPCExceptionIif there's an error finding or parsing the WSDL
        */
       public Service(URL wsdlDoc, QName serviceName) throws JAXRPCException {
  +        this();
           try {
               // Start by reading in the WSDL using WSDL4J
               org.w3c.dom.Document doc = XMLUtils.newDocument(wsdlDoc.toString());
  @@ -171,6 +180,7 @@
        */
       public Service(String wsdlLocation, QName serviceName) 
                              throws JAXRPCException {
  +        this();
           try {
               // Start by reading in the WSDL using WSDL4J
               FileInputStream      fis = new FileInputStream(wsdlLocation);
  @@ -209,6 +219,7 @@
        */
       public Service(InputStream wsdlInputStream, QName serviceName) 
                              throws JAXRPCException {
  +        this();
           try {
               // Start by reading in the WSDL using WSDL4J
               org.w3c.dom.Document doc = XMLUtils.newDocument(wsdlInputStream);
  @@ -400,5 +411,29 @@
        */
       public javax.naming.Reference getReference() {
           return( null );
  +    }
  +
  +    /**
  +     * Sets this Service's AxisEngine.  This engine will be shared by all
  +     * Call objects created from this Service object.
  +     *
  +     * Note: Not part of the JAX-RPC spec.
  +     *
  +     * @param engine  Sets this Service's AxisEngine to the passed in one
  +     */
  +    public void setEngine(AxisEngine engine) {
  +        this.engine = engine ;
  +    }
  +
  +    /**
  +     * Returns the current AxisEngine used by this Service and all of the
  +     * Call objects created from this Service object.
  +     *
  +     * Note: Not part of the JAX-RPC spec.
  +     *
  +     * @return AxisEngine  the engine
  +     */
  +    public AxisEngine getEngine() {
  +        return( engine );
       }
   }
  
  
  
  1.68      +5 -3      xml-axis/java/src/org/apache/axis/client/ServiceClient.java
  
  Index: ServiceClient.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/ServiceClient.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- ServiceClient.java	2001/11/09 23:21:24	1.67
  +++ ServiceClient.java	2001/11/15 19:48:42	1.68
  @@ -150,8 +150,9 @@
        * Construct a ServiceClient with just an AxisEngine.
        */
       public ServiceClient (AxisEngine engine) throws Exception {
  -        call = new Call(new Service());
  -        call.setEngine(engine);
  +        Service service = new Service();
  +        service.setEngine(engine);
  +        call = new Call(service);
       }
   
   
  @@ -178,8 +179,9 @@
               throws AxisFault, Exception
       {
           try {
  +            Service  service = new Service();
  +            service.setEngine(engine);
               call = new Call(endpointURL);
  -            call.setEngine(engine);
           } catch (MalformedURLException e) {
               throw new AxisFault(e);
           }
  
  
  
  1.14      +1 -1      xml-axis/java/test/functional/TestTCPTransportSample.java
  
  Index: TestTCPTransportSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestTCPTransportSample.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestTCPTransportSample.java	2001/11/01 13:12:31	1.13
  +++ TestTCPTransportSample.java	2001/11/15 19:48:42	1.14
  @@ -101,7 +101,7 @@
   
               SimpleTargetedChain c = new SimpleTargetedChain();
               c.setPivotHandler(new TCPSender());
  -            call.getEngine().deployTransport("tcp", c);
  +            service.getEngine().deployTransport("tcp", c);
   
               call.setTargetEndpointAddress( new URL("tcp://localhost:8088") );
               call.setOperationName( "getQuote" );
  
  
  

Mime
View raw message