You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-dev@ws.apache.org by an...@apache.org on 2003/03/19 10:55:17 UTC
cvs commit: xml-axis-wsif/java/src/org/apache/wsif/base WSIFServiceImpl.java
antelder 2003/03/19 01:55:17
Modified: java/src/org/apache/wsif/base WSIFServiceImpl.java
Log:
No changes - just formatted the code
Revision Changes Path
1.35 +272 -199 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.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- WSIFServiceImpl.java 6 Mar 2003 15:54:40 -0000 1.34
+++ WSIFServiceImpl.java 19 Mar 2003 09:55:17 -0000 1.35
@@ -127,8 +127,8 @@
private Map typeReg = null;
private Port chosenPort = null;
private WSIFMessage context;
-
- protected ArrayList schemaTypes = new ArrayList();
+
+ protected ArrayList schemaTypes = new ArrayList();
protected WSIFMappingConvention mapCon = null;
protected WSIFMapper mapper = null;
// Flag to indicate that we have produced mappings based on the types in the schema
@@ -137,7 +137,7 @@
private boolean schemaTypesInitialised = false;
// WSDLLocator needed to find imported xsd files if parsing the schema
private WSDLLocator specialistLocator = null;
-
+
protected Map features = null;
/**
@@ -160,10 +160,16 @@
String portTypeName,
Map factoryFeatures)
throws WSIFException {
- Trc.entry(this, wsdlLoc, serviceNS, serviceName, portTypeNS, portTypeName);
+ Trc.entry(
+ this,
+ wsdlLoc,
+ serviceNS,
+ serviceName,
+ portTypeNS,
+ portTypeName);
+
+ this.features = factoryFeatures;
- this.features = factoryFeatures;
-
// load WSDL defintion
Definition def = null;
try {
@@ -192,7 +198,8 @@
Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
// select WSDL portType if given name
- PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
+ PortType portType =
+ WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
init(def, service, portType);
if (Trc.ON)
@@ -221,14 +228,21 @@
String portTypeName,
Map factoryFeatures)
throws WSIFException {
- Trc.entry(this, wsdlLoc, cl, serviceNS, serviceName, portTypeNS, portTypeName);
+ Trc.entry(
+ this,
+ wsdlLoc,
+ cl,
+ serviceNS,
+ serviceName,
+ portTypeNS,
+ portTypeName);
+
+ this.features = factoryFeatures;
- this.features = factoryFeatures;
-
// load WSDL defintion
Definition def = null;
try {
- // Check if we need to read the wsdl through an authenticating proxy
+ // Check if we need to read the wsdl through an authenticating proxy
PasswordAuthentication pa = getProxyAuthentication();
if (pa != null
&& (wsdlLoc.startsWith("http://")
@@ -242,14 +256,14 @@
}
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);
+ Trc.exception(ex);
throw new WSIFException("could not load " + wsdlLoc, ex);
}
@@ -257,7 +271,8 @@
Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
// select WSDL portType if given name
- PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
+ PortType portType =
+ WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
init(def, service, portType);
if (Trc.ON)
@@ -280,7 +295,8 @@
* The equivalent {@link org.apache.wsif.WSIFServiceFactory}.getService method
* should be used to create a WSIFService.
*/
- WSIFServiceImpl(Definition def, Service service, Map factoryFeatures) throws WSIFException {
+ WSIFServiceImpl(Definition def, Service service, Map factoryFeatures)
+ throws WSIFException {
this(def, service, null, factoryFeatures);
}
@@ -290,7 +306,11 @@
* The equivalent {@link org.apache.wsif.WSIFServiceFactory}.getService method
* should be used to create a WSIFService.
*/
- WSIFServiceImpl(Definition def, Service service, PortType portType, Map factoryFeatures)
+ WSIFServiceImpl(
+ Definition def,
+ Service service,
+ PortType portType,
+ Map factoryFeatures)
throws WSIFException {
Trc.entry(this, def, service, portType, factoryFeatures);
@@ -313,7 +333,7 @@
} catch (WSDLException we) {
Trc.ignoredException(we);
}
-
+
init(def, service, portType);
if (Trc.ON)
Trc.exit(deep());
@@ -325,11 +345,15 @@
* The equivalent {@link org.apache.wsif.WSIFServiceFactory}.getService method
* should be used to create a WSIFService.
*/
- WSIFServiceImpl(Definition def, String serviceNS, String serviceName, Map factoryFeatures)
+ WSIFServiceImpl(
+ Definition def,
+ String serviceNS,
+ String serviceName,
+ Map factoryFeatures)
throws WSIFException {
Trc.entry(this, def, serviceNS, serviceName, factoryFeatures);
- this.features = factoryFeatures;
+ this.features = factoryFeatures;
try {
PasswordAuthentication pa = getProxyAuthentication();
if (pa != null) {
@@ -370,9 +394,16 @@
String portTypeName,
Map factoryFeatures)
throws WSIFException {
- Trc.entry(this, def, serviceNS, serviceName, portTypeNS, portTypeName, factoryFeatures);
+ Trc.entry(
+ this,
+ def,
+ serviceNS,
+ serviceName,
+ portTypeNS,
+ portTypeName,
+ factoryFeatures);
- this.features = factoryFeatures;
+ this.features = factoryFeatures;
try {
PasswordAuthentication pa = getProxyAuthentication();
if (pa != null) {
@@ -398,7 +429,8 @@
Service service = WSIFUtils.selectService(def, serviceNS, serviceName);
// select WSDL portType if given by name or only one portType
- PortType portType = WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
+ PortType portType =
+ WSIFUtils.selectPortType(def, portTypeNS, portTypeName);
init(def, service, portType);
if (Trc.ON)
@@ -409,38 +441,42 @@
* Create a WSIF service instance from another instance. This constructor
* is used by the caching mechanism in WSIFServiceFactoryImpl
*/
- WSIFServiceImpl(WSIFServiceImpl wsi)
- throws WSIFException {
+ WSIFServiceImpl(WSIFServiceImpl wsi) throws WSIFException {
Trc.entry(this, wsi);
copyInitializedService(wsi);
if (Trc.ON)
Trc.exit(deep());
}
- /**
- * Copy the "read-only" parts of an initialized WSIFServiceImpl
- */
- private void copyInitializedService(WSIFServiceImpl svc) {
- this.def = svc.def;
+ /**
+ * Copy the "read-only" parts of an initialized WSIFServiceImpl
+ */
+ private void copyInitializedService(WSIFServiceImpl svc) {
+ this.def = svc.def;
this.service = svc.service;
this.portType = svc.portType;
- this.myPortsArr = new Port[svc.myPortsArr.length];
- System.arraycopy(svc.myPortsArr, 0, this.myPortsArr, 0, svc.myPortsArr.length);
+ this.myPortsArr = new Port[svc.myPortsArr.length];
+ System.arraycopy(
+ svc.myPortsArr,
+ 0,
+ this.myPortsArr,
+ 0,
+ svc.myPortsArr.length);
this.myPortsMap = (Map) ((Hashtable) svc.myPortsMap).clone();
- this.typeMap = svc.typeMap.copy();
- this.schemaTypesInitialised = svc.schemaTypesInitialised;
- this.typeMapInitialised = svc.typeMapInitialised;
- 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;
- }
- }
+ this.typeMap = svc.typeMap.copy();
+ this.schemaTypesInitialised = svc.schemaTypesInitialised;
+ this.typeMapInitialised = svc.typeMapInitialised;
+ 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;
+ }
+ }
/**
* Set the preferred port
@@ -483,7 +519,8 @@
}
Binding binding = port.getBinding();
if (binding == null) {
- throw new WSIFException("No binding found for port '" + portName + "'");
+ throw new WSIFException(
+ "No binding found for port '" + portName + "'");
}
PortType pt = binding.getPortType();
if (pt == null) {
@@ -504,7 +541,7 @@
try {
it = this.myPortsMap.keySet().iterator();
} catch (NullPointerException ne) {
- Trc.exception(ne);
+ Trc.exception(ne);
it = null;
}
Trc.exit();
@@ -527,9 +564,11 @@
WSIFProvider provider = WSIFPluggableProviders.getProvider(bindingNS);
if (provider == null) {
throw new WSIFException(
- "could not find suitable provider for binding namespace '" + bindingNS + "'");
+ "could not find suitable provider for binding namespace '"
+ + bindingNS
+ + "'");
}
- WSIFPort wsifPort =
+ WSIFPort wsifPort =
provider.createDynamicWSIFPort(def, service, port, typeMap);
wsifPort.setContext(getContext());
return wsifPort;
@@ -542,7 +581,7 @@
wp = getPort(this.preferredPort);
} else {
if (preferredPort != null)
- MessageLogger.log("WSIF.0011I",preferredPort);
+ MessageLogger.log("WSIF.0011I", preferredPort);
wp = getPort(null);
}
Trc.exit(wp);
@@ -584,8 +623,8 @@
}
// Store the chosen port so that we can query which was is being used
chosenPort = port;
-
- setupTypeMappings();
+
+ setupTypeMappings();
Trc.exit(portInstance);
return portInstance;
@@ -613,7 +652,7 @@
public void mapType(QName xmlType, Class javaType) throws WSIFException {
Trc.entry(this, xmlType, javaType);
if (mapper != null) {
- mapper.overrideTypeMapping(xmlType, javaType.getName());
+ mapper.overrideTypeMapping(xmlType, javaType.getName());
}
if (!schemaTypesInitialised) {
// Map it directly now!
@@ -630,7 +669,7 @@
public void mapType(QName xmlType, String className) throws WSIFException {
Trc.entry(this, xmlType, className);
if (mapper != null) {
- mapper.overrideTypeMapping(xmlType, className);
+ mapper.overrideTypeMapping(xmlType, className);
}
if (!schemaTypesInitialised) {
// Map it directly now!
@@ -666,22 +705,21 @@
// In order to use package mapping information, we need a list
// of types to apply the mapping to, so let's make sure we have one!
populateSchemaTypes(specialistLocator);
-
+
if (mapCon != null) {
- mapCon.overridePackageMapping(namespace, packageName);
+ mapCon.overridePackageMapping(namespace, packageName);
}
Trc.exit();
}
-
+
/**
* @deprecated this method is replaced by the getProvider
* method in the org.apache.util.WSIFPluggableProviders class
*/
public static WSIFProvider getDynamicWSIFProvider(String namespaceURI) {
Trc.entry(null, namespaceURI);
- WSIFProvider p =
- WSIFPluggableProviders.getProvider( namespaceURI );
- Trc.exit( p );
+ WSIFProvider p = WSIFPluggableProviders.getProvider(namespaceURI);
+ Trc.exit(p);
return p;
}
@@ -695,7 +733,8 @@
Trc.entry(null, providerNamespaceURI, provider);
WSIFPluggableProviders.overrideDefaultProvider(
- providerNamespaceURI, provider );
+ providerNamespaceURI,
+ provider);
Trc.exit();
}
@@ -706,7 +745,7 @@
*/
public static void setAutoLoadProviders(boolean b) {
Trc.entry(null, b);
- WSIFPluggableProviders.setAutoLoadProviders( b );
+ WSIFPluggableProviders.setAutoLoadProviders(b);
Trc.exit();
}
@@ -717,10 +756,10 @@
public Object getStub(String portName, Class iface) throws WSIFException {
Trc.entry(this, portName, iface);
- // Stub support has always included automatically mapping
- // types, albeit badly! So we need to make sure that we
- // do it now, regardless of what flag is set on the WSIFServiceFactory
- populateSchemaTypes(specialistLocator);
+ // Stub support has always included automatically mapping
+ // types, albeit badly! So we need to make sure that we
+ // do it now, regardless of what flag is set on the WSIFServiceFactory
+ populateSchemaTypes(specialistLocator);
// if the port is not available, force the expection now rather
// rather than go through the rest of this method
@@ -757,10 +796,10 @@
public Object getStub(Class iface) throws WSIFException {
Trc.entry(this, iface);
- // Stub support has always included automatically mapping
- // types, albeit badly! So we need to make sure that we
- // do it now, regardless of what flag is set on the WSIFServiceFactory
- populateSchemaTypes(specialistLocator);
+ // Stub support has always included automatically mapping
+ // types, albeit badly! So we need to make sure that we
+ // do it now, regardless of what flag is set on the WSIFServiceFactory
+ populateSchemaTypes(specialistLocator);
// if the port is not available, force the expection now rather
// rather than go through the rest of this method
@@ -825,7 +864,8 @@
if (service == null) {
Map services = WSIFUtils.getAllItems(def, "Service");
- service = (Service) WSIFUtils.getNamedItem(services, null, "Service");
+ service =
+ (Service) WSIFUtils.getNamedItem(services, null, "Service");
}
if (portType == null) {
@@ -833,7 +873,8 @@
Map ports = service.getPorts();
if (ports.size() == 0) {
throw new WSIFException(
- "WSDL must contain at least one port in " + service.getQName());
+ "WSDL must contain at least one port in "
+ + service.getQName());
}
for (Iterator i = ports.values().iterator(); i.hasNext();) {
@@ -884,40 +925,47 @@
try {
// Ignore port if provider is not available for supporting it
- List bindingExList = port.getBinding().getExtensibilityElements();
+ List bindingExList =
+ port.getBinding().getExtensibilityElements();
ExtensibilityElement bindingFirstEx =
(ExtensibilityElement) bindingExList.get(0);
- String bindingNS = bindingFirstEx.getElementType().getNamespaceURI();
+ String bindingNS =
+ bindingFirstEx.getElementType().getNamespaceURI();
String addressNS = bindingNS;
try {
List addressExList = port.getExtensibilityElements();
ExtensibilityElement addressFirstEx =
(ExtensibilityElement) addressExList.get(0);
- addressNS = addressFirstEx.getElementType().getNamespaceURI();
+ addressNS =
+ addressFirstEx.getElementType().getNamespaceURI();
} catch (NullPointerException npe) {
- Trc.ignoredException(npe);
- // ignore
+ Trc.ignoredException(npe);
+ // ignore
} catch (ArrayIndexOutOfBoundsException aie) {
- Trc.ignoredException(aie);
- // Extensibility element 0 does not exist
- // Allow address namespace to be the same as binding
+ Trc.ignoredException(aie);
+ // Extensibility element 0 does not exist
+ // Allow address namespace to be the same as binding
}
// Check for a provider that supports the
- if (WSIFPluggableProviders.isProviderAvailable(bindingNS, addressNS) ) {
- // check if port has the same port type
- if (binding.getPortType().getQName().equals(portType.getQName())) {
- String portName = port.getName();
- myPortsMap.put(portName, port);
- }
+ if (WSIFPluggableProviders
+ .isProviderAvailable(bindingNS, addressNS)) {
+ // check if port has the same port type
+ if (binding
+ .getPortType()
+ .getQName()
+ .equals(portType.getQName())) {
+ String portName = port.getName();
+ myPortsMap.put(portName, port);
+ }
}
} catch (NullPointerException e) {
- Trc.ignoredException(e);
+ Trc.ignoredException(e);
// Binding or extensibility element or QName was null
// any of which means something's not right with
// the port so don't include it.
} catch (ArrayIndexOutOfBoundsException aie) {
- Trc.ignoredException(aie);
- // Extensibility element 0 does not exist
+ Trc.ignoredException(aie);
+ // Extensibility element 0 does not exist
}
}
int size = myPortsMap.size();
@@ -929,33 +977,31 @@
myPortsArr[count++] = port;
}
- // Set up the WSIFMapper and WSIFMappingConvention appropriately
- String mapperClass = null;
- String mappingConvClass = null;
+ // Set up the WSIFMapper and WSIFMappingConvention appropriately
+ String mapperClass = null;
+ String mappingConvClass = null;
try {
- mapperClass =
- (String) features.get(
- WSIFConstants.WSIF_FEATURE_MAPPER_CLASS);
+ mapperClass =
+ (String) features.get(WSIFConstants.WSIF_FEATURE_MAPPER_CLASS);
} catch (ClassCastException cce) {
Trc.ignoredException(cce);
}
try {
- mappingConvClass =
+ mappingConvClass =
(String) features.get(
- WSIFConstants.WSIF_FEATURE_MAPPINGCONVENTION_CLASS);
+ 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);
- }
- }
+ overrideMapper(mapperClass);
+ overrideMappingConvention(mappingConvClass);
+ // If automatic mapping of types is required, generate the list of SchemaType objects
+ if (autoMapTypesOn()) {
+ populateSchemaTypes(specialistLocator);
+ }
+ }
/**
* Check PortType information is consistent. This method can be updated when
@@ -980,15 +1026,18 @@
Input input = op.getInput();
Output output = op.getOutput();
if (input == null) {
- throw new WSIFException("missing input message for operation " + name);
+ throw new WSIFException(
+ "missing input message for operation " + name);
}
if (output == null) {
- throw new WSIFException("missing output message for operation " + name);
+ throw new WSIFException(
+ "missing output message for operation " + name);
}
} else if (opType.equals(OperationType.ONE_WAY)) {
Input input = op.getInput();
if (input == null) {
- throw new WSIFException("missing input message for operation " + name);
+ throw new WSIFException(
+ "missing input message for operation " + name);
}
} else {
// Log message
@@ -1011,8 +1060,10 @@
try {
checkWSDL(def);
} catch (WSDLException ex) {
- Trc.exception(ex);
- throw new WSIFException("invalid WSDL defintion " + def.getQName(), ex);
+ Trc.exception(ex);
+ throw new WSIFException(
+ "invalid WSDL defintion " + def.getQName(),
+ ex);
}
}
@@ -1024,7 +1075,9 @@
* port factory may not need them...).
*/
private void checkWSDL(Definition def) throws WSDLException {
- for (Iterator i = def.getMessages().values().iterator(); i.hasNext();) {
+ for (Iterator i = def.getMessages().values().iterator();
+ i.hasNext();
+ ) {
Message v = (Message) i.next();
if (v.isUndefined()) {
throw new WSDLException(
@@ -1032,7 +1085,9 @@
"referencing undefined message " + v);
}
}
- for (Iterator i = def.getPortTypes().values().iterator(); i.hasNext();) {
+ for (Iterator i = def.getPortTypes().values().iterator();
+ i.hasNext();
+ ) {
PortType v = (PortType) i.next();
if (v.isUndefined()) {
throw new WSDLException(
@@ -1040,7 +1095,9 @@
"referencing undefined portType " + v);
}
}
- for (Iterator i = def.getBindings().values().iterator(); i.hasNext();) {
+ for (Iterator i = def.getBindings().values().iterator();
+ i.hasNext();
+ ) {
Binding v = (Binding) i.next();
if (v.isUndefined()) {
throw new WSDLException(
@@ -1066,19 +1123,20 @@
*/
public WSIFMessage getContext() throws WSIFException {
Trc.entry(this);
- WSIFMessage contextCopy;
- if (this.context == null) {
- contextCopy = new WSIFDefaultMessage();
- } else {
- try {
- contextCopy = (WSIFMessage) this.context.clone();
- } catch (CloneNotSupportedException e) {
- throw new WSIFException(
- "CloneNotSupportedException cloning context", e);
- }
- }
+ WSIFMessage contextCopy;
+ if (this.context == null) {
+ contextCopy = new WSIFDefaultMessage();
+ } else {
+ try {
+ contextCopy = (WSIFMessage) this.context.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new WSIFException(
+ "CloneNotSupportedException cloning context",
+ e);
+ }
+ }
Trc.exit(contextCopy);
- return contextCopy;
+ return contextCopy;
}
/**
@@ -1088,67 +1146,75 @@
public void setContext(WSIFMessage context) {
Trc.entry(this, context);
if (context == null) {
- throw new IllegalArgumentException("context must not be null");
+ throw new IllegalArgumentException("context must not be null");
}
this.context = context;
Trc.exit();
}
-
- /**
- * Override the WSIFMapper used by this WSIFService
- * @param mapperClassName The class name for the WSIFMapper implementation to be used by this WSIFService
- * @throws A WSIFException if the WSIFMapper cannot be found or set
- */
- protected void overrideMapper(String mapperClassName) throws WSIFException {
- if (mapperClassName != null) {
- mapper = WSIFMapperFactory.newMapper(mapperClassName);
- } else {
- mapper = WSIFMapperFactory.newMapper();
- }
- }
-
- /**
- * Override the WSIFMappingConvention used by this WSIFService
- * @param mappingConvClassName The class name for the WSIFMappingConvention implementation
- * to be used by this WSIFService
- * @throws A WSIFException if the WSIFMappingConvention cannot be found or set
- */
- protected void overrideMappingConvention(String mappingConvClassName) throws WSIFException {
- if (mappingConvClassName != null) {
- mapCon = WSIFMappingConventionFactory.newMappingConvention(mappingConvClassName);
- } else {
- mapCon = WSIFMappingConventionFactory.newMappingConvention();
- }
- mapper.setMappingConvention(mapCon);
- }
-
- /**
- * Parse the schema(s) associated with the wsdl and find all the types/elements that are defined.
- * @param loc A WSDLLocator to use in finding imported xsd files
- * @throws A WSIFException if the parsing fails
- */
- protected void populateSchemaTypes(WSDLLocator loc)
+
+ /**
+ * Override the WSIFMapper used by this WSIFService
+ * @param mapperClassName The class name for the WSIFMapper implementation to be used by this WSIFService
+ * @throws A WSIFException if the WSIFMapper cannot be found or set
+ */
+ protected void overrideMapper(String mapperClassName)
+ throws WSIFException {
+ if (mapperClassName != null) {
+ mapper = WSIFMapperFactory.newMapper(mapperClassName);
+ } else {
+ mapper = WSIFMapperFactory.newMapper();
+ }
+ }
+
+ /**
+ * Override the WSIFMappingConvention used by this WSIFService
+ * @param mappingConvClassName The class name for the WSIFMappingConvention implementation
+ * to be used by this WSIFService
+ * @throws A WSIFException if the WSIFMappingConvention cannot be found or set
+ */
+ protected void overrideMappingConvention(String mappingConvClassName)
throws WSIFException {
+ if (mappingConvClassName != null) {
+ mapCon =
+ WSIFMappingConventionFactory.newMappingConvention(
+ mappingConvClassName);
+ } else {
+ mapCon = WSIFMappingConventionFactory.newMappingConvention();
+ }
+ mapper.setMappingConvention(mapCon);
+ }
+
+ /**
+ * Parse the schema(s) associated with the wsdl and find all the types/elements that are defined.
+ * @param loc A WSDLLocator to use in finding imported xsd files
+ * @throws A WSIFException if the parsing fails
+ */
+ protected void populateSchemaTypes(WSDLLocator loc) throws WSIFException {
// Get a lock on the list of type. Nobody else should be able to alter it
- // while we are working in this method.
+ // while we are working in this method.
synchronized (schemaTypes) {
- // Don't parse the schema if we've already done it!!
- if (schemaTypesInitialised) return;
- if (loc == null) {
- loc = new WSIFWSDLLocatorImpl((String) null, (String) null, (ClassLoader) null);
- }
+ // Don't parse the schema if we've already done it!!
+ if (schemaTypesInitialised)
+ return;
+ if (loc == null) {
+ loc =
+ new WSIFWSDLLocatorImpl(
+ (String) null,
+ (String) null,
+ (ClassLoader) null);
+ }
Parser.getAllSchemaTypes(def, schemaTypes, loc);
-
+
// if we can, close the WSDLLocator
if (loc instanceof ClosableLocator) {
- try {
- ((ClosableLocator) loc).close();
- } catch (IOException ioe) {
- // Ignore. Is this the correct thing to do??
- Trc.ignoredException(ioe);
- }
+ try {
+ ((ClosableLocator) loc).close();
+ } catch (IOException ioe) {
+ // Ignore. Is this the correct thing to do??
+ Trc.ignoredException(ioe);
+ }
}
-
+
// 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();
@@ -1156,28 +1222,31 @@
WSIFConstants.CONTEXT_SCHEMA_TYPES,
Collections.unmodifiableList(schemaTypes));
setContext(ctx);
-
+
schemaTypesInitialised = true;
}
}
- /**
- * Create and set all mappings from xml types to Java classes
- * @throws A WSIFException if the mapping process fails
- */
+ /**
+ * Create and set all mappings from xml types to Java classes
+ * @throws A WSIFException if the mapping process fails
+ */
protected void setupTypeMappings() throws WSIFException {
- // Get a lock on the list of type. Nobody else should be able to alter it
- // while we are working in this method.
+ // Get a lock on the list of type. Nobody else should be able to alter it
+ // while we are working in this method.
synchronized (schemaTypes) {
- // Don't calculate the mappings if we've already done it!!
- // This is a one off method. Perhaps in the future a way of updating
- // existing mappings could be added.
- if (typeMapInitialised) return;
-
- // Without a mapper we can't do any mapping!!
+ // Don't calculate the mappings if we've already done it!!
+ // This is a one off method. Perhaps in the future a way of updating
+ // existing mappings could be added.
+ if (typeMapInitialised)
+ return;
+
+ // Without a mapper we can't do any mapping!!
if (mapper == null) {
- Trc.event(this, "Automatic mapping of types did not take place "+
- "because mapper was null");
+ Trc.event(
+ this,
+ "Automatic mapping of types did not take place "
+ + "because mapper was null");
return;
}
SchemaType[] types = new SchemaType[schemaTypes.size()];
@@ -1226,7 +1295,7 @@
return false;
}
} else {
- return false;
+ return false;
}
}
@@ -1235,7 +1304,7 @@
Object pa =
features.get(WSIFConstants.WSIF_FEATURE_PROXY_AUTHENTICATION);
if (pa != null && pa instanceof PasswordAuthentication) {
- return (PasswordAuthentication) pa;
+ return (PasswordAuthentication) pa;
}
}
return null;
@@ -1246,15 +1315,20 @@
try {
buff = new String(this.toString());
buff += "\nprovidersExtRegs:"
- + (providersExtRegs == null ? "null" : providersExtRegs.toString());
+ + (providersExtRegs == null
+ ? "null"
+ : providersExtRegs.toString());
buff += "\ndef:" + Trc.brief(def);
buff += "\nservice:" + Trc.brief(service);
buff += "\nportType:" + Trc.brief(portType);
- buff += "\nmyPortsArr:" + (myPortsArr == null ? "null" : myPortsArr.toString());
+ buff += "\nmyPortsArr:"
+ + (myPortsArr == null ? "null" : myPortsArr.toString());
buff += "\nmyPortsMap:" + Trc.brief(myPortsMap);
- buff += "\ntypeMap:" + (typeMap == null ? "null" : typeMap.toString());
+ buff += "\ntypeMap:"
+ + (typeMap == null ? "null" : typeMap.toString());
buff += "\ntypeMapInitialised:" + typeMapInitialised;
- buff += "\npreferredPort:" + (preferredPort == null ? "null" : preferredPort);
+ buff += "\npreferredPort:"
+ + (preferredPort == null ? "null" : preferredPort);
buff += "\nchosenPort:" + Trc.brief(chosenPort);
buff += "\ncontext:" + context;
} catch (Exception e) {
@@ -1263,4 +1337,3 @@
return buff;
}
}
-