--- experimental/server/ACL/ACLServerSocket.java 2001/12/19 23:43:27 1.1 +++ experimental/server/ACL/ACLServerSocket.java 2001/12/20 00:59:54 1.2 @@ -9,10 +9,14 @@ import java.net.InetAddress; import java.io.IOException; /** - * Access Control List ServerSocket wrapper + * Access Control List ServerSocket wrapper. Used + * to wrap a ServerSocket with an ACL, whilst extending + * ServerSocket to make integration into code easier. + * Once the ACL has been set, accept() can be used exactly + * as it would be with ServerSocket. * * @author $Author: tdb $ - * @version $Id: ACLServerSocket.java,v 1.1 2001/12/19 23:43:27 tdb Exp $ + * @version $Id: ACLServerSocket.java,v 1.2 2001/12/20 00:59:54 tdb Exp $ */ public class ACLServerSocket extends ServerSocket { @@ -21,37 +25,58 @@ public class ACLServerSocket extends ServerSocket { /** * The current CVS revision of this class */ - public static final String REVISION = "$Revision: 1.1 $"; + public static final String REVISION = "$Revision: 1.2 $"; //---STATIC METHODS--- //---CONSTRUCTORS--- + /** + * See relevant ServerSocket constructor. + */ public ACLServerSocket(int port) throws IOException { super(port); setACL(new ACL()); } + /** + * See relevant ServerSocket constructor. + */ public ACLServerSocket(int port, int backlog) throws IOException { super(port, backlog); setACL(new ACL()); } + /** + * See relevant ServerSocket constructor. + */ public ACLServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException { super(port, backlog, bindAddr); setACL(new ACL()); } + /** + * See relevant ServerSocket constructor, and + * sets the default acl. + */ public ACLServerSocket(ACL acl, int port) throws IOException { super(port); setACL(acl); } + /** + * See relevant ServerSocket constructor, and + * sets the default acl. + */ public ACLServerSocket(ACL acl, int port, int backlog) throws IOException { super(port, backlog); setACL(acl); } + /** + * See relevant ServerSocket constructor, and + * sets the default acl. + */ public ACLServerSocket(ACL acl, int port, int backlog, InetAddress bindAddr) throws IOException { super(port, backlog, bindAddr); setACL(acl); @@ -59,6 +84,13 @@ public class ACLServerSocket extends ServerSocket { //---PUBLIC METHODS--- + /** + * Essentially has the same behaviour as the + * ServerSocket.accept() method, except won't + * return a Socket unless it is permitted by + * the ACL. Closes Socket's immediately that + * aren't permitted by the ACL. + */ public Socket accept() throws IOException { while(true) { Socket s = super.accept(); @@ -71,6 +103,12 @@ public class ACLServerSocket extends ServerSocket { } } + /** + * Set the ACL at any point in the operation + * of the ServerSocket. + * + * @param acl the new ACL to apply + */ public void setACL(ACL acl) { _acl = acl; } @@ -108,6 +146,9 @@ public class ACLServerSocket extends ServerSocket { */ private String _name = null; + /** + * The ACL used by this ACLServerSocket. + */ private ACL _acl; //---STATIC ATTRIBUTES---