There are several steps involved in developing your domain specific assertions, these are:
- Implementing the Assertion and AssertionBuilder interfaces
- Registering the AssertionBuilder with the AssertionBuilderRegistry
- 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(...); } } }