Le 29/09/14 10:08, Sebastian Oerding a écrit :
> Hello,
>
> thanks for the help provided thus far. however I still struggling with
> the Apache DS. I tried to add a partition with
>
> private void addPartition(DirectoryService service) {
>
> AvlPartition partition = new
> AvlPartition(service.getSchemaManager());
>
> partition.setId("smpki");
> try {
> partition.setSuffixDn(new Dn(service.getSchemaManager(),
> "dc=smpki"));
> // AvlRdnIndex index = new AvlRdnIndex("2.5.4.3");
> // partition.addIndex(index);
> partition.initialize();
>
> // create the context entry
> Entry contextEntry = new
> DefaultEntry(service.getSchemaManager(), "dc=smpki", "objectClass: top",
> "objectClass: organizationalUnit", "ou: certificates");
>
> partition.add(new AddOperationContext(null, contextEntry));
>
> service.addPartition(partition);
> } catch (Exception e) {
> LOG.error("Error adding a partition", e);
> throw new IllegalStateException("Error occurred adding
> partition!");
> }
> }
>
> but now I'm getting the error
>
> ERR_219 Entry dc=smpki contains no entryCsn attribute: Entry
> dn[n]: dc=smpki
> objectclass: top
> objectclass: organizationalUnit
> ou: certificates
You have to add some internal attributes :
// Adding the 'entryCsn' attribute
if ( contextEntry.get(
SchemaConstants.ENTRY_CSN_AT ) == null )
{
contextEntry.add(
SchemaConstants.ENTRY_CSN_AT, new CsnFactory( 0 ).newInstance()
.toString() );
}
// Adding the 'entryUuid' attribute
if ( contextEntry.get(
SchemaConstants.ENTRY_UUID_AT ) == null )
{
String uuid = UUID.randomUUID().toString();
contextEntry.add(
SchemaConstants.ENTRY_UUID_AT, uuid );
}
>
> I would be glad to use the Apache DS for parsing the requests.
> However as I have only 5 days left to integrate the functionality to
> parse LDAP requests I can not afford to waste any more time with
> fruitless attempts to get it running. If I do not get it managed to
> use the Apache DS I have to write my own ASN1 / LDAP message parser.
Don't expect to be able to write an ASN/1-LDAP parser in 5 days ;-) Keep
going on the mailing list, we should be able to help ypu getting your
partition working before that.