Author: gdaniels
Date: Tue Nov 13 14:14:23 2007
New Revision: 594669
URL: http://svn.apache.org/viewvc?rev=594669&view=rev
Log:
Add new API for iterating with a RolePlayer and a namespace.
We should do a cleanup pass on all the header iterators after we finish
discussion of whether or not to add a stateful RolePlayer.
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java?rev=594669&r1=594668&r2=594669&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/soap/SOAPHeader.java
Tue Nov 13 14:14:23 2007
@@ -120,4 +120,21 @@
* @return Returns ArrayList.
*/
ArrayList getHeaderBlocksWithNSURI(String nsURI);
+
+ /**
+ * Get the appropriate set of headers for a RolePlayer in a particular
namespace
+ * <p/>
+ * The RolePlayer indicates whether it is the ultimate destination (in
which case headers with
+ * no role or the explicit UltimateDestination role will be included), and
any non-standard
+ * roles it supports. Headers targeted to "next" will always be included,
and those targeted to
+ * "none" (for SOAP 1.2) will never be included.
+ * <p/>
+ * This version of the API allows us to iterate only once over the headers
searching for
+ * a particular namespace for headers targeted at "us".
+ *
+ * @param rolePlayer a RolePlayer containing our role configuration
+ * @param namespace if specified, we'll only return headers from this
namespace
+ * @return an Iterator over all the HeaderBlocks this RolePlayer should
process.
+ */
+ Iterator getHeadersToProcess(RolePlayer rolePlayer, String namespace);
}
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java?rev=594669&r1=594668&r2=594669&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderImpl.java
Tue Nov 13 14:14:23 2007
@@ -68,7 +68,6 @@
* <CODE>SOAPHeader</CODE> object
* @throws org.apache.axiom.om.OMException
* if a SOAP error occurs
- * @throws OMException
*/
public abstract SOAPHeaderBlock addHeaderBlock(String localName,
OMNamespace ns)
@@ -86,6 +85,10 @@
*/
public Iterator getHeadersToProcess(RolePlayer rolePlayer) {
return null; // TODO: Implement this!
+ }
+
+ public Iterator getHeadersToProcess(RolePlayer rolePlayer, String
namespace) {
+ return null; // TODO: Implement this!
}
/**
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java?rev=594669&r1=594668&r2=594669&view=diff
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderImpl.java
Tue Nov 13 14:14:23 2007
@@ -88,6 +88,9 @@
class RolePlayerChecker implements Checker {
RolePlayer rolePlayer;
+ /** Optional namespace - if non-null we'll only return headers that match
*/
+ String namespace;
+
/**
* Constructor.
*
@@ -98,7 +101,17 @@
this.rolePlayer = rolePlayer;
}
+ public RolePlayerChecker(RolePlayer rolePlayer, String namespace) {
+ this.rolePlayer = rolePlayer;
+ this.namespace = namespace;
+ }
+
public boolean checkHeader(SOAPHeaderBlock header) {
+ // If we're filtering on namespace, check that first since the compare
is simpler.
+ if ((namespace != null) &&
!namespace.equals(header.getNamespace().getNamespaceURI())) {
+ return false;
+ }
+
String role = header.getRole();
SOAPVersion version = header.getVersion();
@@ -258,6 +271,22 @@
*/
public Iterator getHeadersToProcess(RolePlayer rolePlayer) {
return new HeaderIterator(new RolePlayerChecker(rolePlayer));
+ }
+
+ /**
+ * Get the appropriate set of headers for a RolePlayer.
+ * <p/>
+ * The RolePlayer indicates whether it is the ultimate destination (in
which case headers with
+ * no role or the explicit UltimateDestination role will be included), and
any non-standard
+ * roles it supports. Headers targeted to "next" will always be included,
and those targeted to
+ * "none" (for SOAP 1.2) will never be included.
+ *
+ * @param rolePlayer a RolePlayer containing our role configuration
+ * @param namespace if specified, we'll only return headers from this
namespace
+ * @return an Iterator over all the HeaderBlocks this RolePlayer should
process.
+ */
+ public Iterator getHeadersToProcess(RolePlayer rolePlayer, String
namespace) {
+ return new HeaderIterator(new RolePlayerChecker(rolePlayer,
namespace));
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]