You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jc...@apache.org on 2005/08/27 05:52:30 UTC
svn commit: r240386 [4/5] - in /jakarta/commons/sandbox/proxy/trunk: ./
src/java/org/apache/commons/proxy/
src/java/org/apache/commons/proxy/exception/
src/java/org/apache/commons/proxy/factory/
src/java/org/apache/commons/proxy/factory/cglib/ src/java...
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/HessianProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/HessianProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/HessianProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/HessianProvider.java Fri Aug 26 20:51:56 2005
@@ -1,51 +1,51 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import com.caucho.hessian.client.HessianProxyFactory;
-import org.apache.commons.proxy.exception.ObjectProviderException;
-
-import java.net.MalformedURLException;
-
-/**
- * Provides a hessian service object.
- *
- * @author James Carman
- * @version 1.0
- */
-public class HessianProvider<T> extends AbstractObjectProvider<T>
-{
- private final Class<T> serviceInterface;
- private final String url;
-
- public HessianProvider( Class<T> serviceInterface, String url )
- {
- this.serviceInterface = serviceInterface;
- this.url = url;
- }
-
- public T getObject()
- {
- try
- {
- return serviceInterface.cast( new HessianProxyFactory().create( serviceInterface, url ) );
- }
- catch( MalformedURLException e )
- {
- throw new ObjectProviderException( "Invalid url given.", e );
- }
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import com.caucho.hessian.client.HessianProxyFactory;
+import org.apache.commons.proxy.exception.ObjectProviderException;
+
+import java.net.MalformedURLException;
+
+/**
+ * Provides a hessian service object.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class HessianProvider<T> extends AbstractObjectProvider<T>
+{
+ private final Class<T> serviceInterface;
+ private final String url;
+
+ public HessianProvider( Class<T> serviceInterface, String url )
+ {
+ this.serviceInterface = serviceInterface;
+ this.url = url;
+ }
+
+ public T getObject()
+ {
+ try
+ {
+ return serviceInterface.cast( new HessianProxyFactory().create( serviceInterface, url ) );
+ }
+ catch( MalformedURLException e )
+ {
+ throw new ObjectProviderException( "Invalid url given.", e );
+ }
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/HessianProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/JaxRpcProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/JaxRpcProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/JaxRpcProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/JaxRpcProvider.java Fri Aug 26 20:51:56 2005
@@ -1,128 +1,128 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.exception.ObjectProviderException;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.Service;
-import javax.xml.rpc.ServiceException;
-import javax.xml.rpc.ServiceFactory;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * Returns a proxy for a JAX-RPC-based service.
- *
- * @author James Carman
- * @version 1.0
- */
-public class JaxRpcProvider<T> extends AbstractObjectProvider<T>
-{
- private final Class<? extends T> serviceInterface;
- private String wsdlUrl;
- private String serviceNamespaceUri;
- private String serviceLocalPart;
- private String servicePrefix;
- private String portNamespaceUri;
- private String portLocalPart;
- private String portPrefix;
-
- public JaxRpcProvider( Class<? extends T> serviceInterface )
- {
- this.serviceInterface = serviceInterface;
- }
-
- public T getObject()
- {
- try
- {
- final Service service = ( wsdlUrl == null ? ServiceFactory.newInstance().createService( getServiceQName() ) : ServiceFactory.newInstance().createService( new URL( wsdlUrl ), getServiceQName() ) );
- final QName portQName = getPortQName();
- return serviceInterface.cast( portQName == null ? service.getPort( serviceInterface ) : service.getPort( portQName, serviceInterface ) );
- }
- catch( ServiceException e )
- {
- throw new ObjectProviderException( "Unable to create JAX-RPC service proxy.", e );
- }
- catch( MalformedURLException e )
- {
- throw new ObjectProviderException( "Invalid URL given.", e );
- }
- }
-
- private QName getQName( String namespaceUri, String localPart, String prefix )
- {
- if( namespaceUri != null && localPart != null && prefix != null )
- {
- return new QName( namespaceUri, localPart, prefix );
- }
- else if( namespaceUri != null && localPart != null )
- {
- return new QName( namespaceUri, localPart );
- }
- else if( localPart != null )
- {
- return new QName( localPart );
- }
- return null;
- }
-
- private QName getServiceQName()
- {
- return getQName( serviceNamespaceUri, serviceLocalPart, servicePrefix );
- }
-
- private QName getPortQName()
- {
- return getQName( portNamespaceUri, portLocalPart, portPrefix );
- }
-
- public void setPortNamespaceUri( String portNamespaceUri )
- {
- this.portNamespaceUri = portNamespaceUri;
- }
-
- public void setPortLocalPart( String portLocalPart )
- {
- this.portLocalPart = portLocalPart;
- }
-
- public void setPortPrefix( String portPrefix )
- {
- this.portPrefix = portPrefix;
- }
-
- public void setServiceNamespaceUri( String serviceNamespaceUri )
- {
- this.serviceNamespaceUri = serviceNamespaceUri;
- }
-
- public void setServiceLocalPart( String serviceLocalPart )
- {
- this.serviceLocalPart = serviceLocalPart;
- }
-
- public void setServicePrefix( String servicePrefix )
- {
- this.servicePrefix = servicePrefix;
- }
-
- public void setWsdlUrl( String wsdlUrl )
- {
- this.wsdlUrl = wsdlUrl;
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.exception.ObjectProviderException;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.ServiceFactory;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Returns a proxy for a JAX-RPC-based service.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class JaxRpcProvider<T> extends AbstractObjectProvider<T>
+{
+ private final Class<? extends T> serviceInterface;
+ private String wsdlUrl;
+ private String serviceNamespaceUri;
+ private String serviceLocalPart;
+ private String servicePrefix;
+ private String portNamespaceUri;
+ private String portLocalPart;
+ private String portPrefix;
+
+ public JaxRpcProvider( Class<? extends T> serviceInterface )
+ {
+ this.serviceInterface = serviceInterface;
+ }
+
+ public T getObject()
+ {
+ try
+ {
+ final Service service = ( wsdlUrl == null ? ServiceFactory.newInstance().createService( getServiceQName() ) : ServiceFactory.newInstance().createService( new URL( wsdlUrl ), getServiceQName() ) );
+ final QName portQName = getPortQName();
+ return serviceInterface.cast( portQName == null ? service.getPort( serviceInterface ) : service.getPort( portQName, serviceInterface ) );
+ }
+ catch( ServiceException e )
+ {
+ throw new ObjectProviderException( "Unable to create JAX-RPC service proxy.", e );
+ }
+ catch( MalformedURLException e )
+ {
+ throw new ObjectProviderException( "Invalid URL given.", e );
+ }
+ }
+
+ private QName getQName( String namespaceUri, String localPart, String prefix )
+ {
+ if( namespaceUri != null && localPart != null && prefix != null )
+ {
+ return new QName( namespaceUri, localPart, prefix );
+ }
+ else if( namespaceUri != null && localPart != null )
+ {
+ return new QName( namespaceUri, localPart );
+ }
+ else if( localPart != null )
+ {
+ return new QName( localPart );
+ }
+ return null;
+ }
+
+ private QName getServiceQName()
+ {
+ return getQName( serviceNamespaceUri, serviceLocalPart, servicePrefix );
+ }
+
+ private QName getPortQName()
+ {
+ return getQName( portNamespaceUri, portLocalPart, portPrefix );
+ }
+
+ public void setPortNamespaceUri( String portNamespaceUri )
+ {
+ this.portNamespaceUri = portNamespaceUri;
+ }
+
+ public void setPortLocalPart( String portLocalPart )
+ {
+ this.portLocalPart = portLocalPart;
+ }
+
+ public void setPortPrefix( String portPrefix )
+ {
+ this.portPrefix = portPrefix;
+ }
+
+ public void setServiceNamespaceUri( String serviceNamespaceUri )
+ {
+ this.serviceNamespaceUri = serviceNamespaceUri;
+ }
+
+ public void setServiceLocalPart( String serviceLocalPart )
+ {
+ this.serviceLocalPart = serviceLocalPart;
+ }
+
+ public void setServicePrefix( String servicePrefix )
+ {
+ this.servicePrefix = servicePrefix;
+ }
+
+ public void setWsdlUrl( String wsdlUrl )
+ {
+ this.wsdlUrl = wsdlUrl;
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/JaxRpcProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/NullProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/NullProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/NullProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/NullProvider.java Fri Aug 26 20:51:56 2005
@@ -1,30 +1,30 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-/**
- * Always returns null.
- *
- * @author James Carman
- * @version 1.0
- */
-public class NullProvider<T> extends ConstantProvider<T>
-{
- public NullProvider()
- {
- super( null );
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+/**
+ * Always returns null.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class NullProvider<T> extends ConstantProvider<T>
+{
+ public NullProvider()
+ {
+ super( null );
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/NullProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/PooledProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/PooledProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/PooledProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/PooledProvider.java Fri Aug 26 20:51:56 2005
@@ -1,143 +1,143 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import org.apache.commons.pool.BasePoolableObjectFactory;
-import org.apache.commons.pool.impl.GenericObjectPool;
-import org.apache.commons.proxy.ObjectProvider;
-import org.apache.commons.proxy.exception.ObjectProviderException;
-import org.apache.commons.proxy.provider.cache.Cache;
-import org.apache.commons.proxy.provider.cache.CacheEvictionEvent;
-import org.apache.commons.proxy.provider.cache.CacheEvictionListener;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class PooledProvider<T> extends ProviderDecorator<T> implements CacheEvictionListener
-{
- private final Object cacheKey = new Object();
- private final GenericObjectPool pool;
- private Cache cache;
-
- public PooledProvider( ObjectProvider<? extends T> inner )
- {
- super( inner );
- pool = new GenericObjectPool( new Factory() );
- }
-
- public void setCache( Cache cache )
- {
- this.cache = cache;
- }
-
- public void objectEvicted( CacheEvictionEvent e )
- {
- try
- {
- log.debug( "Returning object to pool in thread " + Thread.currentThread().getName() + "..." );
- pool.returnObject( e.getEvictedObject() );
- }
- catch( Exception e1 )
- {
- // Do nothing.
- }
- }
-
- public T getObject()
- {
- try
- {
- log.debug( "Checking for object in cache in thread " + Thread.currentThread().getName() + "..." );
- T object = ( T ) cache.retrieveObject( cacheKey );
- if( object == null )
- {
- log.debug( "Did not object in cache; borrowing from pool in thread " + Thread.currentThread().getName() + "..." );
- object = ( T ) pool.borrowObject();
- cache.storeObject( cacheKey, object, this );
- }
- return object;
- }
- catch( Exception e )
- {
- throw new ObjectProviderException( "Unable to borrow object from pool.", e );
- }
- }
-
- public void setMaxActive( int i )
- {
- pool.setMaxActive( i );
- }
-
- public void setWhenExhaustedAction( byte b )
- {
- pool.setWhenExhaustedAction( b );
- }
-
- public void setMaxWait( long l )
- {
- pool.setMaxWait( l );
- }
-
- public void setMaxIdle( int i )
- {
- pool.setMaxIdle( i );
- }
-
- public void setTestOnReturn( boolean b )
- {
- pool.setTestOnReturn( b );
- }
-
- public void setTestOnBorrow( boolean b )
- {
- pool.setTestOnBorrow( b );
- }
-
- public void setMinIdle( int i )
- {
- pool.setMinIdle( i );
- }
-
- public void setTimeBetweenEvictionRunsMillis( long l )
- {
- pool.setTimeBetweenEvictionRunsMillis( l );
- }
-
- public void setNumTestsPerEvictionRun( int i )
- {
- pool.setNumTestsPerEvictionRun( i );
- }
-
- public void setMinEvictableIdleTimeMillis( long l )
- {
- pool.setMinEvictableIdleTimeMillis( l );
- }
-
- public void setTestWhileIdle( boolean b )
- {
- pool.setTestWhileIdle( b );
- }
-
- private class Factory extends BasePoolableObjectFactory
- {
- public T makeObject() throws Exception
- {
- log.debug( "Creating new object for pool in thread " + Thread.currentThread().getName() + "..." );
- return inner.getObject();
- }
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import org.apache.commons.pool.BasePoolableObjectFactory;
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.commons.proxy.ObjectProvider;
+import org.apache.commons.proxy.exception.ObjectProviderException;
+import org.apache.commons.proxy.provider.cache.Cache;
+import org.apache.commons.proxy.provider.cache.CacheEvictionEvent;
+import org.apache.commons.proxy.provider.cache.CacheEvictionListener;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class PooledProvider<T> extends ProviderDecorator<T> implements CacheEvictionListener
+{
+ private final Object cacheKey = new Object();
+ private final GenericObjectPool pool;
+ private Cache cache;
+
+ public PooledProvider( ObjectProvider<? extends T> inner )
+ {
+ super( inner );
+ pool = new GenericObjectPool( new Factory() );
+ }
+
+ public void setCache( Cache cache )
+ {
+ this.cache = cache;
+ }
+
+ public void objectEvicted( CacheEvictionEvent e )
+ {
+ try
+ {
+ log.debug( "Returning object to pool in thread " + Thread.currentThread().getName() + "..." );
+ pool.returnObject( e.getEvictedObject() );
+ }
+ catch( Exception e1 )
+ {
+ // Do nothing.
+ }
+ }
+
+ public T getObject()
+ {
+ try
+ {
+ log.debug( "Checking for object in cache in thread " + Thread.currentThread().getName() + "..." );
+ T object = ( T ) cache.retrieveObject( cacheKey );
+ if( object == null )
+ {
+ log.debug( "Did not object in cache; borrowing from pool in thread " + Thread.currentThread().getName() + "..." );
+ object = ( T ) pool.borrowObject();
+ cache.storeObject( cacheKey, object, this );
+ }
+ return object;
+ }
+ catch( Exception e )
+ {
+ throw new ObjectProviderException( "Unable to borrow object from pool.", e );
+ }
+ }
+
+ public void setMaxActive( int i )
+ {
+ pool.setMaxActive( i );
+ }
+
+ public void setWhenExhaustedAction( byte b )
+ {
+ pool.setWhenExhaustedAction( b );
+ }
+
+ public void setMaxWait( long l )
+ {
+ pool.setMaxWait( l );
+ }
+
+ public void setMaxIdle( int i )
+ {
+ pool.setMaxIdle( i );
+ }
+
+ public void setTestOnReturn( boolean b )
+ {
+ pool.setTestOnReturn( b );
+ }
+
+ public void setTestOnBorrow( boolean b )
+ {
+ pool.setTestOnBorrow( b );
+ }
+
+ public void setMinIdle( int i )
+ {
+ pool.setMinIdle( i );
+ }
+
+ public void setTimeBetweenEvictionRunsMillis( long l )
+ {
+ pool.setTimeBetweenEvictionRunsMillis( l );
+ }
+
+ public void setNumTestsPerEvictionRun( int i )
+ {
+ pool.setNumTestsPerEvictionRun( i );
+ }
+
+ public void setMinEvictableIdleTimeMillis( long l )
+ {
+ pool.setMinEvictableIdleTimeMillis( l );
+ }
+
+ public void setTestWhileIdle( boolean b )
+ {
+ pool.setTestWhileIdle( b );
+ }
+
+ private class Factory extends BasePoolableObjectFactory
+ {
+ public T makeObject() throws Exception
+ {
+ log.debug( "Creating new object for pool in thread " + Thread.currentThread().getName() + "..." );
+ return inner.getObject();
+ }
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/PooledProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,37 +1,37 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.ObjectProvider;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class ProviderDecorator<T> extends AbstractObjectProvider<T>
-{
- protected ObjectProvider<? extends T> inner;
-
- public ProviderDecorator( ObjectProvider<? extends T> inner )
- {
- this.inner = inner;
- }
-
- public T getObject()
- {
- return inner.getObject();
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.ObjectProvider;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class ProviderDecorator<T> extends AbstractObjectProvider<T>
+{
+ protected ObjectProvider<? extends T> inner;
+
+ public ProviderDecorator( ObjectProvider<? extends T> inner )
+ {
+ this.inner = inner;
+ }
+
+ public T getObject()
+ {
+ return inner.getObject();
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderDecorator.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,45 +1,45 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.ObjectProvider;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class ProviderUtils
-{
- public static <T> ObjectProvider<T> constantProvider( T value )
- {
- return new ConstantProvider<T>( value );
- }
-
- public static <T> ObjectProvider<T> beanProvider( Class<T> beanClass )
- {
- return new BeanProvider<T>( beanClass );
- }
-
- public static <T> ObjectProvider<T> singletonProvider( ObjectProvider<T> inner )
- {
- return new SingletonProvider<T>( inner );
- }
-
- public static <T> ObjectProvider<T> synchronizedProvider( ObjectProvider<T> inner )
- {
- return new SynchronizedProvider<T>( inner );
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.ObjectProvider;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class ProviderUtils
+{
+ public static <T> ObjectProvider<T> constantProvider( T value )
+ {
+ return new ConstantProvider<T>( value );
+ }
+
+ public static <T> ObjectProvider<T> beanProvider( Class<T> beanClass )
+ {
+ return new BeanProvider<T>( beanClass );
+ }
+
+ public static <T> ObjectProvider<T> singletonProvider( ObjectProvider<T> inner )
+ {
+ return new SingletonProvider<T>( inner );
+ }
+
+ public static <T> ObjectProvider<T> synchronizedProvider( ObjectProvider<T> inner )
+ {
+ return new SynchronizedProvider<T>( inner );
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ProviderUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,129 +1,129 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.exception.ObjectProviderException;
-
-import java.rmi.AccessException;
-import java.rmi.NotBoundException;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.rmi.server.RMIClientSocketFactory;
-
-/**
- * Provides an object by looking it up in an RMI registry.
- *
- * @author James Carman
- * @version 1.0
- */
-public class RmiProvider<T> extends AbstractObjectProvider<T>
-{
- private String host = "localhost";
- private int port = Registry.REGISTRY_PORT;
- private RMIClientSocketFactory clientSocketFactory;
- private final String name;
- private final Class<T> serviceInterface;
-
- public RmiProvider( String name, Class<T> serviceInterface )
- {
- this.name = name;
- this.serviceInterface = serviceInterface;
- }
-
- public RmiProvider( String host, String name, Class<T> serviceInterface )
- {
- this.host = host;
- this.name = name;
- this.serviceInterface = serviceInterface;
- }
-
- public RmiProvider( String host, int port, String name, Class<T> serviceInterface )
- {
- this.host = host;
- this.name = name;
- this.serviceInterface = serviceInterface;
- this.port = port;
- }
-
- public RmiProvider( String host, int port, RMIClientSocketFactory clientSocketFactory, String name, Class<T> serviceInterface )
- {
- this.host = host;
- this.port = port;
- this.clientSocketFactory = clientSocketFactory;
- this.name = name;
- this.serviceInterface = serviceInterface;
- }
-
- public T getObject()
- {
- Registry reg = null;
- try
- {
- reg = getRegistry();
- return serviceInterface.cast( reg.lookup( name ) );
- }
- catch( NotBoundException e )
- {
- throw new ObjectProviderException( "Name " + name + " not found in registry at " + host + ":" + port + ".", e );
- }
- catch( AccessException e )
- {
- throw new ObjectProviderException( "Registry at " + host + ":" + port + " did not allow lookup.", e );
- }
- catch( RemoteException e )
- {
- throw new ObjectProviderException( "Unable to lookup service named " + name + " in registry at " + host + ":" + port + "." );
- }
-
- }
-
- private Registry getRegistry()
- {
- try
- {
- if( clientSocketFactory != null )
- {
- log.debug( "Looking up RMI registry at " + host + ":" + port + " using specified client socket factory..." );
- return LocateRegistry.getRegistry( host, port, clientSocketFactory );
- }
- else
- {
- log.debug( "Looking up RMI registry at " + host + ":" + port + "..." );
- return LocateRegistry.getRegistry( host, port );
- }
- }
- catch( RemoteException e )
- {
- 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;
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.exception.ObjectProviderException;
+
+import java.rmi.AccessException;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.RMIClientSocketFactory;
+
+/**
+ * Provides an object by looking it up in an RMI registry.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class RmiProvider<T> extends AbstractObjectProvider<T>
+{
+ private String host = "localhost";
+ private int port = Registry.REGISTRY_PORT;
+ private RMIClientSocketFactory clientSocketFactory;
+ private final String name;
+ private final Class<T> serviceInterface;
+
+ public RmiProvider( String name, Class<T> serviceInterface )
+ {
+ this.name = name;
+ this.serviceInterface = serviceInterface;
+ }
+
+ public RmiProvider( String host, String name, Class<T> serviceInterface )
+ {
+ this.host = host;
+ this.name = name;
+ this.serviceInterface = serviceInterface;
+ }
+
+ public RmiProvider( String host, int port, String name, Class<T> serviceInterface )
+ {
+ this.host = host;
+ this.name = name;
+ this.serviceInterface = serviceInterface;
+ this.port = port;
+ }
+
+ public RmiProvider( String host, int port, RMIClientSocketFactory clientSocketFactory, String name, Class<T> serviceInterface )
+ {
+ this.host = host;
+ this.port = port;
+ this.clientSocketFactory = clientSocketFactory;
+ this.name = name;
+ this.serviceInterface = serviceInterface;
+ }
+
+ public T getObject()
+ {
+ Registry reg = null;
+ try
+ {
+ reg = getRegistry();
+ return serviceInterface.cast( reg.lookup( name ) );
+ }
+ catch( NotBoundException e )
+ {
+ throw new ObjectProviderException( "Name " + name + " not found in registry at " + host + ":" + port + ".", e );
+ }
+ catch( AccessException e )
+ {
+ throw new ObjectProviderException( "Registry at " + host + ":" + port + " did not allow lookup.", e );
+ }
+ catch( RemoteException e )
+ {
+ throw new ObjectProviderException( "Unable to lookup service named " + name + " in registry at " + host + ":" + port + "." );
+ }
+
+ }
+
+ private Registry getRegistry()
+ {
+ try
+ {
+ if( clientSocketFactory != null )
+ {
+ log.debug( "Looking up RMI registry at " + host + ":" + port + " using specified client socket factory..." );
+ return LocateRegistry.getRegistry( host, port, clientSocketFactory );
+ }
+ else
+ {
+ log.debug( "Looking up RMI registry at " + host + ":" + port + "..." );
+ return LocateRegistry.getRegistry( host, port );
+ }
+ }
+ catch( RemoteException e )
+ {
+ 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;
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/RmiProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,57 +1,57 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.ObjectProvider;
-
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-/**
- * Wraps another object provider, making sure to only call it once, returning the value
- * returned from the wrapped provider on all subsequent invocations.
- *
- * @author James Carman
- * @version 1.0
- */
-public class SingletonProvider<T> extends ProviderDecorator<T>
-{
- private T instance;
- private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
-
- public SingletonProvider( ObjectProvider<? extends T> inner )
- {
- super( inner );
- }
-
- public T getObject()
- {
- rwl.readLock().lock();
- if( instance == null )
- {
- rwl.readLock().unlock();
- rwl.writeLock().lock();
- if( instance == null )
- {
- instance = super.getObject();
- inner = null; // Garbage collection
- }
- rwl.readLock().lock();
- rwl.writeLock().unlock();
- }
- rwl.readLock().unlock();
- return instance;
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.ObjectProvider;
+
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Wraps another object provider, making sure to only call it once, returning the value
+ * returned from the wrapped provider on all subsequent invocations.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class SingletonProvider<T> extends ProviderDecorator<T>
+{
+ private T instance;
+ private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
+
+ public SingletonProvider( ObjectProvider<? extends T> inner )
+ {
+ super( inner );
+ }
+
+ public T getObject()
+ {
+ rwl.readLock().lock();
+ if( instance == null )
+ {
+ rwl.readLock().unlock();
+ rwl.writeLock().lock();
+ if( instance == null )
+ {
+ instance = super.getObject();
+ inner = null; // Garbage collection
+ }
+ rwl.readLock().lock();
+ rwl.writeLock().unlock();
+ }
+ rwl.readLock().unlock();
+ return instance;
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SingletonProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,48 +1,48 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.ObjectProvider;
-
-/**
- * Wraps another object provider, making it synchronized.
- * @author James Carman
- * @version 1.0
- */
-public class SynchronizedProvider<T> extends ProviderDecorator<T>
-{
- private final Object monitor;
-
- public SynchronizedProvider( ObjectProvider<T> inner, Object monitor )
- {
- super( inner );
- this.monitor = monitor;
- }
-
- public SynchronizedProvider( ObjectProvider<T> inner )
- {
- super( inner );
- monitor = this;
- }
-
- public T getObject()
- {
- synchronized( monitor )
- {
- return super.getObject();
- }
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.ObjectProvider;
+
+/**
+ * Wraps another object provider, making it synchronized.
+ * @author James Carman
+ * @version 1.0
+ */
+public class SynchronizedProvider<T> extends ProviderDecorator<T>
+{
+ private final Object monitor;
+
+ public SynchronizedProvider( ObjectProvider<T> inner, Object monitor )
+ {
+ super( inner );
+ this.monitor = monitor;
+ }
+
+ public SynchronizedProvider( ObjectProvider<T> inner )
+ {
+ super( inner );
+ monitor = this;
+ }
+
+ public T getObject()
+ {
+ synchronized( monitor )
+ {
+ return super.getObject();
+ }
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/SynchronizedProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,62 +1,62 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider.cache;
-
-import java.util.LinkedList;
-import java.util.Map;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-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 ) );
- }
-
- public void storeObject( Object key, Object value, CacheEvictionListener listener )
- {
- getCachedObjectMap().put( key, new CachedObject( value, listener ) );
- }
-
- public Object retrieveObject( Object key )
- {
- CachedObject cachedObject = getCachedObjectMap().get( key );
- return cachedObject == null ? null : cachedObject.getObject();
- }
-
- public void clearCache()
- {
- for( Object cacheKey: new LinkedList<Object>( getCachedObjectMap().keySet() ) )
- {
- final CachedObject cachedObject = getCachedObjectMap().get( cacheKey );
- if( cachedObject != null )
- {
- getCachedObjectMap().remove( cacheKey );
- if( cachedObject.getListener() != null )
- {
- cachedObject.getListener().objectEvicted( new CacheEvictionEvent( cacheKey, cachedObject.getObject() ) );
- }
- }
- }
- }
-
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider.cache;
+
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+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 ) );
+ }
+
+ public void storeObject( Object key, Object value, CacheEvictionListener listener )
+ {
+ getCachedObjectMap().put( key, new CachedObject( value, listener ) );
+ }
+
+ public Object retrieveObject( Object key )
+ {
+ CachedObject cachedObject = getCachedObjectMap().get( key );
+ return cachedObject == null ? null : cachedObject.getObject();
+ }
+
+ public void clearCache()
+ {
+ for( Object cacheKey: new LinkedList<Object>( getCachedObjectMap().keySet() ) )
+ {
+ final CachedObject cachedObject = getCachedObjectMap().get( cacheKey );
+ if( cachedObject != null )
+ {
+ getCachedObjectMap().remove( cacheKey );
+ if( cachedObject.getListener() != null )
+ {
+ cachedObject.getListener().objectEvicted( new CacheEvictionEvent( cacheKey, cachedObject.getObject() ) );
+ }
+ }
+ }
+ }
+
+
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/AbstractCache.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,28 +1,28 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider.cache;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public interface Cache
-{
- public void storeObject( Object key, Object value );
- public void storeObject( Object key, Object value, CacheEvictionListener listener );
- public Object retrieveObject( Object key );
- public void clearCache();
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider.cache;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public interface Cache
+{
+ public void storeObject( Object key, Object value );
+ public void storeObject( Object key, Object value, CacheEvictionListener listener );
+ public Object retrieveObject( Object key );
+ public void clearCache();
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/Cache.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,47 +1,47 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider.cache;
-
-import java.util.EventObject;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class CacheEvictionEvent extends EventObject
-{
- private final Object cacheKey;
- private final Object evictedObject;
-
- public CacheEvictionEvent( Object cacheKey, Object evictedObject )
- {
- super( evictedObject );
- this.cacheKey = cacheKey;
- this.evictedObject = evictedObject;
- }
-
- public Object getCacheKey()
- {
- return cacheKey;
- }
-
- public Object getEvictedObject()
- {
- return evictedObject;
- }
-
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider.cache;
+
+import java.util.EventObject;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class CacheEvictionEvent extends EventObject
+{
+ private final Object cacheKey;
+ private final Object evictedObject;
+
+ public CacheEvictionEvent( Object cacheKey, Object evictedObject )
+ {
+ super( evictedObject );
+ this.cacheKey = cacheKey;
+ this.evictedObject = evictedObject;
+ }
+
+ public Object getCacheKey()
+ {
+ return cacheKey;
+ }
+
+ public Object getEvictedObject()
+ {
+ return evictedObject;
+ }
+
+
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,27 +1,27 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider.cache;
-
-import java.util.EventListener;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public interface CacheEvictionListener extends EventListener
-{
- public void objectEvicted( CacheEvictionEvent e );
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider.cache;
+
+import java.util.EventListener;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public interface CacheEvictionListener extends EventListener
+{
+ public void objectEvicted( CacheEvictionEvent e );
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CacheEvictionListener.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,48 +1,48 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider.cache;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class CachedObject
-{
- private final Object object;
- private final CacheEvictionListener listener;
-
- public CachedObject( Object object )
- {
- this.object = object;
- this.listener = null;
- }
-
- public CachedObject( Object object, CacheEvictionListener listener )
- {
- this.object = object;
- this.listener = listener;
- }
-
- public Object getObject()
- {
- return object;
- }
-
- public CacheEvictionListener getListener()
- {
- return listener;
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider.cache;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class CachedObject
+{
+ private final Object object;
+ private final CacheEvictionListener listener;
+
+ public CachedObject( Object object )
+ {
+ this.object = object;
+ this.listener = null;
+ }
+
+ public CachedObject( Object object, CacheEvictionListener listener )
+ {
+ this.object = object;
+ this.listener = listener;
+ }
+
+ public Object getObject()
+ {
+ return object;
+ }
+
+ public CacheEvictionListener getListener()
+ {
+ return listener;
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/CachedObject.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,34 +1,34 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider.cache;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class SimpleCache extends AbstractCache
-{
- private final Map<Object, CachedObject> map = Collections.synchronizedMap( new HashMap<Object, CachedObject>() );
-
- protected Map<Object, CachedObject> getCachedObjectMap()
- {
- return map;
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider.cache;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class SimpleCache extends AbstractCache
+{
+ private final Map<Object, CachedObject> map = Collections.synchronizedMap( new HashMap<Object, CachedObject>() );
+
+ protected Map<Object, CachedObject> getCachedObjectMap()
+ {
+ return map;
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/SimpleCache.java
------------------------------------------------------------------------------
svn:eol-style = native
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=240386&r1=240385&r2=240386&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 Fri Aug 26 20:51:56 2005
@@ -1,39 +1,39 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.provider.cache;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class ThreadLocalCache extends AbstractCache
-{
- private ThreadLocal<Map<Object, CachedObject>> threadLocalMap = new ThreadLocal<Map<Object, CachedObject>>();
-
- public Map<Object, CachedObject> getCachedObjectMap()
- {
- Map<Object, CachedObject> map = threadLocalMap.get();
- if( map == null )
- {
- map = new HashMap<Object, CachedObject>();
- threadLocalMap.set( map );
- }
- return map;
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.provider.cache;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class ThreadLocalCache extends AbstractCache
+{
+ private ThreadLocal<Map<Object, CachedObject>> threadLocalMap = new ThreadLocal<Map<Object, CachedObject>>();
+
+ public Map<Object, CachedObject> getCachedObjectMap()
+ {
+ Map<Object, CachedObject> map = threadLocalMap.get();
+ if( map == null )
+ {
+ map = new HashMap<Object, CachedObject>();
+ threadLocalMap.set( map );
+ }
+ return map;
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/cache/ThreadLocalCache.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/log4j.properties
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/log4j.properties?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/log4j.properties (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/log4j.properties Fri Aug 26 20:51:56 2005
@@ -1,4 +1,4 @@
-log4j.rootLogger=DEBUG, console
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.rootLogger=DEBUG, console
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%c{1}) %3x - %m%n
Propchange: jakarta/commons/sandbox/proxy/trunk/src/test/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java Fri Aug 26 20:51:56 2005
@@ -1,53 +1,53 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.factory;
-
-import org.apache.commons.proxy.ProxyFactory;
-import org.apache.commons.proxy.provider.BeanProvider;
-import org.apache.commons.proxy.provider.SingletonProvider;
-import org.apache.commons.proxy.util.AbstractTestCase;
-import org.apache.commons.proxy.util.Echo;
-import org.apache.commons.proxy.util.EchoImpl;
-import org.apache.commons.proxy.util.SuffixMethodInterceptor;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public abstract class AbstractProxyFactoryTestCase extends AbstractTestCase
-{
- private final ProxyFactory factory;
-
- protected AbstractProxyFactoryTestCase( ProxyFactory factory )
- {
- this.factory = factory;
- }
-
- public void testCreateProxy()
- {
- final Echo echo = ( Echo )factory.createProxy( new SingletonProvider<Echo>( new BeanProvider<Echo>( EchoImpl.class ) ), Echo.class );
- echo.echo();
- assertEquals( "message", echo.echoBack( "message" ) );
- }
-
- public void testCreateInterceptorProxy()
- {
- final Echo target = ( Echo )factory.createProxy( new SingletonProvider<Echo>( new BeanProvider<Echo>( EchoImpl.class ) ), Echo.class );
- final Echo proxy = ( Echo )factory.createInterceptorProxy( target, new SuffixMethodInterceptor( " suffix" ), Echo.class );
- proxy.echo();
- assertEquals( "message suffix", proxy.echoBack( "message" ) );
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.factory;
+
+import org.apache.commons.proxy.ProxyFactory;
+import org.apache.commons.proxy.provider.BeanProvider;
+import org.apache.commons.proxy.provider.SingletonProvider;
+import org.apache.commons.proxy.util.AbstractTestCase;
+import org.apache.commons.proxy.util.Echo;
+import org.apache.commons.proxy.util.EchoImpl;
+import org.apache.commons.proxy.util.SuffixMethodInterceptor;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public abstract class AbstractProxyFactoryTestCase extends AbstractTestCase
+{
+ private final ProxyFactory factory;
+
+ protected AbstractProxyFactoryTestCase( ProxyFactory factory )
+ {
+ this.factory = factory;
+ }
+
+ public void testCreateProxy()
+ {
+ final Echo echo = ( Echo )factory.createProxy( new SingletonProvider<Echo>( new BeanProvider<Echo>( EchoImpl.class ) ), Echo.class );
+ echo.echo();
+ assertEquals( "message", echo.echoBack( "message" ) );
+ }
+
+ public void testCreateInterceptorProxy()
+ {
+ final Echo target = ( Echo )factory.createProxy( new SingletonProvider<Echo>( new BeanProvider<Echo>( EchoImpl.class ) ), Echo.class );
+ final Echo proxy = ( Echo )factory.createInterceptorProxy( target, new SuffixMethodInterceptor( " suffix" ), Echo.class );
+ proxy.echo();
+ assertEquals( "message suffix", proxy.echoBack( "message" ) );
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/AbstractProxyFactoryTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java Fri Aug 26 20:51:56 2005
@@ -1,30 +1,30 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.factory.cglib;
-
-import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class TestCglibProxyFactory extends AbstractProxyFactoryTestCase
-{
- public TestCglibProxyFactory()
- {
- super( new CglibProxyFactory() );
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.factory.cglib;
+
+import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class TestCglibProxyFactory extends AbstractProxyFactoryTestCase
+{
+ public TestCglibProxyFactory()
+ {
+ super( new CglibProxyFactory() );
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/cglib/TestCglibProxyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java Fri Aug 26 20:51:56 2005
@@ -1,30 +1,30 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.factory.javassist;
-
-import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class TestJavassistProxyFactory extends AbstractProxyFactoryTestCase
-{
- public TestJavassistProxyFactory()
- {
- super( new JavassistProxyFactory() );
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.factory.javassist;
+
+import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class TestJavassistProxyFactory extends AbstractProxyFactoryTestCase
+{
+ public TestJavassistProxyFactory()
+ {
+ super( new JavassistProxyFactory() );
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/javassist/TestJavassistProxyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestReflectionProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestReflectionProxyFactory.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestReflectionProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestReflectionProxyFactory.java Fri Aug 26 20:51:56 2005
@@ -1,30 +1,30 @@
-/*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed 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.commons.proxy.factory.reflect;
-
-import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class TestReflectionProxyFactory extends AbstractProxyFactoryTestCase
-{
- public TestReflectionProxyFactory()
- {
- super( new ReflectionProxyFactory() );
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed 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.commons.proxy.factory.reflect;
+
+import org.apache.commons.proxy.factory.AbstractProxyFactoryTestCase;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class TestReflectionProxyFactory extends AbstractProxyFactoryTestCase
+{
+ public TestReflectionProxyFactory()
+ {
+ super( new ReflectionProxyFactory() );
+ }
+}
Propchange: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/factory/reflect/TestReflectionProxyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org