commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcar...@apache.org
Subject svn commit: r278595 [2/2] - in /jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy: ./ exception/ factory/cglib/ factory/javassist/ factory/reflect/ factory/util/ handler/ interceptor/ interceptor/filter/ provider/ provider/cache/
Date Sun, 04 Sep 2005 14:12:38 GMT
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderDecorator.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderDecorator.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderDecorator.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderDecorator.java
Sun Sep  4 07:12:22 2005
@@ -24,15 +24,28 @@
  */
 public class ProviderDecorator extends AbstractObjectProvider
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     protected ObjectProvider inner;
 
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
     public ProviderDecorator( ObjectProvider inner )
     {
         this.inner = inner;
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// ObjectProvider Implementation
+//----------------------------------------------------------------------------------------------------------------------
+
     public Object getObject()
     {
         return inner.getObject();
     }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderUtils.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderUtils.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderUtils.java
Sun Sep  4 07:12:22 2005
@@ -24,16 +24,20 @@
  */
 public class ProviderUtils
 {
-    public static ObjectProvider constantProvider( Object value )
-    {
-        return new ConstantProvider( value );
-    }
+//----------------------------------------------------------------------------------------------------------------------
+// Static Methods
+//----------------------------------------------------------------------------------------------------------------------
 
     public static ObjectProvider beanProvider( Class beanClass )
     {
         return new BeanProvider( beanClass );
     }
 
+    public static ObjectProvider constantProvider( Object value )
+    {
+        return new ConstantProvider( value );
+    }
+
     public static ObjectProvider singletonProvider( ObjectProvider inner )
     {
         return new SingletonProvider( inner );
@@ -44,3 +48,4 @@
         return new SynchronizedProvider( inner );
     }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
Sun Sep  4 07:12:22 2005
@@ -33,15 +33,22 @@
  */
 public class RmiProvider extends AbstractObjectProvider
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private String host = "localhost";
     private int port = Registry.REGISTRY_PORT;
     private RMIClientSocketFactory clientSocketFactory;
     private final String name;
 
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
     public RmiProvider( String name )
     {
         this.name = name;
-
     }
 
     public RmiProvider( String host, String name )
@@ -65,6 +72,10 @@
         this.name = name;
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// ObjectProvider Implementation
+//----------------------------------------------------------------------------------------------------------------------
+
     public Object getObject()
     {
         Registry reg = null;
@@ -87,9 +98,31 @@
             throw new ObjectProviderException(
                     "Unable to lookup service named " + name + " in registry at " + host
+ ":" + port + "." );
         }
+    }
+
+//----------------------------------------------------------------------------------------------------------------------
+// Getter/Setter Methods
+//----------------------------------------------------------------------------------------------------------------------
+
+    public void setClientSocketFactory( RMIClientSocketFactory clientSocketFactory )
+    {
+        this.clientSocketFactory = clientSocketFactory;
+    }
 
+    public void setHost( String host )
+    {
+        this.host = host;
+    }
+
+    public void setPort( int port )
+    {
+        this.port = port;
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// Other Methods
+//----------------------------------------------------------------------------------------------------------------------
+
     private Registry getRegistry()
     {
         try
@@ -111,19 +144,5 @@
             throw new ObjectProviderException( "Unable to locate registry at " + host + ":"
+ port + ".", e );
         }
     }
-
-    public void setHost( String host )
-    {
-        this.host = host;
-    }
-
-    public void setPort( int port )
-    {
-        this.port = port;
-    }
-
-    public void setClientSocketFactory( RMIClientSocketFactory clientSocketFactory )
-    {
-        this.clientSocketFactory = clientSocketFactory;
-    }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SessionBeanProvider.java
Sun Sep  4 07:12:22 2005
@@ -33,10 +33,18 @@
  */
 public class SessionBeanProvider extends AbstractObjectProvider
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private final String jndiName;
     private final Class serviceInterface;
     private final Class homeInterface;
 
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
     public SessionBeanProvider( String jndiName, Class serviceInterface, Class homeInterface
)
     {
         this.jndiName = jndiName;
@@ -44,6 +52,10 @@
         this.homeInterface = homeInterface;
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// ObjectProvider Implementation
+//----------------------------------------------------------------------------------------------------------------------
+
     public Object getObject()
     {
         try
@@ -74,3 +86,4 @@
         }
     }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SingletonProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SingletonProvider.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SingletonProvider.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SingletonProvider.java
Sun Sep  4 07:12:22 2005
@@ -27,13 +27,25 @@
  */
 public class SingletonProvider extends ProviderDecorator
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private Object instance;
 
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
     public SingletonProvider( ObjectProvider inner )
     {
         super( inner );
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// ObjectProvider Implementation
+//----------------------------------------------------------------------------------------------------------------------
+
     public Object getObject()
     {
         synchronized( this )
@@ -47,3 +59,4 @@
         return instance;
     }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SynchronizedProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SynchronizedProvider.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SynchronizedProvider.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SynchronizedProvider.java
Sun Sep  4 07:12:22 2005
@@ -26,20 +26,32 @@
  */
 public class SynchronizedProvider extends ProviderDecorator
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private final Object monitor;
 
-    public SynchronizedProvider( ObjectProvider inner, Object monitor )
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
+    public SynchronizedProvider( ObjectProvider inner )
     {
         super( inner );
-        this.monitor = monitor;
+        monitor = this;
     }
 
-    public SynchronizedProvider( ObjectProvider inner )
+    public SynchronizedProvider( ObjectProvider inner, Object monitor )
     {
         super( inner );
-        monitor = this;
+        this.monitor = monitor;
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// ObjectProvider Implementation
+//----------------------------------------------------------------------------------------------------------------------
+
     public Object getObject()
     {
         synchronized( monitor )
@@ -48,3 +60,4 @@
         }
     }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/AbstractCache.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/AbstractCache.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/AbstractCache.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/AbstractCache.java
Sun Sep  4 07:12:22 2005
@@ -25,23 +25,15 @@
  */
 public abstract class AbstractCache implements Cache
 {
-    protected abstract Map<Object, CachedObject> getCachedObjectMap();
-
-    public void storeObject( Object key, Object value )
-    {
-        getCachedObjectMap().put( key, new CachedObject( value ) );
-    }
+//----------------------------------------------------------------------------------------------------------------------
+// Abstract Methods
+//----------------------------------------------------------------------------------------------------------------------
 
-    public void storeObject( Object key, Object value, CacheEvictionListener listener )
-    {
-        getCachedObjectMap().put( key, new CachedObject( value, listener ) );
-    }
+    protected abstract Map<Object, CachedObject> getCachedObjectMap();
 
-    public Object retrieveObject( Object key )
-    {
-        CachedObject cachedObject = getCachedObjectMap().get( key );
-        return cachedObject == null ? null : cachedObject.getObject();
-    }
+//----------------------------------------------------------------------------------------------------------------------
+// Cache Implementation
+//----------------------------------------------------------------------------------------------------------------------
 
     public void clearCache()
     {
@@ -54,9 +46,23 @@
                 cachedObject.getListener()
                         .objectEvicted( new CacheEvictionEvent( cacheKey, cachedObject.getObject()
) );
             }
-
         }
     }
 
+    public Object retrieveObject( Object key )
+    {
+        CachedObject cachedObject = getCachedObjectMap().get( key );
+        return cachedObject == null ? null : cachedObject.getObject();
+    }
+
+    public void storeObject( Object key, Object value )
+    {
+        getCachedObjectMap().put( key, new CachedObject( value ) );
+    }
 
+    public void storeObject( Object key, Object value, CacheEvictionListener listener )
+    {
+        getCachedObjectMap().put( key, new CachedObject( value, listener ) );
+    }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/Cache.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/Cache.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/Cache.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/Cache.java
Sun Sep  4 07:12:22 2005
@@ -22,11 +22,15 @@
  */
 public interface Cache
 {
-    public void storeObject( Object key, Object value );
+//----------------------------------------------------------------------------------------------------------------------
+// Other Methods
+//----------------------------------------------------------------------------------------------------------------------
 
-    public void storeObject( Object key, Object value, CacheEvictionListener listener );
+    public void clearCache();
 
     public Object retrieveObject( Object key );
+    public void storeObject( Object key, Object value );
 
-    public void clearCache();
+    public void storeObject( Object key, Object value, CacheEvictionListener listener );
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionEvent.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionEvent.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionEvent.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionEvent.java
Sun Sep  4 07:12:22 2005
@@ -24,9 +24,17 @@
  */
 public class CacheEvictionEvent extends EventObject
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private final Object cacheKey;
     private final Object evictedObject;
 
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
     public CacheEvictionEvent( Object cacheKey, Object evictedObject )
     {
         super( evictedObject );
@@ -34,6 +42,10 @@
         this.evictedObject = evictedObject;
     }
 
+//----------------------------------------------------------------------------------------------------------------------
+// Getter/Setter Methods
+//----------------------------------------------------------------------------------------------------------------------
+
     public Object getCacheKey()
     {
         return cacheKey;
@@ -43,6 +55,5 @@
     {
         return evictedObject;
     }
-
-
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionListener.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionListener.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionListener.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionListener.java
Sun Sep  4 07:12:22 2005
@@ -24,5 +24,10 @@
  */
 public interface CacheEvictionListener extends EventListener
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Other Methods
+//----------------------------------------------------------------------------------------------------------------------
+
     public void objectEvicted( CacheEvictionEvent e );
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CachedObject.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CachedObject.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CachedObject.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CachedObject.java
Sun Sep  4 07:12:22 2005
@@ -22,9 +22,17 @@
  */
 public class CachedObject
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private final Object object;
     private final CacheEvictionListener listener;
 
+//----------------------------------------------------------------------------------------------------------------------
+// Constructors
+//----------------------------------------------------------------------------------------------------------------------
+
     public CachedObject( Object object )
     {
         this.object = object;
@@ -37,13 +45,18 @@
         this.listener = listener;
     }
 
-    public Object getObject()
-    {
-        return object;
-    }
+//----------------------------------------------------------------------------------------------------------------------
+// Getter/Setter Methods
+//----------------------------------------------------------------------------------------------------------------------
 
     public CacheEvictionListener getListener()
     {
         return listener;
     }
+
+    public Object getObject()
+    {
+        return object;
+    }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/SimpleCache.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/SimpleCache.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/SimpleCache.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/SimpleCache.java
Sun Sep  4 07:12:22 2005
@@ -26,10 +26,19 @@
  */
 public class SimpleCache extends AbstractCache
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private final Map<Object, CachedObject> map = Collections.synchronizedMap( new
HashMap<Object, CachedObject>() );
 
+//----------------------------------------------------------------------------------------------------------------------
+// Other Methods
+//----------------------------------------------------------------------------------------------------------------------
+
     protected Map<Object, CachedObject> getCachedObjectMap()
     {
         return map;
     }
 }
+

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/ThreadLocalCache.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/ThreadLocalCache.java?rev=278595&r1=278594&r2=278595&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/ThreadLocalCache.java
(original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/ThreadLocalCache.java
Sun Sep  4 07:12:22 2005
@@ -25,8 +25,16 @@
  */
 public class ThreadLocalCache extends AbstractCache
 {
+//----------------------------------------------------------------------------------------------------------------------
+// Fields
+//----------------------------------------------------------------------------------------------------------------------
+
     private ThreadLocal<Map<Object, CachedObject>> threadLocalMap = new ThreadLocal<Map<Object,
CachedObject>>();
 
+//----------------------------------------------------------------------------------------------------------------------
+// Other Methods
+//----------------------------------------------------------------------------------------------------------------------
+
     public Map<Object, CachedObject> getCachedObjectMap()
     {
         Map<Object, CachedObject> map = threadLocalMap.get();
@@ -38,3 +46,4 @@
         return map;
     }
 }
+



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message