--- experimental/server/ACL/ACL.java 2001/12/21 16:49:18 1.3 +++ experimental/server/ACL/ACL.java 2001/12/23 01:05:35 1.5 @@ -5,6 +5,7 @@ import uk.org.iscream.cms.server.util.*; import java.util.ArrayList; import java.net.InetAddress; +import java.io.Serializable; /** * Access Control List for use primarily @@ -15,16 +16,16 @@ import java.net.InetAddress; * the relevant check method. * * @author $Author: tdb $ - * @version $Id: ACL.java,v 1.3 2001/12/21 16:49:18 tdb Exp $ + * @version $Id: ACL.java,v 1.5 2001/12/23 01:05:35 tdb Exp $ */ -public class ACL { +public class ACL implements Serializable { //---FINAL ATTRIBUTES--- /** * The current CVS revision of this class */ - public static final String REVISION = "$Revision: 1.3 $"; + public static final String REVISION = "$Revision: 1.5 $"; /** * static to be used when adding an ALLOW rule to the ACL. @@ -120,45 +121,32 @@ public class ACL { } /** - * Gets the ACL as a String for debugging. + * Gives a String representation of this ACL. * * @return A String representation of this ACL. */ - public String getStringACL() { - String acl = ""; + public String toString() { + StringBuffer acl = new StringBuffer(); + acl.append("{"); for(int i=0; i < _acl.size(); i++) { ACLRule rule = (ACLRule) _acl.get(i); if(rule._allow) { - acl += "ALLOW:" + rule._expression + " "; + acl.append(rule._expression + "=ALLOW"); } else { - acl += "DENY:" + rule._expression + " "; + acl.append(rule._expression + "=DENY"); } + acl.append(","); } if(_defaultMode) { - acl += "DEFAULT:ALLOW"; + acl.append("DEFAULT=ALLOW"); } else { - acl += "DEFAULT:DENY"; + acl.append("DEFAULT=DENY"); } - return acl; + acl.append("}"); + return acl.toString(); } - - /** - * Overrides the {@link java.lang.Object#toString() Object.toString()} - * method to provide clean logging (every class should have this). - * - * This uses the uk.org.iscream.cms.server.util.FormatName class - * to format the toString() - * - * @return the name of this class and its CVS revision - */ - public String toString() { - return FormatName.getName( - _name, - getClass().getName(), - REVISION); - } //---PRIVATE METHODS--- @@ -194,7 +182,7 @@ public class ACL { /** * Wrapper class for an ACL rule. */ - private class ACLRule { + private class ACLRule implements Serializable { /** * Construct an ACL rule.