01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * 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: * Implemented by classes that store and can identify the {@link
24: * ConfigAttributeDefinition} that applies to a given secure object
25: * invocation.
26: *
27: * @author Ben Alex
28: * @version $Id: ObjectDefinitionSource.java 1784 2007-02-24 21:00:24Z luke_t $
29: */
30: public interface ObjectDefinitionSource {
31: //~ Methods ========================================================================================================
32:
33: /**
34: * Accesses the <code>ConfigAttributeDefinition</code> that applies to a given secure object.<P>Returns
35: * <code>null</code> if no <code>ConfigAttribiteDefinition</code> applies.</p>
36: *
37: * @param object the object being secured
38: *
39: * @return the <code>ConfigAttributeDefinition</code> that applies to the passed object
40: *
41: * @throws IllegalArgumentException if the passed object is not of a type supported by the
42: * <code>ObjectDefinitionSource</code> implementation
43: */
44: ConfigAttributeDefinition getAttributes(Object object)
45: throws IllegalArgumentException;
46:
47: /**
48: * If available, all of the <code>ConfigAttributeDefinition</code>s defined by the implementing class.<P>This
49: * is used by the {@link AbstractSecurityInterceptor} to perform startup time validation of each
50: * <code>ConfigAttribute</code> configured against it.</p>
51: *
52: * @return an iterator over all the <code>ConfigAttributeDefinition</code>s or <code>null</code> if unsupported
53: */
54: Iterator getConfigAttributeDefinitions();
55:
56: /**
57: * Indicates whether the <code>ObjectDefinitionSource</code> implementation is able to provide
58: * <code>ConfigAttributeDefinition</code>s for the indicated secure object type.
59: *
60: * @param clazz the class that is being queried
61: *
62: * @return true if the implementation can process the indicated class
63: */
64: boolean supports(Class clazz);
65: }
|