org.apache.oodt.cas.filemgr.ingest
Class LocalCache

java.lang.Object
  extended by org.apache.oodt.cas.filemgr.ingest.LocalCache
All Implemented Interfaces:
Cache

public class LocalCache
extends Object
implements Cache

Author:
bfoster, mattmann

A cached way to determine product ingestion against a File Manager.


Field Summary
 
Fields inherited from interface org.apache.oodt.cas.filemgr.ingest.Cache
DEFAULT_UNIQUE_MET_KEY
 
Constructor Summary
LocalCache(URL fmUrl, String uniqueElementName, List<String> uniqueElementProductTypes, String rangeQueryElementName, String startOfQuery, String endOfQuery)
           
LocalCache(URL fmUrl, String rangeQueryElementName, String startOfQuery, String endOfQuery)
           
 
Method Summary
 void clear()
          Clears the current cache.
 boolean contains(String productName)
          Checks the cache to determine if a Product with the given productName exists.
 URL getFileManagerUrl()
          Gets the URL of the File Manager that this Cache communicates with.
 String getUniqueElementName()
           
 List<String> getUniqueElementProductTypeNames()
           
 boolean liveHasProduct(String uniqueElementName, String uniqueElementValue, String productTypeName)
          Performs a XmlRpcFileManagerClient.hasProduct(String) check against a live File Manager, bypassing the Cache.
 void setFileManager(URL fmUrl)
          Specifies the URL to the File Manager to connect this Cache to.
 void setUniqueElementName(String uniqueElementName)
          Sets the name of the met element to use as the identifier of a Product for use in determining whether the Product is in the Cache.
 void setUniqueElementProductTypeNames(List<String> uniqueElementProductTypeNames)
          Sets the names of the ProductTypes to cache.
 int size()
           
 void sync()
          Synchronizes this Cache with the File Manager specified by the Cache.setFileManager(URL) method.
 void sync(List<String> uniqueElementProductTypeNames)
          Synchronizes this Cache with the File Manager specified by the Cache.setFileManager(URL) method.
 void sync(String uniqueElementName, List<String> uniqueElementProductTypeNames)
          Synchronizes this Cache with the File Manager specified by the Cache.setFileManager(URL) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalCache

public LocalCache(URL fmUrl,
                  String rangeQueryElementName,
                  String startOfQuery,
                  String endOfQuery)
Parameters:
fmUrl -
uniqueElementName -
rangeQueryElementName -
startOfQuery -
endOfQuery -

LocalCache

public LocalCache(URL fmUrl,
                  String uniqueElementName,
                  List<String> uniqueElementProductTypes,
                  String rangeQueryElementName,
                  String startOfQuery,
                  String endOfQuery)
Parameters:
fmUrl -
uniqueElementName -
uniqueElementProductType -
rangeQueryElementName -
startOfQuery -
endOfQuery -
Method Detail

sync

public void sync(List<String> uniqueElementProductTypeNames)
          throws CacheException
Description copied from interface: Cache
Synchronizes this Cache with the File Manager specified by the Cache.setFileManager(URL) method.

Specified by:
sync in interface Cache
Parameters:
uniqueElementProductTypeNames - The List ProductTypes to cache Products from.
Throws:
CacheException - If there is any error.

sync

public void sync(String uniqueElementName,
                 List<String> uniqueElementProductTypeNames)
          throws CacheException
Description copied from interface: Cache
Synchronizes this Cache with the File Manager specified by the Cache.setFileManager(URL) method.

Specified by:
sync in interface Cache
Parameters:
uniqueElementName - The met key identifier to use for determining Product existance (if different than "CAS.ProductName").
uniqueElementProductTypeNames - The List of ProductTypes to cache Products from.
Throws:
CacheException - If there is any error.

clear

public void clear()
Description copied from interface: Cache
Clears the current cache. This should be used before a re-#sync(String, String)) occurs.

Specified by:
clear in interface Cache

size

public int size()
Specified by:
size in interface Cache
Returns:
The size of the current Product cache.

contains

public boolean contains(String productName)
Description copied from interface: Cache
Checks the cache to determine if a Product with the given productName exists.

Specified by:
contains in interface Cache
Parameters:
productName - The name of the Product to check for in the Cache.
Returns:
True if the Product is foudn in the Cache, False, otherwise.

setFileManager

public void setFileManager(URL fmUrl)
Description copied from interface: Cache
Specifies the URL to the File Manager to connect this Cache to.

Specified by:
setFileManager in interface Cache
Parameters:
fmUrl - The URL of the File Manager to cache Products from.

sync

public void sync()
          throws CacheException
Description copied from interface: Cache
Synchronizes this Cache with the File Manager specified by the Cache.setFileManager(URL) method. This method also assumes that the unique element (identified by Cache.setUniqueElementName(String) and the List of ProductTypes have also been set appropriate (e.g., by using Cache.setUniqueElementProductTypeNames(List).

Specified by:
sync in interface Cache
Throws:
CacheException - If any error occurs.

getFileManagerUrl

public URL getFileManagerUrl()
Description copied from interface: Cache
Gets the URL of the File Manager that this Cache communicates with.

Specified by:
getFileManagerUrl in interface Cache
Returns:
The URL of the File Manager that this Cache communicates with.

liveHasProduct

public boolean liveHasProduct(String uniqueElementName,
                              String uniqueElementValue,
                              String productTypeName)
                       throws CacheException
Performs a XmlRpcFileManagerClient.hasProduct(String) check against a live File Manager, bypassing the Cache.

Parameters:
uniqueElementName - The product identifier element to identify whether the product was received yet.
uniqueElementValue - The value of the product identifier element.
productTypeName - The ProductType of the Product that you would like to check existence for.
Returns:
True if the given Product (identified by its uniqueElement) exists, False otherwise.
Throws:
CacheException - If any error occurs.

getUniqueElementName

public String getUniqueElementName()
Returns:
the uniqueElementName

setUniqueElementName

public void setUniqueElementName(String uniqueElementName)
Description copied from interface: Cache
Sets the name of the met element to use as the identifier of a Product for use in determining whether the Product is in the Cache.

Specified by:
setUniqueElementName in interface Cache
Parameters:
uniqueElementName - the uniqueElementName to set

getUniqueElementProductTypeNames

public List<String> getUniqueElementProductTypeNames()
Returns:
the uniqueElementProductTypeNames

setUniqueElementProductTypeNames

public void setUniqueElementProductTypeNames(List<String> uniqueElementProductTypeNames)
Description copied from interface: Cache
Sets the names of the ProductTypes to cache.

Specified by:
setUniqueElementProductTypeNames in interface Cache
Parameters:
uniqueElementProductTypeNames - the uniqueElementProductTypeNames to set


Copyright © 1999-2011 Apache OODT. All Rights Reserved.