View Javadoc

1   /* Copyright 2004 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.acegisecurity.intercept;
17  
18  import org.acegisecurity.ConfigAttributeDefinition;
19  
20  import java.util.Iterator;
21  
22  
23  /***
24   * Implemented by classes that store and can identify the {@link
25   * ConfigAttributeDefinition} that applies to a given secure object
26   * invocation.
27   *
28   * @author Ben Alex
29   * @version $Id: ObjectDefinitionSource.java,v 1.3 2005/11/17 00:55:51 benalex Exp $
30   */
31  public interface ObjectDefinitionSource {
32      //~ Methods ================================================================
33  
34      /***
35       * Accesses the <code>ConfigAttributeDefinition</code> that applies to a
36       * given secure object.
37       * 
38       * <P>
39       * Returns <code>null</code> if no <code>ConfigAttribiteDefinition</code>
40       * applies.
41       * </p>
42       *
43       * @param object the object being secured
44       *
45       * @return the <code>ConfigAttributeDefinition</code> that applies to the
46       *         passed object
47       *
48       * @throws IllegalArgumentException if the passed object is not of a type
49       *         supported by the <code>ObjectDefinitionSource</code>
50       *         implementation
51       */
52      public ConfigAttributeDefinition getAttributes(Object object)
53          throws IllegalArgumentException;
54  
55      /***
56       * If available, all of the <code>ConfigAttributeDefinition</code>s defined
57       * by the implementing class.
58       * 
59       * <P>
60       * This is used by the {@link AbstractSecurityInterceptor} to perform
61       * startup time validation of each <code>ConfigAttribute</code> configured
62       * against it.
63       * </p>
64       *
65       * @return an iterator over all the <code>ConfigAttributeDefinition</code>s
66       *         or <code>null</code> if unsupported
67       */
68      public Iterator getConfigAttributeDefinitions();
69  
70      /***
71       * Indicates whether the <code>ObjectDefinitionSource</code> implementation
72       * is able to provide <code>ConfigAttributeDefinition</code>s for the
73       * indicated secure object type.
74       *
75       * @param clazz the class that is being queried
76       *
77       * @return true if the implementation can process the indicated class
78       */
79      public boolean supports(Class clazz);
80  }