owenb       2003/03/06 07:54:40

  Modified:    java/src/org/apache/wsif/base WSIFServiceImpl.java
                        WSIFServiceFactoryImpl.java
               java/src/org/apache/wsif WSIFServiceFactory.java
                        WSIFConstants.java
  Log:
  Add the ability to set features on a WSIFServiceFactory. Remove the 
automaticallyMapType methods
  and use a feature instead.
  
  Features supported are:
  - Setting automatic mapping of types on or off
  - Setting a username and password for use in retrieving documents though an 
authenticating proxy
  - Setting a WSIFMapper and WSIFMappingConvention to be used when mapping types
  - Setting service caching on or off
  
  Revision  Changes    Path
  1.34      +191 -29   xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceImpl.java
  
  Index: WSIFServiceImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceImpl.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- WSIFServiceImpl.java      5 Mar 2003 16:56:16 -0000       1.33
  +++ WSIFServiceImpl.java      6 Mar 2003 15:54:40 -0000       1.34
  @@ -58,8 +58,10 @@
   package org.apache.wsif.base;
   
   import java.io.IOException;
  +import java.net.PasswordAuthentication;
   import java.util.ArrayList;
   import java.util.Collections;
  +import java.util.HashMap;
   import java.util.Hashtable;
   import java.util.Iterator;
   import java.util.List;
  @@ -98,6 +100,7 @@
   import org.apache.wsif.spi.WSIFProvider;
   import org.apache.wsif.util.WSIFPluggableProviders;
   import org.apache.wsif.util.WSIFUtils;
  +import org.apache.wsif.wsdl.AuthenticatingProxyWSDLLocatorImpl;
   import org.apache.wsif.wsdl.ClosableLocator;
   import org.apache.wsif.wsdl.WSIFWSDLLocatorImpl;
   
  @@ -132,9 +135,10 @@
       private boolean typeMapInitialised = false;
       // Flag to indicate that we have parsed the schema to find the types
       private boolean schemaTypesInitialised = false;
  -    // If the WSDLLocator needed to parse the schema cannot be created by calling
  -    // new WSIFWSDLLocatorImpl((String) null, (String) null, null), store it
  +    // WSDLLocator needed to find imported xsd files if parsing the schema
       private WSDLLocator specialistLocator = null;
  +    
  +    protected Map features = null;
   
       /**
        * Create a WSIF service instance from WSDL document URL.
  @@ -153,17 +157,34 @@
           String serviceNS,
           String serviceName,
           String portTypeNS,
  -        String portTypeName)
  +        String portTypeName,
  +        Map factoryFeatures)
           throws WSIFException {
           Trc.entry(this, wsdlLoc, serviceNS, serviceName, portTypeNS, portTypeName);
   
  +             this.features = factoryFeatures;
  +        
           // load WSDL defintion
           Definition def = null;
           try {
  -            def = WSIFUtils.readWSDL(null, wsdlLoc);
  +            // Check if we need to read the wsdl through an authenticating proxy
  +            PasswordAuthentication pa = getProxyAuthentication();
  +            if (pa != null
  +                && (wsdlLoc.startsWith("http://";)
  +                    || wsdlLoc.startsWith("ftp://";))) {
  +                def = WSIFUtils.readWSDLThroughAuthProxy(wsdlLoc, pa);
  +
  +                // We'll need to use a non default WSDLLocator to help find imported
  +                // xsd files if parsing the schema, so store it
  +                specialistLocator =
  +                    new AuthenticatingProxyWSDLLocatorImpl(wsdlLoc, pa);
  +            }
  +            if (def == null) {
  +                def = WSIFUtils.readWSDL(null, wsdlLoc);
  +            }
               checkWSDL(def);
           } catch (WSDLException ex) {
  -             Trc.exception(ex);
  +            Trc.exception(ex);
               throw new WSIFException("could not load " + wsdlLoc, ex);
           }
   
  @@ -197,24 +218,41 @@
           String serviceNS,
           String serviceName,
           String portTypeNS,
  -        String portTypeName)
  +        String portTypeName,
  +        Map factoryFeatures)
           throws WSIFException {
           Trc.entry(this, wsdlLoc, cl, serviceNS, serviceName, portTypeNS, 
portTypeName);
   
  +             this.features = factoryFeatures;
  +             
           // load WSDL defintion
           Definition def = null;
           try {
  -            def = WSIFUtils.readWSDL(null, wsdlLoc, cl);
  +             // Check if we need to read the wsdl through an authenticating proxy
  +            PasswordAuthentication pa = getProxyAuthentication();
  +            if (pa != null
  +                && (wsdlLoc.startsWith("http://";)
  +                    || wsdlLoc.startsWith("ftp://";))) {
  +                def = WSIFUtils.readWSDLThroughAuthProxy(wsdlLoc, pa);
  +
  +                // We'll need to use a non default WSDLLocator to help find imported
  +                // xsd files if parsing the schema, so store it
  +                specialistLocator =
  +                    new AuthenticatingProxyWSDLLocatorImpl(wsdlLoc, pa);
  +            }
  +            if (def == null) {
  +                def = WSIFUtils.readWSDL(null, wsdlLoc, cl);
  +                
  +                // We'll need to use a non default WSDLLocator to help find imported
  +                // xsd files if parsing the schema, so store it
  +                specialistLocator = new WSIFWSDLLocatorImpl(null, wsdlLoc, cl);
  +            }                    
               checkWSDL(def);
           } catch (WSDLException ex) {
                Trc.exception(ex);
               throw new WSIFException("could not load " + wsdlLoc, ex);
           }
   
  -        // Store a locator with a reference to the classloader in case 
autoTypeMappings
  -        // is off but we use stub invocations later
  -             specialistLocator = new WSIFWSDLLocatorImpl(null, wsdlLoc, cl);
  -
           // select WSDL service if given name
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
   
  @@ -232,8 +270,8 @@
         * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
         * should be used to create a WSIFService.
         */
  -    WSIFServiceImpl(Definition def) throws WSIFException {
  -        this(def, null);
  +    WSIFServiceImpl(Definition def, Map factoryFeatures) throws WSIFException {
  +        this(def, null, factoryFeatures);
       }
   
       /**
  @@ -242,8 +280,8 @@
         * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
         * should be used to create a WSIFService.
         */
  -    WSIFServiceImpl(Definition def, Service service) throws WSIFException {
  -        this(def, service, null);
  +    WSIFServiceImpl(Definition def, Service service, Map factoryFeatures) throws 
WSIFException {
  +        this(def, service, null, factoryFeatures);
       }
   
       /**
  @@ -252,10 +290,30 @@
         * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
         * should be used to create a WSIFService.
         */
  -    WSIFServiceImpl(Definition def, Service service, PortType portType)
  +    WSIFServiceImpl(Definition def, Service service, PortType portType, Map 
factoryFeatures)
           throws WSIFException {
  -        Trc.entry(this, def, service, portType);
  +        Trc.entry(this, def, service, portType, factoryFeatures);
   
  +        this.features = factoryFeatures;
  +        try {
  +            PasswordAuthentication pa = getProxyAuthentication();
  +            if (pa != null) {
  +                def =
  +                    WSIFUtils.readWSDLThroughAuthProxy(
  +                        def.getDocumentBaseURI(),
  +                        pa);
  +
  +                // We'll need to use a non default WSDLLocator to help find imported
  +                // xsd files if parsing the schema, so store it
  +                specialistLocator =
  +                    new AuthenticatingProxyWSDLLocatorImpl(
  +                        def.getDocumentBaseURI(),
  +                        pa);
  +            }
  +        } catch (WSDLException we) {
  +            Trc.ignoredException(we);
  +        }
  +        
           init(def, service, portType);
           if (Trc.ON)
               Trc.exit(deep());
  @@ -267,9 +325,29 @@
         * The equivalent [EMAIL PROTECTED] 
org.apache.wsif.WSIFServiceFactory}.getService method
         * should be used to create a WSIFService.
         */
  -    WSIFServiceImpl(Definition def, String serviceNS, String serviceName)
  +    WSIFServiceImpl(Definition def, String serviceNS, String serviceName, Map 
factoryFeatures)
           throws WSIFException {
  -        Trc.entry(this, def, serviceNS, serviceName);
  +        Trc.entry(this, def, serviceNS, serviceName, factoryFeatures);
  +
  +             this.features = factoryFeatures;
  +        try {
  +            PasswordAuthentication pa = getProxyAuthentication();
  +            if (pa != null) {
  +                def =
  +                    WSIFUtils.readWSDLThroughAuthProxy(
  +                        def.getDocumentBaseURI(),
  +                        pa);
  +
  +                // We'll need to use a non default WSDLLocator to help find imported
  +                // xsd files if parsing the schema, so store it
  +                specialistLocator =
  +                    new AuthenticatingProxyWSDLLocatorImpl(
  +                        def.getDocumentBaseURI(),
  +                        pa);
  +            }
  +        } catch (WSDLException we) {
  +            Trc.ignoredException(we);
  +        }
   
           // select WSDL service if given by name or only one
           Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
  @@ -289,9 +367,30 @@
           String serviceNS,
           String serviceName,
           String portTypeNS,
  -        String portTypeName)
  +        String portTypeName,
  +        Map factoryFeatures)
           throws WSIFException {
  -        Trc.entry(this, def, serviceNS, serviceName, portTypeNS, portTypeName);
  +        Trc.entry(this, def, serviceNS, serviceName, portTypeNS, portTypeName, 
factoryFeatures);
  +
  +             this.features = factoryFeatures;
  +        try {
  +            PasswordAuthentication pa = getProxyAuthentication();
  +            if (pa != null) {
  +                def =
  +                    WSIFUtils.readWSDLThroughAuthProxy(
  +                        def.getDocumentBaseURI(),
  +                        pa);
  +
  +                // We'll need to use a non default WSDLLocator to help find imported
  +                // xsd files if parsing the schema, so store it
  +                specialistLocator =
  +                    new AuthenticatingProxyWSDLLocatorImpl(
  +                        def.getDocumentBaseURI(),
  +                        pa);
  +            }
  +        } catch (WSDLException we) {
  +            Trc.ignoredException(we);
  +        }
   
           checkWSDLForWSIF(def);
   
  @@ -334,6 +433,13 @@
                this.schemaTypes = (ArrayList) svc.schemaTypes.clone();
                this.mapCon = svc.mapCon;
                this.mapper = svc.mapper;
  +             if (svc.features instanceof Hashtable) {
  +                     this.features = (Map) ((Hashtable) svc.features).clone();
  +             } else if (svc.features instanceof HashMap) {
  +                     this.features = (Map) ((HashMap) svc.features).clone();
  +             } else {
  +                 this.features = svc.features;
  +             }
        }
   
       /**
  @@ -823,10 +929,31 @@
               myPortsArr[count++] = port;
           }
   
  -             // Set up the WSIFMapper and WSIFMappingConvention for use by this 
service
  -        mapCon = WSIFMappingConventionFactory.newMappingConvention();
  -        mapper = WSIFMapperFactory.newMapper();
  -        mapper.setMappingConvention(mapCon);       
  +             // Set up the WSIFMapper and WSIFMappingConvention appropriately
  +             String mapperClass = null;
  +             String mappingConvClass = null;
  +        try {
  +            mapperClass = 
  +                (String) features.get(
  +                    WSIFConstants.WSIF_FEATURE_MAPPER_CLASS);                       
 
  +        } catch (ClassCastException cce) {
  +            Trc.ignoredException(cce);
  +        }
  +        try {
  +            mappingConvClass = 
  +                (String) features.get(
  +                    WSIFConstants.WSIF_FEATURE_MAPPINGCONVENTION_CLASS);            
         
  +        } catch (ClassCastException cce) {
  +            Trc.ignoredException(cce);
  +        }        
  +
  +             overrideMapper(mapperClass);
  +             overrideMappingConvention(mappingConvClass);
  +             
  +             // If automatic mapping of types is required, generate the list of 
SchemaType objects
  +             if (autoMapTypesOn()) {
  +                     populateSchemaTypes(specialistLocator);
  +             }     
       }
   
   
  @@ -973,7 +1100,11 @@
         * @throws A WSIFException if the WSIFMapper cannot be found or set
         */
        protected void overrideMapper(String mapperClassName) throws WSIFException {
  -             mapper = WSIFMapperFactory.newMapper(mapperClassName);
  +             if (mapperClassName != null) {
  +                     mapper = WSIFMapperFactory.newMapper(mapperClassName);
  +             } else {
  +                 mapper = WSIFMapperFactory.newMapper();
  +             }
        }
   
        /**
  @@ -983,7 +1114,11 @@
         * @throws A WSIFException if the WSIFMappingConvention cannot be found or set
         */
        protected void overrideMappingConvention(String mappingConvClassName) throws 
WSIFException {
  -             mapCon = 
WSIFMappingConventionFactory.newMappingConvention(mappingConvClassName);
  +         if (mappingConvClassName != null) {
  +                     mapCon = 
WSIFMappingConventionFactory.newMappingConvention(mappingConvClassName);
  +             } else {
  +                 mapCon = WSIFMappingConventionFactory.newMappingConvention();
  +             }
                mapper.setMappingConvention(mapCon);
        }
   
  @@ -1014,8 +1149,8 @@
                }
               }
               
  -            // Add the list of types to the context message so that providers can 
  -            // use the information if needed
  +            // Add a read-only version of the list of types to the context message 
  +            // so that providers can use the information if needed
               WSIFMessage ctx = getContext();
               ctx.setObjectPart(
                   WSIFConstants.CONTEXT_SCHEMA_TYPES,
  @@ -1077,6 +1212,33 @@
               }
               typeMapInitialised = true;
           }
  +    }
  +
  +    private boolean autoMapTypesOn() {
  +        if (features == null) {
  +            return false;
  +        }
  +        Object on = features.get(WSIFConstants.WSIF_FEATURE_AUTO_MAP_TYPES);
  +        if (on != null && on instanceof Boolean) {
  +            if (((Boolean) on).booleanValue()) {
  +                return true;
  +            } else {
  +                return false;
  +            }
  +        } else {
  +             return false;
  +        }
  +    }
  +
  +    private PasswordAuthentication getProxyAuthentication() {
  +        if (features != null) {
  +            Object pa =
  +                features.get(WSIFConstants.WSIF_FEATURE_PROXY_AUTHENTICATION);
  +            if (pa != null && pa instanceof PasswordAuthentication) {
  +                             return (PasswordAuthentication) pa;
  +            }
  +        }
  +        return null;
       }
   
       public String deep() {
  
  
  
  1.11      +59 -64    
xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceFactoryImpl.java
  
  Index: WSIFServiceFactoryImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis-wsif/java/src/org/apache/wsif/base/WSIFServiceFactoryImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WSIFServiceFactoryImpl.java       26 Feb 2003 15:55:18 -0000      1.10
  +++ WSIFServiceFactoryImpl.java       6 Mar 2003 15:54:40 -0000       1.11
  @@ -66,6 +66,7 @@
   import javax.wsdl.xml.WSDLLocator;
   import javax.xml.namespace.QName;
   
  +import org.apache.wsif.WSIFConstants;
   import org.apache.wsif.WSIFException;
   import org.apache.wsif.WSIFService;
   import org.apache.wsif.WSIFServiceFactory;
  @@ -81,10 +82,8 @@
   public class WSIFServiceFactoryImpl extends WSIFServiceFactory {
   
       private boolean useCache = false;
  -    private boolean autoMapTypes = false;
  -    private String mapperClassName = null;
  -    private String mappingConventionClassName = null;
       private Map cache = new Hashtable();
  +    private Map features = new Hashtable();
   
       /**
        * Create a WSIFService from WSDL document URL.
  @@ -140,12 +139,8 @@
                   serviceNS,
                   serviceName,
                   portTypeNS,
  -                portTypeName);
  -
  -             if (autoMapTypes) {
  -                     WSDLLocator loc = new WSIFWSDLLocatorImpl(null, wsdlLoc, null);
  -                     configureServiceImplMappingInfo(wsi, loc);                     
 
  -             }
  +                portTypeName,
  +                getFeatures());
   
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
  @@ -214,12 +209,8 @@
                   serviceNS,
                   serviceName,
                   portTypeNS,
  -                portTypeName);
  -
  -             if (autoMapTypes) {
  -                     WSDLLocator loc = new WSIFWSDLLocatorImpl(null, wsdlLoc, cl);
  -                     configureServiceImplMappingInfo(wsi, loc);                     
 
  -             }
  +                portTypeName,
  +                getFeatures());
   
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
  @@ -248,12 +239,7 @@
               }
           }
   
  -        WSIFServiceImpl wsi = new WSIFServiceImpl(def);
  -
  -             if (autoMapTypes) {
  -                     WSDLLocator loc = new WSIFWSDLLocatorImpl(null, 
def.getDocumentBaseURI(), null);
  -                     configureServiceImplMappingInfo(wsi, loc);                     
 
  -             }
  +        WSIFServiceImpl wsi = new WSIFServiceImpl(def, getFeatures());
   
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
  @@ -284,12 +270,7 @@
               }
           }
   
  -        WSIFServiceImpl wsi = new WSIFServiceImpl(def, service);
  -
  -             if (autoMapTypes) {
  -                     WSDLLocator loc = new WSIFWSDLLocatorImpl(null, 
def.getDocumentBaseURI(), null);
  -                     configureServiceImplMappingInfo(wsi, loc);                     
 
  -             }
  +        WSIFServiceImpl wsi = new WSIFServiceImpl(def, service, getFeatures());
   
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
  @@ -323,12 +304,7 @@
               }
           }
   
  -        WSIFServiceImpl wsi = new WSIFServiceImpl(def, service, portType);
  -
  -             if (autoMapTypes) {
  -                     WSDLLocator loc = new WSIFWSDLLocatorImpl(null, 
def.getDocumentBaseURI(), null);
  -                     configureServiceImplMappingInfo(wsi, loc);                     
 
  -             }
  +        WSIFServiceImpl wsi = new WSIFServiceImpl(def, service, portType, 
getFeatures());
   
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
  @@ -387,12 +363,8 @@
                   serviceNS,
                   serviceName,
                   portTypeNS,
  -                portTypeName);
  -
  -             if (autoMapTypes) {
  -                     WSDLLocator loc = new WSIFWSDLLocatorImpl(null, 
def.getDocumentBaseURI(), null);
  -                     configureServiceImplMappingInfo(wsi, loc);              
  -             }
  +                portTypeName,
  +                getFeatures());
   
           if (useCache && !key.equals("")) {
               cache.put(key, wsi);
  @@ -408,32 +380,65 @@
        * specified has already been created and if so a reference to that instance
        * of WSIFService is returned.
        * @param on Flag to indicate whether or not caching of services should be used
  +     * @deprecated Use <code>setFeature(WSIFConstants.WSIF_FEATURE_SERVICE_CACHING, 
new Boolean(true))</code>
  +     * or <code>setFeature(WSIFConstants.WSIF_FEATURE_SERVICE_CACHING, new 
Boolean(false))</code> instead
        */
       public void cachingOn(boolean on) {
        Trc.entry(this,on);
  -        useCache = on;
  +        setFeature(WSIFConstants.WSIF_FEATURE_SERVICE_CACHING, new Boolean(on));
           Trc.exit();
       }
  -
  -
  +   
       /**
  -     * @see WSIFServiceFactory#automaticallyMapTypes(boolean on)
  +     * @see org.apache.wsif.WSIFServiceFactory#setFeature(String, Object)
        */
  -    public void automaticallyMapTypes(boolean on) {
  -     Trc.entry(this,on);
  -        autoMapTypes = on;
  +    public void setFeature(String name, Object value) {
  +        Trc.entry(this, name, value);
  +        if (WSIFConstants.WSIF_FEATURE_SERVICE_CACHING.equals(name)) {
  +             if (value != null && value instanceof Boolean) {
  +                     if (((Boolean) value).booleanValue()) {
  +                             useCache = true;
  +                     } else {
  +                         useCache = false;
  +                     }
  +             }
  +        }
  +        features.put(name, value);
           Trc.exit();
  -    }
  +    }    
   
       /**
  -     * @see WSIFServiceFactory#automaticallyMapTypes(boolean on, String 
mapperClassName, String conventionClassName)
  +     * @see org.apache.wsif.WSIFServiceFactory#setFeatures(Map)
        */
  -    public void automaticallyMapTypes(boolean on, String mapperClassName, String 
conventionClassName) {
  -     Trc.entry(this, new Boolean(on), mapperClassName, conventionClassName);
  -        autoMapTypes = on;           
  -     this.mapperClassName = mapperClassName;
  -     this.mappingConventionClassName = conventionClassName;
  -     Trc.exit();
  +    public void setFeatures(Map map) {
  +        Trc.entry(this, map);
  +        features.clear();
  +        features.putAll(map);
  +        if (map.containsKey(WSIFConstants.WSIF_FEATURE_SERVICE_CACHING)) {
  +             Object value = map.get(WSIFConstants.WSIF_FEATURE_SERVICE_CACHING);    
         
  +             if (value != null && value instanceof Boolean) {
  +                     if (((Boolean) value).booleanValue()) {
  +                             useCache = true;
  +                     } else {
  +                         useCache = false;
  +                     }
  +             }
  +        }        
  +        Trc.exit();
  +    }
  +    
  +    /**
  +     * @see org.apache.wsif.WSIFServiceFactory#getFeature(String)
  +     */    
  +    public Object getFeature(String name) {
  +     return features.get(name);
  +    }
  +    
  +    /**
  +     * @see org.apache.wsif.WSIFServiceFactory#getFeatures()
  +     */    
  +    public Map getFeatures() {
  +     return (Map) ((Hashtable)features).clone();
       }
   
       private String genCacheKey(
  @@ -548,15 +553,5 @@
               ret = "";
           Trc.exit(ret);
           return ret;
  -    }
  -    
  -    private void configureServiceImplMappingInfo(WSIFServiceImpl ser, WSDLLocator 
loc) throws WSIFException {
  -        ser.populateSchemaTypes(loc);
  -        if (mapperClassName != null) {
  -            ser.overrideMapper(mapperClassName);
  -        }
  -        if (mappingConventionClassName != null) {
  -            ser.overrideMappingConvention(mappingConventionClassName);
  -        }
       }
   }
  
  
  
  1.12      +36 -20    xml-axis-wsif/java/src/org/apache/wsif/WSIFServiceFactory.java
  
  Index: WSIFServiceFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFServiceFactory.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- WSIFServiceFactory.java   26 Feb 2003 15:55:23 -0000      1.11
  +++ WSIFServiceFactory.java   6 Mar 2003 15:54:40 -0000       1.12
  @@ -57,6 +57,7 @@
   
   package org.apache.wsif;
   
  +import java.util.Map;
   import javax.wsdl.Definition;
   import javax.wsdl.PortType;
   import javax.wsdl.Service;
  @@ -161,29 +162,44 @@
       /**
        * Set caching on services on/off. Off is the default
        * @param on Flag to indicate whether or not caching of services should be used
  +     * @deprecated Use <code>setFeature(WSIFConstants.WSIF_FEATURE_SERVICE_CACHING, 
new Boolean(true))</code>
  +     * or <code>setFeature(WSIFConstants.WSIF_FEATURE_SERVICE_CACHING, new 
Boolean(false))</code> instead
        */    
       public void cachingOn(boolean on) {
       }       
  +  
  +    /**
  +     * Set a feature on the WSIFServiceFactory. The names of supported features are 
stored as constants
  +     * in the [EMAIL PROTECTED] WSIFConstants} class. The names of these constants 
have a convention of starting 
  +     * <code>WSIF_FEATURE_</code>. 
  +     * For more information about individual features, see the field details for 
the feature constants.
  +     * <br><br><b>Note:</b> features should be set before calls to the getService 
methods.<br>
  +     * @param name The name of the feature to set
  +     * @param value The value of the feature
  +     */
  +    public abstract void setFeature(String name, Object value);
  +
  +    /**
  +     * Set features on the WSIFServiceFactory. Calling this method will replace the 
currently set features
  +     * with those configured in the Map passed in.
  +     * The names of supported features are stored as constants
  +     * in the [EMAIL PROTECTED] WSIFConstants} class. The names of these constants 
have a convention of starting 
  +     * <code>WSIF_FEATURE_</code>. 
  +     * For more information about individual features, see the field details for 
the feature constants.
  +     * <br><br><b>Note:</b> features should be set before calls to the getService 
methods.<br>
  +     * @param map A Map containing all the features to set on the factory
  +     */    
  +    public abstract void setFeatures(Map map);
   
  -     /**
  -      * Set a flag to indicate whether or not instances of WSIFService created by 
this factory, will
  -      * attempt to automatically calculate mappings between xml names and Java 
class names for the
  -      * types in the wsdl.
  -      * @param on Whether automcatic mapping of types is on or off. The default is 
off
  -      */    
  -    public void automaticallyMapTypes(boolean on) {
  -    }
  +    /**
  +     * Get the map of features currently being used by the factory.
  +     * @return The map of features
  +     */    
  +    public abstract Map getFeatures();
   
  -     /**
  -      * Set a flag to indicate whether or not instances of WSIFService created by 
this factory, will
  -      * attempt to automatically calculate mappings between xml names and Java 
class names for the
  -      * types in the wsdl. This method also allows the user to programatically 
specify the names of the
  -      * WSIFMapper and WSIFMappingConvention classes to be used by WSIFServices 
created by this factory.
  -      * A null value for a class name will be ignored i.e. no overriding will take 
place.
  -      * @param on Whether automcatic mapping of types is on or off. The default is 
off
  -      * @param mapperClassName The WSIFMapper implementation class name
  -      * @param conventionClassName The WSIFMappingConvention implementation class 
name
  -      */
  -    public void automaticallyMapTypes(boolean on, String mapperClassName, String 
conventionClassName) {
  -    }           
  +    /**
  +     * Get the value for a feature currently being used by the factory.
  +     * @return The feature value
  +     */    
  +    public abstract Object getFeature(String name);                     
   }
  
  
  
  1.21      +51 -5     xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java
  
  Index: WSIFConstants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis-wsif/java/src/org/apache/wsif/WSIFConstants.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WSIFConstants.java        5 Mar 2003 16:56:15 -0000       1.20
  +++ WSIFConstants.java        6 Mar 2003 15:54:40 -0000       1.21
  @@ -191,11 +191,11 @@
           "message";
   
       /**
  -     *  WSIF context part name for the schema types iterator 
  +     *  WSIF context part name for the list of schema types
        */
       public static final String CONTEXT_SCHEMA_TYPES =
           "org.apache.wsif.schematypes";
  -        
  +
       /**
        *  SOAP faults WSIFMessage part name for the fault code
        */
  @@ -278,12 +278,58 @@
           "http://xml.apache.org/xml-soap";;
           
       /**
  -     * Property name that specifies a WSIFMapper implementation class
  +     * Property name that specifies a WSIFMapper implementation class. This 
property can be
  +     * set as a System property or in the wsif,properties file.
  +     * @see org.apache.wsif.mapping.WSIFMapperFactory
        */
        public static final String WSIF_MAPPER_PROPERTY = "org.apache.wsif.mapper";
   
       /**
  -     * Property name that specifies a WSIFMappingConvention implementation class
  +     * Property name that specifies a WSIFMappingConvention implementation class. 
This property can be
  +     * set as a System property or in the wsif,properties file.
  +     * @see org.apache.wsif.mapping.WSIFMappingConventionFactory
  +     */      
  +     public static final String WSIF_MAPPINGCONVENTION_PROPERTY = 
"org.apache.wsif.mappingconvention";
  +     
  +    /**
  +     * Feature name for service caching. The value of this feature should be a 
<code>java.lang.Boolean</code>
  +     * object<br><br>
  +     * Setting this feature as <code>true</code> will cause the WSIFServiceFactory 
to store shallow 
  +     * copies of any WSIFService instances it creates and to reuse these whenever 
possible rather than 
  +     * creating new WSIFService instances. This can provide a performance 
improvement if you are creating
  +     * and using the same WSIFServices multiple times.
  +     */      
  +     public static final String WSIF_FEATURE_SERVICE_CACHING = 
"org.apache.wsif.servicecaching";
  +
  +    /**
  +     * Feature name for automatic mapping of types. The value of this feature 
should be a 
  +     * <code>java.lang.Boolean</code> object<br><br>
  +     * Setting this feature as <code>true</code> will cause instances of 
WSIFService created by this factory,
  +     * to attempt to automatically calculate mappings between xml names and Java 
class names for the
  +      * types in the wsdl.
  +     */      
  +     public static final String WSIF_FEATURE_AUTO_MAP_TYPES = 
"org.apache.wsif.automaptypes";
  +
  +    /**
  +     * Feature name for the name of a WSIFMapper class to be used. The value for 
this feature should be
  +     * a String giving the name of the WSIFMapper implementation class to be used 
by all WSIFServices
  +     * created by the factory. Setting this feature will override the use of the 
org.apache.wsif.mapper
  +     * property for WSIFServices created by the factory.
  +     */      
  +     public static final String WSIF_FEATURE_MAPPER_CLASS = 
"org.apache.wsif.mapper";
  +
  +    /**
  +     * Feature name for the name of a WSIFMappingConvention class to be used. The 
value for this feature 
  +     * should be a String giving the name of the WSIFMappingConvention 
implementation class to be used by 
  +     * all WSIFServices created by the factory. Setting this feature will override 
the use of the 
  +     * org.apache.wsif.mappingconvention property for WSIFServices created by the 
factory.
  +     */      
  +     public static final String WSIF_FEATURE_MAPPINGCONVENTION_CLASS = 
"org.apache.wsif.mappingconvention";
  +
  +    /**
  +     * Feature name for a authenticating proxy username and password to be used 
when reading wsdl files and
  +     * parsing schemas. The value for this feature should be a 
<code>java.net.PasswordAuthentication</code> 
  +     * object which encapsultes the username and password.
        */      
  -     public static final String WSIF_MAPPINGCONVENTION_PROPERTY = 
"org.apache.wsif.mappingconvention";                               
  +     public static final String WSIF_FEATURE_PROXY_AUTHENTICATION = 
"org.apache.wsif.proxyauthentication";                                                 
                                  
   }
  
  
  

Reply via email to