com.bigdata.service.jini.lookup
Class DataServicesClient

java.lang.Object
  extended by com.bigdata.service.jini.lookup.AbstractCachingServiceClient<S>
      extended by com.bigdata.service.jini.lookup.BigdataCachingServiceClient<IDataService>
          extended by com.bigdata.service.jini.lookup.DataServicesClient

public class DataServicesClient
extends BigdataCachingServiceClient<IDataService>

Class handles discovery, caching, and local lookup of IDataServices and IMetadataServices.

Note: Since IMetadataService extends IDataService this class uses ServiceItemFilters as necessary to exclude IDataServices or IMetadataServices from responses.

Version:
$Id$
Author:
Bryan Thompson

Field Summary
 
Fields inherited from class com.bigdata.service.jini.lookup.AbstractCachingServiceClient
cacheMissTimeout, filter, log, lookupCache, serviceCache, template
 
Constructor Summary
DataServicesClient(JiniFederation fed, long timeout)
          
 
Method Summary
 IDataService getDataService()
          Return an arbitrary IDataService instance from the cache -or- null if there is none in the cache and a remote lookup times out.
 IDataService getDataService(UUID serviceUUID)
          Return the proxy for an IDataService from the local cache.
 IDataService getDataServiceByName(String name)
          Return an arbitrary IDataService having the specified service name on an Entry for that service.
 UUID[] getDataServiceUUIDs(int maxCount)
          Return an array UUIDs for IDataServices.
 IMetadataService getMetadataService()
          Return an arbitrary IMetadataService from the cache -or- null if there is none in the cache and a remote lookup times out.
 IMetadataService getMetadataService(UUID serviceUUID)
          Return the proxy for an IMetadataService from the local cache.
 
Methods inherited from class com.bigdata.service.jini.lookup.AbstractCachingServiceClient
destroyDiscoveredServices, destroyService, getLookupCache, getService, getService, getServiceCache, getServiceDiscoveryManager, getServiceItem, getServiceItem, getServiceItems, getServiceUUIDs, shutdownDiscoveredServices, shutdownService, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataServicesClient

public DataServicesClient(JiniFederation fed,
                          long timeout)
                   throws RemoteException

Throws:
RemoteException
Method Detail

getDataService

public final IDataService getDataService()
Return an arbitrary IDataService instance from the cache -or- null if there is none in the cache and a remote lookup times out. This method will NOT return an IMetadataService.

Returns:
The service.

getMetadataService

public final IMetadataService getMetadataService()
Return an arbitrary IMetadataService from the cache -or- null if there is none in the cache and a remote lookup times out. This method will NOT return an IDataService unless it also implements IMetadataService.

TODO:
handle more than one metadata service. right now registering more than one will cause problems since different clients might discover different metadata services and the metadata services are not arranging themselves into a failover chain or a hash partitioned service.

getDataService

public IDataService getDataService(UUID serviceUUID)
Return the proxy for an IDataService from the local cache.

Parameters:
serviceUUID - The UUID for the IDataService.
Returns:
The proxy or null if the UUID does not identify a known IDataService.
Throws:
IllegalArgumentException - if serviceUUID is null.
RuntimeException - if serviceUUID identifies an IMetadataService.

getMetadataService

public IMetadataService getMetadataService(UUID serviceUUID)
Return the proxy for an IMetadataService from the local cache.

Parameters:
serviceUUID - The UUID for the IMetadataService.
Returns:
The proxy or null if the UUID does not identify a known IMetadataService.
Throws:
IllegalArgumentException - if serviceUUID is null.
RuntimeException - if serviceUUID identifies a IDataService.

getDataServiceUUIDs

public UUID[] getDataServiceUUIDs(int maxCount)
Return an array UUIDs for IDataServices.

Parameters:
maxCount - The maximum #of data services whose UUID will be returned. When zero (0) the UUID for all known data services will be returned.
Returns:
An array of UUIDs for data services.

getDataServiceByName

public IDataService getDataServiceByName(String name)
Return an arbitrary IDataService having the specified service name on an Entry for that service.

Parameters:
name - The service name.
Returns:
The IDataService -or- null if there is none in the cache and a remote lookup times out.
TODO:
refactor into the base class but keep semantics of only matching data services (vs metadata services) in this class.


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.