View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements. See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License. You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied. See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.ws.security.message;
21  
22  import java.util.List;
23  
24  import org.apache.ws.security.WSSecurityException;
25  import org.w3c.dom.Element;
26  
27  /**
28   * This interface defines a pluggable way of locating Elements that are referenced via an Id.
29   */
30  public interface CallbackLookup {
31  
32      /**
33       * Get the DOM element that corresponds to the given id and ValueType reference. The Id can 
34       * be a wsu:Id or else an Id attribute, or a SAML Id when the ValueType refers to a SAML
35       * Assertion.
36       * @param id The id of the element to locate
37       * @param valueType The ValueType attribute of the element to locate (can be null)
38       * @param checkMultipleElements If true then go through the entire tree and return 
39       *        null if there are multiple elements with the same Id
40       * @return the located element
41       * @throws WSSecurityException
42       */
43      Element getElement(
44          String id, String valueType, boolean checkMultipleElements
45      ) throws WSSecurityException;
46      
47      /**
48       * Get the DOM element(s) that correspond to the given localname/namespace. 
49       * @param localname The localname of the Element(s)
50       * @param namespace The namespace of the Element(s)
51       * @return the located element(s)
52       * @throws WSSecurityException
53       */
54      List<Element> getElements(
55          String localname, String namespace
56      ) throws WSSecurityException;
57  }