Methods Summary |
---|
public abstract java.util.Collection | findPeople(java.util.Map searchParams)Search method. Search parameters are given as name/value pairs
in the Map argument. Known subclasses currently support the
following search parameter names:
"firstName": Pattern matched against first names.
"lastName" : Pattern matched against last names.
"email" : Pattern matches against email addresses.
The known implementations also all support the "*" wildcard,
converting it to the appropriate search syntax for their underlying
persistence scheme.
If no search parameters are given, or if unsuported search parameters
are given, the DAO implementation should throw an InvalidSearchException.
|
public abstract Person | findPerson(java.lang.String id)Find a person, given their unique identifier.
|
public abstract Person | findPersonByAcct(java.lang.String acctID)Match a person to a given login account. If no match possible, throw
an InvalidSearchException.
|
public static com.oreilly.jent.people.PersonDAO | getInstance()Accessor for the PersonDAO singleton
if (sDAO == null) {
initSingleton(sDefaultConfig);
}
return sDAO;
|
public abstract void | init(com.oreilly.jent.people.util.ConfigSet config)Initialize the DAO from the data provided in the config file. Sub-classes
implement this method to look for implementation-specific config
parameters.
|
public static void | initSingleton(java.lang.String configRef)
// Static initializer of PersonDAO singleton. Reads configuration
// parameters from an XML file loaded from the classpath using the
// reference passed as an argument.
//
// The classpath reference must point to an XML file with the format:
//
// <dao>
// <classname>org.jsmith.MyPersonDAOImpl</classname>
// <parameters>
// <my-param-1>foo</my-param-1>
// <my-param-2>bar</my-param-2>
// </parameters>
// </dao>
//
// The classname in the config file will be used to initialize a DAO
// implementation (using reflection to invoke the no-argument constructor
// on the named class). Then the entire config set will be passed to the
// DAO's init() method as a ConfigSet instance, so it can parse any
// implementation-specific parameters from the rest of the file.
try {
sLog.info("Initializing from " + configRef);
ConfigSet config = new ConfigSet(configRef);
String daoClass = config.getParameter("dao.classname");
sDAO = (PersonDAO)Class.forName(daoClass).newInstance();
sDAO.init(config);
}
catch (IllegalArgumentException iae1) {
sLog.severe("Failed to initialize ConfigReader: " +
iae1.getMessage());
}
catch (InstantiationException ie) {
sLog.severe("Failed to initialize PersonDAO singleton: " +
ie.getMessage());
}
catch (IllegalAccessException iae2) {
sLog.severe("Failed to initialize PersonDAO singleton: " +
iae2.getMessage());
}
catch (ClassNotFoundException cnfe) {
sLog.severe("Failed to initialize PersonDAO singleton: " +
cnfe.getMessage());
}
|