com.sun.slamd.db
Class DSMigrator

java.lang.Object
  extended by com.sun.slamd.db.DSMigrator

public class DSMigrator
extends java.lang.Object

This class provides a utility that can be used to migrate data from a SLAMD 1.x-style configuration directory server to the new embedded configuration database. It can migrate all of the data, or just a selected portion of it (at the folder level).

Author:
Neil A. Wilson

Constructor Summary
DSMigrator(SLAMDServer slamdServer, java.lang.String serverAddress, int serverPort, boolean useSSL, java.lang.String bindDN, java.lang.String bindPW, java.lang.String baseDN)
          Creates a new instance of this DS migrator with the specified configuration.
 
Method Summary
 java.lang.String[] getFolderNames()
          Retrieves a list of the job folders that have been defined in the configuration directory.
 java.lang.String[] getUploadedFileNames(java.lang.String folderDN)
          Retrieves the names of the uploaded files contained in the specified folder in the directory server.
 java.lang.String[] getVirtualFolderNames()
          Retrieves a list of the virtual job folders that have been defined in the configuration directory.
 boolean migrateJobFolder(java.lang.String folderName, java.io.PrintWriter writer)
          Attempts to migrate all the data contained in the specified folder from the configuration directory into the new database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSMigrator

public DSMigrator(SLAMDServer slamdServer,
                  java.lang.String serverAddress,
                  int serverPort,
                  boolean useSSL,
                  java.lang.String bindDN,
                  java.lang.String bindPW,
                  java.lang.String baseDN)
           throws netscape.ldap.LDAPException
Creates a new instance of this DS migrator with the specified configuration.

Parameters:
slamdServer - The SLAMD server instance into which the data is to be imported.
serverAddress - The address of the directory server containing the data to migrate.
serverPort - The port of the directory server.
useSSL - Indicates whether to use SSL to communicate with the directory server.
bindDN - The DN to use to bind to the directory server.
bindPW - The password to use to bind to the directory server.
baseDN - The base DN for the SLAMD data in the directory server.
Throws:
netscape.ldap.LDAPException - If the connection is configured to use SSL but a problem occurs while trying to perform the SSL initialization.
Method Detail

getFolderNames

public java.lang.String[] getFolderNames()
                                  throws netscape.ldap.LDAPException
Retrieves a list of the job folders that have been defined in the configuration directory.

Returns:
A list of the job folders that have been defined in the configuration directory.
Throws:
netscape.ldap.LDAPException - If a problem occurs while attempting to interact with the configuration directory.

getVirtualFolderNames

public java.lang.String[] getVirtualFolderNames()
                                         throws netscape.ldap.LDAPException
Retrieves a list of the virtual job folders that have been defined in the configuration directory.

Returns:
A list of the virtual job folders that have been defined in the configuration directory.
Throws:
netscape.ldap.LDAPException - If a problem occurs while attempting to interact with the configuration directory.

migrateJobFolder

public boolean migrateJobFolder(java.lang.String folderName,
                                java.io.PrintWriter writer)
Attempts to migrate all the data contained in the specified folder from the configuration directory into the new database. This will migrate the folder itself, along with the jobs, optimizing jobs, and uploaded files that it contains.

Parameters:
folderName - The name of the job folder to migrate.
writer - The print writer that should be used to output information about the progress of the migration.
Returns:
true if the migration was completely successful, or false if there may have been problems along the way that could have interfered with the migration.

getUploadedFileNames

public java.lang.String[] getUploadedFileNames(java.lang.String folderDN)
                                        throws netscape.ldap.LDAPException
Retrieves the names of the uploaded files contained in the specified folder in the directory server.

Parameters:
folderDN - The DN of the job folder entry with which the uploaded files should be associated.
Returns:
The names of the uploaded files contained in the specified folder.
Throws:
netscape.ldap.LDAPException - If a problem occurs while interacting with the directory server.