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

Comparing experimental/server/ACL/ACLServerSocket.java (file contents):
Revision 1.1 by tdb, Wed Dec 19 23:43:27 2001 UTC vs.
Revision 1.2 by tdb, Thu Dec 20 00:59:54 2001 UTC

# Line 9 | Line 9 | import java.net.InetAddress;
9   import java.io.IOException;
10  
11   /**
12 < * Access Control List ServerSocket wrapper
12 > * Access Control List ServerSocket wrapper. Used
13 > * to wrap a ServerSocket with an ACL, whilst extending
14 > * ServerSocket to make integration into code easier.
15 > * Once the ACL has been set, accept() can be used exactly
16 > * as it would be with ServerSocket.
17   *
18   * @author  $Author$
19   * @version $Id$
# Line 27 | Line 31 | public class ACLServerSocket extends ServerSocket {
31  
32   //---CONSTRUCTORS---
33  
34 +    /**
35 +     * See relevant ServerSocket constructor.
36 +     */
37      public ACLServerSocket(int port) throws IOException {
38          super(port);
39          setACL(new ACL());
40      }
41      
42 +    /**
43 +     * See relevant ServerSocket constructor.
44 +     */
45      public ACLServerSocket(int port, int backlog) throws IOException {
46          super(port, backlog);
47          setACL(new ACL());
48      }
49      
50 +    /**
51 +     * See relevant ServerSocket constructor.
52 +     */
53      public ACLServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException {
54          super(port, backlog, bindAddr);
55          setACL(new ACL());
56      }
57      
58 +    /**
59 +     * See relevant ServerSocket constructor, and
60 +     * sets the default acl.
61 +     */
62      public ACLServerSocket(ACL acl, int port) throws IOException {
63          super(port);
64          setACL(acl);
65      }
66      
67 +    /**
68 +     * See relevant ServerSocket constructor, and
69 +     * sets the default acl.
70 +     */
71      public ACLServerSocket(ACL acl, int port, int backlog) throws IOException {
72          super(port, backlog);
73          setACL(acl);
74      }
75      
76 +    /**
77 +     * See relevant ServerSocket constructor, and
78 +     * sets the default acl.
79 +     */
80      public ACLServerSocket(ACL acl, int port, int backlog, InetAddress bindAddr) throws IOException {
81          super(port, backlog, bindAddr);
82          setACL(acl);
# Line 59 | Line 84 | public class ACLServerSocket extends ServerSocket {
84  
85   //---PUBLIC METHODS---
86  
87 +    /**
88 +     * Essentially has the same behaviour as the
89 +     * ServerSocket.accept() method, except won't
90 +     * return a Socket unless it is permitted by
91 +     * the ACL. Closes Socket's immediately that
92 +     * aren't permitted by the ACL.
93 +     */
94      public Socket accept() throws IOException {
95          while(true) {
96              Socket s = super.accept();
# Line 71 | Line 103 | public class ACLServerSocket extends ServerSocket {
103          }
104      }
105      
106 +    /**
107 +     * Set the ACL at any point in the operation
108 +     * of the ServerSocket.
109 +     *
110 +     * @param acl the new ACL to apply
111 +     */
112      public void setACL(ACL acl) {
113          _acl = acl;
114      }
# Line 108 | Line 146 | public class ACLServerSocket extends ServerSocket {
146       */
147      private String _name = null;
148      
149 +    /**
150 +     * The ACL used by this ACLServerSocket.
151 +     */
152      private ACL _acl;
153      
154   //---STATIC ATTRIBUTES---

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines