protected Partition addPartition(String partitionId, String partitionDn) throws Exception { Partition partition = new JdbmPartition(); partition.setId(partitionId); partition.setSuffix(partitionDn); service.addPartition(partition); return partition; }
public ApacheDSContainer(String root, String ldifs) throws Exception { this.ldifResources = ldifs; service = new DefaultDirectoryService(); List<Interceptor> list = new ArrayList<>(); list.add(new NormalizationInterceptor()); list.add(new AuthenticationInterceptor()); list.add(new ReferralInterceptor()); // list.add( new AciAuthorizationInterceptor() ); // list.add( new DefaultAuthorizationInterceptor() ); list.add(new ExceptionInterceptor()); // list.add( new ChangeLogInterceptor() ); list.add(new OperationalAttributeInterceptor()); // list.add( new SchemaInterceptor() ); list.add(new SubentryInterceptor()); // list.add( new CollectiveAttributeInterceptor() ); // list.add( new EventInterceptor() ); // list.add( new TriggerInterceptor() ); // list.add( new JournalInterceptor() ); service.setInterceptors(list); partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(root); this.root = root; service.addPartition(partition); service.setExitVmOnShutdown(false); service.setShutdownHookEnabled(false); service.getChangeLog().setEnabled(false); service.setDenormalizeOpAttrsEnabled(true); }
service.getAdminSession().lookup(partition.getSuffixDn());
/** * @see Index#count(java.lang.Object) */ public int count( Object attrVal ) throws NamingException { return forward.count( getNormalized( attrVal ) ); }
/** * @see Index#hasValue(java.lang.Object, * java.math.BigInteger) */ public boolean hasValue( Object attrVal, BigInteger id ) throws NamingException { return forward.has( getNormalized( attrVal ), id ); }
/** * @see org.apache.directory.server.core.partition.impl.btree.Index#add(java.lang.Object, * java.math.BigInteger) */ public synchronized void add( Object attrVal, BigInteger id ) throws NamingException { forward.put( getNormalized( attrVal ), id ); reverse.put( id, getNormalized( attrVal ) ); }
/** * @see org.apache.directory.server.core.partition.impl.btree.Index#drop(java.lang.Object, * java.math.BigInteger) */ public synchronized void drop( Object attrVal, BigInteger id ) throws NamingException { forward.remove( getNormalized( attrVal ), id ); reverse.remove( id, getNormalized( attrVal ) ); }
/** * @see Index#forwardLookup(java.lang.Object) */ public BigInteger forwardLookup( Object attrVal ) throws NamingException { return ( BigInteger ) forward.get( getNormalized( attrVal ) ); }
/** * {@inheritDoc} */ public long count( PartitionTxn partitionTxn ) throws LdapException { return forward.count( partitionTxn ); }
/** * {@inheritDoc} */ @Override public Cursor<org.apache.directory.api.ldap.model.cursor.Tuple<K, V>> cursor() { if ( allowsDuplicates ) { return new DupsCursor<>( this ); } return new NoDupsCursor<>( this ); }
@Override public PartitionWriteTxn beginWriteTransaction() { return new JdbmPartitionWriteTxn( recMan, isSyncOnWrite() ); } }
/** * {@inheritDoc} */ public String forwardLookup( PartitionTxn partitionTxn, K attrVal ) throws LdapException { return forward.get( partitionTxn, attrVal ); }
static final int write( byte[] buf, byte[] value, int offset ) { offset = writeLengthBytes( buf, value.length, offset ); return writeValueBytes( buf, value, offset ); }
/** * {@inheritDoc} */ public byte[] serialize( Object o ) throws IOException { String uuid = ( String ) o; return StringSerializer.INSTANCE.serialize( uuid ); }
/** * {@inheritDoc} */ @Override public void close() throws IOException { commit(); } }
public ApacheDsSSLContainer(String root, Resource[] ldifs) throws Exception { this.ldifResources = ldifs; service = new DefaultDirectoryService(); List<Interceptor> list = new ArrayList<Interceptor>(); //list.add(new NormalizationInterceptor()); list.add(new AuthenticationInterceptor()); list.add(new ReferralInterceptor()); // list.add( new AciAuthorizationInterceptor() ); // list.add( new DefaultAuthorizationInterceptor() ); //list.add(new ExceptionInterceptor()); // list.add( new ChangeLogInterceptor() ); //list.add(new OperationalAttributeInterceptor()); // list.add( new SchemaInterceptor() ); //list.add(new SubentryInterceptor()); // list.add( new CollectiveAttributeInterceptor() ); // list.add( new EventInterceptor() ); // list.add( new TriggerInterceptor() ); // list.add( new JournalInterceptor() ); //service.setInterceptors(list); partition = new JdbmPartition(); partition.setId("rootPartition"); partition.setSuffix(root); this.root = root; service.addPartition(partition); service.setExitVmOnShutdown(false); service.setShutdownHookEnabled(false); service.getChangeLog().setEnabled(false); service.setDenormalizeOpAttrsEnabled(true); }
service.getAdminSession().lookup(partition.getSuffixDn()); } catch (LdapNameNotFoundException e) { try {
/** * @see org.apache.directory.server.core.partition.impl.btree.Index#count(java.lang.Object, boolean) */ public int count( Object attrVal, boolean isGreaterThan ) throws NamingException { return forward.count( getNormalized( attrVal ), isGreaterThan ); }
/** * @see Index#hasValue(java.lang.Object, * java.math.BigInteger, boolean) */ public boolean hasValue( Object attrVal, BigInteger id, boolean isGreaterThan ) throws NamingException { return forward.has( getNormalized( attrVal ), id, isGreaterThan ); }