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 2016/06/15 12:30:01 UTC
svn commit: r1748572 [15/23] - in
/directory/apacheds/branches/apacheds-value: ./
benchmarks/installers-maven-plugin/
benchmarks/installers-maven-plugin/.settings/
benchmarks/installers-maven-plugin/target/
benchmarks/installers-maven-plugin/target/cla...
Modified: directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/DefaultChangeLog.java Wed Jun 15 12:29:57 2016
@@ -93,6 +93,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public ChangeLogStore getChangeLogStore()
{
return store;
@@ -104,6 +105,7 @@ public class DefaultChangeLog implements
*
* If there is an existing changeLog store, we don't switch it
*/
+ @Override
public void setChangeLogStore( ChangeLogStore store )
{
if ( storeInitialized )
@@ -120,7 +122,8 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
- public long getCurrentRevision() throws LdapException
+ @Override
+public long getCurrentRevision() throws LdapException
{
synchronized ( store )
{
@@ -132,6 +135,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws LdapException
{
if ( !enabled )
@@ -141,9 +145,7 @@ public class DefaultChangeLog implements
try
{
- ChangeLogEvent event = store.log( principal, forward, reverse );
-
- return event;
+ return store.log( principal, forward, reverse );
}
catch ( Exception e )
{
@@ -155,6 +157,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry> reverses )
throws LdapException
{
@@ -177,6 +180,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public boolean isLogSearchSupported()
{
return store instanceof SearchableChangeLogStore;
@@ -186,6 +190,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public boolean isTagSearchSupported()
{
return store instanceof TaggableSearchableChangeLogStore;
@@ -195,6 +200,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public boolean isTagStorageSupported()
{
return store instanceof TaggableChangeLogStore;
@@ -204,6 +210,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public ChangeLogSearchEngine getChangeLogSearchEngine()
{
if ( isLogSearchSupported() )
@@ -218,6 +225,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public TagSearchEngine getTagSearchEngine()
{
if ( isTagSearchSupported() )
@@ -232,6 +240,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public Tag tag( long revision, String description ) throws Exception
{
if ( revision < 0 )
@@ -258,6 +267,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public Tag tag( long revision ) throws Exception
{
return tag( revision, null );
@@ -267,6 +277,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public Tag tag( String description ) throws Exception
{
return tag( store.getCurrentRevision(), description );
@@ -276,6 +287,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public Tag tag() throws Exception
{
return tag( store.getCurrentRevision(), null );
@@ -285,6 +297,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public void setEnabled( boolean enabled )
{
this.enabled = enabled;
@@ -294,6 +307,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public boolean isEnabled()
{
return enabled;
@@ -303,6 +317,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public Tag getLatest() throws LdapException
{
if ( latest != null )
@@ -323,6 +338,7 @@ public class DefaultChangeLog implements
/**
* Initialize the ChangeLog system. We will initialize the associated store.
*/
+ @Override
public void init( DirectoryService service ) throws Exception
{
if ( enabled )
@@ -356,6 +372,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public void sync() throws Exception
{
if ( enabled )
@@ -368,6 +385,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public void destroy() throws Exception
{
if ( enabled )
@@ -382,6 +400,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public boolean isExposed()
{
return exposed;
@@ -391,6 +410,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public void setExposed( boolean exposed )
{
this.exposed = exposed;
@@ -400,6 +420,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public void setPartitionSuffix( String suffix )
{
this.partitionSuffix = suffix;
@@ -409,6 +430,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public void setRevisionsContainerName( String revContainerName )
{
this.revContainerName = revContainerName;
@@ -418,6 +440,7 @@ public class DefaultChangeLog implements
/**
* {@inheritDoc}
*/
+ @Override
public void setTagsContainerName( String tagContainerName )
{
this.tagContainerName = tagContainerName;
@@ -427,6 +450,7 @@ public class DefaultChangeLog implements
/**
* @see Object#toString()
*/
+ @Override
public String toString()
{
StringBuilder sb = new StringBuilder();
Modified: directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java Wed Jun 15 12:29:57 2016
@@ -69,9 +69,9 @@ public class MemoryChangeLogStore implem
private Tag latest;
/** A Map of tags and revisions */
- private final Map<Long, Tag> tags = new HashMap<Long, Tag>( 100 );
+ private final Map<Long, Tag> tags = new HashMap<>( 100 );
- private final List<ChangeLogEvent> events = new ArrayList<ChangeLogEvent>();
+ private final List<ChangeLogEvent> events = new ArrayList<>();
private File workingDirectory;
/** The DirectoryService */
@@ -81,6 +81,7 @@ public class MemoryChangeLogStore implem
/**
* {@inheritDoc}
*/
+ @Override
public Tag tag( long revision ) throws Exception
{
if ( tags.containsKey( revision ) )
@@ -97,6 +98,7 @@ public class MemoryChangeLogStore implem
/**
* {@inheritDoc}
*/
+ @Override
public Tag tag() throws Exception
{
if ( ( latest != null ) && ( latest.getRevision() == currentRevision ) )
@@ -110,6 +112,7 @@ public class MemoryChangeLogStore implem
}
+ @Override
public Tag tag( String description ) throws Exception
{
if ( ( latest != null ) && ( latest.getRevision() == currentRevision ) )
@@ -123,6 +126,7 @@ public class MemoryChangeLogStore implem
}
+ @Override
public void init( DirectoryService service ) throws Exception
{
workingDirectory = service.getInstanceLayout().getLogDirectory();
@@ -175,12 +179,9 @@ public class MemoryChangeLogStore implem
{
File revFile = new File( workingDirectory, REV_FILE );
- if ( revFile.exists() )
+ if ( revFile.exists() && !revFile.delete() )
{
- if ( !revFile.delete() )
- {
- throw new IOException( I18n.err( I18n.ERR_726_FILE_UNDELETABLE, revFile.getAbsolutePath() ) );
- }
+ throw new IOException( I18n.err( I18n.ERR_726_FILE_UNDELETABLE, revFile.getAbsolutePath() ) );
}
try ( PrintWriter out = new PrintWriter( new FileWriter( revFile ) ) )
@@ -201,12 +202,9 @@ public class MemoryChangeLogStore implem
{
File tagFile = new File( workingDirectory, TAG_FILE );
- if ( tagFile.exists() )
+ if ( tagFile.exists() && !tagFile.delete() )
{
- if ( !tagFile.delete() )
- {
- throw new IOException( I18n.err( I18n.ERR_726_FILE_UNDELETABLE, tagFile.getAbsolutePath() ) );
- }
+ throw new IOException( I18n.err( I18n.ERR_726_FILE_UNDELETABLE, tagFile.getAbsolutePath() ) );
}
FileOutputStream out = null;
@@ -270,7 +268,7 @@ public class MemoryChangeLogStore implem
{
in = new FileInputStream( revFile );
props.load( in );
- ArrayList<Long> revList = new ArrayList<Long>();
+ ArrayList<Long> revList = new ArrayList<>();
for ( Object key : props.keySet() )
{
@@ -288,7 +286,7 @@ public class MemoryChangeLogStore implem
String rev = String.valueOf( lkey );
String desc = props.getProperty( rev );
- if ( desc != null && desc.equals( "null" ) )
+ if ( ( desc != null ) && desc.equals( "null" ) )
{
tag = new Tag( lkey, null );
}
@@ -339,7 +337,7 @@ public class MemoryChangeLogStore implem
in = new ObjectInputStream( new FileInputStream( file ) );
int size = in.readInt();
- ArrayList<ChangeLogEvent> changeLogEvents = new ArrayList<ChangeLogEvent>( size );
+ ArrayList<ChangeLogEvent> changeLogEvents = new ArrayList<>( size );
for ( int i = 0; i < size; i++ )
{
@@ -381,12 +379,9 @@ public class MemoryChangeLogStore implem
{
File file = new File( workingDirectory, CHANGELOG_FILE );
- if ( file.exists() )
+ if ( file.exists() && !file.delete() )
{
- if ( !file.delete() )
- {
- throw new IOException( I18n.err( I18n.ERR_726_FILE_UNDELETABLE, file.getAbsolutePath() ) );
- }
+ throw new IOException( I18n.err( I18n.ERR_726_FILE_UNDELETABLE, file.getAbsolutePath() ) );
}
try
@@ -434,6 +429,7 @@ public class MemoryChangeLogStore implem
}
+ @Override
public void sync() throws Exception
{
saveRevision();
@@ -445,6 +441,7 @@ public class MemoryChangeLogStore implem
/**
* Save logs, tags and revision on disk, and clean everything in memory
*/
+ @Override
public void destroy() throws Exception
{
saveRevision();
@@ -453,6 +450,7 @@ public class MemoryChangeLogStore implem
}
+ @Override
public long getCurrentRevision()
{
return currentRevision;
@@ -462,6 +460,7 @@ public class MemoryChangeLogStore implem
/**
* {@inheritDoc}
*/
+ @Override
public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) throws Exception
{
currentRevision++;
@@ -475,6 +474,7 @@ public class MemoryChangeLogStore implem
/**
* {@inheritDoc}
*/
+ @Override
public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry> reverses ) throws Exception
{
currentRevision++;
@@ -485,6 +485,7 @@ public class MemoryChangeLogStore implem
}
+ @Override
public ChangeLogEvent lookup( long revision ) throws Exception
{
if ( revision < 0 )
@@ -501,30 +502,35 @@ public class MemoryChangeLogStore implem
}
+ @Override
public Cursor<ChangeLogEvent> find() throws Exception
{
- return new ListCursor<ChangeLogEvent>( events );
+ return new ListCursor<>( events );
}
+ @Override
public Cursor<ChangeLogEvent> findBefore( long revision ) throws Exception
{
- return new ListCursor<ChangeLogEvent>( events, ( int ) revision );
+ return new ListCursor<>( events, ( int ) revision );
}
+ @Override
public Cursor<ChangeLogEvent> findAfter( long revision ) throws LdapException
{
- return new ListCursor<ChangeLogEvent>( ( int ) revision, events );
+ return new ListCursor<>( ( int ) revision, events );
}
+ @Override
public Cursor<ChangeLogEvent> find( long startRevision, long endRevision ) throws Exception
{
- return new ListCursor<ChangeLogEvent>( ( int ) startRevision, events, ( int ) ( endRevision + 1 ) );
+ return new ListCursor<>( ( int ) startRevision, events, ( int ) ( endRevision + 1 ) );
}
+ @Override
public Tag getLatest() throws LdapException
{
return latest;
@@ -534,6 +540,7 @@ public class MemoryChangeLogStore implem
/**
* @see TaggableChangeLogStore#removeTag(long)
*/
+ @Override
public Tag removeTag( long revision ) throws Exception
{
return tags.remove( revision );
@@ -543,6 +550,7 @@ public class MemoryChangeLogStore implem
/**
* @see TaggableChangeLogStore#tag(long, String)
*/
+ @Override
public Tag tag( long revision, String descrition ) throws Exception
{
if ( tags.containsKey( revision ) )
@@ -559,6 +567,7 @@ public class MemoryChangeLogStore implem
/**
* @see Object#toString()
*/
+ @Override
public String toString()
{
StringBuilder sb = new StringBuilder();
Modified: directory/apacheds/branches/apacheds-value/interceptors/changelog/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/changelog/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/changelog/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/changelog/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java Wed Jun 15 12:29:57 2016
@@ -102,10 +102,8 @@ public class MemoryChangeLogStoreTest
public void testChangeLogSerialization() throws LdapException, IOException, ClassNotFoundException
{
Dn systemDn = new Dn( schemaManager, "ou=system" );
- systemDn.apply( schemaManager );
Dn adminDn = new Dn( schemaManager, "uid=admin, ou=system" );
- adminDn.apply( schemaManager );
LdifEntry forward = new LdifEntry();
forward.setDn( systemDn );
@@ -114,7 +112,6 @@ public class MemoryChangeLogStoreTest
forward.putAttribute( "ou", "system" );
Dn reverseDn = forward.getDn();
- reverseDn.apply( schemaManager );
LdifEntry reverse = LdifRevertor.reverseAdd( reverseDn );
Modified: directory/apacheds/branches/apacheds-value/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Wed Jun 15 12:29:57 2016
@@ -86,6 +86,7 @@ public class CollectiveAttributeIntercep
/**
* {@inheritDoc}
*/
+ @Override
public boolean accept( SearchOperationContext operation, Entry entry ) throws LdapException
{
addCollectiveAttributes( operation, entry );
@@ -97,6 +98,7 @@ public class CollectiveAttributeIntercep
/**
* {@inheritDoc}
*/
+ @Override
public String toString( String tabs )
{
return tabs + "CollectiveAttributeFilter";
@@ -113,6 +115,7 @@ public class CollectiveAttributeIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
@@ -127,6 +130,7 @@ public class CollectiveAttributeIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
checkAdd( addContext.getDn(), addContext.getEntry() );
@@ -138,6 +142,7 @@ public class CollectiveAttributeIntercep
/**
* {@inheritDoc}
*/
+ @Override
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
Entry result = next( lookupContext );
@@ -158,6 +163,7 @@ public class CollectiveAttributeIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
checkModify( modifyContext );
@@ -169,6 +175,7 @@ public class CollectiveAttributeIntercep
/**
* {@inheritDoc}
*/
+ @Override
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
EntryFilteringCursor cursor = next( searchContext );
@@ -353,7 +360,7 @@ public class CollectiveAttributeIntercep
*/
Attribute collectiveExclusions = ( ( ClonedServerEntry ) entry ).getOriginalEntry().get(
directoryService.getAtProvider().getCollectiveExclusions() );
- Set<AttributeType> exclusions = new HashSet<AttributeType>();
+ Set<AttributeType> exclusions = new HashSet<>();
if ( collectiveExclusions != null )
{
@@ -371,9 +378,9 @@ public class CollectiveAttributeIntercep
return;
}
- for ( Value<?> value : collectiveExclusions )
+ for ( Value value : collectiveExclusions )
{
- AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( value.getString() );
+ AttributeType attrType = schemaManager.lookupAttributeTypeRegistry( value.getValue() );
exclusions.add( attrType );
LOG.debug( "Adding {} in the list of excluded collectiveAttributes", attrType.getName() );
}
@@ -384,9 +391,9 @@ public class CollectiveAttributeIntercep
* attributes of the subentry and copy collective attributes from the
* subentry into the entry.
*/
- for ( Value<?> value : collectiveAttributeSubentries )
+ for ( Value value : collectiveAttributeSubentries )
{
- String subentryDnStr = value.getString();
+ String subentryDnStr = value.getValue();
Dn subentryDn = dnFactory.create( subentryDnStr );
LOG.debug( "Applying subentries {}", subentryDn.getName() );
@@ -453,10 +460,10 @@ public class CollectiveAttributeIntercep
* Add all the collective attribute values in the subentry
* to the currently processed collective attribute in the entry.
*/
- for ( Value<?> subentryColVal : subentryColAttr )
+ for ( Value subentryColVal : subentryColAttr )
{
LOG.debug( "Adding the {} collective attribute into the entry", subentryColAttr );
- entryColAttr.add( subentryColVal.getString() );
+ entryColAttr.add( subentryColVal.getValue() );
}
}
}
Modified: directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/DefaultEventService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/DefaultEventService.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/DefaultEventService.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/DefaultEventService.java Wed Jun 15 12:29:57 2016
@@ -25,6 +25,7 @@ import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.directory.api.ldap.model.filter.ExprNode;
+import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.model.schema.normalizers.ConcreteNameComponentNormalizer;
import org.apache.directory.api.ldap.model.schema.normalizers.NameComponentNormalizer;
@@ -45,7 +46,7 @@ import org.apache.directory.server.core.
class DefaultEventService implements EventService
{
/** The list of RegistrationEntries being registered */
- private List<RegistrationEntry> registrations = new CopyOnWriteArrayList<RegistrationEntry>();
+ private List<RegistrationEntry> registrations = new CopyOnWriteArrayList<>();
/** The DirectoryService instance */
private DirectoryService directoryService;
@@ -71,9 +72,14 @@ class DefaultEventService implements Eve
/**
* {@inheritDoc}
*/
+ @Override
public void addListener( DirectoryListener listener, NotificationCriteria criteria ) throws Exception
{
- criteria.getBase().apply( directoryService.getSchemaManager() );
+ if ( !criteria.getBase().isSchemaAware() )
+ {
+ criteria.setBase( new Dn( directoryService.getSchemaManager(), criteria.getBase() ) );
+ }
+
ExprNode result = ( ExprNode ) criteria.getFilter().accept( filterNormalizer );
criteria.setFilter( result );
registrations.add( new RegistrationEntry( listener, criteria ) );
@@ -83,6 +89,7 @@ class DefaultEventService implements Eve
/**
* {@inheritDoc}
*/
+ @Override
public void removeListener( DirectoryListener listener )
{
for ( RegistrationEntry entry : registrations )
@@ -98,6 +105,7 @@ class DefaultEventService implements Eve
/**
* {@inheritDoc}
*/
+ @Override
public List<RegistrationEntry> getRegistrationEntries()
{
return Collections.unmodifiableList( registrations );
Modified: directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/event/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java Wed Jun 15 12:29:57 2016
@@ -87,6 +87,7 @@ public class EventInterceptor extends Ba
* Initialize the event interceptor. It creates a pool of executor which will be used
* to call the listeners in separate threads.
*/
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
LOG.info( "Initializing ..." );
@@ -116,6 +117,7 @@ public class EventInterceptor extends Ba
{
executor.execute( new Runnable()
{
+ @Override
public void run()
{
listener.entryAdded( ( AddOperationContext ) opContext );
@@ -134,6 +136,7 @@ public class EventInterceptor extends Ba
{
executor.execute( new Runnable()
{
+ @Override
public void run()
{
listener.entryDeleted( ( DeleteOperationContext ) opContext );
@@ -152,6 +155,7 @@ public class EventInterceptor extends Ba
{
executor.execute( new Runnable()
{
+ @Override
public void run()
{
listener.entryModified( ( ModifyOperationContext ) opContext );
@@ -170,6 +174,7 @@ public class EventInterceptor extends Ba
{
executor.execute( new Runnable()
{
+ @Override
public void run()
{
listener.entryMoved( ( MoveOperationContext ) opContext );
@@ -188,6 +193,7 @@ public class EventInterceptor extends Ba
{
executor.execute( new Runnable()
{
+ @Override
public void run()
{
listener.entryRenamed( ( RenameOperationContext ) opContext );
@@ -206,6 +212,7 @@ public class EventInterceptor extends Ba
{
executor.execute( new Runnable()
{
+ @Override
public void run()
{
listener.entryMovedAndRenamed( ( MoveAndRenameOperationContext ) opContext );
@@ -224,6 +231,7 @@ public class EventInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void add( final AddOperationContext addContext ) throws LdapException
{
next( addContext );
@@ -248,6 +256,7 @@ public class EventInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void delete( final DeleteOperationContext deleteContext ) throws LdapException
{
next( deleteContext );
@@ -272,6 +281,7 @@ public class EventInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void modify( final ModifyOperationContext modifyContext ) throws LdapException
{
Entry oriEntry = modifyContext.getEntry();
@@ -310,6 +320,7 @@ public class EventInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
Entry oriEntry = moveContext.getOriginalEntry();
@@ -336,6 +347,7 @@ public class EventInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( final MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
Entry oriEntry = moveAndRenameContext.getOriginalEntry();
@@ -361,6 +373,7 @@ public class EventInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
Entry oriEntry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getOriginalEntry();
@@ -405,7 +418,7 @@ public class EventInterceptor extends Ba
return Collections.emptyList();
}
- List<RegistrationEntry> selecting = new ArrayList<RegistrationEntry>();
+ List<RegistrationEntry> selecting = new ArrayList<>();
for ( RegistrationEntry registration : registrations )
{
Modified: directory/apacheds/branches/apacheds-value/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Jun 15 12:29:57 2016
@@ -99,15 +99,17 @@ public class ExceptionInterceptor extend
/**
* {@inheritDoc}
*/
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
nexus = directoryService.getPartitionNexus();
- Value<?> attr = nexus.getRootDseValue( directoryService.getAtProvider().getSubschemaSubentry() );
- subschemSubentryDn = dnFactory.create( attr.getString() );
+ Value attr = nexus.getRootDseValue( directoryService.getAtProvider().getSubschemaSubentry() );
+ subschemSubentryDn = dnFactory.create( attr.getValue() );
}
+ @Override
public void destroy()
{
}
@@ -117,6 +119,7 @@ public class ExceptionInterceptor extend
* In the pre-invocation state this interceptor method checks to see if the entry to be added already exists. If it
* does an exception is raised.
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
Dn name = addContext.getDn();
@@ -193,6 +196,7 @@ public class ExceptionInterceptor extend
* Checks to make sure the entry being deleted exists, and has no children, otherwise throws the appropriate
* LdapException.
*/
+ @Override
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
Dn dn = deleteContext.getDn();
@@ -219,6 +223,7 @@ public class ExceptionInterceptor extend
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
// check if entry to modify exists
@@ -256,6 +261,7 @@ public class ExceptionInterceptor extend
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
Dn oriChildName = moveContext.getDn();
@@ -282,12 +288,13 @@ public class ExceptionInterceptor extend
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
Dn oldDn = moveAndRenameContext.getDn();
// Don't allow M&R in the SSSE
- if ( oldDn.equals( subschemSubentryDn ) )
+ if ( oldDn.getNormName().equals( subschemSubentryDn.getNormName() ) )
{
throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258,
subschemSubentryDn, subschemSubentryDn ) );
@@ -309,6 +316,7 @@ public class ExceptionInterceptor extend
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
Dn dn = renameContext.getDn();
Modified: directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/ConfigurableHashingInterceptor.java Wed Jun 15 12:29:57 2016
@@ -71,6 +71,7 @@ public class ConfigurableHashingIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
if ( algorithm == null )
@@ -112,9 +113,11 @@ public class ConfigurableHashingIntercep
// hash any values if necessary
List<byte[]> values = new ArrayList<>();
- for ( Value<?> value : attribute )
+
+ for ( Value value : attribute )
{
byte[] bytes = value.getBytes();
+
if ( bytes == null )
{
// value may be empty, dont wanna attempt to hash empty
@@ -123,6 +126,7 @@ public class ConfigurableHashingIntercep
// check if the given field is already hashed
LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( bytes );
+
if ( existingAlgo == null )
{
// not already hashed, so hash it
@@ -163,6 +167,7 @@ public class ConfigurableHashingIntercep
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
if ( algorithm == null )
Modified: directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/hash/src/main/java/org/apache/directory/server/core/hash/PasswordHashingInterceptor.java Wed Jun 15 12:29:57 2016
@@ -26,7 +26,6 @@ import java.util.List;
import org.apache.directory.api.ldap.model.constants.LdapSecurityConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
-import org.apache.directory.api.ldap.model.entry.BinaryValue;
import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
@@ -34,6 +33,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.password.PasswordUtil;
+import org.apache.directory.api.util.Strings;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -70,6 +70,7 @@ public abstract class PasswordHashingInt
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
if ( algorithm == null )
@@ -97,6 +98,7 @@ public abstract class PasswordHashingInt
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
if ( algorithm == null )
@@ -147,28 +149,26 @@ public abstract class PasswordHashingInt
Attribute newPwd = new DefaultAttribute( pwdAt.getAttributeType() );
// Special case : deal with a potential empty value. We may have more than one
- for ( Value<?> userPassword : pwdAt )
+ for ( Value userPassword : pwdAt )
{
- if ( userPassword.getValue() == null )
+ if ( Strings.isEmpty( userPassword.getValue() ) )
{
continue;
}
// check if the given password is already hashed
- LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( ( ( BinaryValue ) userPassword )
- .getValue() );
+ LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( userPassword.getBytes() );
// if there exists NO algorithm, then hash the password
if ( existingAlgo == null )
{
- byte[] hashedPassword = PasswordUtil.createStoragePassword(
- ( ( BinaryValue ) userPassword ).getValue(), algorithm );
+ byte[] hashedPassword = PasswordUtil.createStoragePassword( userPassword.getBytes(), algorithm );
newPwd.add( hashedPassword );
}
else
{
- newPwd.add( ( ( BinaryValue ) userPassword ).getValue() );
+ newPwd.add( userPassword.getBytes() );
}
}
Modified: directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournal.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournal.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournal.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournal.java Wed Jun 15 12:29:57 2016
@@ -57,6 +57,7 @@ public class DefaultJournal implements J
/**
* {@inheritDoc}
*/
+ @Override
public void destroy() throws Exception
{
LOG.debug( "Stopping the journal" );
@@ -73,6 +74,7 @@ public class DefaultJournal implements J
/**
* {@inheritDoc}
*/
+ @Override
public JournalStore getJournalStore()
{
return store;
@@ -82,6 +84,7 @@ public class DefaultJournal implements J
/**
* {@inheritDoc}
*/
+ @Override
public void init( DirectoryService directoryService ) throws Exception
{
LOG.debug( "Starting the journal" );
@@ -100,6 +103,7 @@ public class DefaultJournal implements J
/**
* {@inheritDoc}
*/
+ @Override
public boolean isEnabled()
{
return enabled;
@@ -109,6 +113,7 @@ public class DefaultJournal implements J
/**
* {@inheritDoc}
*/
+ @Override
public void log( LdapPrincipal principal, long revision, LdifEntry entry ) throws LdapException
{
store.log( principal, revision, entry );
@@ -118,6 +123,7 @@ public class DefaultJournal implements J
/**
* {@inheritDoc}
*/
+ @Override
public void ack( long revision )
{
store.ack( revision );
@@ -127,6 +133,7 @@ public class DefaultJournal implements J
/**
* {@inheritDoc}
*/
+ @Override
public void nack( long revision )
{
store.nack( revision );
@@ -136,6 +143,7 @@ public class DefaultJournal implements J
/**
* @return the rotation
*/
+ @Override
public int getRotation()
{
return rotation;
@@ -145,18 +153,21 @@ public class DefaultJournal implements J
/**
* @param rotation the rotation to set
*/
+ @Override
public void setRotation( int rotation )
{
this.rotation = rotation;
}
+ @Override
public void setEnabled( boolean enabled )
{
this.enabled = enabled;
}
+ @Override
public void setJournalStore( JournalStore store )
{
this.store = store;
Modified: directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java Wed Jun 15 12:29:57 2016
@@ -57,6 +57,7 @@ public class DefaultJournalStore impleme
/**
* {@inheritDoc}
*/
+ @Override
public void destroy() throws Exception
{
if ( writer != null )
@@ -69,6 +70,7 @@ public class DefaultJournalStore impleme
/**
* Initialize the interceptor
*/
+ @Override
public void init( DirectoryService service ) throws Exception
{
if ( workingDirectory == null )
@@ -98,6 +100,7 @@ public class DefaultJournalStore impleme
* @param revision The operation revision
* @param forward The change to log
*/
+ @Override
public boolean log( LdapPrincipal principal, long revision, LdifEntry forward )
{
synchronized ( writer )
@@ -144,6 +147,7 @@ public class DefaultJournalStore impleme
* @return <code>true</code> if the ack has been written
* @throws Exception if there are problems logging the ack
*/
+ @Override
public boolean ack( long revision )
{
synchronized ( writer )
@@ -174,6 +178,7 @@ public class DefaultJournalStore impleme
* @return <code>true</code> if the nack has been written
* @throws Exception if there are problems logging the nack
*/
+ @Override
public boolean nack( long revision )
{
synchronized ( writer )
@@ -197,6 +202,7 @@ public class DefaultJournalStore impleme
}
+ @Override
public void sync() throws Exception
{
// TODO Auto-generated method stub
@@ -204,6 +210,7 @@ public class DefaultJournalStore impleme
}
+ @Override
public long getCurrentRevision()
{
// TODO Auto-generated method stub
@@ -223,6 +230,7 @@ public class DefaultJournalStore impleme
/**
* @param fileName the fileName to set
*/
+ @Override
public void setFileName( String fileName )
{
this.fileName = fileName;
@@ -232,6 +240,7 @@ public class DefaultJournalStore impleme
/**
* {@inheritDoc}
*/
+ @Override
public void setWorkingDirectory( String workingDirectoryName )
{
this.workingDirectory = new File( workingDirectoryName );
Modified: directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java Wed Jun 15 12:29:57 2016
@@ -80,6 +80,7 @@ public class JournalInterceptor extends
* The init method will initialize the local variables and load the
* entryDeleted AttributeType.
*/
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
@@ -110,6 +111,7 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
long opRevision = 0;
@@ -160,6 +162,7 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
long opRevision = 0;
@@ -202,6 +205,7 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
long opRevision = 0;
@@ -249,6 +253,7 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
long opRevision = 0;
@@ -261,7 +266,7 @@ public class JournalInterceptor extends
LdifEntry ldif = new LdifEntry();
ldif.setChangeType( ChangeType.ModDn );
ldif.setDn( moveContext.getDn() );
- ldif.setNewSuperior( moveContext.getNewSuperior().getNormName() );
+ ldif.setNewSuperior( moveContext.getNewSuperior().getName() );
journal.log( getPrincipal( moveContext ), opRevision, ldif );
}
@@ -292,6 +297,7 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
long opRevision = 0;
@@ -304,9 +310,9 @@ public class JournalInterceptor extends
LdifEntry ldif = new LdifEntry();
ldif.setChangeType( ChangeType.ModDn );
ldif.setDn( moveAndRenameContext.getDn() );
- ldif.setNewRdn( moveAndRenameContext.getNewRdn().getNormName() );
+ ldif.setNewRdn( moveAndRenameContext.getNewRdn().getName() );
ldif.setDeleteOldRdn( moveAndRenameContext.getDeleteOldRdn() );
- ldif.setNewSuperior( moveAndRenameContext.getNewDn().getNormName() );
+ ldif.setNewSuperior( moveAndRenameContext.getNewDn().getName() );
journal.log( getPrincipal( moveAndRenameContext ), opRevision, ldif );
}
@@ -337,6 +343,7 @@ public class JournalInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
long opRevision = 0;
@@ -349,7 +356,7 @@ public class JournalInterceptor extends
LdifEntry ldif = new LdifEntry();
ldif.setChangeType( ChangeType.ModRdn );
ldif.setDn( renameContext.getDn() );
- ldif.setNewRdn( renameContext.getNewRdn().getNormName() );
+ ldif.setNewRdn( renameContext.getNewRdn().getName() );
ldif.setDeleteOldRdn( renameContext.getDeleteOldRdn() );
journal.log( getPrincipal( renameContext ), opRevision, ldif );
Modified: directory/apacheds/branches/apacheds-value/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/logger/src/main/java/org/apache/directory/server/core/logger/TimerInterceptor.java Wed Jun 15 12:29:57 2016
@@ -138,7 +138,8 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void init( DirectoryService directoryService ) throws LdapException
+ @Override
+public void init( DirectoryService directoryService ) throws LdapException
{
}
@@ -146,7 +147,8 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
- public void destroy()
+ @Override
+public void destroy()
{
}
@@ -154,6 +156,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -183,6 +186,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void bind( BindOperationContext bindContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -212,6 +216,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -243,6 +248,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -272,6 +278,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public Entry getRootDse( GetRootDseOperationContext getRootDseContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -303,6 +310,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -334,6 +342,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -365,6 +374,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -394,6 +404,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -423,6 +434,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -453,6 +465,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -482,6 +495,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
long t0 = System.nanoTime();
@@ -513,6 +527,7 @@ public class TimerInterceptor extends Ba
/**
* {@inheritDoc}
*/
+ @Override
public void unbind( UnbindOperationContext unbindContext ) throws LdapException
{
long t0 = System.nanoTime();
Modified: directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java Wed Jun 15 12:29:57 2016
@@ -64,24 +64,40 @@ public class ExpandingVisitor implements
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public boolean canVisit( ExprNode node )
{
return node instanceof BranchNode;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public List<ExprNode> getOrder( BranchNode node, List<ExprNode> children )
{
return children;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public boolean isPrefix()
{
return false;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public Object visit( ExprNode node )
{
BranchNode bnode = ( BranchNode ) node;
@@ -117,7 +133,7 @@ public class ExpandingVisitor implements
while ( descendants.hasNext() )
{
- LeafNode newLeaf = null;
+ LeafNode newLeaf;
AttributeType descendant = descendants.next();
if ( leaf instanceof PresenceNode )
Modified: directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Wed Jun 15 12:29:57 2016
@@ -24,7 +24,6 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.cursor.EmptyCursor;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Modification;
-import org.apache.directory.api.ldap.model.entry.StringValue;
import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeTypeException;
@@ -98,6 +97,7 @@ public class NormalizationInterceptor ex
/**
* Initialize the registries, normalizers.
*/
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
LOG.debug( "Initialiazing the NormalizationInterceptor" );
@@ -112,6 +112,7 @@ public class NormalizationInterceptor ex
/**
* The destroy method does nothing
*/
+ @Override
public void destroy()
{
}
@@ -123,11 +124,25 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
- addContext.getDn().apply( schemaManager );
- addContext.getEntry().getDn().apply( schemaManager );
+ Dn addDn = addContext.getDn();
+
+ if ( !addDn.isSchemaAware() )
+ {
+ addContext.setDn( new Dn( schemaManager, addDn ) );
+ }
+
+ Dn entryDn = addContext.getEntry().getDn();
+
+ if ( !entryDn.isSchemaAware() )
+ {
+ addContext.getEntry().setDn( new Dn( schemaManager, entryDn ) );
+ }
+
addRdnAttributesToEntry( addContext.getDn(), addContext.getEntry() );
+
next( addContext );
}
@@ -135,9 +150,15 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public boolean compare( CompareOperationContext compareContext ) throws LdapException
{
- compareContext.getDn().apply( schemaManager );
+ Dn dn = compareContext.getDn();
+
+ if ( !dn.isSchemaAware() )
+ {
+ compareContext.setDn( new Dn( schemaManager, dn ) );
+ }
// Get the attributeType from the OID
try
@@ -147,8 +168,7 @@ public class NormalizationInterceptor ex
// Translate the value from binary to String if the AT is HR
if ( attributeType.getSyntax().isHumanReadable() && ( !compareContext.getValue().isHumanReadable() ) )
{
- String value = compareContext.getValue().getString();
- compareContext.setValue( new StringValue( value ) );
+ compareContext.setValue( compareContext.getValue() );
}
compareContext.setAttributeType( attributeType );
@@ -165,11 +185,15 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
Dn dn = deleteContext.getDn();
-
- dn.apply( schemaManager );
+
+ if ( !dn.isSchemaAware() )
+ {
+ deleteContext.setDn( new Dn( schemaManager, dn ) );
+ }
next( deleteContext );
}
@@ -178,9 +202,15 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
- hasEntryContext.getDn().apply( schemaManager );
+ Dn dn = hasEntryContext.getDn();
+
+ if ( !dn.isSchemaAware() )
+ {
+ hasEntryContext.setDn( new Dn( schemaManager, dn ) );
+ }
return next( hasEntryContext );
}
@@ -189,9 +219,15 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
- lookupContext.getDn().apply( schemaManager );
+ Dn dn = lookupContext.getDn();
+
+ if ( !dn.isSchemaAware() )
+ {
+ lookupContext.setDn( new Dn( schemaManager, dn ) );
+ }
return next( lookupContext );
}
@@ -200,9 +236,15 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
- modifyContext.getDn().apply( schemaManager );
+ Dn dn = modifyContext.getDn();
+
+ if ( !dn.isSchemaAware() )
+ {
+ modifyContext.setDn( new Dn( schemaManager, dn ) );
+ }
if ( modifyContext.getModItems() != null )
{
@@ -220,16 +262,42 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
- moveContext.getDn().apply( schemaManager );
- moveContext.getOldSuperior().apply( schemaManager );
- moveContext.getNewSuperior().apply( schemaManager );
- moveContext.getNewDn().apply( schemaManager );
+ Dn moveDn = moveContext.getDn();
+
+ if ( !moveDn.isSchemaAware() )
+ {
+ moveContext.setDn( new Dn( schemaManager, moveDn ) );
+ }
- if ( !moveContext.getRdn().isSchemaAware() )
+ Dn oldSuperiorDn = moveContext.getOldSuperior();
+
+ if ( !oldSuperiorDn.isSchemaAware() )
{
- moveContext.getRdn().apply( schemaManager );
+ moveContext.setOldSuperior( new Dn( schemaManager, oldSuperiorDn ) );
+ }
+
+ Dn newSuperiorDn = moveContext.getNewSuperior();
+
+ if ( !newSuperiorDn.isSchemaAware() )
+ {
+ moveContext.setNewSuperior( new Dn( schemaManager, newSuperiorDn ) );
+ }
+
+ Dn newDn = moveContext.getNewDn();
+
+ if ( !newDn.isSchemaAware() )
+ {
+ moveContext.setNewDn( new Dn( schemaManager, newDn ) );
+ }
+
+ Rdn rdn = moveContext.getRdn();
+
+ if ( !rdn.isSchemaAware() )
+ {
+ moveContext.setRdn( new Rdn( schemaManager, rdn ) );
}
next( moveContext );
@@ -239,16 +307,36 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
- if ( !moveAndRenameContext.getNewRdn().isSchemaAware() )
+ Rdn newRdn = moveAndRenameContext.getNewRdn();
+
+ if ( !newRdn.isSchemaAware() )
{
- moveAndRenameContext.getNewRdn().apply( schemaManager );
+ moveAndRenameContext.setNewRdn( new Rdn( schemaManager, newRdn ) );
+ }
+
+ Dn dn = moveAndRenameContext.getDn();
+
+ if ( !dn.isSchemaAware() )
+ {
+ moveAndRenameContext.setDn( new Dn( schemaManager, dn ) );
+ }
+
+ Dn newDn = moveAndRenameContext.getNewDn();
+
+ if ( !newDn.isSchemaAware() )
+ {
+ moveAndRenameContext.setNewDn( new Dn( schemaManager, newDn ) );
+ }
+
+ Dn newSuperiorDn = moveAndRenameContext.getNewSuperiorDn();
+
+ if ( !newSuperiorDn.isSchemaAware() )
+ {
+ moveAndRenameContext.setNewSuperiorDn( new Dn( schemaManager, newSuperiorDn ) );
}
-
- moveAndRenameContext.getDn().apply( schemaManager );
- moveAndRenameContext.getNewDn().apply( schemaManager );
- moveAndRenameContext.getNewSuperiorDn().apply( schemaManager );
next( moveAndRenameContext );
}
@@ -257,12 +345,30 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
// Normalize the new Rdn and the Dn if needed
- renameContext.getDn().apply( schemaManager );
- renameContext.getNewRdn().apply( schemaManager );
- renameContext.getNewDn().apply( schemaManager );
+ Dn dn = renameContext.getDn();
+
+ if ( !dn.isSchemaAware() )
+ {
+ renameContext.setDn( new Dn( schemaManager, dn ) );
+ }
+
+ Rdn newRdn = renameContext.getNewRdn();
+
+ if ( !newRdn.isSchemaAware() )
+ {
+ renameContext.setNewRdn( new Rdn( schemaManager, newRdn ) );
+ }
+
+ Dn newDn = renameContext.getNewDn();
+
+ if ( !newDn.isSchemaAware() )
+ {
+ renameContext.setNewDn( new Dn( schemaManager, newDn ) );
+ }
// Push to the next interceptor
next( renameContext );
@@ -272,11 +378,15 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
+ @Override
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
Dn dn = searchContext.getDn();
-
- dn.apply( schemaManager );
+
+ if ( !dn.isSchemaAware() )
+ {
+ searchContext.setDn( new Dn( schemaManager, dn ) );
+ }
ExprNode filter = searchContext.getFilter();
@@ -410,9 +520,9 @@ public class NormalizationInterceptor ex
}
else if ( leafNode instanceof EqualityNode )
{
- Value<String> v = ( ( EqualityNode<String> ) leafNode ).getValue();
+ Value value = ( ( EqualityNode<String> ) leafNode ).getValue();
- if ( v.getNormValue().equals( SchemaConstants.TOP_OC ) )
+ if ( value.equals( SchemaConstants.TOP_OC ) )
{
// Here too we can safely remove the node and return an undefined node
return ObjectClassNode.OBJECT_CLASS_NODE;
@@ -466,8 +576,8 @@ public class NormalizationInterceptor ex
// Loop on all the AVAs
for ( Ava ava : rdn )
{
- Value<?> value = ava.getValue();
- String upValue = ava.getValue().getString();
+ Value value = ava.getValue();
+ String upValue = ava.getValue().getValue();
String upId = ava.getType();
// Check that the entry contains this Ava
Modified: directory/apacheds/branches/apacheds-value/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/normalization/src/test/java/org/apache/directory/server/core/normalization/NormalizationVisitorTest.java Wed Jun 15 12:29:57 2016
@@ -91,9 +91,9 @@ public class NormalizationVisitorTest
assertNotNull( result );
assertTrue( result instanceof EqualityNode<?> );
- EqualityNode<?> equalityNode = ( EqualityNode<?> ) result;
+ EqualityNode<?> equalityNode = (org.apache.directory.api.ldap.model.filter.EqualityNode<?> ) result;
- assertEquals( "test 1", equalityNode.getValue().getNormValue() );
+ assertEquals( " test 1 ", equalityNode.getValue().getValue() );
assertEquals( "2.5.4.11", equalityNode.getAttributeType().getOid() );
}
Modified: directory/apacheds/branches/apacheds-value/interceptors/number/src/main/java/org/apache/directory/server/core/number/NumberIncrementingInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/number/src/main/java/org/apache/directory/server/core/number/NumberIncrementingInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/number/src/main/java/org/apache/directory/server/core/number/NumberIncrementingInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/number/src/main/java/org/apache/directory/server/core/number/NumberIncrementingInterceptor.java Wed Jun 15 12:29:57 2016
@@ -62,7 +62,7 @@ public class NumberIncrementingIntercept
private Dn numberHolder;
/** a map of integer attribute and it's present value */
- private Map<String, AtomicInteger> incMap = new HashMap<String, AtomicInteger>();
+ private Map<String, AtomicInteger> incMap = new HashMap<>();
@Override
@@ -100,13 +100,11 @@ public class NumberIncrementingIntercept
for ( Attribute at : entry )
{
MatchingRule mr = at.getAttributeType().getEquality();
- if ( mr != null )
+
+ if ( ( mr != null ) && SchemaConstants.INTEGER_MATCH_MR_OID.equals( mr.getOid() ) )
{
- if ( SchemaConstants.INTEGER_MATCH_MR_OID.equals( mr.getOid() ) )
- {
- int t = Integer.parseInt( at.getString() );
- incMap.put( at.getId(), new AtomicInteger( t ) );
- }
+ int t = Integer.parseInt( at.getString() );
+ incMap.put( at.getId(), new AtomicInteger( t ) );
}
}
}
@@ -116,6 +114,7 @@ public class NumberIncrementingIntercept
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
LOG.debug( ">>> Entering into the number incrementing interceptor, addRequest" );
@@ -129,7 +128,7 @@ public class NumberIncrementingIntercept
Entry entry = addContext.getEntry();
- List<Attribute> lst = new ArrayList<Attribute>();
+ List<Attribute> lst = new ArrayList<>();
for ( String oid : incMap.keySet() )
{
@@ -160,7 +159,7 @@ public class NumberIncrementingIntercept
bindModCtx.setDn( numberHolder );
bindModCtx.setPushToEvtInterceptor( true );
- List<Modification> mods = new ArrayList<Modification>();
+ List<Modification> mods = new ArrayList<>();
for ( Attribute at : lst )
{
Modified: directory/apacheds/branches/apacheds-value/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Wed Jun 15 12:29:57 2016
@@ -40,6 +40,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.name.Rdn;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.AttributeTypeOptions;
+import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.util.DateUtils;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
@@ -101,6 +102,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public boolean accept( SearchOperationContext operation, Entry entry ) throws LdapException
{
if ( operation.getReturningAttributesString() == null )
@@ -118,6 +120,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public String toString( String tabs )
{
return tabs + "OperationalAttributeDenormalizingSearchFilter";
@@ -133,6 +136,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public boolean accept( SearchOperationContext operation, Entry entry ) throws LdapException
{
if ( operation.getReturningAttributesString() == null )
@@ -141,9 +145,11 @@ public class OperationalAttributeInterce
}
// Add the SubschemaSubentry AttributeType if it's requested
+ SchemaManager schemaManager = operation.getSession().getDirectoryService().getSchemaManager();
+
if ( operation.isAllOperationalAttributes()
- || operation.getReturningAttributes().contains( SchemaConstants.SUBSCHEMA_SUBENTRY_AT )
- || operation.getReturningAttributes().contains( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
+ || operation.getReturningAttributes().contains(
+ new AttributeTypeOptions( schemaManager.getAttributeType( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) ) ) )
{
AttributeType subschemaSubentryAt = schemaManager.getAttributeType( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
entry.add( new DefaultAttribute( subschemaSubentryAt,
@@ -157,6 +163,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public String toString( String tabs )
{
return tabs + "OperationalAttributeSearchFilter";
@@ -172,6 +179,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public boolean accept( SearchOperationContext operation, Entry entry ) throws LdapException
{
// Add the nbChildren/nbSubordinates attributes if required
@@ -184,6 +192,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public String toString( String tabs )
{
return tabs + "SubordinatesSearchFilter";
@@ -200,20 +209,22 @@ public class OperationalAttributeInterce
}
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
// stuff for dealing with subentries (garbage for now)
- Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue(
+ Value subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue(
directoryService.getAtProvider().getSubschemaSubentry() );
- subschemaSubentryDn = dnFactory.create( subschemaSubentry.getString() );
+ subschemaSubentryDn = dnFactory.create( subschemaSubentry.getValue() );
// Create the Admin Dn
adminDn = dnFactory.create( ServerDNConstants.ADMIN_SYSTEM_DN );
}
+ @Override
public void destroy()
{
}
@@ -258,6 +269,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
String principal = getPrincipal( addContext ).getName();
@@ -266,8 +278,7 @@ public class OperationalAttributeInterce
// If we are using replication, the below four OAs may already be present and we retain
// those values if the user is admin.
- boolean isAdmin = addContext.getSession().getAuthenticatedPrincipal().getName().equals(
- ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+ boolean isAdmin = addContext.getSession().getAuthenticatedPrincipal().getDn().equals( adminDn );
// The EntryUUID attribute
if ( !checkAddOperationalAttribute( isAdmin, entry, directoryService.getAtProvider().getEntryUUID() ) )
@@ -314,11 +325,12 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
Dn dn = lookupContext.getDn();
- if ( dn.equals( subschemaSubentryDn ) )
+ if ( dn.getNormName().equals( subschemaSubentryDn.getNormName() ) )
{
Entry serverEntry = SchemaService.getSubschemaEntry( directoryService, lookupContext );
serverEntry.setDn( dn );
@@ -340,6 +352,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
// We must check that the user hasn't injected either the modifiersName
@@ -453,6 +466,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
Entry modifiedEntry = moveContext.getOriginalEntry().clone();
@@ -473,9 +487,10 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
- Entry modifiedEntry = moveAndRenameContext.getOriginalEntry().clone();
+ Entry modifiedEntry = moveAndRenameContext.getModifiedEntry();
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( moveAndRenameContext ).getName() );
modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
modifiedEntry.setDn( moveAndRenameContext.getNewDn() );
@@ -493,6 +508,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
@@ -516,6 +532,7 @@ public class OperationalAttributeInterce
/**
* {@inheritDoc}
*/
+ @Override
public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
EntryFilteringCursor cursor = next( searchContext );
@@ -613,19 +630,19 @@ public class OperationalAttributeInterce
else if ( rdn.size() == 1 )
{
String name = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName();
- String value = rdn.getNormValue();
+ String value = rdn.getValue();
newDn = newDn.add( new Rdn( name, value ) );
continue;
}
// below we only process multi-valued rdns
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
for ( Iterator<Ava> atavs = rdn.iterator(); atavs.hasNext(); /**/)
{
Ava atav = atavs.next();
String type = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType() ).getName();
- buf.append( type ).append( '=' ).append( atav.getValue().getNormValue() );
+ buf.append( type ).append( '=' ).append( atav.getValue().getValue() );
if ( atavs.hasNext() )
{
@@ -657,8 +674,8 @@ public class OperationalAttributeInterce
if ( returningAttributes != null )
{
- boolean nbChildrenRequested = returningAttributes.contains( nbChildrenAto ) | allAttributes;
- boolean nbSubordinatesRequested = returningAttributes.contains( nbSubordinatesAto ) | allAttributes;
+ boolean nbChildrenRequested = returningAttributes.contains( nbChildrenAto ) || allAttributes;
+ boolean nbSubordinatesRequested = returningAttributes.contains( nbSubordinatesAto ) || allAttributes;
if ( nbChildrenRequested || nbSubordinatesRequested )
{
Modified: directory/apacheds/branches/apacheds-value/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=1748572&r1=1748571&r2=1748572&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-value/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Wed Jun 15 12:29:57 2016
@@ -23,7 +23,6 @@ package org.apache.directory.server.core
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.Entry;
-import org.apache.directory.api.ldap.model.entry.StringValue;
import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapURLEncodingException;
@@ -70,11 +69,18 @@ public class ReferralInterceptor extends
private Dn subschemaSubentryDn;
- private static void checkRefAttributeValue( Value<?> value ) throws LdapException, LdapURLEncodingException
+ /**
+ * Creates a new instance of a ReferralInterceptor.
+ */
+ public ReferralInterceptor()
{
- StringValue ref = ( StringValue ) value;
+ super( InterceptorEnum.REFERRAL_INTERCEPTOR );
+ }
+
- String refVal = ref.getString();
+ private static void checkRefAttributeValue( Value value ) throws LdapException, LdapURLEncodingException
+ {
+ String refVal = value.getValue();
LdapUrl ldapUrl = new LdapUrl( refVal );
@@ -102,21 +108,21 @@ public class ReferralInterceptor extends
throw new LdapException( message );
}
- if ( ( ldapUrl.getAttributes() != null ) && ( ldapUrl.getAttributes().size() != 0 ) )
+ if ( ( ldapUrl.getAttributes() != null ) && !ldapUrl.getAttributes().isEmpty() )
{
String message = I18n.err( I18n.ERR_38 );
LOG.error( message );
throw new LdapException( message );
}
- if ( ( ldapUrl.getExtensions() != null ) && ( ldapUrl.getExtensions().size() != 0 ) )
+ if ( ( ldapUrl.getExtensions() != null ) && !ldapUrl.getExtensions().isEmpty() )
{
String message = I18n.err( I18n.ERR_39 );
LOG.error( message );
throw new LdapException( message );
}
- if ( ( ldapUrl.getExtensions() != null ) && ( ldapUrl.getExtensions().size() != 0 ) )
+ if ( ( ldapUrl.getExtensions() != null ) && !ldapUrl.getExtensions().isEmpty() )
{
String message = I18n.err( I18n.ERR_40 );
LOG.error( message );
@@ -174,7 +180,7 @@ public class ReferralInterceptor extends
throw new LdapException( message );
}
- for ( Value<?> value : refAttr )
+ for ( Value value : refAttr )
{
try
{
@@ -192,15 +198,7 @@ public class ReferralInterceptor extends
}
- /**
- * Creates a new instance of a ReferralInterceptor.
- */
- public ReferralInterceptor()
- {
- super( InterceptorEnum.REFERRAL_INTERCEPTOR );
- }
-
-
+ @Override
public void init( DirectoryService directoryService ) throws LdapException
{
super.init( directoryService );
@@ -211,8 +209,8 @@ public class ReferralInterceptor extends
referralManager = new ReferralManagerImpl( directoryService );
directoryService.setReferralManager( referralManager );
- Value<?> subschemaSubentry = nexus.getRootDseValue( directoryService.getAtProvider().getSubschemaSubentry() );
- subschemaSubentryDn = dnFactory.create( subschemaSubentry.getString() );
+ Value subschemaSubentry = nexus.getRootDseValue( directoryService.getAtProvider().getSubschemaSubentry() );
+ subschemaSubentryDn = dnFactory.create( subschemaSubentry.getValue() );
}
@@ -236,6 +234,7 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void add( AddOperationContext addContext ) throws LdapException
{
Entry entry = addContext.getEntry();
@@ -280,6 +279,7 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
// First delete the entry into the server
@@ -309,6 +309,7 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
*/
+ @Override
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
Dn dn = modifyContext.getDn();
@@ -360,6 +361,7 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
**/
+ @Override
public void move( MoveOperationContext moveContext ) throws LdapException
{
// Check if the entry is a referral itself
@@ -388,6 +390,7 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
**/
+ @Override
public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
// Check if the entry is a referral itself
@@ -418,6 +421,7 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
**/
+ @Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
// Check if the entry is a referral itself