1 /* 2 * Copyright 2001-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.neethi.builders; 17 18 import javax.xml.namespace.QName; 19 20 import org.apache.axiom.om.OMElement; 21 import org.apache.neethi.Assertion; 22 import org.apache.neethi.AssertionBuilderFactory; 23 24 /** 25 * AssertionBuilder is the interface which must implement by any 26 * CustomAssertionBuilder. It defines a single method which takes an OMElement 27 * and an AssertionFactory instace and creates an Assertion from the given 28 * OMElement. Custom AssertionBuilder authors can use the AssertionFactory 29 * specified to build Assertions for any unknown OMElements inside the given 30 * OMElement. They are given the opportunity to control the behaviour of 31 * Assertion operations based on the corresponding domain policy assertion of 32 * the given OMElement and the level of its processing. 33 * 34 */ 35 public interface AssertionBuilder { 36 37 /** 38 * Constructs an assertion from a known OMElement. If that element contains 39 * other child elements that the Builder doesn't understand, it uses the 40 * AssertionBuilderFactory to construct assertions from them. 41 * 42 * @param element 43 * the known element from which an assertion can be built 44 * @param factory 45 * the factory from which AssertionBuilders are taken to build 46 * assertion from unknown child elements 47 * @return an Assertion built from the given element 48 * @throws IllegalArgumentException 49 * if the given element is malformed 50 */ 51 public Assertion build(OMElement element, AssertionBuilderFactory factory) 52 throws IllegalArgumentException; 53 54 /** 55 * Returns an array of QNames of OMElements from which assertion can be 56 * built by this AssertionFactory. 57 * 58 * @return an array of QNames of known OMElements 59 */ 60 public QName[] getKnownElements(); 61 }