You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

There are several steps involved in developing your domain specific assertions, these are:

  1. Implementing the Assertion and AssertionBuilder interfaces
  2. Registering the AssertionBuilder with the AssertionBuilderRegistry
  3. Providing runtime support for the Assertion - in form of an interceptor or inside a conduit or a destination.
    They are outlined in some more detail below:

Implementing the Assertion Interface

Implementing the AssertionBuilder Interface

Registering the AssertionBuilder with the AssertionBuilderRegistry

Implementing a Policy-Aware Interceptor

This is the easiest way of providing runtime support for an Assertion, and essentially consist in steps 1. and 2. described in WS-Policy Framework Overview:

import org.apache.cxf.ws.policy.AssertionInfoMap;

class MyPolicyAwareInterceptor {
   static final QName assertionType = new QName("http://mycompany.com}", "MyType"});
   public void handleMessage(Message message) {

      // get AssertionInfoMap
       org.apache.cxf.ws.policy.AssertionInfoMap aim = message.get(org.apache.cxf.ws.policy.AssertionInfoMap.class);
       Collection<AssertionInfo ais> = aim.get(assertionType );

       // extract Assertion information
       for (AssertionInfo ai : ais) {
           org.apache.neethi.Assertion a = ai.getAssertion();
           MyAssertionType ma = (MyAssertionType)a;
          // digest ....
       }

       // process message ...
            // express support

       for (AssertionInfo ai : ais) {
           ai.setAsserted(...);
       }          }
}

Implementing a Policy-Aware Conduit/Destination

  • No labels