wt.org
Class UpgradeUFIDsR6toR7

java.lang.Object
  extended bywt.org.UpgradeUFIDsR6toR7
All Implemented Interfaces:
JavaMigrator

public class UpgradeUFIDsR6toR7
extends Object
implements JavaMigrator

Migration strategy: Obtain all entries from the REMOTEOBJECTINFO table that reference objects of type WTUser and WTGroup. Query the LDAP service of each such object to determine the object's distinguished name. Set the object's normalized distinguished name as its REMOTEOBJECTID column value.


Field Summary
private static String CLASSNAME
           
private  Connection connection
           
private  String defaultDirectoryUser
           
private  boolean DISABLE_PRINCIPAL
           
private  DirectiveServices ds
           
private  HashMap groupIds
           
private  HashMap groupServices
           
private  String PJL_GROUP_SERVICE
           
private static String RESOURCE
           
private  HashMap services
          HashMap of LDAP service names, keyed by repository OID.
private  Vector unableToLocatePrincipals
          This vector is a list of Principals that were not found in the list of adapters.
private  HashMap userIds
          HashMaps, keyed by UFID OID, of REMOTEOBJECTID values and associated LDAP service names.
private  HashMap userServices
           
private  boolean VERBOSE
           
 
Constructor Summary
UpgradeUFIDsR6toR7()
           
 
Method Summary
private  void disablePrincipal(String oid, String name, String service, boolean userFlag)
          Disables specified principal; mangles the name, and deletes the REMOTEOBJECTINFO table
private  String escape(String s)
           
private  String getDN(String remoteObjectInfo, String service, String oid, boolean userFlag)
          Query an LDAP service for a principal and, if found, return the entry's normalized distinguished name.
private  void getServices()
          Gets the names information services and their corresponding OIDs.
private  void getUFIDs()
          Gets REMOTEOBJECTID values of UFID's of all users and groups.
private  void initialize()
          initialize.
private static String nextUp(String name)
           
 boolean runMigration(DirectiveServices ds)
          Run the migration.
private static void safeClose(ResultSet rs)
          If the Statement is not null, try to close it, catching and smothering any SQLException that results.
private  void safeClose(Statement stmt)
          If the Statement is not null, try to close it, catching and smothering any SQLException that results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

connection

private Connection connection

defaultDirectoryUser

private String defaultDirectoryUser

ds

private DirectiveServices ds

VERBOSE

private boolean VERBOSE

DISABLE_PRINCIPAL

private boolean DISABLE_PRINCIPAL

PJL_GROUP_SERVICE

private String PJL_GROUP_SERVICE

services

private HashMap services
HashMap of LDAP service names, keyed by repository OID.


userIds

private HashMap userIds
HashMaps, keyed by UFID OID, of REMOTEOBJECTID values and associated LDAP service names.


userServices

private HashMap userServices

groupIds

private HashMap groupIds

groupServices

private HashMap groupServices

unableToLocatePrincipals

private Vector unableToLocatePrincipals
This vector is a list of Principals that were not found in the list of adapters. All referenced principals should already exist in LDAP.

Constructor Detail

UpgradeUFIDsR6toR7

public UpgradeUFIDsR6toR7()
Method Detail

runMigration

public boolean runMigration(DirectiveServices ds)
                     throws SQLException,
                            IOException,
                            ClassNotFoundException,
                            WTException,
                            IEException,
                            Exception
Description copied from interface: JavaMigrator
Run the migration.

Migrators should log all output to the given PrintWriter. This is the log that is created by RunMigrators. It is an autoflush writer.

Migrators should return true if they successfully completed migration and false otherwise. It is the migrator's responsibility to log failure reasons to the log.

Migrators should not concern themselves with committing the work on the connection. The MigratorRunner will commit the connection work after running each Migrator.

Specified by:
runMigration in interface JavaMigrator
Parameters:
ds - provide access to database, logging, and versioning information
Throws:
SQLException
IOException
ClassNotFoundException
WTException
IEException
Exception

initialize

private void initialize()
                 throws WTException,
                        IOException,
                        IEException,
                        Exception
initialize.

Throws:
WTException
IOException
IEException
Exception

getDN

private String getDN(String remoteObjectInfo,
                     String service,
                     String oid,
                     boolean userFlag)
              throws SQLException,
                     IOException,
                     IEException,
                     WTException,
                     ClassNotFoundException
Query an LDAP service for a principal and, if found, return the entry's normalized distinguished name.

Throws:
SQLException
IOException
IEException
WTException
ClassNotFoundException

getServices

private void getServices()
                  throws SQLException,
                         IOException,
                         WTException,
                         DatastoreException,
                         IEException
Gets the names information services and their corresponding OIDs.

Throws:
SQLException
IOException
WTException
DatastoreException
IEException

getUFIDs

private void getUFIDs()
               throws SQLException,
                      IOException,
                      WTException,
                      ClassNotFoundException,
                      DatastoreException,
                      IEException
Gets REMOTEOBJECTID values of UFID's of all users and groups.

Throws:
SQLException
IOException
WTException
ClassNotFoundException
DatastoreException
IEException

disablePrincipal

private void disablePrincipal(String oid,
                              String name,
                              String service,
                              boolean userFlag)
                       throws SQLException,
                              IOException,
                              WTException,
                              ClassNotFoundException,
                              DatastoreException,
                              IEException
Disables specified principal; mangles the name, and deletes the REMOTEOBJECTINFO table

Throws:
SQLException
IOException
WTException
ClassNotFoundException
DatastoreException
IEException

escape

private String escape(String s)

safeClose

private void safeClose(Statement stmt)
If the Statement is not null, try to close it, catching and smothering any SQLException that results.


safeClose

private static void safeClose(ResultSet rs)
If the Statement is not null, try to close it, catching and smothering any SQLException that results.


nextUp

private static String nextUp(String name)