|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.tnt.ldaputils.annotations.processing.LdapEntityHandler ca.tnt.ldaputils.annotations.processing.LdapEntityLoader
public class LdapEntityLoader
IAnnotationHandler
implementation that processes LPA annotations for
the purpose of loading the LdapEntity
annotated instance from the
ldap query results.
Field Summary |
---|
Fields inherited from class ca.tnt.ldaputils.annotations.processing.LdapEntityHandler |
---|
entity, manager |
Constructor Summary | |
---|---|
LdapEntityLoader()
does nothing |
|
LdapEntityLoader(Object newObject,
Attributes attributes,
LdapName dn)
creates a new LdapEntityHandler with given parameters. |
Method Summary | |
---|---|
protected boolean |
isDnSet()
Checks if the distinguished name was set |
protected boolean |
preProcessAnnotation(LdapEntity annotation,
Class annotatedClass)
Does annotation pre-processing, in case the subclass wants to do something special before anything is processed. |
protected Object |
processAttribute(Field field,
LdapAttribute attrAnnotation)
Simple attribute processing. |
protected void |
processDN(Class annotatedClass,
Field field)
Processing for DN annotation |
protected Object |
processForeignAggregate(Field field,
Class<?> aggClass,
String dnReference,
LdapAttribute attrAnnotation)
Called to process a foreign aggregate. |
protected void |
processLdapAttributes(Field field)
Processing for LdapAttribute annotation where name is '*' |
protected Object |
processLocalAggregate(Field field,
Class<?> aggClass,
LdapAttribute attrAnnotation)
Do what you need to for the local aggregate. |
void |
setManager(LdapManager managerInstance)
Sets the established ldap manager object, which should be pre-authenticated. |
void |
validateProcessing()
Method for validating the processing of the annotations. |
Methods inherited from class ca.tnt.ldaputils.annotations.processing.LdapEntityHandler |
---|
getAnnotatedClass, getAnnotationClass, getReferencedEntity, isMultiValued, noAnnotation, processAggregate, processAnnotation, processLdapAttribute, processManager, validateDN, validateObjectClasses |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LdapEntityLoader()
public LdapEntityLoader(Object newObject, Attributes attributes, LdapName dn)
newObject
- the new object to processattributes
- the attributes from ldapdn
- the ldap distinguished nameMethod Detail |
---|
public void setManager(LdapManager managerInstance)
IAnnotationHandler
managerInstance
- the already authenticated managerprotected boolean preProcessAnnotation(LdapEntity annotation, Class annotatedClass)
LdapEntityHandler
preProcessAnnotation
in class LdapEntityHandler
annotation
- the annotation being processedannotatedClass
- the annotated class with the annotation
protected void processLdapAttributes(Field field) throws IllegalAccessException
LdapEntityHandler
LdapAttribute
annotation where name is '*'
processLdapAttributes
in class LdapEntityHandler
field
- the field the annotation is on
IllegalAccessException
- if java policies prevent access to fields
via reflectionprotected void processDN(Class annotatedClass, Field field) throws IllegalAccessException, NoSuchMethodException
LdapEntityHandler
DN
annotation
processDN
in class LdapEntityHandler
annotatedClass
- class of the annotated objectfield
- the field the annotation is on
IllegalAccessException
- if java policies prevent access to fields
via reflection
NoSuchMethodException
- if the LdapAttribute.referencedDNMethod()
is the name of a method that does not
existprotected Object processAttribute(Field field, LdapAttribute attrAnnotation) throws NamingException, IllegalAccessException
LdapEntityHandler
processAttribute
in class LdapEntityHandler
field
- the field being processedattrAnnotation
- the LdapAttribute
annotation instance being
processed
ClassCastException
- if we attempt to store an attribute value in
an unsupported field Class type. Your
problem, not ours, until we support TypeHandler
for non aggregates
NamingException
- general JNDI exception wrapper for any
errors that occur in the directory
IllegalAccessException
- if java policies prevent access to fields
via reflectionprotected Object processForeignAggregate(Field field, Class<?> aggClass, String dnReference, LdapAttribute attrAnnotation) throws NamingException, IllegalAccessException
LdapEntityHandler
LdapEntity
annotated instance, but is
instead reading from the instance.
Tip on implementing: aggregates are stored in one of two ways. SortedSet<MyAggregateClass> myAggregates
LdapAttribute.aggregateClass()
by asking if they are equal. See the LdapEntityLoader
source for
an example.
processForeignAggregate
in class LdapEntityHandler
field
- the field being processedaggClass
- the aggregate class as defined by LdapAttribute.aggregateClass()
dnReference
- the "properly" formatted dn, with bind parameter,
as returned by the LdapAttribute.referencedDNMethod()
methodattrAnnotation
- the LdapAttribute
annotation instance being
processed
NamingException
- general JNDI exception wrapper for any
errors that occur in the directory
IllegalAccessException
- if java policies prevent access to fields
via reflectionpublic void validateProcessing()
IAnnotationHandler
protected boolean isDnSet()
protected Object processLocalAggregate(Field field, Class<?> aggClass, LdapAttribute attrAnnotation) throws IllegalAccessException, InstantiationException, NamingException
LdapEntityHandler
LdapEntity
annotated instance, but is instead reading from the instance.
A local aggregate is an aggregate object which will be injected into the
object field, which has requested it via LdapAttribute.aggregateClass()
,
and is also using the existing LDAP entry's attributes as a basis for the
object. See the documentation on LdapAttribute.aggregateClass()
for more information.
processLocalAggregate
in class LdapEntityHandler
field
- the field being processedaggClass
- the aggregate class, if needed.attrAnnotation
- the LdapAttribute
annotation instance being
processed
IllegalAccessException
- if java policies prevent access to fields
via reflection
InstantiationException
- if an error occurs creating an aggregate
instance
NamingException
- general JNDI exception wrapper for any
errors that occur in the directory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This documentation is part of the LDAP Persistence API (LPA).
Copyright Trenton D. Adams <lpa at trentonadams daught ca>
LPA is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
LPA is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with LPA. If not, see GNU Licenses.
See the COPYING file, in the git repository, for more information.