You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2018/01/23 07:20:57 UTC
[directory-server] 02/05: o Fixed Java 8 warnings o Removed useless
comparator in JdbmMasterTable o Removed the useless adminTable in
JdbmMasterTable o Removed the unused resetCounter method in JdbmMasterTable
o Removed the useless close() method from the MavibotMasterTable
This is an automated email from the ASF dual-hosted git repository.
elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-server.git
commit 1a6205e780ec66e2a6094b0f65f6cab62d4b8d0b
Author: Emmanuel Lécharny <el...@symas.com>
AuthorDate: Fri Jan 5 19:44:44 2018 +0100
o Fixed Java 8 warnings
o Removed useless comparator in JdbmMasterTable
o Removed the useless adminTable in JdbmMasterTable
o Removed the unused resetCounter method in JdbmMasterTable
o Removed the useless close() method from the MavibotMasterTable
---
.../partition/impl/btree/jdbm/JdbmMasterTable.java | 48 ----------------------
.../impl/btree/mavibot/MavibotMasterTable.java | 7 ----
.../directory/server/xdbm/impl/avl/AvlTable.java | 24 +++++------
3 files changed, 12 insertions(+), 67 deletions(-)
diff --git a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
index a96e306..0553f81 100644
--- a/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
+++ b/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
@@ -24,11 +24,9 @@ import java.util.UUID;
import jdbm.RecordManager;
import jdbm.helper.Serializer;
-import jdbm.helper.StringComparator;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
-import org.apache.directory.api.ldap.model.schema.comparators.SerializableComparator;
import org.apache.directory.api.ldap.model.schema.comparators.UuidComparator;
import org.apache.directory.server.xdbm.MasterTable;
@@ -40,23 +38,6 @@ import org.apache.directory.server.xdbm.MasterTable;
*/
public class JdbmMasterTable extends JdbmTable<String, Entry> implements MasterTable
{
- private static final StringComparator STRCOMP = new StringComparator();
-
- private static final SerializableComparator<String> STRING_COMPARATOR =
- new SerializableComparator<String>( "1.3.6.1.4.1.18060.0.4.1.1.3" )
- {
- private static final long serialVersionUID = 3258689922792961845L;
-
-
- public int compare( String o1, String o2 )
- {
- return STRCOMP.compare( o1, o2 );
- }
- };
-
- protected final JdbmTable<String, String> adminTbl;
-
-
/**
* Creates the master table using JDBM B+Trees for the backing store.
*
@@ -68,17 +49,8 @@ public class JdbmMasterTable extends JdbmTable<String, Entry> implements MasterT
{
super( schemaManager, DBF, recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE,
new EntrySerializer( schemaManager ) );
- adminTbl = new JdbmTable<String, String>( schemaManager, "admin", recMan, STRING_COMPARATOR,
- StringSerializer.INSTANCE, StringSerializer.INSTANCE );
- String seqValue = adminTbl.get( SEQPROP_KEY );
-
- if ( null == seqValue )
- {
- adminTbl.put( SEQPROP_KEY, "0" );
- }
UuidComparator.INSTANCE.setSchemaManager( schemaManager );
- STRING_COMPARATOR.setSchemaManager( schemaManager );
}
@@ -86,14 +58,6 @@ public class JdbmMasterTable extends JdbmTable<String, Entry> implements MasterT
throws Exception
{
super( schemaManager, DBF, recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE, serializer );
- adminTbl = new JdbmTable<String, String>( schemaManager, dbName, recMan, STRING_COMPARATOR,
- StringSerializer.INSTANCE, StringSerializer.INSTANCE );
- String seqValue = adminTbl.get( SEQPROP_KEY );
-
- if ( null == seqValue )
- {
- adminTbl.put( SEQPROP_KEY, "0" );
- }
}
@@ -111,16 +75,4 @@ public class JdbmMasterTable extends JdbmTable<String, Entry> implements MasterT
{
return UUID.randomUUID().toString();
}
-
-
- /**
- * {@inheritDoc}
- */
- public void resetCounter() throws Exception
- {
- synchronized ( adminTbl )
- {
- adminTbl.put( SEQPROP_KEY, "0" );
- }
- }
}
diff --git a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java
index 55b0aa6..67bfb61 100644
--- a/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java
+++ b/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java
@@ -55,11 +55,4 @@ public class MavibotMasterTable extends MavibotTable<String, Entry> implements M
{
return UUID.randomUUID().toString();
}
-
-
- @Override
- public void close() throws Exception
- {
- // do nothing here, the RecordManager will be closed in MavibotMasterTable.close()
- }
}
diff --git a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java
index 00a44ba..7d53c3b 100644
--- a/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java
+++ b/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java
@@ -54,7 +54,7 @@ public class AvlTable<K, V> extends AbstractTable<K, V>
boolean dupsEnabled )
{
super( null, name, keyComparator, valueComparator );
- this.avl = new AvlTreeMapImpl<K, V>( keyComparator, valueComparator, dupsEnabled );
+ this.avl = new AvlTreeMapImpl<>( keyComparator, valueComparator, dupsEnabled );
allowsDuplicates = this.avl.isDupsAllowed();
this.keyOnlytupleComparator = new Comparator<Tuple<K, V>>()
{
@@ -71,7 +71,7 @@ public class AvlTable<K, V> extends AbstractTable<K, V>
*/
public void close() throws Exception
{
- ( ( AvlTreeMapImpl ) avl ).removeAll();
+ ( ( AvlTreeMapImpl<K, V> ) avl ).removeAll();
}
@@ -332,11 +332,11 @@ public class AvlTable<K, V> extends AbstractTable<K, V>
{
if ( !allowsDuplicates )
{
- return new AvlTreeMapNoDupsWrapperCursor<K, V>(
+ return new AvlTreeMapNoDupsWrapperCursor<>(
new AvlSingletonOrOrderedSetCursor<K, V>( avl ) );
}
- return new AvlTableDupsCursor<K, V>( this );
+ return new AvlTableDupsCursor<>( this );
}
@@ -347,22 +347,22 @@ public class AvlTable<K, V> extends AbstractTable<K, V>
{
if ( key == null )
{
- return new EmptyCursor<Tuple<K, V>>();
+ return new EmptyCursor<>();
}
LinkedAvlMapNode<K, V> node = avl.find( key );
if ( node == null )
{
- return new EmptyCursor<Tuple<K, V>>();
+ return new EmptyCursor<>();
}
if ( node.getValue().isOrderedSet() )
{
- return new KeyTupleAvlCursor<K, V>( node.getValue().getOrderedSet(), key );
+ return new KeyTupleAvlCursor<>( node.getValue().getOrderedSet(), key );
}
- return new SingletonCursor<Tuple<K, V>>( new Tuple<K, V>( key, node.getValue().getSingleton() ),
+ return new SingletonCursor<>( new Tuple<K, V>( key, node.getValue().getSingleton() ),
keyOnlytupleComparator );
}
@@ -374,22 +374,22 @@ public class AvlTable<K, V> extends AbstractTable<K, V>
{
if ( key == null )
{
- return new EmptyCursor<V>();
+ return new EmptyCursor<>();
}
LinkedAvlMapNode<K, V> node = avl.find( key );
if ( node == null )
{
- return new EmptyCursor<V>();
+ return new EmptyCursor<>();
}
if ( node.getValue().isOrderedSet() )
{
- return new AvlTreeCursor<V>( node.getValue().getOrderedSet() );
+ return new AvlTreeCursor<>( node.getValue().getOrderedSet() );
}
- return new SingletonCursor<V>( node.getValue().getSingleton(), valueComparator );
+ return new SingletonCursor<>( node.getValue().getSingleton(), valueComparator );
}
--
To stop receiving notification emails like this one, please contact
elecharny@apache.org.