ca.uhn.hl7v2.conf.store
Class ProfileStoreFactory

java.lang.Object
  extended by ca.uhn.hl7v2.conf.store.ProfileStoreFactory

public class ProfileStoreFactory
extends java.lang.Object

Provides access to a (configurable) ProfileStore.

Author:
Bryan Tripp

Constructor Summary
ProfileStoreFactory()
           
 
Method Summary
static void addCodeStore(CodeStore store)
          Registers a code store for use with all profiles.
static void addCodeStore(CodeStore store, java.util.regex.Pattern profileIdPattern)
          Registers a code store for use with certain profiles.
static void addCodeStore(CodeStore store, java.lang.String profileID)
          Registers a code store for use with a specific profile.
static CodeStore getCodeStore(java.lang.String profileID, java.lang.String codeSystem)
          Returns the first code store that knows the codes in the given code system (as per CodeStore.knowsCodes) and is registered for the given profile.
static ProfileStore getProfileStore()
          Returns a single configurable instance of a ProfileStore.
static void setStore(ProfileStore store)
          Sets the profile store that will be returned in subsequent calls to getProfileStore().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileStoreFactory

public ProfileStoreFactory()
Method Detail

getProfileStore

public static ProfileStore getProfileStore()
Returns a single configurable instance of a ProfileStore. Configurable by calling setStore(). Defaults to FileProfileStore using the current /profiles as a base directory Note: not a singleton (by design) in that nothing prevents creation of profile stores by other means.


setStore

public static void setStore(ProfileStore store)
Sets the profile store that will be returned in subsequent calls to getProfileStore().


addCodeStore

public static void addCodeStore(CodeStore store)
Registers a code store for use with all profiles.


addCodeStore

public static void addCodeStore(CodeStore store,
                                java.lang.String profileID)
Registers a code store for use with a specific profile.


addCodeStore

public static void addCodeStore(CodeStore store,
                                java.util.regex.Pattern profileIdPattern)
Registers a code store for use with certain profiles. The profiles with which the code store are used are determined by profileIdPattern, which is a regular expression that will be matched against profile IDs. For example suppose there are three profiles in the profile store, with the following IDs:
  1. ADT:confsig-UHN-2.4-profile-AL-NE-Immediate
  2. ADT:confsig-CIHI-2.4-profile-AL-NE-Immediate
  3. ADT:confsig-CIHI-2.3-profile-AL-NE-Immediate
Then to use a code store with only the first profile, the profileIdPattern would be "ADT:confsig-UHN-2.4-profile-AL-NE-Immediate". To use a code store with both of the 2.4 profiles, the pattern would be ".*2\\.4.*". To use a code store with all profiles, the pattern would be '.*". Multiple stores can be registered for use with the same profile. If this happens, the first one that returned true for knowsCodes(codeSystem) will used. Stores are searched in the order they are added here.


getCodeStore

public static CodeStore getCodeStore(java.lang.String profileID,
                                     java.lang.String codeSystem)
Returns the first code store that knows the codes in the given code system (as per CodeStore.knowsCodes) and is registered for the given profile. Code stores are checked in the order in which they are added (with addCodeStore()).

Returns:
null if none are found


Copyright © 2001-2011 University Health Network. All Rights Reserved.