org.abstracthorizon.proximity.logic
Class DefaultExpiringProxyingRepositoryLogic

java.lang.Object
  extended by org.abstracthorizon.proximity.logic.DefaultProxyingRepositoryLogic
      extended by org.abstracthorizon.proximity.logic.DefaultExpiringProxyingRepositoryLogic
All Implemented Interfaces:
RepositoryLogic

public class DefaultExpiringProxyingRepositoryLogic
extends DefaultProxyingRepositoryLogic

Simple logic with expiration support. If expirationPeriod is not -1, it will apply expiration period onto items, and will handle removal of them when they expires.

Author:
cstamas

Field Summary
static java.lang.String METADATA_EXPIRES
          The Constant METADATA_EXPIRES.
static long NO_EXPIRATION
          The Constant NO_EXPIRATION.
 
Fields inherited from class org.abstracthorizon.proximity.logic.DefaultProxyingRepositoryLogic
logger
 
Constructor Summary
DefaultExpiringProxyingRepositoryLogic()
           
 
Method Summary
 Item afterLocalCopyFound(Repository repository, ProximityRequest request, Item item)
          If item has defined EXPIRES metadata, will use it and remove item from repository if needed.
 Item afterRemoteCopyFound(Repository repository, ProximityRequest request, Item localItem, Item remoteItem)
          If expiration period is not NO_EXPIRATION, it will apply it on all items.
 long getItemExpirationPeriodInSeconds()
          Gets the item expiration period in seconds.
 void setItemExpirationPeriodInSeconds(long itemExpirationPeriod)
          Sets the item expiration period in seconds.
 
Methods inherited from class org.abstracthorizon.proximity.logic.DefaultProxyingRepositoryLogic
afterRetrieval, shouldCheckForLocalCopy, shouldCheckForRemoteCopy, shouldStoreLocallyAfterRemoteRetrieval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_EXPIRATION

public static final long NO_EXPIRATION
The Constant NO_EXPIRATION.

See Also:
Constant Field Values

METADATA_EXPIRES

public static final java.lang.String METADATA_EXPIRES
The Constant METADATA_EXPIRES.

See Also:
Constant Field Values
Constructor Detail

DefaultExpiringProxyingRepositoryLogic

public DefaultExpiringProxyingRepositoryLogic()
Method Detail

getItemExpirationPeriodInSeconds

public long getItemExpirationPeriodInSeconds()
Gets the item expiration period in seconds.

Returns:
the item expiration period in seconds

setItemExpirationPeriodInSeconds

public void setItemExpirationPeriodInSeconds(long itemExpirationPeriod)
Sets the item expiration period in seconds.

Parameters:
itemExpirationPeriod - the new item expiration period in seconds

afterLocalCopyFound

public Item afterLocalCopyFound(Repository repository,
                                ProximityRequest request,
                                Item item)
If item has defined EXPIRES metadata, will use it and remove item from repository if needed.

Specified by:
afterLocalCopyFound in interface RepositoryLogic
Overrides:
afterLocalCopyFound in class DefaultProxyingRepositoryLogic
Parameters:
repository - the repository
request - the request
item - the item
Returns:
the item

afterRemoteCopyFound

public Item afterRemoteCopyFound(Repository repository,
                                 ProximityRequest request,
                                 Item localItem,
                                 Item remoteItem)
If expiration period is not NO_EXPIRATION, it will apply it on all items.

Specified by:
afterRemoteCopyFound in interface RepositoryLogic
Overrides:
afterRemoteCopyFound in class DefaultProxyingRepositoryLogic
Parameters:
repository - the repository
request - the request
localItem - the local item
remoteItem - the remote item
Returns:
the item


Copyright © 2005-2007 Abstract Horizon. All Rights Reserved.