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

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.apache.oodt.cas.filemgr.ingest.RmiCacheServer
All Implemented Interfaces:
Serializable, Remote, RemoteableCache

public class RmiCacheServer
extends UnicastRemoteObject
implements RemoteableCache, Serializable

Author:
bfoster, mattmann A Java RMI based interface to a backend LocalCache.
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.apache.oodt.cas.filemgr.ingest.RemoteableCache
DEFAULT_UNIQUE_MET_KEY
 
Constructor Summary
RmiCacheServer(URL fmUrl, String rangeQueryElementName, String rangeStartDateTime, String rangeEndDateTime, String uniqueElementName, List<String> productTypeNames)
           
 
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()
           
 void launchServer(int rmiPort)
           
 void launchServer(URL filemgrUrl, int rmiPort)
           
 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 stopServer(int port)
           
 void sync()
          Synchronizes this Cache with the File Manager specified by the RemoteableCache.setFileManager(URL) method.
 void sync(List<String> uniqueElementProductTypeNames)
          Synchronizes this Cache with the File Manager specified by the RemoteableCache.setFileManager(URL) method.
 void sync(String uniqueElementName, List<String> uniqueElementProductTypeNames)
          Synchronizes this Cache with the File Manager specified by the RemoteableCache.setFileManager(URL) method.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RmiCacheServer

public RmiCacheServer(URL fmUrl,
                      String rangeQueryElementName,
                      String rangeStartDateTime,
                      String rangeEndDateTime,
                      String uniqueElementName,
                      List<String> productTypeNames)
               throws RemoteException
Throws:
RemoteException
Method Detail

launchServer

public void launchServer(int rmiPort)
                  throws RemoteException
Throws:
RemoteException

launchServer

public void launchServer(URL filemgrUrl,
                         int rmiPort)
                  throws RemoteException
Throws:
RemoteException

stopServer

public void stopServer(int port)
                throws RemoteException
Throws:
RemoteException

clear

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

Specified by:
clear in interface RemoteableCache
Throws:
RemoteException

contains

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

Specified by:
contains in interface RemoteableCache
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.
Throws:
RemoteException

setFileManager

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

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

size

public int size()
         throws RemoteException
Specified by:
size in interface RemoteableCache
Returns:
The size of the current Product cache.
Throws:
RemoteException

sync

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

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

sync

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

Specified by:
sync in interface RemoteableCache
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:
RemoteException - If there is any error.

sync

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

Specified by:
sync in interface RemoteableCache
Throws:
RemoteException - If any error occurs.

getFileManagerUrl

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

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

getUniqueElementProductTypeNames

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

setUniqueElementProductTypeNames

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

Specified by:
setUniqueElementProductTypeNames in interface RemoteableCache
Parameters:
uniqueElementProductTypeNames - the uniqueElementProductTypeNames to set
Throws:
RemoteException

getUniqueElementName

public String getUniqueElementName()
                            throws RemoteException
Returns:
the uniqueElementName
Throws:
RemoteException

setUniqueElementName

public void setUniqueElementName(String uniqueElementName)
                          throws RemoteException
Description copied from interface: RemoteableCache
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 RemoteableCache
Parameters:
uniqueElementName - the uniqueElementName to set
Throws:
RemoteException


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