com.ibm.commerce.fulfillment.commands
Class ShippingJurisdictionCache

java.lang.Object
  |
  +--com.ibm.commerce.order.calculation.Cache
        |
        +--com.ibm.commerce.fulfillment.commands.ShippingJurisdictionCache

public class ShippingJurisdictionCache
extends Cache

This MRU cache caches ShippingJurisdictionIds by AddressId.


Nested Class Summary
static class ShippingJurisdictionCache.Key
          Key class of ShippingJurisdictionCache.
 
Field Summary
static java.lang.String COPYRIGHT
          The IBM copyright string.
 
Fields inherited from class com.ibm.commerce.order.calculation. Cache
DEFAULT_MAX_SIZE
 
Constructor Summary
ShippingJurisdictionCache( CommandContext aCommandContext)
          Constructs a ShippingJurisdictionCache with the default cache size.
ShippingJurisdictionCache( CommandContext aCommandContext, int anCacheSize)
          Constructs a ShippingJurisdictionCache with the specified cache size.
 
Method Summary
static  ShippingJurisdictionCache getInstance( CommandContext aCommandContext)
          Returns the instance from the command context.
 java.lang.Integer[] getJurisdictionIds( ShippingJurisdictionCache.Key aKey)
          Returns the JurisdictionIds associated with the Store and Address indicated by aKey.
protected  int getSize(java.lang.Object aValue)
          Returns a number of ShippingJurisdictionIds in the specified array.
protected  java.lang.Object miss(java.lang.Object aKey)
          Returns an array of ShippingJurisdictionIds for the specified addressId.
static void releaseInstance( CommandContext aCommandContext)
          Releases the instance from the command context, if there is one in the command context.
 
Methods inherited from class com.ibm.commerce.order.calculation. Cache
clear, get, remove, setMaxSize, setSize, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
The IBM copyright string.
See Also:
Constant Field Values
Constructor Detail

ShippingJurisdictionCache

public ShippingJurisdictionCache(CommandContext aCommandContext)
Constructs a ShippingJurisdictionCache with the default cache size.
Parameters:
aCommandContext - The command context as CommandContext object.

ShippingJurisdictionCache

public ShippingJurisdictionCache(CommandContext aCommandContext,
                                 int anCacheSize)
Constructs a ShippingJurisdictionCache with the specified cache size.
Parameters:
aCommandContext - The command context as CommandContext object.
anCacheSize - the cache size
Method Detail

getInstance

public static ShippingJurisdictionCache getInstance(CommandContext aCommandContext)
Returns the instance from the command context. Creates one in the command context if one is not there already.
Parameters:
aCommandContext - The command context as CommandContext object.
Returns:
the instance from the command context.

releaseInstance

public static void releaseInstance(CommandContext aCommandContext)
Releases the instance from the command context, if there is one in the command context.
Parameters:
aCommandContext - The command context as CommandContext object.

getJurisdictionIds

public java.lang.Integer[] getJurisdictionIds(ShippingJurisdictionCache.Key aKey)
                                       throws ECException
Returns the JurisdictionIds associated with the Store and Address indicated by aKey.
Parameters:
aKey - indicates the Store and Address.
Returns:
the JurisdictionIds.
Throws:
ECException

miss

protected java.lang.Object miss(java.lang.Object aKey)
                         throws ECException
Returns an array of ShippingJurisdictionIds for the specified addressId.
Specified by:
miss in class Cache
Parameters:
aKey - the key (ShippingJurisdictionCache.Key)
Returns:
the array of ShippingJurisdictionIds.
Throws:
ECException
See Also:
Cache.miss(Object)

getSize

protected int getSize(java.lang.Object aValue)
Returns a number of ShippingJurisdictionIds in the specified array.
Overrides:
getSize in class Cache
Parameters:
aValue - the array of ShippingJurisdictionIds.
Returns:
the number of shipping jurisdiction ids; 0 is returned if aValue object is null.