org.apache.directory.server.dhcp.store
Class AbstractDhcpStore

java.lang.Object
  extended by org.apache.directory.server.dhcp.store.AbstractDhcpStore
All Implemented Interfaces:
DhcpStore
Direct Known Subclasses:
SimpleDhcpStore

public abstract class AbstractDhcpStore
extends java.lang.Object
implements DhcpStore

Abstract base implementation of a DhcpStore.

Version:
$Rev: 545042 $, $Date: 2007-06-06 22:32:01 -0500 (Mi, 06 Jun 2007) $
Author:
Apache Directory Project

Constructor Summary
AbstractDhcpStore()
           
 
Method Summary
protected abstract  Host findDesignatedHost(HardwareAddress hardwareAddress)
          Find a host to with the explicitely designated hardware address.
protected abstract  Lease findExistingLease(HardwareAddress hardwareAddress, Lease existingLease)
          Find an existing lease in the store.
protected abstract  Subnet findSubnet(java.net.InetAddress clientAddress)
          Find the subnet definition matching the given address.
 Lease getExistingLease(HardwareAddress hardwareAddress, java.net.InetAddress requestedAddress, java.net.InetAddress selectionBase, long requestedLeaseTime, OptionsField options)
          Retrieve an existing lease from the dhcp store.
 Lease getLeaseOffer(HardwareAddress hardwareAddress, java.net.InetAddress requestedAddress, java.net.InetAddress selectionBase, long requestedLeaseTime, OptionsField options)
          Find a lease to offer in response to a DHCPDISCOVER request.
protected abstract  OptionsField getOptions(DhcpConfigElement element)
          Return a list of all options applicable to the given config element.
protected abstract  java.util.Map getProperties(DhcpConfigElement element)
          Return a list of all options applicable to the given config element.
 void releaseLease(Lease lease)
          Release the specified lease.
protected abstract  void updateLease(Lease lease)
          Update the (possibly changed) lease in the store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDhcpStore

public AbstractDhcpStore()
Method Detail

getLeaseOffer

public Lease getLeaseOffer(HardwareAddress hardwareAddress,
                           java.net.InetAddress requestedAddress,
                           java.net.InetAddress selectionBase,
                           long requestedLeaseTime,
                           OptionsField options)
                    throws DhcpException
Description copied from interface: DhcpStore
Find a lease to offer in response to a DHCPDISCOVER request.

The lease to offer should be determined by an algorithme like the following:

If the requestedLeaseTime is >= 0, the validity duration of the returned lease must be updated, so that the lease is valid for at least the specified time. The duration may, however, be constrained by a configured maximum lease time.

Specified by:
getLeaseOffer in interface DhcpStore
Parameters:
hardwareAddress - hardwareAddress the hardware address of the client requesting the lease.
requestedAddress - the address requested by the client or null if the client did not request a specific address.
selectionBase - the address on which to base the selection of a lease from a pool, i.e. either the address of the interface on which the request was received or the address of a DHCP relay agent.
requestedLeaseTime - the lease time in milliseconds as requested by the client, or -1 if the client did not request a specific lease time.
options - the supplied DHCP options. Lease selection may be refined by using those options
Returns:
a lease or null if no matching lease was found.
Throws:
DhcpException

getExistingLease

public Lease getExistingLease(HardwareAddress hardwareAddress,
                              java.net.InetAddress requestedAddress,
                              java.net.InetAddress selectionBase,
                              long requestedLeaseTime,
                              OptionsField options)
                       throws DhcpException
Description copied from interface: DhcpStore
Retrieve an existing lease from the dhcp store.

Specified by:
getExistingLease in interface DhcpStore
Returns:
Lease
Throws:
DhcpException

releaseLease

public void releaseLease(Lease lease)
Description copied from interface: DhcpStore
Release the specified lease.

Specified by:
releaseLease in interface DhcpStore

updateLease

protected abstract void updateLease(Lease lease)
Update the (possibly changed) lease in the store.

Parameters:
lease -

getOptions

protected abstract OptionsField getOptions(DhcpConfigElement element)
Return a list of all options applicable to the given config element. List list must contain the options specified for the element and all parent elements in an aggregated fashion. For instance, the options for a host must include the global default options, the options of classes the host is a member of, the host's group options and the host's options.

Parameters:
element -
Returns:
OptionsField

getProperties

protected abstract java.util.Map getProperties(DhcpConfigElement element)
Return a list of all options applicable to the given config element. List list must contain the options specified for the element and all parent elements in an aggregated fashion. For instance, the options for a host must include the global default options, the options of classes the host is a member of, the host's group options and the host's options.

Parameters:
element -
Returns:
Map

findExistingLease

protected abstract Lease findExistingLease(HardwareAddress hardwareAddress,
                                           Lease existingLease)
Find an existing lease in the store.

Parameters:
hardwareAddress -
existingLease -
Returns:
Map

findDesignatedHost

protected abstract Host findDesignatedHost(HardwareAddress hardwareAddress)
                                    throws DhcpException
Find a host to with the explicitely designated hardware address.

Parameters:
hardwareAddress -
Returns:
Host
Throws:
DhcpException

findSubnet

protected abstract Subnet findSubnet(java.net.InetAddress clientAddress)
Find the subnet definition matching the given address.

Parameters:
clientAddress -
Returns:
Subnet


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.