|
||||||||||
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.LdapEntityBinder
public class LdapEntityBinder
IAnnotationHandler
implementation that processes LPA annotations for
the purpose of generating JNDI Attributes for the bind call.
Field Summary |
---|
Fields inherited from class ca.tnt.ldaputils.annotations.processing.LdapEntityHandler |
---|
entity, manager |
Constructor Summary | |
---|---|
LdapEntityBinder(Object entityInstance)
Initializes the entity binder with the instance to be bound to ldap. |
Method Summary | |
---|---|
List<Attributes> |
getAttributesList()
Retrieve the processed attributes for LDAP. |
LdapName |
getDn()
Returns the dn processed during processDN(Class, Field) |
List<LdapName> |
getDnList()
Get the list of DNs that match the list of Attributes returned by getAttributesList()
WARNING! WARNING! WARNING! you may only
call this method a SINGLE time. |
protected boolean |
preProcessAnnotation(LdapEntity annotation,
Class annotatedClass)
grabs the object classes from the LdapEntity.requiredObjectClasses()
annotation field, and puts them in an Attribute , and stores them
for return from getAttributesList() |
protected Object |
processAttribute(Field field,
LdapAttribute attrAnnotation)
Processes the field for binding, generates a JNDI Attribute for it, and puts it in the list of JNDI Attributes. |
protected void |
processDN(Class annotatedClass,
Field field)
Only calls LdapEntityHandler.validateDN(Class, Field) , and then
stores the dn for return through the getDn() method. |
protected Object |
processForeignAggregate(Field field,
Class<?> aggClass,
String dnReference,
LdapAttribute attrAnnotation)
Process the field as a foreign aggregate for binding, generates a JNDI Attribute for it, and stores it in the list of JNDI Attributes |
protected void |
processLdapAttributes(Field field)
Processing for LdapAttribute annotation where name is '*' |
protected Object |
processLocalAggregate(Field field,
Class<?> aggClass,
LdapAttribute attrAnnotation)
Process the field as a local aggregate for binding, generates a series of JNDI Attribute for it, and stores them in the list of JNDI Attributes. |
protected void |
processManager(Field field)
Does nothing, and does not call the super, as the entity binder does not require the handling of manager instances. |
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, validateDN, validateObjectClasses |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LdapEntityBinder(Object entityInstance)
entityInstance
- the LdapEntity
annotated entityInstance
instance that needs to be bound to ldap.Method Detail |
---|
protected void processManager(Field field) throws IllegalAccessException
processManager
in class LdapEntityHandler
field
- the field to inject the manager to
IllegalAccessException
- if java policies prevent access to fields
via reflectionprotected 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 Object processAttribute(Field field, LdapAttribute attrAnnotation) throws NamingException, IllegalAccessException
processAttribute
in class LdapEntityHandler
field
- the field being processedattrAnnotation
- 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 reflectionprotected Object processForeignAggregate(Field field, Class<?> aggClass, String dnReference, LdapAttribute attrAnnotation) throws NamingException, IllegalAccessException
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 reflectionprotected Object processLocalAggregate(Field field, Class<?> aggClass, LdapAttribute attrAnnotation) throws IllegalAccessException, InstantiationException, NamingException
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 directoryprotected void processDN(Class annotatedClass, Field field) throws IllegalAccessException, NoSuchMethodException
LdapEntityHandler.validateDN(Class, Field)
, and then
stores the dn for return through the getDn()
method.
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 boolean preProcessAnnotation(LdapEntity annotation, Class annotatedClass)
LdapEntity.requiredObjectClasses()
annotation field, and puts them in an Attribute
, and stores them
for return from getAttributesList()
preProcessAnnotation
in class LdapEntityHandler
annotation
- the annotation being processedannotatedClass
- the annotated class with the annotation
public void validateProcessing()
IAnnotationHandler
public void setManager(LdapManager managerInstance)
IAnnotationHandler
managerInstance
- the already authenticated managerpublic List<Attributes> getAttributesList() throws UnsupportedOperationException
UnsupportedOperationException
.
UnsupportedOperationException
- if you call this method more than
oncepublic List<LdapName> getDnList()
getAttributesList()
WARNING! WARNING! WARNING! you may only
call this method a SINGLE time. Once it has been called, the list of DNs
is immutable, and this method will throw an UnsupportedOperationException
.
UnsupportedOperationException
- if you call this method more than
oncepublic LdapName getDn()
processDN(Class, Field)
|
||||||||||
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.