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 2013/05/20 09:47:41 UTC

svn commit: r1484389 [1/2] - in /directory: apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/ apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/ apacheds/trunk/core/src/main/java/org/apache/dir...

Author: elecharny
Date: Mon May 20 07:47:40 2013
New Revision: 1484389

URL: http://svn.apache.org/r1484389
Log:
o Removed classes that are never used
o Fixed many warnings

Modified:
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PPolicyInit.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreError.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreGraceAuthNRemaining.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueStatesEnum.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueGrammar.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueStatesEnum.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueGrammar.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueStatesEnum.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueGrammar.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueStatesEnum.java
    directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelGrammar.java
    directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schemamanager/impl/DefaultSchemaManager.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayEnumeration.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayNamingEnumeration.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Base32.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ByteBuffer.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Hex.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/IteratorNamingEnumeration.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/JoinIterator.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/PreferencesDictionary.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/PropertiesUtils.java
    directory/shared/trunk/util/src/test/java/org/apache/directory/api/util/ArrayEnumerationTest.java
    directory/shared/trunk/util/src/test/java/org/apache/directory/api/util/ArrayNamingEnumerationTest.java
    directory/shared/trunk/util/src/test/java/org/apache/directory/api/util/Base32Test.java
    directory/shared/trunk/util/src/test/java/org/apache/directory/api/util/JoinIteratorTest.java

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java Mon May 20 07:47:40 2013
@@ -1267,4 +1267,82 @@ public class SearchAuthorizationIT exten
 
         cnx.unBind();
     }
+
+
+    /**
+     * Checks to make sure <b>allUsers</b> userClass works for search operations.
+     *
+     * @throws Exception if the test encounters an error
+     */
+    @Test
+    public void testDenySearchUserPassword() throws Exception
+    {
+        // create the non-admin user
+        createUser( "billyd", "billyd" );
+
+        // try a search operation which should fail without any ACI
+        LdapConnection userCtx = getConnectionAs( "uid=billyd,ou=users,ou=system", "billyd" );
+        EntryCursor cursor = userCtx.search( "ou=users,ou=system", "(ObjectClass=*)", SearchScope.SUBTREE,
+            "userPassword" );
+        int counter = 0;
+
+        while ( cursor.next() )
+        {
+            Entry result = cursor.get();
+            results.put( result.getDn().getName(), result );
+            counter++;
+        }
+
+        cursor.close();
+
+        assertEquals( 0, counter );
+
+        // now add a subentry that enables anyone to search an entry below ou=system
+        createAccessControlSubentry( "protectUserPassword",
+            "{" +
+                "  identificationTag \"protectUserPassword\"," +
+                "  precedence 14," +
+                "  authenticationLevel none," +
+                "  itemOrUserFirst itemFirst: " +
+                "  {" +
+                "    protectedItems " +
+                "    {" +
+                "      allAttributeValues { userPassword }" +
+                "    }," +
+                "    itemPermissions " +
+                "    {" +
+                "      {" +
+                "        userClasses " +
+                "        {" +
+                "          allUsers " +
+                "        }," +
+                "        grantsAndDenials { denyBrowse }" +
+                "      }," +
+                "      {" +
+                "        userClasses " +
+                "        {" +
+                "          thisEntry " +
+                "        }," +
+                "        grantsAndDenials { grantBrowse }" +
+                "      }" +
+                "    }" +
+                "  }" +
+                "}" );
+
+        // see if we can now search that tree which we could not before
+        // should work now with billyd now that all users are authorized
+        userCtx = getConnectionAs( "uid=billyd,ou=users,ou=system", "billyd" );
+        cursor = userCtx.search( "ou=users,ou=system", "(ObjectClass=*)", SearchScope.SUBTREE,
+            "userPassword" );
+        counter = 0;
+
+        while ( cursor.next() )
+        {
+            Entry result = cursor.get();
+            results.put( result.getDn().getName(), result );
+            counter++;
+        }
+
+        cursor.close();
+    }
 }

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java (original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/prefs/PreferencesIT.java Mon May 20 07:47:40 2013
@@ -1,213 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.server.core.prefs;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
-
-import org.apache.directory.server.core.annotations.CreateDS;
-import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
-import org.apache.directory.server.core.integ.FrameworkRunner;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-
-/**
- * Tests the ServerSystemPreferences class.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-@RunWith(FrameworkRunner.class)
-@CreateDS(name = "PreferencesIT")
-public class PreferencesIT extends AbstractLdapTestUnit
-{
-
-    @Test
-    public void testSystemRoot()
-    {
-        ServerPreferencesFactory factory = new ServerPreferencesFactory( getService() );
-        Preferences prefs = factory.systemRoot();
-
-        assertNotNull( prefs );
-        assertEquals( "sysPrefRoot", prefs.get( "prefNodeName", "default value" ) );
-    }
-
-
-    /**
-     * Tests to make sure the system preferences root has entry (test, abc123).
-     *
-     * @throws Exception if there are failures with the store
-     */
-    @Test
-    public void testRoot() throws Exception
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        assertEquals( "sysPrefRoot", prefs.get( "prefNodeName", "not the value" ) );
-    }
-
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    @Test
-    public void testCreate() throws BackingStoreException
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        Preferences testNode = prefs.node( "testNode" );
-
-        testNode.put( "cn", "testNodeValue" );
-        testNode.sync();
-    }
-
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    @Test
-    public void testCreateAndSetBoolean() throws BackingStoreException
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        Preferences testNode = prefs.node( "testNode" );
-        testNode.putBoolean( "cn", false );
-        testNode.sync();
-        testNode = prefs.node( "testNode" );
-        assertEquals( false, testNode.getBoolean( "cn", false ) );
-    }
-
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    /* TODO: Temporarily commented until we get a clear status about this package
-    public void testCreateAndSetByteArray() throws BackingStoreException
-    {
-        byte[] jpegValue = new byte[]
-                                   { (byte)0xFF, (byte)0xD8, (byte)0xFF, (byte)0xE0, 0x01, 0x02, 'J', 'F', 'I', 'F', 0x00, 0x45, 0x23, 0x7d, 0x7f };
-        Preferences testNode = prefs.node( "testNode" );
-        testNode.putByteArray( "jpegPhoto", jpegValue );
-        testNode.sync();
-        testNode = prefs.node( "testNode" );
-    }
-    */
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    @Test
-    public void testCreateAndSetDouble() throws BackingStoreException
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        Preferences testNode = prefs.node( "testNode" );
-        testNode.putDouble( "cn", 3.14 );
-        testNode.sync();
-        testNode = prefs.node( "testNode" );
-        assertTrue( 3.14 == testNode.getDouble( "cn", 9.20 ) );
-    }
-
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    @Test
-    public void testCreateAndSetFloat() throws BackingStoreException
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        Preferences testNode = prefs.node( "testNode" );
-        testNode.putFloat( "cn", ( float ) 9.20 );
-        testNode.sync();
-        testNode = prefs.node( "testNode" );
-        assertTrue( ( float ) 9.20 == testNode.getFloat( "cn", ( float ) 9.20 ) );
-    }
-
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    @Test
-    public void testCreateAndSetInt() throws BackingStoreException
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        Preferences testNode = prefs.node( "testNode" );
-        testNode.putInt( "cn", 345 );
-        testNode.sync();
-        testNode = prefs.node( "testNode" );
-        assertTrue( 345 == testNode.getInt( "cn", 345 ) );
-    }
-
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    @Test
-    public void testCreateAndSetLong() throws BackingStoreException
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        Preferences testNode = prefs.node( "testNode" );
-        testNode.putLong( "cn", 75449559185447L );
-        testNode.sync();
-        testNode = prefs.node( "testNode" );
-        assertTrue( 75449559185447L == testNode.getLong( "cn", 75449559185447L ) );
-    }
-
-
-    /**
-     * Tests the creation and use of a new preferences node.
-     *
-     * @throws BackingStoreException if there are failures with the store
-     */
-    @Test
-    public void testCreateAndRemove() throws BackingStoreException
-    {
-        ServerSystemPreferences prefs = new ServerSystemPreferences( getService() );
-        Preferences testNode = prefs.node( "testNode" );
-
-        testNode.put( "cn", "testNodeValue" );
-        testNode.putInt( "roomNumber", 345 );
-        testNode.sync();
-
-        testNode = prefs.node( "testNode" );
-        assertEquals( 345, testNode.getInt( "roomNumber", 87 ) );
-        testNode.remove( "cn" );
-        testNode.remove( "roomNumber" );
-        testNode.sync();
-
-        assertEquals( "no value", testNode.get( "cn", "no value" ) );
-        assertEquals( "no value", testNode.get( "roomNumber", "no value" ) );
-    }
-}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/PreferencesUtils.java Mon May 20 07:47:40 2013
@@ -1,54 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.server.core.prefs;
-
-
-/**
- * Document this class.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-class PreferencesUtils
-{
-    /**
-     * Translates an absolute system preferences node name into the distinguished
-     * name of the entry corresponding to the preferences node.
-     *
-     * @param absPrefPath the absolute path to the system preferences node
-     * @return the distinguished name of the entry representing the system preferences node
-     * @throws LdapInvalidDnException if there are namespace problems while translating the path
-     *
-    public static Dn toSysDn( String absPrefPath ) throws LdapInvalidDnException
-    {
-        Dn dn = new Dn( ServerDNConstants.SYSPREFROOT_SYSTEM_DN );
-
-        String[] comps = absPrefPath.split( "/" );
-
-        for ( int ii = 0; ii < comps.length; ii++ )
-        {
-            if ( comps[ii] != null && !comps[ii].trim().equals( "" ) )
-            {
-                dn = dn.add( "prefNodeName=" + comps[ii] );
-            }
-        }
-
-        return dn;
-    }*/
-}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerPreferencesFactory.java Mon May 20 07:47:40 2013
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.server.core.prefs;
-
-
-import org.apache.directory.api.util.exception.NotImplementedException;
-import org.apache.directory.server.core.api.DirectoryService;
-import org.apache.directory.server.i18n.I18n;
-
-import java.util.prefs.Preferences;
-import java.util.prefs.PreferencesFactory;
-
-
-/**
- * A preferences factory implementation.  Currently the userRoot() preferences
- * are not available and will throw NotImplementedExceptions.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class ServerPreferencesFactory implements PreferencesFactory
-{
-    private final DirectoryService directoryService;
-
-
-    public ServerPreferencesFactory( DirectoryService directoryService )
-    {
-        this.directoryService = directoryService;
-    }
-
-
-    public Preferences systemRoot()
-    {
-        return new ServerSystemPreferences( directoryService );
-    }
-
-
-    public Preferences userRoot()
-    {
-        throw new NotImplementedException( I18n.err( I18n.ERR_269 ) );
-    }
-}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferenceException.java Mon May 20 07:47:40 2013
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.server.core.prefs;
-
-
-/**
- * A {@link RuntimeException} that is thrown when accessing
- * {@link ServerSystemPreferences} failed.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class ServerSystemPreferenceException extends RuntimeException
-{
-    private static final long serialVersionUID = -2042269063779317751L;
-
-
-    public ServerSystemPreferenceException()
-    {
-        super();
-    }
-
-
-    public ServerSystemPreferenceException( String message )
-    {
-        super( message );
-    }
-
-
-    public ServerSystemPreferenceException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-
-
-    public ServerSystemPreferenceException( Throwable cause )
-    {
-        super( cause );
-    }
-}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Mon May 20 07:47:40 2013
@@ -1,362 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.server.core.prefs;
-
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.List;
-import java.util.prefs.AbstractPreferences;
-import java.util.prefs.BackingStoreException;
-import java.util.prefs.Preferences;
-
-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.DefaultAttribute;
-import org.apache.directory.api.ldap.model.entry.DefaultModification;
-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.ModificationOperation;
-import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
-import org.apache.directory.api.ldap.model.message.AliasDerefMode;
-import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.api.ldap.model.schema.AttributeType;
-import org.apache.directory.api.util.PreferencesDictionary;
-import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.api.DirectoryService;
-import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
-import org.apache.directory.server.i18n.I18n;
-
-
-/**
- * A server side system {@link Preferences} implementation.  This implementation
- * presumes the creation of a root system preferences node in advance.  This
- * should be included with the system.ldif that is packaged with the server.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class ServerSystemPreferences extends AbstractPreferences
-{
-    /** an empty array of Strings used to get array from list */
-    private static final String[] EMPTY_STRINGS = new String[0];
-
-    /** the changes representing cached alterations to preferences */
-    private List<Modification> changes = new ArrayList<Modification>( 3 );
-
-    /** maps changes based on key: key->list of mods (on same key) */
-    private HashMap<String, List<Modification>> keyToChange = new HashMap<String, List<Modification>>( 3 );
-
-    private Dn dn;
-
-    private DirectoryService directoryService;
-
-
-    /**
-     * Creates a preferences object for the system preferences root.
-     * @param directoryService the directory service core
-     */
-    // This will suppress PMD.EmptyCatchBlock warnings in this method
-    @SuppressWarnings("PMD.EmptyCatchBlock")
-    public ServerSystemPreferences( DirectoryService directoryService )
-    {
-        super( null, "" );
-        super.newNode = false;
-
-        try
-        {
-            dn = directoryService.getDnFactory().create( "prefNodeName=sysPrefRoot,ou=system" );
-        }
-        catch ( LdapInvalidDnException e )
-        {
-            // never happens
-        }
-
-        this.directoryService = directoryService;
-    }
-
-
-    public void close() throws LdapException
-    {
-    }
-
-
-    /**
-     * Creates a preferences object using a relative name.
-     * 
-     * @param name the name of the preference node to create
-     * @param parent the parent of the preferences node to create
-     */
-    public ServerSystemPreferences( ServerSystemPreferences parent, String name )
-    {
-        super( parent, name );
-
-        this.directoryService = parent.directoryService;
-        Dn parentDn = ( ( ServerSystemPreferences ) parent() ).dn;
-        try
-        {
-            dn = directoryService.getDnFactory().create( "prefNodeName=" + name + "," + parentDn.getName() );
-
-            if ( !directoryService.getAdminSession().exists( dn ) )
-            {
-                Entry entry = directoryService.newEntry( dn );
-                entry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
-                    ApacheSchemaConstants.PREF_NODE_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
-                entry.add( "prefNodeName", name );
-
-                directoryService.getAdminSession().add( entry );
-
-                super.newNode = false;
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new ServerSystemPreferenceException( I18n.err( I18n.ERR_270 ), e );
-        }
-    }
-
-
-    // ------------------------------------------------------------------------
-    // Utility Methods
-    // ------------------------------------------------------------------------
-
-    /**
-     * Wraps this ServerPreferences object as a Dictionary.
-     *
-     * @return a Dictionary that uses this ServerPreferences object as the underlying backing store
-     */
-    public Dictionary<String, String> wrapAsDictionary()
-    {
-        return new PreferencesDictionary( this );
-    }
-
-
-    // ------------------------------------------------------------------------
-    // Protected SPI Methods
-    // ------------------------------------------------------------------------
-
-    protected void flushSpi() throws BackingStoreException
-    {
-        if ( changes.isEmpty() )
-        {
-            return;
-        }
-
-        try
-        {
-            directoryService.getAdminSession().modify( dn, changes );
-        }
-        catch ( Exception e )
-        {
-            throw new BackingStoreException( e );
-        }
-
-        changes.clear();
-        keyToChange.clear();
-    }
-
-
-    protected void removeNodeSpi() throws BackingStoreException
-    {
-        try
-        {
-            directoryService.getAdminSession().delete( dn );
-        }
-        catch ( Exception e )
-        {
-            throw new BackingStoreException( e );
-        }
-
-        changes.clear();
-        keyToChange.clear();
-    }
-
-
-    protected void syncSpi() throws BackingStoreException
-    {
-        if ( changes.isEmpty() )
-        {
-            return;
-        }
-
-        try
-        {
-            directoryService.getAdminSession().modify( dn, changes );
-        }
-        catch ( Exception e )
-        {
-            throw new BackingStoreException( e );
-        }
-
-        changes.clear();
-        keyToChange.clear();
-    }
-
-
-    protected String[] childrenNamesSpi() throws BackingStoreException
-    {
-        List<String> children = new ArrayList<String>();
-        EntryFilteringCursor list;
-
-        try
-        {
-            list = directoryService.getAdminSession().list( dn, AliasDerefMode.DEREF_ALWAYS, null );
-            list.beforeFirst();
-            while ( list.next() )
-            {
-                Entry entry = list.get();
-                children.add( entry.getDn().getRdn().getNormValue().getString() );
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new BackingStoreException( e );
-        }
-
-        return children.toArray( EMPTY_STRINGS );
-    }
-
-
-    protected String[] keysSpi() throws BackingStoreException
-    {
-        List<String> keys = new ArrayList<String>();
-
-        try
-        {
-            Entry entry = directoryService.getAdminSession().lookup( dn );
-
-            for ( Attribute attr : entry )
-            {
-                String oid = attr.getAttributeType().getOid();
-
-                if ( oid.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) )
-                {
-                    continue;
-                }
-
-                keys.add( attr.getUpId() );
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new BackingStoreException( e );
-        }
-
-        return keys.toArray( EMPTY_STRINGS );
-    }
-
-
-    protected void removeSpi( String key )
-    {
-        AttributeType at;
-        try
-        {
-            at = directoryService.getSchemaManager().lookupAttributeTypeRegistry( key );
-            Attribute attr = new DefaultAttribute( at );
-            Modification mi = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attr );
-            addDelta( mi );
-        }
-        catch ( LdapException e )
-        {
-            e.printStackTrace();
-        }
-    }
-
-
-    private void addDelta( Modification mi )
-    {
-        String key = mi.getAttribute().getUpId();
-        List<Modification> deltas;
-        changes.add( mi );
-
-        if ( keyToChange.containsKey( key ) )
-        {
-            deltas = keyToChange.get( key );
-        }
-        else
-        {
-            deltas = new ArrayList<Modification>();
-        }
-
-        deltas.add( mi );
-        keyToChange.put( key, deltas );
-    }
-
-
-    protected String getSpi( String key )
-    {
-        try
-        {
-            Attribute attr = directoryService.getAdminSession().lookup( dn ).get( key );
-
-            if ( keyToChange.containsKey( key ) )
-            {
-                for ( Modification mod : keyToChange.get( key ) )
-                {
-                    if ( mod.getOperation() == ModificationOperation.REMOVE_ATTRIBUTE )
-                    {
-                        attr = null;
-                    }
-                    else
-                    {
-                        attr = mod.getAttribute();
-                    }
-                }
-            }
-
-            if ( attr == null )
-            {
-                return null;
-            }
-            else
-            {
-                return attr.getString();
-            }
-        }
-        catch ( Exception e )
-        {
-            throw new ServerSystemPreferenceException( I18n.err( I18n.ERR_271 ), e );
-        }
-    }
-
-
-    protected void putSpi( String key, String value )
-    {
-        AttributeType at;
-        try
-        {
-            at = directoryService.getSchemaManager().lookupAttributeTypeRegistry( key );
-            Attribute attr = new DefaultAttribute( at, value );
-            Modification mi = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attr );
-            addDelta( mi );
-        }
-        catch ( LdapException e )
-        {
-            e.printStackTrace();
-        }
-    }
-
-
-    protected AbstractPreferences childSpi( String name )
-    {
-        return new ServerSystemPreferences( this, name );
-    }
-}

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/package-info.java Mon May 20 07:47:40 2013
@@ -1,40 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-
-/**
- * <pre>
- * <p>
- * Platform independent server side Preferences implementation based on ApacheDS.
- * The data is backed by the directory using a specific LDAP schema to map
- * preferences to the LDAP/X.500 namespace.  To make sure you're preferences are
- * using the right preferences factory implementation please check to see the
- * following property is set to our implementation:
- * </p>
- * <p>
- * java.util.prefs.PreferencesFactory=org.apache.ldap.server.prefs.ServerPreferencesFactory
- * <p>
- * </pre>
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-
-package org.apache.directory.server.core.prefs;
-
-

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PPolicyInit.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PPolicyInit.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PPolicyInit.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PPolicyInit.java Mon May 20 07:47:40 2013
@@ -21,7 +21,6 @@ package org.apache.directory.api.ldap.ex
 
 
 import org.apache.directory.api.asn1.DecoderException;
-import org.apache.directory.api.asn1.ber.Asn1Container;
 import org.apache.directory.api.asn1.ber.grammar.GrammarAction;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,7 +31,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PPolicyInit extends GrammarAction<Asn1Container>
+public class PPolicyInit extends GrammarAction<PasswordPolicyContainer>
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( PPolicyInit.class );
@@ -53,7 +52,7 @@ public class PPolicyInit extends Grammar
     /**
      * {@inheritDoc}
      */
-    public void action( Asn1Container container ) throws DecoderException
+    public void action( PasswordPolicyContainer container ) throws DecoderException
     {
         // As all the values are optional or defaulted, we can end here
         container.setGrammarEndAllowed( true );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java Mon May 20 07:47:40 2013
@@ -55,8 +55,7 @@ public class PasswordPolicyGrammar exten
     private static final PasswordPolicyGrammar INSTANCE = new PasswordPolicyGrammar();
 
 
-    @SuppressWarnings(
-        { "unchecked", "rawtypes" })
+    @SuppressWarnings("unchecked")
     private PasswordPolicyGrammar()
     {
         setName( PasswordPolicyGrammar.class.getName() );
@@ -65,32 +64,33 @@ public class PasswordPolicyGrammar exten
 
         // PasswordPolicyResponseValue ::= SEQUENCE {
         // ...
-        super.transitions[PasswordPolicyStates.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
-            PasswordPolicyStates.START_STATE, PasswordPolicyStates.PPOLICY_SEQ_STATE, UniversalTag.SEQUENCE.getValue(),
+        super.transitions[PasswordPolicyStates.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition<PasswordPolicyContainer>(
+            PasswordPolicyStates.START_STATE, PasswordPolicyStates.PPOLICY_SEQ_STATE,
+            UniversalTag.SEQUENCE.getValue(),
             new PPolicyInit() );
 
         // PasswordPolicyResponseValue ::= SEQUENCE {
         //              warning [0] CHOICE {
         super.transitions[PasswordPolicyStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyTags.PPOLICY_WARNING_TAG
-            .getValue()] = new GrammarTransition(
+            .getValue()] = new GrammarTransition<PasswordPolicyContainer>(
             PasswordPolicyStates.PPOLICY_SEQ_STATE, PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE,
             PasswordPolicyTags.PPOLICY_WARNING_TAG.getValue(),
-            new CheckNotNullLength() );
+            new CheckNotNullLength<PasswordPolicyContainer>() );
 
         // PasswordPolicyResponseValue ::= SEQUENCE {
         //              ...
         //              error   [1] ENUMERATED {
         super.transitions[PasswordPolicyStates.PPOLICY_SEQ_STATE.ordinal()][PasswordPolicyTags.PPOLICY_ERROR_TAG
-            .getValue()] = new GrammarTransition(
+            .getValue()] = new GrammarTransition<PasswordPolicyContainer>(
             PasswordPolicyStates.PPOLICY_SEQ_STATE, PasswordPolicyStates.PPOLICY_ERROR_TAG_STATE,
             PasswordPolicyTags.PPOLICY_ERROR_TAG.getValue(),
-            new StoreError() );
+            new StoreError<PasswordPolicyContainer>() );
 
         // PasswordPolicyResponseValue ::= SEQUENCE {
         //              warning [0] CHOICE {
         //                      timeBeforeExpiration [0] INTEGER (0 .. maxInt),
         super.transitions[PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyTags.TIME_BEFORE_EXPIRATION_TAG
-            .getValue()] = new GrammarTransition(
+            .getValue()] = new GrammarTransition<PasswordPolicyContainer>(
             PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE,
             PasswordPolicyTags.TIME_BEFORE_EXPIRATION_TAG.getValue(),
             new StoreTimeBeforeExpiration() );
@@ -100,7 +100,7 @@ public class PasswordPolicyGrammar exten
         //                      ...
         //                      graceAuthNsRemaining [1] INTEGER (0 .. maxInt) } OPTIONAL,
         super.transitions[PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE.ordinal()][PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG
-            .getValue()] = new GrammarTransition(
+            .getValue()] = new GrammarTransition<PasswordPolicyContainer>(
             PasswordPolicyStates.PPOLICY_WARNING_TAG_STATE, PasswordPolicyStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE,
             PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
             new StoreGraceAuthNRemaining() );
@@ -109,19 +109,19 @@ public class PasswordPolicyGrammar exten
         //              ...
         //              error   [1] ENUMERATED {
         super.transitions[PasswordPolicyStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE.ordinal()][PasswordPolicyTags.PPOLICY_ERROR_TAG
-            .getValue()] = new GrammarTransition(
+            .getValue()] = new GrammarTransition<PasswordPolicyContainer>(
             PasswordPolicyStates.PPOLICY_TIME_BEFORE_EXPIRATION_STATE, PasswordPolicyStates.PPOLICY_ERROR_TAG_STATE,
             PasswordPolicyTags.PPOLICY_ERROR_TAG.getValue(),
-            new StoreError() );
+            new StoreError<PasswordPolicyContainer>() );
 
         // PasswordPolicyResponseValue ::= SEQUENCE {
         //              ...
         //              error   [1] ENUMERATED {
         super.transitions[PasswordPolicyStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE.ordinal()][PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG
-            .getValue()] = new GrammarTransition(
+            .getValue()] = new GrammarTransition<PasswordPolicyContainer>(
             PasswordPolicyStates.PPOLICY_GRACE_AUTHNS_REMAINING_STATE, PasswordPolicyStates.PPOLICY_ERROR_TAG_STATE,
             PasswordPolicyTags.GRACE_AUTHNS_REMAINING_TAG.getValue(),
-            new StoreError() );
+            new StoreError<PasswordPolicyContainer>() );
     }
 
 

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreError.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreError.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreError.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreError.java Mon May 20 07:47:40 2013
@@ -30,8 +30,7 @@ import org.apache.directory.api.ldap.ext
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@SuppressWarnings("rawtypes")
-public class StoreError extends AbstractReadInteger
+public class StoreError<C extends Asn1Container> extends AbstractReadInteger<C>
 {
 
     /**

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreGraceAuthNRemaining.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreGraceAuthNRemaining.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreGraceAuthNRemaining.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreGraceAuthNRemaining.java Mon May 20 07:47:40 2013
@@ -21,7 +21,6 @@ package org.apache.directory.api.ldap.ex
 
 
 import org.apache.directory.api.asn1.actions.AbstractReadInteger;
-import org.apache.directory.api.asn1.ber.Asn1Container;
 
 
 /**
@@ -29,8 +28,7 @@ import org.apache.directory.api.asn1.ber
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@SuppressWarnings("rawtypes")
-public class StoreGraceAuthNRemaining extends AbstractReadInteger
+public class StoreGraceAuthNRemaining extends AbstractReadInteger<PasswordPolicyContainer>
 {
 
     /**
@@ -46,10 +44,8 @@ public class StoreGraceAuthNRemaining ex
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, PasswordPolicyContainer ppolicyContainer )
     {
-        PasswordPolicyContainer ppolicyContainer = ( PasswordPolicyContainer ) container;
-
         ppolicyContainer.getPasswordPolicyResponseControl().getResponse().setGraceAuthNRemaining( value );
 
         ppolicyContainer.setGrammarEndAllowed( true );

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java Mon May 20 07:47:40 2013
@@ -21,7 +21,6 @@ package org.apache.directory.api.ldap.ex
 
 
 import org.apache.directory.api.asn1.actions.AbstractReadInteger;
-import org.apache.directory.api.asn1.ber.Asn1Container;
 
 
 /**
@@ -29,8 +28,7 @@ import org.apache.directory.api.asn1.ber
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@SuppressWarnings("rawtypes")
-public class StoreTimeBeforeExpiration extends AbstractReadInteger
+public class StoreTimeBeforeExpiration extends AbstractReadInteger<PasswordPolicyContainer>
 {
 
     /**
@@ -46,12 +44,10 @@ public class StoreTimeBeforeExpiration e
      * {@inheritDoc}
      */
     @Override
-    protected void setIntegerValue( int value, Asn1Container container )
+    protected void setIntegerValue( int value, PasswordPolicyContainer ppolicyContainer )
     {
-        PasswordPolicyContainer ppolicyContainer = ( PasswordPolicyContainer ) container;
-
         ppolicyContainer.getPasswordPolicyResponseControl().getResponse().setTimeBeforeExpiration( value );
 
-        container.setGrammarEndAllowed( true );
+        ppolicyContainer.setGrammarEndAllowed( true );
     }
 }

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueStatesEnum.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueStatesEnum.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueStatesEnum.java Mon May 20 07:47:40 2013
@@ -68,7 +68,7 @@ public enum SyncDoneValueStatesEnum impl
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<SyncDoneValueContainer> grammar )
     {
         if ( grammar instanceof SyncDoneValueGrammar )
         {

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueGrammar.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueGrammar.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueGrammar.java Mon May 20 07:47:40 2013
@@ -62,7 +62,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncInfoValueGrammar extends AbstractGrammar
+public final class SyncInfoValueGrammar extends AbstractGrammar<SyncInfoValueContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( SyncInfoValueGrammar.class );
@@ -71,18 +71,20 @@ public final class SyncInfoValueGrammar 
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. SyncInfoValueControlGrammar is a singleton */
-    private static Grammar instance = new SyncInfoValueGrammar();
+    private static Grammar<SyncInfoValueContainer> instance = new SyncInfoValueGrammar();
 
 
     /**
      * Creates a new SyncInfoValueControlGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private SyncInfoValueGrammar()
     {
         setName( SyncInfoValueGrammar.class.getName() );
 
         // Create the transitions table
-        super.transitions = new GrammarTransition[SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE.ordinal()][256];
+        super.transitions = new GrammarTransition[SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE
+            .ordinal()][256];
 
         /** 
          * Transition from initial state to SyncInfoValue newCookie choice
@@ -93,7 +95,7 @@ public final class SyncInfoValueGrammar 
          * Initialize the syncInfoValue object
          */
         super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.NEW_COOKIE_TAG.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.START_STATE,
                 SyncInfoValueStatesEnum.NEW_COOKIE_STATE,
                 SyncInfoValueTags.NEW_COOKIE_TAG.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "NewCookie choice for SyncInfoValueControl" )
@@ -132,7 +134,7 @@ public final class SyncInfoValueGrammar 
          */
         super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.REFRESH_DELETE_TAG
             .getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.START_STATE,
                 SyncInfoValueStatesEnum.REFRESH_DELETE_STATE,
                 SyncInfoValueTags.REFRESH_DELETE_TAG.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshDelete choice for SyncInfoValueControl" )
@@ -158,7 +160,7 @@ public final class SyncInfoValueGrammar 
          * Load the cookie object
          */
         super.transitions[SyncInfoValueStatesEnum.REFRESH_DELETE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_DELETE_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.REFRESH_DELETE_STATE,
                 SyncInfoValueStatesEnum.REFRESH_DELETE_COOKIE_STATE,
                 UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshDelete cookie" )
@@ -195,7 +197,7 @@ public final class SyncInfoValueGrammar 
          */
         super.transitions[SyncInfoValueStatesEnum.REFRESH_DELETE_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN
             .getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_DELETE_COOKIE_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.REFRESH_DELETE_COOKIE_STATE,
                 SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                 UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshDelete refreshDone flag" )
@@ -244,7 +246,7 @@ public final class SyncInfoValueGrammar 
          * Load the refreshDone flag
          */
         super.transitions[SyncInfoValueStatesEnum.REFRESH_DELETE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_DELETE_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.REFRESH_DELETE_STATE,
                 SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                 UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshDelete refreshDone flag" )
@@ -294,7 +296,7 @@ public final class SyncInfoValueGrammar 
          */
         super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.REFRESH_PRESENT_TAG
             .getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.START_STATE,
                 SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                 SyncInfoValueTags.REFRESH_PRESENT_TAG.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshDelete choice for SyncInfoValueControl" )
@@ -320,7 +322,7 @@ public final class SyncInfoValueGrammar 
          * Load the cookie object
          */
         super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                 SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE,
                 UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshPresent cookie" )
@@ -357,7 +359,7 @@ public final class SyncInfoValueGrammar 
          */
         super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN
             .getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.REFRESH_PRESENT_COOKIE_STATE,
                 SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                 UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshPresent refreshDone flag" )
@@ -406,7 +408,7 @@ public final class SyncInfoValueGrammar 
          * Load the refreshDone flag
          */
         super.transitions[SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.REFRESH_PRESENT_STATE,
                 SyncInfoValueStatesEnum.LAST_SYNC_INFO_VALUE_STATE,
                 UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "RefreshPresent refreshDone flag" )
@@ -455,7 +457,7 @@ public final class SyncInfoValueGrammar 
          * Initialize the syncInfoValue object
          */
         super.transitions[SyncInfoValueStatesEnum.START_STATE.ordinal()][SyncInfoValueTags.SYNC_ID_SET_TAG.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.START_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.START_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                 SyncInfoValueTags.SYNC_ID_SET_TAG.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet choice for SyncInfoValueControl" )
@@ -478,7 +480,7 @@ public final class SyncInfoValueGrammar 
          * Load the cookie object
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                 UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet cookie" )
@@ -511,7 +513,7 @@ public final class SyncInfoValueGrammar 
          * Load the refreshDeletes flag
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                 UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet refreshDeletes" )
@@ -554,7 +556,7 @@ public final class SyncInfoValueGrammar 
          * Load the refreshDeletes flag
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                 UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet refreshDeletes" )
@@ -597,7 +599,7 @@ public final class SyncInfoValueGrammar 
          * Initialize the UUID set : no action associated, except allowing a grammar end
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_STATE.ordinal()][UniversalTag.SET.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                 UniversalTag.SET.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
@@ -619,7 +621,7 @@ public final class SyncInfoValueGrammar 
          * Initialize the UUID set : no action associated
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE.ordinal()][UniversalTag.SET.getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_COOKIE_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                 UniversalTag.SET.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
@@ -642,7 +644,7 @@ public final class SyncInfoValueGrammar 
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE.ordinal()][UniversalTag.SET
             .getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_REFRESH_DELETES_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                 UniversalTag.SET.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet syncUUIDs" )
@@ -665,7 +667,7 @@ public final class SyncInfoValueGrammar 
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE.ordinal()][UniversalTag.OCTET_STRING
             .getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_SET_OF_UUIDS_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                 UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet first UUID" )
@@ -710,7 +712,7 @@ public final class SyncInfoValueGrammar 
          */
         super.transitions[SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING
             .getValue()] =
-            new GrammarTransition( SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
+            new GrammarTransition<SyncInfoValueContainer>( SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                 SyncInfoValueStatesEnum.SYNC_ID_SET_UUID_STATE,
                 UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction<SyncInfoValueContainer>( "SyncIdSet UUID" )
@@ -751,7 +753,7 @@ public final class SyncInfoValueGrammar 
      * 
      * @return An instance on this grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<SyncInfoValueContainer> getInstance()
     {
         return instance;
     }

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueStatesEnum.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueStatesEnum.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncInfoValueStatesEnum.java Mon May 20 07:47:40 2013
@@ -101,7 +101,7 @@ public enum SyncInfoValueStatesEnum impl
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<SyncInfoValueContainer> grammar )
     {
         if ( grammar instanceof SyncInfoValueGrammar )
         {

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueGrammar.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueGrammar.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueGrammar.java Mon May 20 07:47:40 2013
@@ -57,7 +57,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncRequestValueGrammar extends AbstractGrammar
+public final class SyncRequestValueGrammar extends AbstractGrammar<SyncRequestValueContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( SyncRequestValueGrammar.class );
@@ -66,12 +66,13 @@ public final class SyncRequestValueGramm
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. SyncRequestValueControlGrammar is a singleton */
-    private static Grammar instance = new SyncRequestValueGrammar();
+    private static Grammar<SyncRequestValueContainer> instance = new SyncRequestValueGrammar();
 
 
     /**
      * Creates a new SyncRequestValueControlGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private SyncRequestValueGrammar()
     {
         setName( SyncRequestValueGrammar.class.getName() );
@@ -87,7 +88,7 @@ public final class SyncRequestValueGramm
          * Initialize the syncRequestValue object
          */
         super.transitions[SyncRequestValueStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] =
-            new GrammarTransition( SyncRequestValueStatesEnum.START_STATE,
+            new GrammarTransition<SyncRequestValueContainer>( SyncRequestValueStatesEnum.START_STATE,
                 SyncRequestValueStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE,
                 UniversalTag.SEQUENCE.getValue(),
                 null );
@@ -107,7 +108,8 @@ public final class SyncRequestValueGramm
          */
         super.transitions[SyncRequestValueStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED
             .getValue()] =
-            new GrammarTransition( SyncRequestValueStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE,
+            new GrammarTransition<SyncRequestValueContainer>(
+                SyncRequestValueStatesEnum.SYNC_REQUEST_VALUE_SEQUENCE_STATE,
                 SyncRequestValueStatesEnum.MODE_STATE,
                 UniversalTag.ENUMERATED.getValue(),
                 new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl mode" )
@@ -154,7 +156,7 @@ public final class SyncRequestValueGramm
          * Stores the cookie
          */
         super.transitions[SyncRequestValueStatesEnum.MODE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] =
-            new GrammarTransition( SyncRequestValueStatesEnum.MODE_STATE,
+            new GrammarTransition<SyncRequestValueContainer>( SyncRequestValueStatesEnum.MODE_STATE,
                 SyncRequestValueStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),
                 new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl cookie" )
                 {
@@ -186,7 +188,7 @@ public final class SyncRequestValueGramm
          * Stores the reloadHint flag
          */
         super.transitions[SyncRequestValueStatesEnum.MODE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
-            new GrammarTransition( SyncRequestValueStatesEnum.MODE_STATE,
+            new GrammarTransition<SyncRequestValueContainer>( SyncRequestValueStatesEnum.MODE_STATE,
                 SyncRequestValueStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl reloadHint flag" )
                 {
@@ -227,7 +229,7 @@ public final class SyncRequestValueGramm
          * Stores the reloadHint flag
          */
         super.transitions[SyncRequestValueStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()] =
-            new GrammarTransition( SyncRequestValueStatesEnum.COOKIE_STATE,
+            new GrammarTransition<SyncRequestValueContainer>( SyncRequestValueStatesEnum.COOKIE_STATE,
                 SyncRequestValueStatesEnum.RELOAD_HINT_STATE, UniversalTag.BOOLEAN.getValue(),
                 new GrammarAction<SyncRequestValueContainer>( "Set SyncRequestValueControl reloadHint flag" )
                 {
@@ -265,7 +267,7 @@ public final class SyncRequestValueGramm
      * 
      * @return An instance on this grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<SyncRequestValueContainer> getInstance()
     {
         return instance;
     }

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueStatesEnum.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueStatesEnum.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueStatesEnum.java Mon May 20 07:47:40 2013
@@ -77,7 +77,7 @@ public enum SyncRequestValueStatesEnum i
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<SyncRequestValueContainer> grammar )
     {
         if ( grammar instanceof SyncRequestValueGrammar )
         {

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueGrammar.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueGrammar.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueGrammar.java Mon May 20 07:47:40 2013
@@ -55,7 +55,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncStateValueGrammar extends AbstractGrammar
+public final class SyncStateValueGrammar extends AbstractGrammar<SyncStateValueContainer>
 {
     /** The logger */
     static final Logger LOG = LoggerFactory.getLogger( SyncStateValueGrammar.class );
@@ -64,12 +64,13 @@ public final class SyncStateValueGrammar
     static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The instance of grammar. SyncStateValueControlGrammar is a singleton */
-    private static Grammar instance = new SyncStateValueGrammar();
+    private static Grammar<SyncStateValueContainer> instance = new SyncStateValueGrammar();
 
 
     /**
      * Creates a new SyncStateValueControlGrammar object.
      */
+    @SuppressWarnings("unchecked")
     private SyncStateValueGrammar()
     {
         setName( SyncStateValueGrammar.class.getName() );
@@ -84,7 +85,7 @@ public final class SyncStateValueGrammar
          *     
          * Initialize the syncStateValue object
          */
-        super.transitions[SyncStateValueStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition(
+        super.transitions[SyncStateValueStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()] = new GrammarTransition<SyncStateValueContainer>(
             SyncStateValueStatesEnum.START_STATE, SyncStateValueStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
             UniversalTag.SEQUENCE.getValue(), null );
 
@@ -102,7 +103,7 @@ public final class SyncStateValueGrammar
          * Stores the sync state type value
          */
         super.transitions[SyncStateValueStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.ENUMERATED
-            .getValue()] = new GrammarTransition(
+            .getValue()] = new GrammarTransition<SyncStateValueContainer>(
             SyncStateValueStatesEnum.SYNC_STATE_VALUE_SEQUENCE_STATE,
             SyncStateValueStatesEnum.SYNC_TYPE_STATE, UniversalTag.ENUMERATED.getValue(),
             new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl state type" )
@@ -147,7 +148,7 @@ public final class SyncStateValueGrammar
          *     
          * Stores the entryUUID
          */
-        super.transitions[SyncStateValueStatesEnum.SYNC_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncStateValueStatesEnum.SYNC_TYPE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition<SyncStateValueContainer>(
             SyncStateValueStatesEnum.SYNC_TYPE_STATE, SyncStateValueStatesEnum.SYNC_UUID_STATE,
             UniversalTag.OCTET_STRING.getValue(),
             new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl entryUUID" )
@@ -179,7 +180,7 @@ public final class SyncStateValueGrammar
          *     
          * Stores the reloadHint flag
          */
-        super.transitions[SyncStateValueStatesEnum.SYNC_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition(
+        super.transitions[SyncStateValueStatesEnum.SYNC_UUID_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()] = new GrammarTransition<SyncStateValueContainer>(
             SyncStateValueStatesEnum.SYNC_UUID_STATE, SyncStateValueStatesEnum.COOKIE_STATE,
             UniversalTag.OCTET_STRING.getValue(),
             new GrammarAction<SyncStateValueContainer>( "Set SyncStateValueControl cookie value" )
@@ -209,7 +210,7 @@ public final class SyncStateValueGrammar
      * 
      * @return An instance on this grammar
      */
-    public static Grammar getInstance()
+    public static Grammar<SyncStateValueContainer> getInstance()
     {
         return instance;
     }

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueStatesEnum.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueStatesEnum.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueStatesEnum.java Mon May 20 07:47:40 2013
@@ -32,9 +32,6 @@ import org.apache.directory.api.asn1.ber
  */
 public enum SyncStateValueStatesEnum implements States
 {
-    // ~ Static fields/initializers
-    // -----------------------------------------------------------------
-
     /** The END_STATE */
     END_STATE,
 
@@ -77,7 +74,7 @@ public enum SyncStateValueStatesEnum imp
      * @param grammar The grammar class
      * @return The grammar name
      */
-    public String getGrammarName( Grammar grammar )
+    public String getGrammarName( Grammar<SyncStateValueContainer> grammar )
     {
         if ( grammar instanceof SyncStateValueGrammar )
         {

Modified: directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelGrammar.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelGrammar.java (original)
+++ directory/shared/trunk/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/extended/ads_impl/cancel/CancelGrammar.java Mon May 20 07:47:40 2013
@@ -21,7 +21,6 @@ package org.apache.directory.api.ldap.ex
 
 
 import org.apache.directory.api.asn1.DecoderException;
-import org.apache.directory.api.asn1.ber.Asn1Container;
 import org.apache.directory.api.asn1.ber.grammar.AbstractGrammar;
 import org.apache.directory.api.asn1.ber.grammar.Grammar;
 import org.apache.directory.api.asn1.ber.grammar.GrammarAction;
@@ -65,8 +64,7 @@ public final class CancelGrammar extends
     /**
      * Creates a new GracefulDisconnectGrammar object.
      */
-    @SuppressWarnings(
-        { "unchecked", "rawtypes" })
+    @SuppressWarnings("unchecked")
     private CancelGrammar()
     {
         setName( CancelGrammar.class.getName() );
@@ -85,11 +83,10 @@ public final class CancelGrammar extends
             new GrammarTransition<CancelContainer>( CancelStatesEnum.START_STATE,
                 CancelStatesEnum.CANCEL_SEQUENCE_STATE,
                 UniversalTag.SEQUENCE.getValue(),
-                new GrammarAction( "Init Cancel" )
+                new GrammarAction<CancelContainer>( "Init Cancel" )
                 {
-                    public void action( Asn1Container container )
+                    public void action( CancelContainer cancelContainer )
                     {
-                        CancelContainer cancelContainer = ( CancelContainer ) container;
                         Cancel cancel = new Cancel();
                         cancelContainer.setCancel( cancel );
                     }
@@ -108,11 +105,10 @@ public final class CancelGrammar extends
             new GrammarTransition<CancelContainer>( CancelStatesEnum.CANCEL_SEQUENCE_STATE,
                 CancelStatesEnum.CANCEL_ID_STATE,
                 UniversalTag.INTEGER.getValue(),
-                new GrammarAction( "Stores CancelId" )
+                new GrammarAction<CancelContainer>( "Stores CancelId" )
                 {
-                    public void action( Asn1Container container ) throws DecoderException
+                    public void action( CancelContainer cancelContainer ) throws DecoderException
                     {
-                        CancelContainer cancelContainer = ( CancelContainer ) container;
                         BerValue value = cancelContainer.getCurrentTLV().getValue();
 
                         try

Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schemamanager/impl/DefaultSchemaManager.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schemamanager/impl/DefaultSchemaManager.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schemamanager/impl/DefaultSchemaManager.java (original)
+++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/api/ldap/schemamanager/impl/DefaultSchemaManager.java Mon May 20 07:47:40 2013
@@ -756,8 +756,6 @@ public class DefaultSchemaManager implem
      * - isRelaxed
      * - disabledAccepted
      */
-    // False positive
-    @SuppressWarnings("PMD.UnusedPrivateMethod")
     private boolean unload( Registries registries, Schema schema ) throws LdapException
     {
         if ( schema == null )

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayEnumeration.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayEnumeration.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayEnumeration.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayEnumeration.java Mon May 20 07:47:40 2013
@@ -1,77 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.api.util;
-
-
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-
-/**
- * An enumeration wrapper around an array.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-@SuppressWarnings("rawtypes")
-public class ArrayEnumeration implements Enumeration
-{
-    /** the index into the array */
-    private int index = 0;
-
-    /** Underlying array that is wrapped */
-    private final Object[] array;
-
-
-    /**
-     * Constructs an enumeration by wrapping an array.
-     * 
-     * @param array
-     *            the underlying array that is wrapped
-     */
-    public ArrayEnumeration( Object[] array )
-    {
-        if ( array != null )
-        {
-            this.array = new Object[array.length];
-            System.arraycopy( array, 0, this.array, 0, array.length );
-        }
-        else
-        {
-            this.array = null;
-        }
-    }
-
-
-    public final boolean hasMoreElements()
-    {
-        return array != null && array.length != 0 && index < array.length;
-    }
-
-
-    public Object nextElement()
-    {
-        if ( !hasMoreElements() )
-        {
-            throw new NoSuchElementException( "no more objects in array" );
-        }
-
-        return array[index++];
-    }
-}

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayNamingEnumeration.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayNamingEnumeration.java?rev=1484389&r1=1484388&r2=1484389&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayNamingEnumeration.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/ArrayNamingEnumeration.java Mon May 20 07:47:40 2013
@@ -1,96 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.api.util;
-
-
-import java.util.NoSuchElementException;
-import javax.naming.NamingEnumeration;
-
-
-/**
- * A NamingEnumeration over an array of objects.
- * 
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class ArrayNamingEnumeration<T> implements NamingEnumeration<T>
-{
-    /** the objects to enumerate */
-    private final T[] objects;
-
-    /** the index pointing into the array */
-    private int index = 0;
-
-
-    /**
-     * Creates a NamingEnumeration over an array of objects.
-     * 
-     * @param objects
-     *            the objects to enumerate over
-     */
-    public ArrayNamingEnumeration( T[] objects )
-    {
-        this.objects = objects;
-    }
-
-
-    public void close()
-    {
-        if ( objects != null )
-        {
-            index = objects.length;
-        }
-    }
-
-
-    public boolean hasMore()
-    {
-        if ( objects == null || objects.length == 0 )
-        {
-            return false;
-        }
-
-        return index < objects.length;
-    }
-
-
-    public T next()
-    {
-        if ( objects == null || objects.length == 0 || index >= objects.length )
-        {
-            throw new NoSuchElementException();
-        }
-
-        T retval = objects[index];
-        index++;
-        return retval;
-    }
-
-
-    public boolean hasMoreElements()
-    {
-        return hasMore();
-    }
-
-
-    public T nextElement()
-    {
-        return next();
-    }
-}