Coverage Report - org.apache.shiro.jndi.JndiCallback
 
Classes in this File Line Coverage Branch Coverage Complexity
JndiCallback
N/A
N/A
1
 
 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  
 package org.apache.shiro.jndi;
 20  
 
 21  
 import javax.naming.Context;
 22  
 import javax.naming.NamingException;
 23  
 
 24  
 /**
 25  
  * Callback interface to be implemented by classes that need to perform an
 26  
  * operation (such as a lookup) in a JNDI context. This callback approach
 27  
  * is valuable in simplifying error handling, which is performed by the
 28  
  * JndiTemplate class. This is a similar to JdbcTemplate's approach.
 29  
  *
 30  
  * <p>Note that there is hardly any need to implement this callback
 31  
  * interface, as JndiTemplate provides all usual JNDI operations via
 32  
  * convenience methods.
 33  
  *
 34  
  * <p>Note that this interface is an exact copy of the Spring Framework's identically named interface from
 35  
  * their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require a full dependency on the
 36  
  * Spring framework, nor does Spring make available only its JNDI classes in a small jar, or we would have used that.
 37  
  * Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and authors have remained in tact.
 38  
  *
 39  
  * @see JndiTemplate
 40  
  */
 41  
 public interface JndiCallback {
 42  
 
 43  
     /**
 44  
      * Do something with the given JNDI context.
 45  
      * Implementations don't need to worry about error handling
 46  
      * or cleanup, as the JndiTemplate class will handle this.
 47  
      *
 48  
      * @param ctx the current JNDI context
 49  
      * @return a result object, or <code>null</code>
 50  
      * @throws NamingException if thrown by JNDI methods
 51  
      */
 52  
     Object doInContext(Context ctx) throws NamingException;
 53  
 
 54  
 }