gov.nasa.pds.search.core.registry
Class RegistryHandler

java.lang.Object
  extended by gov.nasa.pds.search.core.registry.RegistryHandler

public class RegistryHandler
extends Object

Class to handle the communication with the Registry Service

Author:
jpadams

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<SearchCoreExtrinsic> getAssociatedExtrinsicsByReferenceType(SearchCoreExtrinsic searchExtrinsic, String referenceType)
          Query the associated objects and map the objects to their slots.
 List<SearchCoreExtrinsic> getAssociationsBySourceObject(SearchCoreExtrinsic searchExtrinsic, String associationType)
          Query the association objects by the Extrinsic's guid.
 SearchCoreExtrinsic getExtrinsicByGuid(String guid)
          Get the ExtrinsicObjects associated with the current object being queried.
 SearchCoreExtrinsic getExtrinsicByLidvid(String lidvid)
          Get the ExtrinsicObjects associated with the current object being queried.
 RegistryResults getExtrinsicsByQuery(List<Query> queryList)
          Get the ExtrinsicObjects from the given object type.
 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
 

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

public RegistryResults getExtrinsicsByQuery(List<Query> queryList)
                                     throws RegistryHandlerException
Get the ExtrinsicObjects from the given object type.

Parameters:
objectType - @see gov.nasa.pds.registry.model.ExtrinsicObject
Returns:
list of ExtrinsicObject for given objectType
Throws:
Exception - thrown if there are issues with the RegistryClient
RegistryHandlerException

getExtrinsicByLidvid

public SearchCoreExtrinsic 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 SearchCoreExtrinsic 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<SearchCoreExtrinsic> getAssociatedExtrinsicsByReferenceType(SearchCoreExtrinsic 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<SearchCoreExtrinsic> getAssociationsBySourceObject(SearchCoreExtrinsic 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 gov.nasa.pds.registry.exception.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:
gov.nasa.pds.registry.exception.RegistryClientException
gov.nasa.pds.registry.exception.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 primaryRegistryUrl to append

resetAllRegistries

public void resetAllRegistries()
Parameters:
secondaryRegistries - the secondaryRegistries to set

addToAllRegistries

public void addToAllRegistries(String registry)

doPrimaryRegistriesExist

public boolean doPrimaryRegistriesExist()
                                 throws RegistryHandlerException
Throws:
RegistryHandlerException

setCheckAssociations

public void setCheckAssociations(boolean checkAssociations)


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