directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r239372 - in /directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay: InMemoryReplayCache.java ReplayCache.java
Date Tue, 23 Aug 2005 07:18:35 GMT
Author: erodriguez
Date: Tue Aug 23 00:18:30 2005
New Revision: 239372

URL: http://svn.apache.org/viewcvs?rev=239372&view=rev
Log:
Reformatting:  imports, whitespace, line breaks, or code convention.

Modified:
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/InMemoryReplayCache.java
    directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/ReplayCache.java

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/InMemoryReplayCache.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/InMemoryReplayCache.java?rev=239372&r1=239371&r2=239372&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/InMemoryReplayCache.java
(original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/InMemoryReplayCache.java
Tue Aug 23 00:18:30 2005
@@ -16,68 +16,82 @@
  */
 package org.apache.kerberos.replay;
 
-import org.apache.kerberos.messages.value.*;
-
-import java.util.*;
-
-import javax.security.auth.kerberos.*;
-
-public class InMemoryReplayCache implements ReplayCache {
-	
-	private static final long TWO_WEEKS = 1000 * 60 * 60 * 24 * 14;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.security.auth.kerberos.KerberosPrincipal;
+
+import org.apache.kerberos.messages.value.KerberosTime;
+
+public class InMemoryReplayCache implements ReplayCache
+{
+    private static final long TWO_WEEKS = 1000 * 60 * 60 * 24 * 14;
 
     private List list = new ArrayList();
 
-    public synchronized boolean isReplay(KerberosTime clientTime, KerberosPrincipal clientPrincipal)
{
-        ReplayCacheEntry testEntry = new ReplayCacheEntry(clientTime, clientPrincipal);
+    public synchronized boolean isReplay( KerberosTime clientTime, KerberosPrincipal clientPrincipal
)
+    {
+        ReplayCacheEntry testEntry = new ReplayCacheEntry( clientTime, clientPrincipal );
         Iterator it = list.iterator();
-        while (it.hasNext()) {
-            ReplayCacheEntry entry = (ReplayCacheEntry)it.next();
-            if (entry.equals(testEntry))
+        while ( it.hasNext() )
+        {
+            ReplayCacheEntry entry = (ReplayCacheEntry) it.next();
+            if ( entry.equals( testEntry ) )
+            {
                 return true;
+            }
         }
         return false;
     }
 
-    public synchronized void save(KerberosTime clientTime, KerberosPrincipal clientPrincipal)
{
-        list.add(new ReplayCacheEntry(clientTime, clientPrincipal));
+    public synchronized void save( KerberosTime clientTime, KerberosPrincipal clientPrincipal
)
+    {
+        list.add( new ReplayCacheEntry( clientTime, clientPrincipal ) );
         purgeExpired();
     }
-    
+
     /*
      * TODO - age needs to be configurable; requires store
      */
-    private synchronized void purgeExpired() {
-    	long now = new Date().getTime();
-    	
-        KerberosTime age = new KerberosTime(now - TWO_WEEKS);
-        
+    private synchronized void purgeExpired()
+    {
+        long now = new Date().getTime();
+
+        KerberosTime age = new KerberosTime( now - TWO_WEEKS );
+
         Iterator it = list.iterator();
-        while (it.hasNext()) {
-            ReplayCacheEntry entry = (ReplayCacheEntry)it.next();
-            if (entry.olderThan(age))
-                list.remove(entry);
+        while ( it.hasNext() )
+        {
+            ReplayCacheEntry entry = (ReplayCacheEntry) it.next();
+            if ( entry.olderThan( age ) )
+            {
+                list.remove( entry );
+            }
         }
     }
-    
-    private class ReplayCacheEntry {
 
-    	private KerberosTime      _clientTime;
-    	private KerberosPrincipal _clientPrincipal;
-    	
-    	public ReplayCacheEntry(KerberosTime time, KerberosPrincipal principal) {
-    		_clientTime      = time;
-    		_clientPrincipal = principal;
-    	}
-    	
-        public boolean equals(ReplayCacheEntry other) {
-            return _clientTime.equals(other._clientTime) && 
-    				_clientPrincipal.equals(other._clientPrincipal);
+    private class ReplayCacheEntry
+    {
+        private KerberosTime clientTime;
+        private KerberosPrincipal clientPrincipal;
+
+        public ReplayCacheEntry( KerberosTime time, KerberosPrincipal principal )
+        {
+            clientTime = time;
+            clientPrincipal = principal;
         }
-        
-        public boolean olderThan(KerberosTime time) {
-            return time.greaterThan(_clientTime);
+
+        public boolean equals( ReplayCacheEntry other )
+        {
+            return clientTime.equals( other.clientTime )
+                    && clientPrincipal.equals( other.clientPrincipal );
+        }
+
+        public boolean olderThan( KerberosTime time )
+        {
+            return time.greaterThan( clientTime );
         }
     }
 }
-

Modified: directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/ReplayCache.java
URL: http://svn.apache.org/viewcvs/directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/ReplayCache.java?rev=239372&r1=239371&r2=239372&view=diff
==============================================================================
--- directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/ReplayCache.java
(original)
+++ directory/shared/kerberos/branches/refactor-to-chain/common/src/java/org/apache/kerberos/replay/ReplayCache.java
Tue Aug 23 00:18:30 2005
@@ -16,14 +16,13 @@
  */
 package org.apache.kerberos.replay;
 
-import org.apache.kerberos.messages.value.*;
+import javax.security.auth.kerberos.KerberosPrincipal;
 
-import javax.security.auth.kerberos.*;
+import org.apache.kerberos.messages.value.KerberosTime;
 
-public interface ReplayCache {
+public interface ReplayCache
+{
+    boolean isReplay( KerberosTime clientTime, KerberosPrincipal clientPrincipal );
 
-    boolean isReplay(KerberosTime clientTime, KerberosPrincipal clientPrincipal);
-    
-    void save(KerberosTime clientTime, KerberosPrincipal clientPrincipal);
+    void save( KerberosTime clientTime, KerberosPrincipal clientPrincipal );
 }
-



Mime
View raw message