1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.acl.basic.cache;
17
18 import org.acegisecurity.acl.basic.BasicAclEntry;
19
20 import java.io.Serializable;
21
22 import org.springframework.util.Assert;
23
24
25 /***
26 * Used by {@link EhCacheBasedAclEntryCache} to store the array of
27 * <code>BasicAclEntry</code>s in the cache.
28 *
29 * <P>
30 * This is necessary because caches store a single object per key, not an
31 * array.
32 * </p>
33 *
34 * <P>
35 * This class uses value object semantics. ie: construction-based
36 * initialisation without any setters for the properties.
37 * </p>
38 *
39 * @author Ben Alex
40 * @version $Id: BasicAclEntryHolder.java,v 1.3 2005/11/17 00:56:47 benalex Exp $
41 */
42 public class BasicAclEntryHolder implements Serializable {
43
44
45 private BasicAclEntry[] basicAclEntries;
46
47
48
49 /***
50 * Constructs the <code>BasicAclEntryHolder</code>.
51 *
52 * @param aclEntries to cache (any <code>null</code>s will cause an
53 * exception, which should not be a problem as the contract for
54 * <code>BasicAclEntryCache</code> allows exceptions if
55 * <code>null</code>s are presented)
56 *
57 * @throws IllegalArgumentException if a <code>null</code> exists anywhere
58 * in the <code>aclEntries</code> or if a <code>null</code> is
59 * passed to the constructor
60 */
61 public BasicAclEntryHolder(BasicAclEntry[] aclEntries) {
62 Assert.notNull(aclEntries, "aclEntries cannot be null");
63
64 for (int i = 0; i < aclEntries.length; i++) {
65 Assert.notNull(aclEntries[i], "aclEntries cannot be null");
66 }
67
68 this.basicAclEntries = aclEntries;
69 }
70
71
72
73 public BasicAclEntry[] getBasicAclEntries() {
74 return basicAclEntries;
75 }
76 }