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.4 by tdb, Sun Dec 23 00:29:33 2001 UTC vs.
Revision 1.6 by tdb, Mon Dec 24 04:17:29 2001 UTC

# Line 121 | Line 121 | public class ACL implements Serializable {
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) {
133 <                acl += "ALLOW:" + rule._expression + " ";
134 <            }
135 <            else {
136 <                acl += "DENY:" + rule._expression + " ";
137 <            }
132 >            acl.append((ACLRule) _acl.get(i));
133 >            acl.append(",");
134          }
135          if(_defaultMode) {
136 <            acl += "DEFAULT:ALLOW";
136 >            acl.append("DEFAULT=ALLOW");
137          }
138          else {
139 <            acl += "DEFAULT:DENY";
139 >            acl.append("DEFAULT=DENY");
140          }
141 <        return acl;
141 >        acl.append("}");
142 >        return acl.toString();
143      }
147    
148    /**
149     * Overrides the {@link java.lang.Object#toString() Object.toString()}
150     * method to provide clean logging (every class should have this).
151     *
152     * This uses the uk.org.iscream.cms.server.util.FormatName class
153     * to format the toString()
154     *
155     * @return the name of this class and its CVS revision
156     */
157    public String toString() {
158        return FormatName.getName(
159            _name,
160            getClass().getName(),
161            REVISION);
162    }
144  
145   //---PRIVATE METHODS---
146  
# Line 206 | Line 187 | public class ACL implements Serializable {
187          private ACLRule(boolean allow, String expression) {
188              _allow = allow;
189              _expression = expression;
190 +        }
191 +        
192 +        /**
193 +         * Returns a String representation of this rule.
194 +         *
195 +         * @return A String representation of this rule.
196 +         */
197 +        public String toString() {
198 +            if(_allow) {
199 +                return _expression + "=ALLOW";
200 +            }
201 +            else {
202 +                return _expression + "=DENY";
203 +            }
204          }
205          
206          /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines