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;
17
18 import javax.xml.stream.XMLStreamException;
19 import javax.xml.stream.XMLStreamWriter;
20
21 /**
22 * This is an interface which any component of the framework must implement.
23 */
24 public interface PolicyComponent {
25
26 /**
27 * Serializes the PolicyComponent using an XMLStreamWriter.
28 *
29 * @param writer the writer that the component should write itself
30 * @throws XMLStreamException if an errors in the process of serialization of the
31 * PolicyComponent.
32 */
33 public void serialize(XMLStreamWriter writer) throws XMLStreamException;
34
35 /**
36 * Returns a short value which uniquely identify the type of the
37 * PolicyComponent.
38 *
39 * @return Constants.POLICY for Policy type PolicyComponent
40 * Constants.EXACTLYONE for ExactlyOne type PolicyComponent
41 * Constants.ALL for All type PolicyComponent
42 * Constants.ASSERTION for Assertion type PolicyComponent
43 */
44 public short getType();
45
46 /**
47 * Returns true if the argument is equal to self.
48 *
49 * @param policyComponent the PolicyComponent to check whether self is
50 * logically equal or not
51 * @return ture if the argument is equal to self.
52 */
53 public boolean equal(PolicyComponent policyComponent);
54 }