gov.nasa.pds.registry.client.results
Class RegistryHandler

java.lang.Object
  extended by gov.nasa.pds.registry.client.results.RegistryHandler

public class RegistryHandler
extends Object

Class to handle the communication with the Registry Service

Author:
jpadams

Field Summary
static int DFLT_QUERY_MAX
           
 
Constructor Summary
RegistryHandler(List<String> primaryRegistries, List<String> secondaryRegistries, int queryMax)
           
RegistryHandler(List<String> primaryRegistries, List<String> secondaryRegistries, int queryMax, boolean checkAssociations)
           
 
Method Summary
 void addPrimaryRegistry(String primaryRegistry)
           
 void addSecondaryRegistry(String secondaryRegistry)
           
 void addToAllRegistries(String registry)
           
 String checkForReference(String value, String slotName)
          Check if the value comes from an association field (*_ref).
 boolean doPrimaryRegistriesExist()
           
 List<ExtendedExtrinsicObject> getAssociatedExtrinsicsByReferenceType(ExtendedExtrinsicObject searchExtrinsic, String referenceType)
          Query the associated objects and map the objects to their slots.
 List<ExtendedExtrinsicObject> getAssociationsBySourceObject(ExtendedExtrinsicObject searchExtrinsic, String associationType)
          Query the association objects by the Extrinsic's guid.
 ExtendedExtrinsicObject getExtrinsicByGuid(String guid)
          Get the ExtrinsicObjects associated with the current object being queried.
 ExtendedExtrinsicObject getExtrinsicByLidvid(String lidvid)
          Get the ExtrinsicObjects associated with the current object being queried.
 RegistryResults getExtrinsicsByQuery(Map<String,String> queryMap)
          Deprecated. Use getExtrinsicsWithFilter method
 RegistryResults getExtrinsicsWithAllRegistries(List<ResultsFilter> resultsFilterList)
          Get the ExtrinsicObjects after results have been filtered.
 RegistryResults getExtrinsicsWithFilter(List<ResultsFilter> resultsFilterList)
          Get the ExtrinsicObjects after results have been filtered.
 List<String> getPrimaryRegistries()
           
 int getQueryMax()
           
 List<String> getSecondaryRegistries()
           
 void resetAllRegistries()
           
 void setCheckAssociations(boolean checkAssociations)
           
 void setPrimaryRegistries(List<String> primaryRegistries)
           
 void setQueryMax(int queryMax)
           
 void setSecondaryRegistries(List<String> secondaryRegistries)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DFLT_QUERY_MAX

public static final int DFLT_QUERY_MAX
See Also:
Constant Field Values
Constructor Detail

RegistryHandler

public RegistryHandler(List<String> primaryRegistries,
                       List<String> secondaryRegistries,
                       int queryMax)

RegistryHandler

public RegistryHandler(List<String> primaryRegistries,
                       List<String> secondaryRegistries,
                       int queryMax,
                       boolean checkAssociations)
Method Detail

getExtrinsicsByQuery

@Deprecated
public RegistryResults getExtrinsicsByQuery(Map<String,String> queryMap)
                                     throws RegistryHandlerException
Deprecated. Use getExtrinsicsWithFilter method

Get the ExtrinsicObjects from the given query params

Parameters:
queryMap - query map for attribute name->value pairs
Returns:
RegistryResults object containing filtered results
Throws:
Exception - thrown if there are issues with the RegistryClient
RegistryHandlerException

getExtrinsicsWithFilter

public RegistryResults getExtrinsicsWithFilter(List<ResultsFilter> resultsFilterList)
                                        throws RegistryHandlerException
Get the ExtrinsicObjects after results have been filtered. Queries against only the primary registries for extrinsics.

Parameters:
resultsFilterList -
Returns:
Throws:
RegistryHandlerException

getExtrinsicsWithAllRegistries

public RegistryResults getExtrinsicsWithAllRegistries(List<ResultsFilter> resultsFilterList)
                                               throws RegistryHandlerException
Get the ExtrinsicObjects after results have been filtered. Queries against all registries specified in the initializer, including primary and secondary registries.

Parameters:
resultsFilterList -
Returns:
Throws:
RegistryHandlerException

getExtrinsicByLidvid

public ExtendedExtrinsicObject getExtrinsicByLidvid(String lidvid)
                                             throws Exception
Get the ExtrinsicObjects associated with the current object being queried.

Parameters:
lidvid - identifies the ExtrinsicObject list to be queried for
Returns:
list of ExtrinsicObjects
Throws:
Exception

getExtrinsicByGuid

public ExtendedExtrinsicObject getExtrinsicByGuid(String guid)
                                           throws Exception
Get the ExtrinsicObjects associated with the current object being queried.

Parameters:
lidvid - identifies the ExtrinsicObject list to be queried for
Returns:
list of ExtrinsicObjects
Throws:
Exception

getAssociatedExtrinsicsByReferenceType

public List<ExtendedExtrinsicObject> getAssociatedExtrinsicsByReferenceType(ExtendedExtrinsicObject searchExtrinsic,
                                                                            String referenceType)
                                                                     throws Exception
Query the associated objects and map the objects to their slots.

Parameters:
guid -
referenceType -
Returns:
Throws:
Exception

getAssociationsBySourceObject

public List<ExtendedExtrinsicObject> getAssociationsBySourceObject(ExtendedExtrinsicObject searchExtrinsic,
                                                                   String associationType)
                                                            throws Exception
Query the association objects by the Extrinsic's guid.

Parameters:
guid -
referenceType -
Returns:
Throws:
Exception

checkForReference

public String checkForReference(String value,
                                String slotName)
                         throws RegistryClientException
Check if the value comes from an association field (*_ref). If so, need to verify it is a lidvid otherwise query registry for version number to append to lid. TODO Refactor into SearchCoreExtrinsic

Parameters:
value -
registryRef -
Returns:
Throws:
RegistryClientException
RegistryServiceException

getQueryMax

public int getQueryMax()
Returns:
the queryMax

setQueryMax

public void setQueryMax(int queryMax)
Parameters:
queryMax - the queryMax to set

getPrimaryRegistries

public List<String> getPrimaryRegistries()
Returns:
the primaryRegistries

setPrimaryRegistries

public void setPrimaryRegistries(List<String> primaryRegistries)
Parameters:
primaryRegistries - the primaryRegistries to set

addPrimaryRegistry

public void addPrimaryRegistry(String primaryRegistry)
Parameters:
primaryRegistry - the primaryRegistryUrl to append

getSecondaryRegistries

public List<String> getSecondaryRegistries()
Returns:
the secondaryRegistries

setSecondaryRegistries

public void setSecondaryRegistries(List<String> secondaryRegistries)
Parameters:
secondaryRegistries - the secondaryRegistries to set

addSecondaryRegistry

public void addSecondaryRegistry(String secondaryRegistry)
Parameters:
secondaryRegistry - the secondaryRegistry Url to append

resetAllRegistries

public void resetAllRegistries()

addToAllRegistries

public void addToAllRegistries(String registry)

doPrimaryRegistriesExist

public boolean doPrimaryRegistriesExist()
                                 throws RegistryHandlerException
Throws:
RegistryHandlerException

setCheckAssociations

public void setCheckAssociations(boolean checkAssociations)


Copyright © 2010-2014 Planetary Data System. All Rights Reserved.