org.lsc.beans
Class BeanComparator

java.lang.Object
  extended by org.lsc.beans.BeanComparator

public final class BeanComparator
extends Object

Bean comparison to generate the JndiModification array This class is used to generate the modifications to be applied to the directory according the differences between two beans.

Author:
Sebastien Bahloul <seb@lsc-project.org>, Jonathan Clarke <jon@lsc-project.org>

Method Summary
static JndiModifications calculateModifications(ISyncOptions syncOptions, IBean srcBean, IBean itmBean, IBean dstBean, Object customLibrary, boolean condition)
          Static comparison method.
static JndiModifications calculateModifications(ISyncOptions syncOptions, IBean srcBean, IBean destBean, Object customLibrary)
          Deprecated. Use calculateModifications(ISyncOptions, IBean, IBean, Object, boolean)
static JndiModifications calculateModifications(ISyncOptions syncOptions, IBean srcBean, IBean dstBean, Object customLibrary, boolean condition)
          Deprecated. Use calculateModifications(ISyncOptions, IBean, IBean, IBean, Object, boolean)
static JndiModificationType calculateModificationType(ISyncOptions syncOptions, IBean srcBean, IBean itmBean, IBean dstBean, Object customLibrary)
          Static method to return the kind of operation that would happen
static JndiModificationType calculateModificationType(ISyncOptions syncOptions, IBean srcBean, IBean dstBean, Object customLibrary)
          Deprecated. This method forces multiple clones, and should be avoided. Use calculateModificationType(ISyncOptions, IBean, IBean, IBean, Object) instead.
static JndiModifications[] checkOtherModifications(IBean srcBean, IBean destBean, JndiModifications jm)
          Check modifications across other directory objects - Never used at this time : implementation may be buggy While adding, deleting or modifying an entry, specific treatments must be done like removing a member from all the remaining inscription, modifying an attribute in the person entry while the original modification has been done on a inscription.
static IBean cloneSrcBean(IBean srcBean, ISyncOptions syncOptions, Object customLibrary)
           Clone the source bean and return a new object that is a copy of the srcBean and includes any modifications on the DN.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calculateModificationType

public static JndiModificationType calculateModificationType(ISyncOptions syncOptions,
                                                             IBean srcBean,
                                                             IBean dstBean,
                                                             Object customLibrary)
                                                      throws CloneNotSupportedException
Deprecated. This method forces multiple clones, and should be avoided. Use calculateModificationType(ISyncOptions, IBean, IBean, IBean, Object) instead.

Static method to return the kind of operation that would happen

Parameters:
syncOptions - SyncOptions object from properties
srcBean - Bean from source
dstBean - JNDI bean
customLibrary - User-specified object to add to the JavaScript execution environment
Returns:
JndiModificationType the modification type that would happen
Throws:
CloneNotSupportedException

calculateModificationType

public static JndiModificationType calculateModificationType(ISyncOptions syncOptions,
                                                             IBean srcBean,
                                                             IBean itmBean,
                                                             IBean dstBean,
                                                             Object customLibrary)
Static method to return the kind of operation that would happen

Parameters:
syncOptions - SyncOptions object from properties
srcBean - Bean from source
itmBean - Copy of the bean from source (from cloneSrcBean(IBean, ISyncOptions, Object))
dstBean - JNDI bean
customLibrary - User-specified object to add to the JavaScript execution environment
Returns:
JndiModificationType the modification type that would happen

calculateModifications

public static JndiModifications calculateModifications(ISyncOptions syncOptions,
                                                       IBean srcBean,
                                                       IBean destBean,
                                                       Object customLibrary)
                                                throws NamingException,
                                                       CloneNotSupportedException
Deprecated. Use calculateModifications(ISyncOptions, IBean, IBean, Object, boolean)

Static comparison method.

By default, source information override destination (i.e. Database => Directory) But if a piece of information is present only in the destination, it remains

Parameters:
syncOptions - Instance of ISyncOptions to use.
srcBean - Bean from source
destBean - JNDI bean
customLibrary - User-specified object to add to the JavaScript execution environment
Returns:
modifications to apply to the directory
Throws:
NamingException - an exception may be thrown if an LDAP data access error is encountered
CloneNotSupportedException - No longer thrown, actually.

calculateModifications

public static JndiModifications calculateModifications(ISyncOptions syncOptions,
                                                       IBean srcBean,
                                                       IBean dstBean,
                                                       Object customLibrary,
                                                       boolean condition)
                                                throws NamingException,
                                                       CloneNotSupportedException
Deprecated. Use calculateModifications(ISyncOptions, IBean, IBean, IBean, Object, boolean)

Static comparison method.

By default, source information override destination (i.e. Database => Directory) But if a piece of information is present only in the destination, it remains

Parameters:
syncOptions - Instance of ISyncOptions to use.
srcBean - Bean from source
dstBean - JNDI bean
customLibrary - User-specified object to add to the JavaScript execution environment
condition -
Returns:
modifications to apply to the directory
Throws:
NamingException - an exception may be thrown if an LDAP data access error is encountered
CloneNotSupportedException - No longer thrown, actually.

calculateModifications

public static JndiModifications calculateModifications(ISyncOptions syncOptions,
                                                       IBean srcBean,
                                                       IBean itmBean,
                                                       IBean dstBean,
                                                       Object customLibrary,
                                                       boolean condition)
                                                throws NamingException

Static comparison method.

By default, source information override destination (i.e. Database => Directory) But if a piece of information is present only in the destination, it remains

Parameters:
syncOptions - Instance of ISyncOptions to use.
srcBean - Bean from source
itmBean - Copy of the bean from source (from cloneSrcBean(IBean, ISyncOptions, Object))
dstBean - JNDI bean
customLibrary - User-specified object to add to the JavaScript execution environment
condition -
Returns:
modifications to apply to the directory
Throws:
NamingException - an exception may be thrown if an LDAP data access error is encountered

checkOtherModifications

public static JndiModifications[] checkOtherModifications(IBean srcBean,
                                                          IBean destBean,
                                                          JndiModifications jm)
                                                   throws IllegalAccessException,
                                                          InvocationTargetException
Check modifications across other directory objects - Never used at this time : implementation may be buggy While adding, deleting or modifying an entry, specific treatments must be done like removing a member from all the remaining inscription, modifying an attribute in the person entry while the original modification has been done on a inscription.

Parameters:
srcBean - database object bean
destBean - directory object bean
jm - modification to apply on the main object
Returns:
Array of JndiModifications
Throws:
InvocationTargetException
IllegalAccessException
IllegalArgumentException

cloneSrcBean

public static IBean cloneSrcBean(IBean srcBean,
                                 ISyncOptions syncOptions,
                                 Object customLibrary)
                          throws CloneNotSupportedException

Clone the source bean and return a new object that is a copy of the srcBean and includes any modifications on the DN.

Always use this method for source/destination compares, and make sure to only change the result intermediary bean, never the original source bean

Parameters:
srcBean - Original bean from source
syncOptions -
customLibrary -
Returns:
New bean cloned from srcBean
Throws:
CloneNotSupportedException


Copyright © 2005-2010 LSC project. All Rights Reserved.