15 |
|
// not really needed if we default to deny :) |
16 |
|
//acl.add(ACL.DENY, "*"); |
17 |
|
|
18 |
< |
// dump our ACL to the console |
19 |
< |
System.out.println(acl.getStringACL()); |
18 |
> |
// dump our ACL to the console before serialization |
19 |
> |
System.out.println("BEFORE: "+acl.getStringACL()); |
20 |
> |
|
21 |
> |
// name for our serialized ACL |
22 |
> |
String aclFilename = "aclfile"; |
23 |
> |
|
24 |
> |
// write out our ACL to a file |
25 |
> |
try { |
26 |
> |
ObjectOutputStream ostream = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(aclFilename))); |
27 |
> |
ostream.writeObject(acl); |
28 |
> |
ostream.flush(); |
29 |
> |
ostream.close(); |
30 |
> |
} |
31 |
> |
catch (Exception e) { |
32 |
> |
System.out.println("exception: " + e); |
33 |
> |
e.printStackTrace(); |
34 |
> |
System.exit(1); |
35 |
> |
} |
36 |
> |
|
37 |
> |
// and read it back in :) |
38 |
> |
try { |
39 |
> |
ObjectInputStream istream = new ObjectInputStream(new BufferedInputStream(new FileInputStream(aclFilename))); |
40 |
> |
acl = (ACL) istream.readObject(); |
41 |
> |
istream.close(); |
42 |
> |
} |
43 |
> |
catch (Exception e) { |
44 |
> |
System.out.println("exception: " + e); |
45 |
> |
e.printStackTrace(); |
46 |
> |
System.exit(1); |
47 |
> |
} |
48 |
> |
|
49 |
> |
// dump our ACL to the console after serialization |
50 |
> |
System.out.println("AFTER: "+acl.getStringACL()); |
51 |
|
|
52 |
|
// run a few tests |
53 |
|
System.out.println("killigrew.ukc.ac.uk: " + acl.check("killigrew.ukc.ac.uk")); |