axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/utils XMLUtils.java
Date Thu, 11 Oct 2001 21:04:47 GMT
gdaniels    01/10/11 14:04:47

  Modified:    java/src/org/apache/axis/deployment DeploymentRegistry.java
                        SimpleDeploymentManager.java
               java/src/org/apache/axis/deployment/wsdd
                        SimpleWsddDeploymentManager.java WSDDChain.java
                        WSDDConstants.java WSDDDeployableItem.java
                        WSDDFlow.java WSDDService.java
               java/src/org/apache/axis/deployment/wsdd/providers
                        WSDDBsfProvider.java WSDDComProvider.java
                        WSDDJavaProvider.java
               java/src/org/apache/axis/utils XMLUtils.java
  Log:
  Various fixes to WSDD code - eliminate String types, always use QNames.
  
  For now Java provider is always RPCProvider - should add ability to
  differentiate between RPC and Document services.
  
  Revision  Changes    Path
  1.6       +1 -18     xml-axis/java/src/org/apache/axis/deployment/DeploymentRegistry.java
  
  Index: DeploymentRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/DeploymentRegistry.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DeploymentRegistry.java	2001/10/11 15:49:27	1.5
  +++ DeploymentRegistry.java	2001/10/11 21:04:46	1.6
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -93,15 +93,6 @@
   
       /**
        * retrieve an instance of the named handler
  -     * @param name XXX
  -     * @return XXX
  -     * @throws DeploymentException XXX
  -     */
  -    public abstract Handler getDeployedItem(String name)
  -        throws DeploymentException;
  -
  -    /**
  -     * retrieve an instance of the named handler
        * @param qname XXX
        * @return XXX
        * @throws DeploymentException XXX
  @@ -151,14 +142,6 @@
        * @throws DeploymentException XXX
        */
       public abstract void deployItem(DeployableItem item)
  -        throws DeploymentException;
  -
  -    /**
  -     * remove the given item
  -     * @param name XXX
  -     * @throws DeploymentException XXX
  -     */
  -    public abstract void removeDeployedItem(String name)
           throws DeploymentException;
   
       /**
  
  
  
  1.8       +5 -28     xml-axis/java/src/org/apache/axis/deployment/SimpleDeploymentManager.java
  
  Index: SimpleDeploymentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/SimpleDeploymentManager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SimpleDeploymentManager.java	2001/10/11 15:49:27	1.7
  +++ SimpleDeploymentManager.java	2001/10/11 21:04:46	1.8
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -133,7 +133,7 @@
       public void deployItem(DeployableItem item)
           throws DeploymentException
       {
  -        items.put(item.getQName().toString(), item);
  +        items.put(item.getQName(), item);
       }
   
       /**
  @@ -145,21 +145,8 @@
       public Handler getDeployedItem(QName qname)
           throws DeploymentException
       {
  -        return getDeployedItem(qname.toString());
  -    }
  -
  -    /**
  -     * Return an instance of the deployed item
  -     * @param name XXX
  -     * @return XXX
  -     * @throws DeploymentException XXX
  -     */
  -    public Handler getDeployedItem(String name)
  -        throws DeploymentException
  -    {
  -
           try {
  -            DeployableItem item = (DeployableItem) items.get(name);
  +            DeployableItem item = (DeployableItem) items.get(qname);
   
               return item.newInstance(this);
           }
  @@ -173,22 +160,12 @@
        * @param name XXX
        * @throws DeploymentException XXX
        */
  -    public void removeDeployedItem(String name)
  -        throws DeploymentException
  -    {
  -        items.remove(name);
  -    }
  -
  -    /**
  -     * remove the given item
  -     * @param qname XXX
  -     * @throws DeploymentException XXX
  -     */
       public void removeDeployedItem(QName qname)
           throws DeploymentException
       {
  -        removeDeployedItem(qname.toString());
  +        items.remove(qname);
       }
  +
   
       /**
        * return the named mapping registry
  
  
  
  1.3       +1 -21     xml-axis/java/src/org/apache/axis/deployment/wsdd/SimpleWsddDeploymentManager.java
  
  Index: SimpleWsddDeploymentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/SimpleWsddDeploymentManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleWsddDeploymentManager.java	2001/10/11 18:53:44	1.2
  +++ SimpleWsddDeploymentManager.java	2001/10/11 21:04:46	1.3
  @@ -81,26 +81,6 @@
       public WSDDDeployableItem getDeployedWsddItem(QName qname)
           throws DeploymentException
       {
  -        return getDeployedWsddItem(qname.toString());
  -    }
  -
  -    /**
  -     * Return the RAW deployed item
  -     * @param name XXX
  -     * @return XXX
  -     * @throws DeploymentException XXX
  -     */
  -    public WSDDDeployableItem getDeployedWsddItem(String name)
  -        throws DeploymentException
  -    {
  -
  -        try {
  -            WSDDDeployableItem item = (WSDDDeployableItem) getDeployedItem(name);
  -
  -            return item;
  -        }
  -        catch (Exception e) {
  -            throw new DeploymentException(e.getMessage());
  -        }
  +        return getDeployedWsddItem(qname);
       }
   }
  
  
  
  1.7       +7 -6      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDChain.java
  
  Index: WSDDChain.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDChain.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSDDChain.java	2001/10/11 15:49:28	1.6
  +++ WSDDChain.java	2001/10/11 21:04:46	1.7
  @@ -61,6 +61,7 @@
   
   import org.apache.axis.Chain;
   import org.apache.axis.Handler;
  +import org.apache.axis.utils.QName;
   import org.apache.axis.deployment.DeploymentRegistry;
   import org.apache.axis.deployment.DeployableItem;
   
  @@ -72,7 +73,8 @@
   public class WSDDChain
       extends WSDDHandler
   {
  -
  +    public static final QName DEFAULT_QNAME =
  +            new QName(WSDDConstants.WSDD_JAVA, "org.apache.axis.SimpleChain");
       /**
        *
        * @param e (Element) XXX
  @@ -152,13 +154,12 @@
        *
        * @return XXX
        */
  -    public String getType()
  +    public QName getType()
       {
  -
  -        String type = super.getType();
  +        QName type = super.getType();
   
  -        if (type.equals("")) {
  -            type = "java:org.apache.axis.SimpleChain";
  +        if (type == null) {
  +            type = DEFAULT_QNAME;
           }
   
           return type;
  
  
  
  1.5       +1 -2      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java
  
  Index: WSDDConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDConstants.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WSDDConstants.java	2001/10/11 15:49:28	1.4
  +++ WSDDConstants.java	2001/10/11 21:04:46	1.5
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -59,7 +59,6 @@
    */
   public class WSDDConstants
   {
  -
       /** XXX */
       public final static String WSDD_NS = "http://xml.apache.org/axis/wsdd/";
   
  
  
  
  1.7       +23 -27    xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java
  
  Index: WSDDDeployableItem.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSDDDeployableItem.java	2001/10/11 15:49:28	1.6
  +++ WSDDDeployableItem.java	2001/10/11 21:04:46	1.7
  @@ -65,6 +65,7 @@
   import org.apache.axis.deployment.DeploymentRegistry;
   import org.apache.axis.deployment.DeployableItem;
   import org.apache.axis.utils.QName;
  +import org.apache.axis.utils.XMLUtils;
   
   
   /**
  @@ -151,9 +152,13 @@
        *
        * @return XXX
        */
  -    public String getType()
  +    public QName getType()
       {
  -        return getAttribute("type");
  +        String type = getAttribute("type");
  +        if (type != null && !type.equals(""))
  +            return XMLUtils.getQNameFromString(type, getElement());
  +
  +        return null;
       }
   
       /**
  @@ -193,7 +198,6 @@
        */
       public WSDDParameter[] getParameters()
       {
  -
           WSDDElement[]   e = createArray("parameter", WSDDParameter.class);
           WSDDParameter[] p = new WSDDParameter[e.length];
   
  @@ -266,30 +270,20 @@
           throws Exception
       {
           try {
  -            Class   c = getTypeClass(getType());
  -            Handler h = (Handler) createInstance(c);
  -
  -            h.setOptions(getParametersTable());
  +            Class   c = getJavaClass();
  +            Handler h = null;
   
  -            return h;
  -        }
  -        catch (ClassNotFoundException e) {
  -            String  type = getType();
  -            Handler h    = registry.getDeployedItem(type);
  +            if (c != null) {
  +                h = (Handler)createInstance(c);
  +            } else {
  +                h = registry.getDeployedItem(getType());
  +            }
   
               if (h != null) {
  -                WSDDParameter[] parms = getParameters();
  -
  -                for (int n = 0; n < parms.length; n++) {
  -                    WSDDParameter parm = parms[n];
  -
  -                    h.addOption(parm.getName(), parm.getValue());
  -                }
  -
  -                return h;
  +                h.setOptions(getParametersTable());
               }
   
  -            throw e;
  +            return h;
           }
           catch (Exception e) {
               throw e;
  @@ -314,12 +308,14 @@
        * @return XXX
        * @throws ClassNotFoundException XXX
        */
  -    Class getTypeClass(String type)
  +    public Class getJavaClass()
           throws ClassNotFoundException
       {
  -
  -        type = type.substring(type.indexOf(":") + 1);
  -
  -        return Class.forName(type);
  +        QName type = getType();
  +        if (type != null &&
  +                WSDDConstants.WSDD_JAVA.equals(type.getNamespaceURI())) {
  +            return Class.forName(type.getLocalPart());
  +        }
  +        return null;
       }
   }
  
  
  
  1.7       +7 -5      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDFlow.java
  
  Index: WSDDFlow.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDFlow.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSDDFlow.java	2001/10/11 15:49:28	1.6
  +++ WSDDFlow.java	2001/10/11 21:04:46	1.7
  @@ -60,6 +60,7 @@
   
   import org.apache.axis.Handler;
   import org.apache.axis.Chain;
  +import org.apache.axis.utils.QName;
   import org.apache.axis.deployment.DeploymentRegistry;
   
   
  @@ -70,6 +71,8 @@
   public abstract class WSDDFlow
       extends WSDDDeployableItem
   {
  +    public static final QName DEFAULT_QNAME =
  +            new QName(WSDDConstants.WSDD_JAVA, "org.apache.axis.SimpleChain");
   
       /**
        *
  @@ -168,13 +171,12 @@
        *
        * @return XXX
        */
  -    public String getType()
  +    public QName getType()
       {
  +        QName type = super.getType();
   
  -        String type = super.getType();
  -
  -        if (type.equals("")) {
  -            type = "java:org.apache.axis.SimpleChain";
  +        if (type == null) {
  +            type = DEFAULT_QNAME;
           }
   
           return type;
  
  
  
  1.9       +9 -4      xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
  
  Index: WSDDService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WSDDService.java	2001/10/11 15:49:28	1.8
  +++ WSDDService.java	2001/10/11 21:04:46	1.9
  @@ -64,6 +64,7 @@
   import org.apache.axis.Handler;
   import org.apache.axis.Chain;
   import org.apache.axis.TargetedChain;
  +import org.apache.axis.utils.QName;
   import org.apache.axis.deployment.DeploymentRegistry;
   import org.apache.axis.deployment.DeployableItem;
   import org.apache.axis.description.ServiceDescription;
  @@ -75,6 +76,10 @@
   public class WSDDService
       extends WSDDDeployableItem
   {
  +    public static final QName DEFAULT_QNAME =
  +            new QName(WSDDConstants.WSDD_JAVA,
  +                      "org.apache.axis.SimpleTargetedChain");
  +
       /**
        *
        * @param e (Element) XXX
  @@ -102,12 +107,12 @@
        *
        * @return XXX
        */
  -    public String getType()
  +    public QName getType()
       {
  -        String type = super.getType();
  +        QName type = super.getType();
   
  -        if (type.equals("")) {
  -            type = "java:org.apache.axis.SimpleTargetedChain";
  +        if (type == null) {
  +            type = DEFAULT_QNAME;
           }
   
           return type;
  
  
  
  1.7       +7 -9      xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDBsfProvider.java
  
  Index: WSDDBsfProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDBsfProvider.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSDDBsfProvider.java	2001/10/11 15:49:29	1.6
  +++ WSDDBsfProvider.java	2001/10/11 21:04:46	1.7
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -102,7 +102,7 @@
           throws WSDDException
       {
           super(d, n);
  -    
  +
   	    Element specificProvider =
   	    	d.createElementNS(WSDDConstants.WSDD_BSF, "bsf:provider");
   	    getElement().appendChild(specificProvider);
  @@ -120,7 +120,7 @@
   	        throw new WSDDException(
   	            "The BSF Provider requires the presence of a bsf:provider element in the WSDD");
   	    }
  -    	
  +
       	return prov;
       }
   
  @@ -133,14 +133,12 @@
       public Handler newProviderInstance(DeploymentRegistry registry)
           throws Exception
       {
  -
  -        String type;
  +        Class _class = getJavaClass();
   
  -        type = (!(type = getType()).equals("")
  -                ? type
  -                : "org.apache.axis.handlers.providers.BSFProvider");
  +        if (_class == null) {
  +            _class = Class.forName("org.apache.axis.handlers.providers.BSFProvider");
  +        }
   
  -        Class         _class   = Class.forName(type);
           BasicProvider provider = (BasicProvider) _class.newInstance();
   
           // set the basic java provider deployment options
  
  
  
  1.7       +8 -10     xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDComProvider.java
  
  Index: WSDDComProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDComProvider.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSDDComProvider.java	2001/10/11 15:49:29	1.6
  +++ WSDDComProvider.java	2001/10/11 21:04:46	1.7
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -101,7 +101,7 @@
           throws WSDDException
       {
           super(d, n);
  -    
  +
   	    Element specificProvider =
   	    	d.createElementNS(WSDDConstants.WSDD_COM, "com:provider");
   	    getElement().appendChild(specificProvider);
  @@ -119,10 +119,10 @@
   	        throw new WSDDException(
   	            "The Com Provider requires the presence of a com:provider element in the WSDD");
   	    }
  -    	
  +
       	return prov;
       }
  -    
  +
       /**
        *
        * @param registry XXX
  @@ -132,14 +132,12 @@
       public Handler newProviderInstance(DeploymentRegistry registry)
           throws Exception
       {
  -
  -        String type;
  +        Class _class = getJavaClass();
   
  -        type = (!(type = getType()).equals("")
  -                ? type
  -                : "org.apache.axis.handlers.providers.ComProvider");
  +        if (_class == null) {
  +            _class = Class.forName("org.apache.axis.handlers.providers.ComProvider");
  +        }
   
  -        Class         _class   = Class.forName(type);
           BasicProvider provider = (BasicProvider) _class.newInstance();
   
           // set the basic java provider deployment options
  
  
  
  1.7       +8 -10     xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaProvider.java
  
  Index: WSDDJavaProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/providers/WSDDJavaProvider.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WSDDJavaProvider.java	2001/10/11 15:49:29	1.6
  +++ WSDDJavaProvider.java	2001/10/11 21:04:46	1.7
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -101,7 +101,7 @@
           throws WSDDException
       {
           super(d, n);
  -		
  +
   		Element specificProvider =
   			d.createElementNS(WSDDConstants.WSDD_JAVA, "java:provider");
   		getElement().appendChild(specificProvider);
  @@ -119,10 +119,10 @@
   		    throw new WSDDException(
   		        "The Java Provider requires the presence of a java:provider element in the WSDD");
   		}
  -		
  +
   		return prov;
   	}
  -	
  +
       /**
        *
        * @param registry XXX
  @@ -132,14 +132,12 @@
       public Handler newProviderInstance(DeploymentRegistry registry)
           throws Exception
       {
  -
  -        String type;
  +        Class _class = getJavaClass();
   
  -        type = (!(type = getType()).equals("")
  -                ? type
  -                : "org.apache.axis.handlers.providers.JavaProvider");
  +        if (_class == null) {
  +            _class = Class.forName("org.apache.axis.providers.java.RPCProvider");
  +        }
   
  -        Class         _class   = Class.forName(type);
           BasicProvider provider = (BasicProvider) _class.newInstance();
   
           // set the basic java provider deployment options
  
  
  
  1.25      +23 -0     xml-axis/java/src/org/apache/axis/utils/XMLUtils.java
  
  Index: XMLUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/XMLUtils.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- XMLUtils.java	2001/10/11 15:49:29	1.24
  +++ XMLUtils.java	2001/10/11 21:04:47	1.25
  @@ -285,6 +285,29 @@
           }
           return null;
       }
  +
  +    /**
  +     * Return a QName when passed a string like "foo:bar" by mapping
  +     * the "foo" prefix to a namespace in the context of the given Node.
  +     *
  +     * @return a QName generated from the given string representation
  +     */
  +    public static QName getQNameFromString(String str, Node e) {
  +        if (str == null || e == null)
  +            return null;
  +
  +        int idx = str.indexOf(':');
  +        if (idx > -1) {
  +            String prefix = str.substring(0, idx);
  +            String ns = getNamespace(prefix, e);
  +            if (ns == null)
  +                return null;
  +            return new QName(ns, str.substring(idx + 1));
  +        } else {
  +            return new QName("", str);
  +        }
  +    }
  +
       /**
        * Gather all existing prefixes in use in this document
        *
  
  
  

Mime
View raw message