org.apache.ftpserver.ip
Class FileIpRestrictor

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.ftpserver.ip.AbstractIpRestrictor
          extended by org.apache.ftpserver.ip.FileIpRestrictor
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, IpRestrictorInterface

public class FileIpRestrictor
extends AbstractIpRestrictor

This class provides IP restriction functionality.

Author:
Rana Bhattacharyya

Field Summary
 
Fields inherited from class org.apache.ftpserver.ip.AbstractIpRestrictor
mbAllowIp, mConfig
 
Fields inherited from interface org.apache.ftpserver.ip.IpRestrictorInterface
ROLE
 
Constructor Summary
FileIpRestrictor()
           
 
Method Summary
 void addEntry(String entry)
          Add a new entry.
 void clear()
          Remove all entries
 void contextualize(org.apache.avalon.framework.context.Context context)
          Set application context.
 Collection getAllEntries()
          Get all entries
 File getFile()
          Get IP resrictor file object.
 boolean hasPermission(InetAddress addr)
          Check IP permission.
 void reload()
          Read the list from the file.
 void removeEntry(String entry)
          Remove entry
 void save()
          Save this IP restriction list.
 
Methods inherited from class org.apache.ftpserver.ip.AbstractIpRestrictor
configure, dispose, getBaseDirectory, getConfig, initialize, isAllowIp
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileIpRestrictor

public FileIpRestrictor()
Method Detail

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Set application context.

Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Overrides:
contextualize in class AbstractIpRestrictor
Throws:
org.apache.avalon.framework.context.ContextException

reload

public void reload()
            throws IOException
Read the list from the file.

Specified by:
reload in interface IpRestrictorInterface
Overrides:
reload in class AbstractIpRestrictor
Throws:
IOException

getFile

public File getFile()
Get IP resrictor file object.


save

public void save()
          throws IOException
Save this IP restriction list.

Throws:
IOException

hasPermission

public boolean hasPermission(InetAddress addr)
Check IP permission. Compare it with all the entries in the list.


addEntry

public void addEntry(String entry)
Add a new entry.


removeEntry

public void removeEntry(String entry)
Remove entry


getAllEntries

public Collection getAllEntries()
Get all entries


clear

public void clear()
Remove all entries



Copyright © 2001-2012 Codehaus. All Rights Reserved.