[prev in list] [next in list] [prev in thread] [next in thread]
List: woden-dev
Subject: svn commit: r349267 -
From: jkaputin () apache ! org
Date: 2005-11-27 18:04:38
Message-ID: 20051127180438.1936.qmail () minotaur ! apache ! org
[Download RAW message or body]
Author: jkaputin
Date: Sun Nov 27 10:04:32 2005
New Revision: 349267
URL: http://svn.apache.org/viewcvs?rev=349267&view=rev
Log:
Modified how binding faults are stored and retrieved
within binding.
Modified:
incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java
Modified: incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java?rev=349267&r1=349266&r2=349267&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java \
(original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/BindingImpl.java Sun \
Nov 27 10:04:32 2005 @@ -51,17 +51,22 @@
* TODO determine type of retrieval required for binding faults and operations
* as this may influence the choice of collection type - e.g. Map for keyed \
access,
* or a List for sequential access.
- * A Map of binding faults or operations is keyed by the 'ref' attribute qname.
- * When the 'ref' qname is missing, we can store these objects in the Map
- * inside a List keyed by null rather than as individual objects keyed by qname.
+ *
+ * Binding faults and operations could be accessed by their 'ref' attribute \
qname, which + * typically suggests a Map implementation keyed by 'ref' qname. \
However, with these + * objects we have a null key problem when their 'ref' qname \
is missing. These 'null key' + * objects could be stored in a List, separately to \
the 'keyed' objects stored in the Map - + * i.e. they cannot be looked up in a \
Map because they have no key, but they must be stored + * so we store them in a \
list.
*
* TODO Final implementation choice will probably depend on what the resulting \
code
* looks like, its readability, etc. It may be that List is a better \
implementation choice,
* even for retrieval based on a 'ref' qname key, because the null key problem \
does not arise.
- * For now, I have implemented binding faults as a Map and binding operations as \
a List
- * to compare the implementations.
+ * For now, I have implemented binding faults as a Map of keyed objects AND a \
list of null key + * objects, and have implemented binding operations as a List \
to compare the implementations.
*/
- private Map fFaults = new HashMap();
+ private Map fFaultsWithRef = new HashMap();
+ private List fFaultsWithoutRef = new Vector();
private List fOperations = new Vector();
/* ************************************************************
@@ -113,14 +118,12 @@
public BindingFault[] getBindingFaults()
{
Collection coll = null;
- if(fFaults.containsKey(null)) {
- coll = (Collection)fFaults.get(null); //collect faults without a 'ref' \
qname
- Map map = new HashMap();
- map.putAll(fFaults);
- map.remove(null); //collect faults with a 'ref' \
qname
- coll.addAll(map.values()); //collect all faults (with and \
without 'ref') + if(fFaultsWithoutRef.isEmpty()) {
+ coll = fFaultsWithRef.values();
} else {
- coll = fFaults.values(); //all faults have a 'ref' qname
+ coll = new Vector();
+ coll.addAll(fFaultsWithoutRef);
+ coll.addAll(fFaultsWithRef.values());
}
BindingFault[] array = new BindingFault[coll.size()];
@@ -188,24 +191,18 @@
* TODO see previous comments for fFaults and getBindingFaults() about the null \
key problem
* with the use of Map, rather than List.
*
+ * Binding faults are stored in a Map keyed by their 'ref' attribute qname.
+ * If they are missing their 'ref' qname, they are stored in a list instead of \
the map. + *
* @see org.apache.woden.wsdl20.xml.BindingElement#addBindingFaultElement(org.apache.woden.wsdl20.xml.BindingFaultElement)
*/
public void addBindingFaultElement(BindingFaultElement fault)
{
QName qname = fault.getRef();
- if(qname != null)
- {
- fFaults.put(qname, fault);
- }
- else
- {
- //Any binding faults missing their 'ref' qname, are stored in a list \
keyed by null.
- List list = (List)fFaults.get(null);
- if(list == null) {
- list = new Vector();
- fFaults.put(null, list);
- }
- list.add(fault);
+ if(qname != null) {
+ fFaultsWithRef.put(qname, fault);
+ } else {
+ fFaultsWithoutRef.add(fault);
}
}
@@ -218,14 +215,12 @@
public BindingFaultElement[] getBindingFaultElements()
{
Collection coll = null;
- if(fFaults.containsKey(null)) {
- coll = (Collection)fFaults.get(null); //collect faults without a 'ref' \
qname
- Map map = new HashMap();
- map.putAll(fFaults);
- map.remove(null); //collect faults with a 'ref' \
qname
- coll.addAll(map.values()); //collect all faults (with and \
without 'ref') + if(fFaultsWithoutRef.isEmpty()) {
+ coll = fFaultsWithRef.values();
} else {
- coll = fFaults.values(); //all faults have a 'ref' qname
+ coll = new Vector();
+ coll.addAll(fFaultsWithoutRef);
+ coll.addAll(fFaultsWithRef.values());
}
BindingFaultElement[] array = new BindingFaultElement[coll.size()];
@@ -263,11 +258,7 @@
*/
public BindingFaultElement getBindingFaultElement(QName qname)
{
- if(qname != null) {
- return (BindingFaultElement)fFaults.get(qname);
- } else {
- return null;
- }
+ return (BindingFaultElement)fFaultsWithRef.get(qname);
}
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic