/** * Creates the master entry table using a Berkeley Db for the backing store. * * @param recMan the jdbm record manager * @throws NamingException if there is an error opening the Db file. */ public JdbmMasterTable(RecordManager recMan) throws NamingException { super( DBF, recMan, BIG_INTEGER_COMPARATOR ); adminTbl = new JdbmTable( "admin", recMan, STRING_COMPARATOR ); String seqValue = ( String ) adminTbl.get( SEQPROP_KEY ); if ( null == seqValue ) { adminTbl.put( SEQPROP_KEY, BigInteger.ZERO.toString() ); } }
/** * Initializes the forward and reverse tables used by this Index. * * @param schemaManager The server schemaManager * @throws IOException if we cannot initialize the forward and reverse * tables * @throws NamingException */ private void initTables( SchemaManager schemaManager ) throws IOException { MatchingRule mr = attributeType.getEquality(); if ( mr == null ) { throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) ); } DnSerializerComparator comp = new DnSerializerComparator( mr.getOid() ); UuidComparator.INSTANCE.setSchemaManager( schemaManager ); DnSerializer dnSerializer = new DnSerializer( schemaManager ); forward = new JdbmTable<Dn, String>( schemaManager, attributeType.getOid() + FORWARD_BTREE, recMan, comp, dnSerializer, UuidSerializer.INSTANCE ); reverse = new JdbmTable<String, Dn>( schemaManager, attributeType.getOid() + REVERSE_BTREE, recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE, dnSerializer ); } }
/** * Initializes the forward and reverse tables used by this Index. * * @param schemaManager The server schemaManager * @throws IOException if we cannot initialize the forward and reverse * tables * @throws NamingException */ private void initTables( SchemaManager schemaManager ) throws IOException { MatchingRule mr = attributeType.getEquality(); if ( mr == null ) { throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) ); } ParentIdAndRdnComparator<String> comp = new ParentIdAndRdnComparator<String>( mr.getOid() ); UuidComparator.INSTANCE.setSchemaManager( schemaManager ); ParentIdAndRdnSerializer parentIdAndSerializer = new ParentIdAndRdnSerializer( schemaManager ); forward = new JdbmTable<ParentIdAndRdn, String>( schemaManager, attributeType.getOid() + FORWARD_BTREE, recMan, comp, parentIdAndSerializer, UuidSerializer.INSTANCE ); reverse = new JdbmTable<String, ParentIdAndRdn>( schemaManager, attributeType.getOid() + REVERSE_BTREE, recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE, parentIdAndSerializer ); } }
/** * Creates a new instance of EventLog for a replica * * @param partitionTxn The Transaction to use * @param directoryService The DirectoryService instance * @param replicaId The replica ID * @throws IOException if we weren't able to log the event */ public ReplicaEventLog( PartitionTxn partitionTxn, DirectoryService directoryService, int replicaId ) throws IOException { PROVIDER_LOG.debug( "Creating the replication queue for replica {}", replicaId ); SchemaManager schemaManager = directoryService.getSchemaManager(); this.replicaId = replicaId; this.searchCriteria = new NotificationCriteria( schemaManager ); this.searchCriteria.setEventMask( EventType.ALL_EVENT_TYPES_MASK ); // Create the journal file, or open if already exists File replDir = directoryService.getInstanceLayout().getReplDirectory(); journalFile = new File( replDir, REPLICA_EVENT_LOG_NAME_PREFIX + replicaId ); recman = new BaseRecordManager( journalFile.getAbsolutePath() ); TransactionManager transactionManager = ( ( BaseRecordManager ) recman ).getTransactionManager(); transactionManager.setMaximumTransactionsInLog( 200 ); SerializableComparator<String> comparator = new SerializableComparator<>( SchemaConstants.CSN_ORDERING_MATCH_MR_OID ); comparator.setSchemaManager( schemaManager ); journal = new JdbmTable<>( schemaManager, journalFile.getName(), recman, comparator, StringSerializer.INSTANCE, new ReplicaEventMessageSerializer( schemaManager ) ); this.partitionTxn = partitionTxn; }
forward = new JdbmTable<>( schemaManager, attributeType.getOid() + FORWARD_BTREE, numDupLimit, recMan, comp, UuidComparator.INSTANCE, StringSerializer.INSTANCE, UuidSerializer.INSTANCE ); forward = new JdbmTable<>( schemaManager, attributeType.getOid() + FORWARD_BTREE, numDupLimit, recMan, comp, UuidComparator.INSTANCE, new ByteArraySerializer(), UuidSerializer.INSTANCE ); reverse = new JdbmTable<>( schemaManager, attributeType.getOid() + REVERSE_BTREE, recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE, null ); reverse = new JdbmTable<>( schemaManager, attributeType.getOid() + REVERSE_BTREE, numDupLimit, recMan, UuidComparator.INSTANCE, comp, UuidSerializer.INSTANCE, null );
/** * Initializes the forward and reverse tables used by this Index. * * @throws NamingException if we cannot initialize the forward and reverse * tables */ private void initTables() throws NamingException { SerializableComparator comp; comp = new SerializableComparator( attribute.getEquality().getOid() ); /* * The forward key/value map stores attribute values to master table * primary keys. A value for an attribute can occur several times in * different entries so the forward map can have more than one value. */ forward = new JdbmTable( attribute.getName() + FORWARD_BTREE, true, numDupLimit, recMan, new IndexComparator( comp, true ) ); /* * Now the reverse map stores the primary key into the master table as * the key and the values of attributes as the value. If an attribute * is single valued according to its specification based on a schema * then duplicate keys should not be allowed within the reverse table. */ reverse = new JdbmTable( attribute.getName() + REVERSE_BTREE, !attribute.isSingleValue(), numDupLimit, recMan, new IndexComparator( comp, false ) ); }