public class LdapVCardProvider extends Object implements VCardProvider, PropertyEventListener
provider.vcard.className = org.jivesoftware.openfire.ldap.LdapVCardProvider
and an xml vcard-mapping in the system properties.
The vcard attributes can be configured by adding an attrs="attr1,attr2"
attribute to the vcard elements.
Arbitrary text can be used for the element values as well as MessageFormat
style placeholders for the ldap attributes. For example, if you wanted to map the LDAP
attribute displayName
to the vcard element FN
, the xml
nippet would be:
<FN attrs="displayName">{0}</FN>
The vCard XML must be escaped in CDATA and must also be well formed. It is the exact
XML this provider will send to a client after after stripping attr
attributes
and populating the placeholders with the data retrieved from LDAP. This system should
be flexible enough to handle any client's vCard format. An example mapping follows.
An easy way to get the vcard format your client needs, assuming you've been
using the database store, is to do a SELECT value FROM ofVCard WHERE
username='some_user'
in your favorite sql querier and paste the result
into the vcard-mapping
(don't forget the CDATA).
Constructor and Description |
---|
LdapVCardProvider() |
Modifier and Type | Method and Description |
---|---|
org.dom4j.Element |
createVCard(String username,
org.dom4j.Element vCardElement)
Handles when a user creates a new vcard.
|
void |
deleteVCard(String username)
Handles when a user deletes their vcard.
|
boolean |
isReadOnly()
Returns true if this VCardProvider is read-only.
|
org.dom4j.Element |
loadVCard(String username)
Loads the avatar from LDAP, based off the vcard template.
|
void |
propertyDeleted(String property,
Map params)
A property was deleted.
|
void |
propertySet(String property,
Map params)
A property was set.
|
org.dom4j.Element |
updateVCard(String username,
org.dom4j.Element vCardElement)
Handles when a user updates their vcard.
|
void |
xmlPropertyDeleted(String property,
Map params)
An XML property was deleted.
|
void |
xmlPropertySet(String property,
Map params)
An XML property was set.
|
public org.dom4j.Element loadVCard(String username)
loadVCard
in interface VCardProvider
username
- User we are loading the vcard for.public org.dom4j.Element createVCard(String username, org.dom4j.Element vCardElement) throws UnsupportedOperationException, AlreadyExistsException
createVCard
in interface VCardProvider
username
- User that created a new vcard.vCardElement
- vCard element containing the new vcard.UnsupportedOperationException
- If an invalid field is changed or we are in readonly mode.AlreadyExistsException
- if the user already has a vCard.public org.dom4j.Element updateVCard(String username, org.dom4j.Element vCardElement) throws UnsupportedOperationException
updateVCard
in interface VCardProvider
username
- User that updated their vcard.vCardElement
- vCard element containing the new vcard.UnsupportedOperationException
- If an invalid field is changed or we are in readonly mode.public void deleteVCard(String username) throws UnsupportedOperationException
deleteVCard
in interface VCardProvider
username
- User that deketed their vcard.UnsupportedOperationException
- If an invalid field is changed or we are in readonly mode.public boolean isReadOnly()
VCardProvider
isReadOnly
in interface VCardProvider
public void propertySet(String property, Map params)
PropertyEventListener
propertySet
in interface PropertyEventListener
property
- the name of the property.params
- event parameters.public void propertyDeleted(String property, Map params)
PropertyEventListener
propertyDeleted
in interface PropertyEventListener
property
- the name of the property deleted.params
- event parameters.public void xmlPropertySet(String property, Map params)
PropertyEventListener
xmlPropertySet
in interface PropertyEventListener
property
- the name of the property.params
- event parameters.public void xmlPropertyDeleted(String property, Map params)
PropertyEventListener
xmlPropertyDeleted
in interface PropertyEventListener
property
- the name of the property.params
- event parameters.Copyright © 2003-2008 Jive Software.