com.infoengine.util
Class LDAPExport

java.lang.Object
  extended bycom.infoengine.util.LDAPExport

public class LDAPExport
extends Object

This class will perform an LDAP Export from an LDAP directory to a ldif formatted text file. By default the LDAP credentials and export point is derived from the ie.properties file. The export can be done from any branch of the LDAP directory by specifying an LDAP uri as a parameter. Example - ldap://<managerDn>:<managerPw>@<hostname>[:<port>]/<distinguishedName> During export the ldif file is normalized with the base distinguished name of the export point and can be imported in another branch of another directory. Any attribute entry with an attribute value that contains the LDAP uri distinguished name is normalized. The resulting ldif file must be imported with the LDAPimport utility.

Parameters required are:

[dir] The home of Windchill installation (ex. c:\ptc\Windchill )
The value is not used if ldapurl is specified.

[ldiffile] A path relative to "dir" or the current director or an absolute path of the
ldif file to write.

[ldapurl] An ldap provider url specifying the directory and distinguished name
of the ldap branch to export to the ldif file.
This parameter is optional, if not specified, ie.properties
in the "dir" is used. Example:
ldap://cn=Manager:admin@jdmeyer03d.ptcnet.ptc.com/cn=myhost,cn=Application Services,o=ptc

[filter] An LDAP filter to limit the entries to export.
This parameter is optional.
[reldn] An LDAP relative distingusihed name used to further restrict the branch of the LDAP tree to export.
This parameter is optional.

Dependancies: Additional dependant jar files

ie.jar servlet.jar

The command line calling sequence is:
java -cp v:\Windchill\codebase;v:\Windchill\codebase\WEB-INF\lib\ie.jar;v:\Windchill\lib\servlet.jar com.infoengine.util.LDAPExport -dir (windchill install dir) -ldiffile file


Field Summary
private static String IEPROPS
           
private  String ivExportFile
          list of import files
private  String ivFilter
          LDAP search filter
private  String ivInstallDir
          Installation directory
private  String ivLdapUrl
          LDAP url
private  String ivRelDn
          LDAP search filter
 
Constructor Summary
LDAPExport()
           
 
Method Summary
 String getExportFile()
          Get the current ldif import list.
 String getIEProperties(String wcHome)
          Helper method to get the provider url from the Info*Engine install.
 String getInstallDir()
          Get the file path to current installation directory.
 String getLdapUrl()
          Return the current ldap url
 String getProvider(String wcHome)
          Helper method to get the provider url from the Info*Engine install.
 String getRelDn()
          Return the current relative dn
static void main(String[] args)
          Main entry point.
 void process(String[] args)
          Called by the install framework when this action is run.
 void runAction()
          May be called by java code to execute this action in a stand alone java environment.
 void setExportFile(String vals)
          Set the relative or absolute paths to the ldif files to import.
 void setInstallDir(String val)
          Set the file path to the installation directory.
 void setLdapUrl(String val)
          Set the LDAP url
 void setRelDn(String val)
          Set the relative dn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IEPROPS

private static final String IEPROPS
See Also:
Constant Field Values

ivInstallDir

private String ivInstallDir
Installation directory


ivExportFile

private String ivExportFile
list of import files


ivLdapUrl

private String ivLdapUrl
LDAP url


ivFilter

private String ivFilter
LDAP search filter


ivRelDn

private String ivRelDn
LDAP search filter

Constructor Detail

LDAPExport

public LDAPExport()
Method Detail

setInstallDir

public void setInstallDir(String val)
Set the file path to the installation directory.

Parameters:
val - Fully qualified path of a valid Windchill installation directory.

getInstallDir

public String getInstallDir()
Get the file path to current installation directory.

Returns:
The relative path to the current install directory

setExportFile

public void setExportFile(String vals)
Set the relative or absolute paths to the ldif files to import. A relative path is to the Windchill installation directory codebase.

Parameters:
vals - Relative or absolute path string.

getExportFile

public String getExportFile()
Get the current ldif import list.

Returns:
An array of the relative paths of the ldif files to import

setLdapUrl

public void setLdapUrl(String val)
Set the LDAP url

Parameters:
val - Specifies a valid string form of an LDAP url.

getLdapUrl

public String getLdapUrl()
Return the current ldap url

Returns:
String representation of the current LDAP Url.

setRelDn

public void setRelDn(String val)
Set the relative dn

Parameters:
val - Specifies a valid string form of relative dn.

getRelDn

public String getRelDn()
Return the current relative dn

Returns:
String representation of the current relative dn.

process

public void process(String[] args)
             throws IEException,
                    IOException
Called by the install framework when this action is run.

Throws:
Exception - If an unexpected exception occurs.
IEException
IOException

runAction

public void runAction()
               throws IEException,
                      IOException
May be called by java code to execute this action in a stand alone java environment. Required properties must be set correctly before execution.

Throws:
IEException - If a variable setting is unacceptable
IOException - If an IO error occurs when reading the ldif files.

getProvider

public String getProvider(String wcHome)
                   throws IOException
Helper method to get the provider url from the Info*Engine install. It will first look at the ie.properties located in /codebase/WEB-INF/ie.properties and attempt to determine the provider from there.

Parameters:
wcHome - Install path to the Windchill installation.
Returns:
The provider url
Throws:
IOException - If an unexpected exception occurs.

getIEProperties

public String getIEProperties(String wcHome)
Helper method to get the provider url from the Info*Engine install. It will first look at the ie.properties located in /codebase/WEB-INF/ie.properties and attempt to determine the provider from there.

Parameters:
wcHome - Install path to the Windchill installation.
Returns:
The provider url
Throws:
IOException - If an unexpected exception occurs.

main

public static void main(String[] args)
Main entry point.

Throws:
IOException - If an unexpected exception occurs.