Emmanuel Lécharny <[email protected]> writes: > Le 8/22/13 8:11 PM, Gerald Turner a écrit : >> Gerald Turner <[email protected]> writes: Sorry about the huge >> mailing list post, I went ahead and created bug DIRAPI-156 >> instead. I'm trying like mad to get the ApacheDS client API schema >> aware with our OpenLDAP server contianing a couple custom >> attributes/classes. I can proceed with the hacked copy of the >> 'schema' folder and use LdifSchemaLoader(File) - unfortunately this >> will be ugly as far as deployment goes. > Sorry for not beng able to help... I wrote some part of his API, but I > have no time to give ou some direction, as I leave for one week... > > The key, here, is to create the correct schemaLoader and to use it to > initialize the schemaManager : > > LdifSchemaLoader loader = new LdifSchemaLoader( new File( workingDirectory, > "schema" ) ); > SchemaManager sm = new DefaultSchemaManager( loader ); > > boolean loaded = sm.loadAllEnabled(); > > The first step creates a loader that read the schema from ldif files > on the disk. The second step creates the schemamanager. the third step > loads the enabled schemas to generate a valid schemaManager that can > be use by the API. > > The tricky part here is that the schema must be stored in a LDIF > format which is specific to ApacheDS. > > Or you can use a SchemaEditorSchemaLoader, which is capable of > converting OpenLDAP formatted schema to standard ApacheDS entries > (this should work, I never tested it). > > I'm not sure tht it helps, but I would be pleased to help when I'll be > back from vacations (in one week).
Thanks Emmanuel, I basically have what you're talking about implemented, also from advice given by Kiran and Stefan. I've come down to three flavors, in order of preference, unfortunately the first two don't work: // Load schema: // - Using RFC4512 // Bug: https://issues.apache.org/jira/browse/DIRAPI-154 //con.loadSchema(); // - Using ApacheDS native schema + custom OpenLDAP schema // Bug: https://issues.apache.org/jira/browse/DIRAPI-156 //con.loadSchema(new JarLdifSchemaLoader()); //con.addSchema(getFileResource("openldap-schema/xocust.schema")); // - Using modified copy of ApacheDS native schema con.loadSchema(new LdifSchemaLoader(getFileResource("apacheds-schema"))); The third flavor works, but it's going to be a deployment problem. I want to pack the schema directory in a JAR, but don't think there's a way to get a JAR Resource to a File required by the LdifSchemaLoader constructor, so I may have to do something silly like copy them to some external path on the servers. I like your concept of initializing a SchemaManager outside of LdapNetworkConnection loadSchema/addSchema methods. Too bad LdapNetworkConnection doesn't have setSchemaManager (only getter) - perhaps that would be a simple solution to DIRAPI-153 https://issues.apache.org/jira/browse/DIRAPI-153 -- Gerald Turner Email: [email protected] JID: [email protected] GPG: 0xFA8CD6D5 21D9 B2E8 7FE7 F19E 5F7D 4D0C 3FA0 810F FA8C D6D5
pgpnTCYysGXl3.pgp
Description: PGP signature
