uk.org.iscream.cms.util
Class ACLDatagramSocket

java.lang.Object
  extended byjava.net.DatagramSocket
      extended byuk.org.iscream.cms.util.ACLDatagramSocket

public class ACLDatagramSocket
extends DatagramSocket

Access Control List DatagramSocket wrapper. Used to wrap a DatagramSocket with an ACL, whilst extending DatagramSocket to make integration into code easier. Once the ACL has been set, receive() can be used exactly as it would be with a DatagramSocket.

Version:
$Id: ACLDatagramSocket.java,v 1.4 2003/02/05 14:27:58 tdb Exp $
Author:
$Author: tdb $

Field Summary
private  ACL _acl
          The ACL used by this ACLDatagramSocket.
private  String _name
          This is the friendly identifier of the component this class is running in.
static String REVISION
          The current CVS revision of this class
 
Fields inherited from class java.net.DatagramSocket
 
Constructor Summary
ACLDatagramSocket()
          See relevant DatagramSocket constructor.
ACLDatagramSocket(ACL acl)
          See relevant DatagramSocket constructor, and sets the default acl.
ACLDatagramSocket(ACL acl, int port)
          See relevant DatagramSocket constructor, and sets the default acl.
ACLDatagramSocket(ACL acl, int port, InetAddress laddr)
          See relevant DatagramSocket constructor, and sets the default acl.
ACLDatagramSocket(int port)
          See relevant DatagramSocket constructor.
ACLDatagramSocket(int port, InetAddress laddr)
          See relevant DatagramSocket constructor.
 
Method Summary
 void receive(DatagramPacket p)
          Essentially has the same behaviour as the Datagram.receive() method, except won't return unless it is permitted by the ACL.
 void setACL(ACL acl)
          Set the ACL at any point in the operation of the DatagramSocket.
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
 
Methods inherited from class java.net.DatagramSocket
bind, close, connect, connect, disconnect, getBroadcast, getChannel, getInetAddress, getLocalAddress, getLocalPort, getLocalSocketAddress, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoTimeout, getTrafficClass, isBound, isClosed, isConnected, send, setBroadcast, setDatagramSocketImplFactory, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoTimeout, setTrafficClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.


_acl

private ACL _acl
The ACL used by this ACLDatagramSocket.

Constructor Detail

ACLDatagramSocket

public ACLDatagramSocket()
                  throws IOException
See relevant DatagramSocket constructor.


ACLDatagramSocket

public ACLDatagramSocket(int port)
                  throws IOException
See relevant DatagramSocket constructor.


ACLDatagramSocket

public ACLDatagramSocket(int port,
                         InetAddress laddr)
                  throws IOException
See relevant DatagramSocket constructor.


ACLDatagramSocket

public ACLDatagramSocket(ACL acl)
                  throws IOException
See relevant DatagramSocket constructor, and sets the default acl.


ACLDatagramSocket

public ACLDatagramSocket(ACL acl,
                         int port)
                  throws IOException
See relevant DatagramSocket constructor, and sets the default acl.


ACLDatagramSocket

public ACLDatagramSocket(ACL acl,
                         int port,
                         InetAddress laddr)
                  throws IOException
See relevant DatagramSocket constructor, and sets the default acl.

Method Detail

receive

public void receive(DatagramPacket p)
             throws IOException
Essentially has the same behaviour as the Datagram.receive() method, except won't return unless it is permitted by the ACL.

Throws:
IOException

setACL

public void setACL(ACL acl)
Set the ACL at any point in the operation of the DatagramSocket.

Parameters:
acl - the new ACL to apply

toString

public String toString()
Overrides the 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()

Returns:
the name of this class and its CVS revision


Copyright © 2000-2003 i-scream. All Rights Reserved.