The org.springframework.ldap.odm.OdmManager
interface,
and its implementation, is the central class in the ODM package. The
OdmManager
orchestrates the process of reading objects from
the directory and mapping the data to annotated Java object classes. This
interface provides access to the underlying directory instance through the
following methods:
<T> T read(Class<T> clazz, Name
dn)
void create(Object entry)
void update(Object entry)
void delete(Object entry)
<T> List<T> findAll(Class<T> clazz, Name
base, SearchControls searchControls)
<T> List<T> search(Class<T> clazz, Name
base, String filter, SearchControls searchControls)
A reference to an implementation of this interface can be obtained
through the
org.springframework.ldap.odm.core.impl.OdmManagerImplFactoryBean
.
A basic configuration of this factory would be as follows:
Example 12.1. Configuring the OdmManager Factory
<beans> ... <bean id="odmManager" class="org.springframework.ldap.odm.core.impl.OdmManagerImplFactoryBean"> <property name="converterManager" ref="converterManager" /> <property name="contextSource" ref="contextSource" /> <property name="managedClasses"> <set> <value>com.example.dao.SimplePerson</value> </set> </property> </bean> ... </beans>
The factory requires the list of entity classes to be managed by the
OdmManager
to be explicitly declared. These classes should be
properly annotated as defined in the next section. The
converterManager
referenced in the above definition is
described in the section called “Type Conversion”.