directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Karasulu" <akaras...@apache.org>
Subject Re: Replicating an AD schema with ADS
Date Tue, 26 Feb 2008 19:52:10 GMT
You could just write a little JNDI program to read the contents of the
subschema subentry from AD and ADS and add those definitions that are not
present in ADS.  This is very easy to do.  Here's some code for that:

        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
        controls.setReturningAttributes( new String[]{ "subschemaSubentry" }
);

        NamingEnumeration<SearchResult> results = getRootContext( service )
                .search( "", "(objectClass=*)", controls );
        SearchResult result = results.next();
        results.close();
        Attribute subschemaSubentry = result.getAttributes().get(
"subschemaSubentry" );
        String subentryDN = subschemaSubentry.get();

Once you get the subentryDn you can object level search that entry for
attributeTypes to list everything there.

        SearchControls controls = new SearchControls();
        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
        controls.setReturningAttributes( new String[]{ "+", "*" } );

        NamingEnumeration<SearchResult> results = getRootContext( service )
                .search( subentryDN, "(objectClass=*)", controls );
        SearchResult result = results.next();
        results.close();
        Attributes attrs = result.getAttributes();

Now that you have these attributeTypes you can simply do a modify (add)
operation against the subschemaSubentry of ApacheDS adding these very same
attributes you pulled out of AD.

Note you have to make sure that if you do want to migrate an attributeType
from AD to ApacheDS you should make sure it's syntax and matchingRules are
supported in ApacheDS.

HTH,
Alex


On Tue, Feb 26, 2008 at 2:39 PM, Hammond, Steve <steve.hammond@polycom.com>
wrote:

> I have been trying to find an ldif or schema or AD so that I can use
> some of the attributes in ADS.
>
>
>
> I have a connection in Studio to an AD, and I can see the schema, but I
> have not been able to find a way to import that into the schema editor.
>
>
>
> If I can find an ldif, that would be cool, if there is a way to import
> from the ad we are using, that would be nice.
>
>
>
> The end result, is that we have another team that has written their
> clients to work against AD (sAMAccountName, ObjectGUID, group, ...) and
> I need ADS to look like AD with these attributes.
>
>
>
> Thanx.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message