ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/ACL/ACL.java
(Generate patch)

Comparing experimental/server/ACL/ACL.java (file contents):
Revision 1.3 by tdb, Fri Dec 21 16:49:18 2001 UTC vs.
Revision 1.5 by tdb, Sun Dec 23 01:05:35 2001 UTC

# Line 5 | Line 5
5   import uk.org.iscream.cms.server.util.*;
6   import java.util.ArrayList;
7   import java.net.InetAddress;
8 + import java.io.Serializable;
9  
10   /**
11   * Access Control List for use primarily
# Line 17 | Line 18 | import java.net.InetAddress;
18   * @author  $Author$
19   * @version $Id$
20   */
21 < public class ACL {
21 > public class ACL implements Serializable {
22  
23   //---FINAL ATTRIBUTES---
24  
# Line 120 | Line 121 | public class ACL {
121      }
122      
123      /**
124 <     * Gets the ACL as a String for debugging.
124 >     * Gives a String representation of this ACL.
125       *
126       * @return A String representation of this ACL.
127       */
128 <    public String getStringACL() {
129 <        String acl = "";
128 >    public String toString() {
129 >        StringBuffer acl = new StringBuffer();
130 >        acl.append("{");
131          for(int i=0; i < _acl.size(); i++) {
132              ACLRule rule = (ACLRule) _acl.get(i);
133              if(rule._allow) {
134 <                acl += "ALLOW:" + rule._expression + " ";
134 >                acl.append(rule._expression + "=ALLOW");
135              }
136              else {
137 <                acl += "DENY:" + rule._expression + " ";
137 >                acl.append(rule._expression + "=DENY");
138              }
139 +            acl.append(",");
140          }
141          if(_defaultMode) {
142 <            acl += "DEFAULT:ALLOW";
142 >            acl.append("DEFAULT=ALLOW");
143          }
144          else {
145 <            acl += "DEFAULT:DENY";
145 >            acl.append("DEFAULT=DENY");
146          }
147 <        return acl;
147 >        acl.append("}");
148 >        return acl.toString();
149      }
146    
147    /**
148     * Overrides the {@link java.lang.Object#toString() Object.toString()}
149     * method to provide clean logging (every class should have this).
150     *
151     * This uses the uk.org.iscream.cms.server.util.FormatName class
152     * to format the toString()
153     *
154     * @return the name of this class and its CVS revision
155     */
156    public String toString() {
157        return FormatName.getName(
158            _name,
159            getClass().getName(),
160            REVISION);
161    }
150  
151   //---PRIVATE METHODS---
152  
# Line 194 | Line 182 | public class ACL {
182      /**
183       * Wrapper class for an ACL rule.
184       */
185 <    private class ACLRule {
185 >    private class ACLRule implements Serializable {
186          
187          /**
188           * Construct an ACL rule.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines