axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/test/functional TestTransportSample.java
Date Thu, 14 Jun 2001 12:39:03 GMT
rubys       01/06/14 05:39:03

  Modified:    java/src/org/apache/axis AxisEngine.java
               java/src/org/apache/axis/utils Admin.java
               java/test/functional TestTransportSample.java
  Log:
  More ripple effect from the elimination of the per-messageContext
  typemapping registry... however, this change represents a big
  improvement; instead of making guesses as to which typemap registry
  is the engine's, now we can locate the engine and get the right one.
  
  Also eliminates some hacky statics...  ;-)
  
  Revision  Changes    Path
  1.6       +0 -6      xml-axis/java/src/org/apache/axis/AxisEngine.java
  
  Index: AxisEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AxisEngine.java	2001/06/14 07:03:59	1.5
  +++ AxisEngine.java	2001/06/14 12:39:00	1.6
  @@ -187,12 +187,6 @@
           tmr.setParent(new SOAPTypeMappingRegistry());
           _typeMappingRegistry = tmr;
           
  -        /** ??? Why are we doing this??
  -         */
  -        Handler admin = getServiceRegistry().find("AdminService");
  -        if (admin != null && admin instanceof SOAPService)
  -          ((SOAPService)admin).setTypeMappingRegistry(tmr);
  -
           Debug.Print( 1, "Exit: AxisEngine::init" );
       }
   
  
  
  
  1.40      +22 -45    xml-axis/java/src/org/apache/axis/utils/Admin.java
  
  Index: Admin.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Admin.java	2001/06/12 15:43:22	1.39
  +++ Admin.java	2001/06/14 12:39:01	1.40
  @@ -64,6 +64,8 @@
   import org.apache.axis.utils.* ;
   import org.apache.axis.suppliers.*;
   import org.apache.axis.encoding.*;
  +import org.apache.axis.client.AxisClient;
  +import org.apache.axis.server.AxisServer;
   
   import org.w3c.dom.* ;
   
  @@ -72,42 +74,7 @@
    * @author Doug Davis (dug@us.ibm.com)
    */
   public class Admin {
  -  private static  DefaultHandlerRegistry  hr = null ;
  -  private static  DefaultServiceRegistry  sr = null ;
  -  private static  TypeMappingRegistry     tmr = null ;
  -  private boolean onServer = true ;
  -    
  -
  -    /**
  -     * Hacky tester function.  Wipe the statics so we can invoke this class
  -     * multiple times within the same JVM.  For functional testing purposes.
  -     * See test.functional.TestTransportSample
  -     */
  -    public static void wipe () {
  -        hr = null;
  -        sr = null;
  -        tmr = null;
  -    }
   
  -  private void init() {
  -    if ( hr == null ) {
  -      if ( onServer )
  -        hr = new DefaultHandlerRegistry(Constants.SERVER_HANDLER_REGISTRY);
  -      else
  -        hr = new DefaultHandlerRegistry(Constants.CLIENT_HANDLER_REGISTRY);
  -      hr.setOnServer( onServer );
  -      hr.init();
  -    }
  -    if ( sr == null ) {
  -      if ( onServer )
  -        sr = new DefaultServiceRegistry(Constants.SERVER_SERVICE_REGISTRY);
  -      else
  -        sr = new DefaultServiceRegistry(Constants.CLIENT_SERVICE_REGISTRY);
  -      sr.setOnServer( onServer );
  -      sr.init();
  -    }
  -  }
  -
     private void getOptions(Element root, Handler handler) {
       NodeList  list = root.getChildNodes();
       for ( int i = 0 ; list != null && i < list.getLength() ; i++ ) {
  @@ -138,10 +105,6 @@
                     throws AxisFault
     {
       Debug.Print( 1, "Enter: Admin:AdminService" );
  -    AxisEngine engine =  msgContext.getAxisEngine();
  -    hr = (DefaultHandlerRegistry)engine.getHandlerRegistry();
  -    sr = (DefaultServiceRegistry)engine.getServiceRegistry();
  -    tmr = msgContext.getTypeMappingRegistry();
       Document doc = process( msgContext, xml );
       Debug.Print( 1, "Exit: Admin:AdminService" );
       return( doc );
  @@ -153,8 +116,12 @@
   
     public Document process(MessageContext msgContext, Element root) throws AxisFault {
       Document doc = null ;
  +
  +    AxisEngine engine =  msgContext.getAxisEngine();
  +    HandlerRegistry hr = engine.getHandlerRegistry();
  +    HandlerRegistry sr = engine.getServiceRegistry();
  +
       try {
  -      init();
         AxisClassLoader   cl     = AxisClassLoader.getClassLoader();
         String            action = root.getTagName();
   
  @@ -386,8 +353,10 @@
             if ( service == null ) service = new SOAPService();
             else              service.clear();
             
  -          if (tmr != null)
  -            service.getTypeMappingRegistry().setParent(tmr.getParent());
  +          // connect the deployed service's typemapping registry to the
  +          // engine's typemapping registry
  +          TypeMappingRegistry engineTypeMap = engine.getTypeMappingRegistry();
  +          service.getTypeMappingRegistry().setParent(engineTypeMap);
   
             if ( input != null && !"".equals(input) ) {
               st = new StringTokenizer( input, " \t\n\r\f," );
  @@ -437,7 +406,8 @@
           // for a bean at the same time.
           else if ( type.equals( "bean" ) ) {
             Debug.Print( 2, "Deploying bean: " + name );
  -          registerTypeMapping(elem, tmr.getParent());
  +          TypeMappingRegistry engineTypeMap = engine.getTypeMappingRegistry();
  +          registerTypeMapping(elem, engineTypeMap);
           } else
             throw new AxisFault( "Admin.error",
                                  "Unknown type to " + action + ": " + type,
  @@ -529,12 +499,19 @@
   
       Admin admin = new Admin();
   
  -    if ( args[0].equals("client") ) admin.onServer = false ;
  +    AxisEngine engine;
  +    if ( args[0].equals("client") ) 
  +      engine = new AxisClient();
  +    else
  +      engine = new AxisServer();
  +    engine.init();
  +    MessageContext msgContext = new MessageContext(engine);
   
       try {
         for ( i = 1 ; i < args.length ; i++ ) {
           System.out.println( "Processing '" + args[i] + "'" );
  -        admin.process(null, XMLUtils.newDocument( new FileInputStream( args[i] ) ));
  +        Document doc = XMLUtils.newDocument( new FileInputStream( args[i] ) );
  +        admin.process(msgContext, doc);
         }
       }
       catch( AxisFault e ) {
  
  
  
  1.3       +0 -2      xml-axis/java/test/functional/TestTransportSample.java
  
  Index: TestTransportSample.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/functional/TestTransportSample.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestTransportSample.java	2001/06/11 10:51:55	1.2
  +++ TestTransportSample.java	2001/06/14 12:39:02	1.3
  @@ -84,13 +84,11 @@
       public void doTestClientDeploy () throws Exception {
           String[] args = { "client", "samples/transport/client_deploy.xml" };
           Admin.main(args);
  -        Admin.wipe(); // hack!  why are those statics in Admin anyway? -- RobJ
       }
       
       public void doTestDeploy () throws Exception {
           String[] args = { "server", "samples/transport/deploy.xml" };
           Admin.main(args);
  -        Admin.wipe(); // hack!  why are those statics in Admin anyway? -- RobJ
       }
       
       public void doTestIBM () throws Exception {
  
  
  

Mime
View raw message