FileDocCategorySizeDatePackage
SimpleProvider.javaAPI DocApache Axis 1.49701Sat Apr 22 18:57:28 BST 2006org.apache.axis.configuration

SimpleProvider

public class SimpleProvider extends Object implements org.apache.axis.EngineConfiguration
A SimpleProvider is an EngineConfiguration which contains a simple HashMap-based registry of Handlers, Transports, and Services. This is for when you want to programatically deploy components which you create. SimpleProvider may also optionally contain a reference to a "default" EngineConfiguration, which will be scanned for components not found in the internal registry. This is handy when you want to start with a base configuration (like the default WSDD) and then quickly add stuff without changing the WSDD document.
author
Glen Daniels (gdaniels@apache.org)

Fields Summary
HashMap
handlers
Handler registry
HashMap
transports
Transport registry
HashMap
services
Service registry
Hashtable
globalOptions
Global configuration stuff
org.apache.axis.Handler
globalRequest
org.apache.axis.Handler
globalResponse
List
roles
org.apache.axis.encoding.TypeMappingRegistry
tmr
Our TypeMappingRegistry
org.apache.axis.EngineConfiguration
defaultConfiguration
An optional "default" EngineConfiguration
private org.apache.axis.AxisEngine
engine
Constructors Summary
public SimpleProvider()
Default constructor.


           
      
    
public SimpleProvider(org.apache.axis.EngineConfiguration defaultConfiguration)
Constructor which takes an EngineConfiguration which will be used as the default.

        this.defaultConfiguration = defaultConfiguration;
    
public SimpleProvider(org.apache.axis.encoding.TypeMappingRegistry typeMappingRegistry)
Construct a SimpleProvider using the supplied TypeMappingRegistry.

param
typeMappingRegistry

        this.tmr = typeMappingRegistry;
    
Methods Summary
public voidaddRole(java.lang.String role)
Add a role to the configuration's global list

param
role

        roles.add(role);
    
public voidconfigureEngine(org.apache.axis.AxisEngine engine)
Configure an AxisEngine. Right now just calls the default configuration if there is one, since we don't do anything special.

        this.engine = engine;

        if (defaultConfiguration != null)
            defaultConfiguration.configureEngine(engine);

        for (Iterator i = services.values().iterator(); i.hasNext(); ) {
            ((SOAPService)i.next()).setEngine(engine);
        }
    
public voiddeployService(javax.xml.namespace.QName qname, org.apache.axis.handlers.soap.SOAPService service)

        services.put(qname, service);
        if (engine != null)
            service.setEngine(engine);
    
public voiddeployService(java.lang.String name, org.apache.axis.handlers.soap.SOAPService service)

        deployService(new QName(null, name), service);
    
public voiddeployTransport(javax.xml.namespace.QName qname, org.apache.axis.Handler transport)

        transports.put(qname, transport);
    
public voiddeployTransport(java.lang.String name, org.apache.axis.Handler transport)

        deployTransport(new QName(null, name), transport);
    
public java.util.IteratorgetDeployedServices()
Get an enumeration of the services deployed to this engine

        ArrayList serviceDescs = new ArrayList();
        Iterator i = services.values().iterator();
        while (i.hasNext()) {
            SOAPService service = (SOAPService)i.next();
            serviceDescs.add(service.getServiceDescription());
        }
        return serviceDescs.iterator();
    
public java.util.HashtablegetGlobalOptions()
Returns the global configuration options.

        if (globalOptions != null)
            return globalOptions;

        if (defaultConfiguration != null)
            return defaultConfiguration.getGlobalOptions();

        return null;
    
public org.apache.axis.HandlergetGlobalRequest()
Returns a global request handler.

        if (globalRequest != null)
            return globalRequest;

        if (defaultConfiguration != null)
            return defaultConfiguration.getGlobalRequest();

        return null;
    
public org.apache.axis.HandlergetGlobalResponse()
Returns a global response handler.

        if (globalResponse != null)
            return globalResponse;

        if (defaultConfiguration != null)
            return defaultConfiguration.getGlobalResponse();

        return null;
    
public org.apache.axis.HandlergetHandler(javax.xml.namespace.QName qname)

        Handler handler = (Handler)handlers.get(qname);
        if ((defaultConfiguration != null) && (handler == null))
            handler = defaultConfiguration.getHandler(qname);
        return handler;
    
public java.util.ListgetRoles()
Get a list of roles that this engine plays globally. Services within the engine configuration may also add additional roles.

return
a List of the roles for this engine

        return roles;
    
public org.apache.axis.handlers.soap.SOAPServicegetService(javax.xml.namespace.QName qname)

        SOAPService service = (SOAPService)services.get(qname);
        if ((defaultConfiguration != null) && (service == null))
            service = defaultConfiguration.getService(qname);
        return service;
    
public org.apache.axis.handlers.soap.SOAPServicegetServiceByNamespaceURI(java.lang.String namespace)
Get a service which has been mapped to a particular namespace

param
namespace a namespace URI
return
an instance of the appropriate Service, or null

        SOAPService service = (SOAPService)services.get(new QName("",namespace));
        if ((service == null) && (defaultConfiguration != null))
            service = defaultConfiguration.getServiceByNamespaceURI(namespace);
        return service;
    
public org.apache.axis.HandlergetTransport(javax.xml.namespace.QName qname)

        Handler transport = (Handler)transports.get(qname);
        if ((defaultConfiguration != null) && (transport == null))
            transport = defaultConfiguration.getTransport(qname);
        return transport;
    
public org.apache.axis.encoding.TypeMappinggetTypeMapping(java.lang.String encodingStyle)

        return (TypeMapping)getTypeMappingRegistry().getTypeMapping(encodingStyle);
    
public org.apache.axis.encoding.TypeMappingRegistrygetTypeMappingRegistry()
Get our TypeMappingRegistry. Returns our specific one if we have one, otherwise the one from our defaultConfiguration. If we don't have one and also don't have a defaultConfiguration, we create one.

        if (tmr != null)
            return tmr;

        if (defaultConfiguration != null)
            return defaultConfiguration.getTypeMappingRegistry();

        // No default config, but we need a TypeMappingRegistry...
        // (perhaps the TMRs could just be chained?)
        tmr = new TypeMappingRegistryImpl();
        return tmr;
    
public voidremoveRole(java.lang.String role)
Remove a role from the configuration's global list

param
role

        roles.remove(role);
    
public voidsetGlobalOptions(java.util.Hashtable options)
Set the global options Hashtable

param
options

        globalOptions = options;
    
public voidsetGlobalRequest(org.apache.axis.Handler globalRequest)
Set the global request Handler

param
globalRequest

        this.globalRequest = globalRequest;
    
public voidsetGlobalResponse(org.apache.axis.Handler globalResponse)
Set the global response Handler

param
globalResponse

        this.globalResponse = globalResponse;
    
public voidsetRoles(java.util.List roles)
Set the global role list for this configuration. Note that we use the actual passed value, so if anyone else changes that collection, our role list will change. Be careful to pass this a cloned list if you want to change the list later without affecting the config.

param
roles

        this.roles = roles;
    
public voidwriteEngineConfig(org.apache.axis.AxisEngine engine)
We don't write ourselves out, so this is a noop.