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.acl.basic;
17  
18  /***
19   * Provides a cache of {@link BasicAclEntry} objects.
20   * 
21   * <P>
22   * Implementations should provide appropriate methods to set their cache
23   * parameters (eg time-to-live) and/or force removal of entities before their
24   * normal expiration. These are not part of the
25   * <code>BasicAclEntryCache</code> interface contract because they vary
26   * depending on the type of caching system used (eg in-memory vs disk vs
27   * cluster vs hybrid).
28   * </p>
29   *
30   * @author Ben Alex
31   * @version $Id: BasicAclEntryCache.java,v 1.2 2005/11/17 00:55:47 benalex Exp $
32   */
33  public interface BasicAclEntryCache {
34      //~ Methods ================================================================
35  
36      /***
37       * Obtains an array of {@link BasicAclEntry}s from the cache.
38       *
39       * @param aclObjectIdentity which should be obtained from the cache
40       *
41       * @return any applicable <code>BasicAclEntry</code>s (no
42       *         <code>null</code>s are permitted in the returned array) or
43       *         <code>null</code> if the object identity could not be found or
44       *         if the cache entry has expired
45       */
46      public BasicAclEntry[] getEntriesFromCache(
47          AclObjectIdentity aclObjectIdentity);
48  
49      /***
50       * Places an array of {@link BasicAclEntry}s in the cache.
51       * 
52       * <P>
53       * No <code>null</code>s are allowed in the passed array. If any
54       * <code>null</code> is passed, the implementation may throw an exception.
55       * </p>
56       *
57       * @param basicAclEntry the ACL entries to cache (the key will be extracted
58       *        from the {@link BasicAclEntry#getAclObjectIdentity()} method
59       */
60      public void putEntriesInCache(BasicAclEntry[] basicAclEntry);
61  }