UnboundID LDAP SDK for Java

LDAP SDK Home Page
Product Information
Using the UnboundID LDAP SDK Persistence Framework

The generate-source-from-schema Tool

The generate-source-from-schema tool may be used to automatically generate properly-annotated Java source code for a class that may be used with the LDAP SDK persistence framework using schema information read from an LDAP directory server. It can dramatically simplify the process of creating an LDAP-enabled application which can be used to interact with existing data.

It is a command-line tool that may be invoked using the corresponding shell script or batch file located in the tools directory of the UnboundID LDAP SDK for Java distribution. Alternately, it may be run programmatically by invoking the main method of class com.unboundid.ldap.sdk.persist.GenerateSourceFromSchema. In either case, some of the arguments which may be used with this tool are provided below. Use the --help argument for a complete listing of all supported options.

  • --hostname {host} -- This specifies the address of the directory server containing the schema definitions to be read. If this is not provided, then a default of "localhost" will be used.

  • --port {port} -- This specifies the port number of the directory server containing the schema definitions to be read. If this is not provided, then a default of "389" will be used.

  • --bindDN {dn} -- This specifies the DN for the user as whom to bind when reading the schema definitions. If this is not provided, then no authentication will be performed.

  • --bindPassword {password} -- This specifies the password for the user as whom to bind when reading the schema definitions. If this is not provided, then no authentication will be performed.

  • --useSSL -- This indicates that the tool should communicate securely with the directory server using SSL.

  • --useStartTLS -- This indicates that the tool should communicate securely with the directory server using the StartTLS extended operation.

  • --outputDirectory {path} -- This specifies the path to the directory in which to write the Java source file. If a value is given, then that path must exist, and it must be a directory. If no value is provided, then the current working directory will be used.

  • --structuralClass {name} -- This specifies the name of the structural object class that should be used for the object to create. This argument must be provided, and it must be the name of a structural object class defined in the directory server schema.

  • --auxiliaryClass {name} -- This specifies the name of an auxiliary object class that should be used in conjunction with the structural object class. This argument may be provided multiple times with different auxiliary object class names if multiple auxiliary classes should be used. If this is not provided, then no auxiliary object classes will be used.

  • --rdnAttribute {name} -- This specifies the name of an attribute which should be used to construct the RDN of entries generated from objects of the associated type. The specified attribute name must be defined in the directory server schema, and it must be allowed by at least one of the structural or auxiliary object classes. This argument may be provided multiple times with different attribute names if generated entries should have multivalued RDNs. At least one RDN attribute must be specified.

  • --defaultParentDN {dn} -- This specifies the default parent DN that will be used for objects of the associated type. It may be used when adding entries created from Java objects, or as the base DN when searching for objects. If no default parent DN is specified, then it is assumed that an explicit parent DN will be given for every search or add operation.

  • --packageName {name} -- This specifies the fully-qualified name of the Java package to use for the generated class. If this is not provided, then the generated class will be placed in the default (i.e., top-level) package.

  • --className {name} -- This specifies the name to use for the generated Java class. If a value is given, it must be unqualified (i.e., it should not include any package information). If this is not provided, then the class name will be generated from the name of the structural object class.