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/30 18:09:09 UTC
svn commit: r264802 [2/2] - 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/BeanProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java Tue Aug 30 09:08:46 2005
@@ -1,21 +1,22 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.exception.DelegateProviderException;
/**
* Uses <code>Class.newInstance()</code> to instantiate an object.
@@ -23,16 +24,16 @@
* @author James Carman
* @version $Rev: 57 $
*/
-public class BeanProvider<T> extends AbstractObjectProvider<T>
+public class BeanProvider extends AbstractDelegateProvider
{
- private final Class<? extends T> beanClass;
+ private final Class beanClass;
- public BeanProvider( Class<? extends T> beanClass )
+ public BeanProvider( Class beanClass )
{
this.beanClass = beanClass;
}
- public T getObject()
+ public Object getDelegate()
{
try
{
@@ -40,11 +41,12 @@
}
catch( InstantiationException e )
{
- throw new ObjectProviderException( "Class " + beanClass.getName() + " is not concrete.", e );
+ throw new DelegateProviderException( "Class " + beanClass.getName() + " is not concrete.", e );
}
catch( IllegalAccessException e )
{
- throw new ObjectProviderException( "Constructor for class " + beanClass.getName() + " is not accessible.", e );
+ throw new DelegateProviderException( "Constructor for class " + beanClass.getName() + " is not accessible.",
+ e );
}
}
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java Tue Aug 30 09:08:46 2005
@@ -1,22 +1,23 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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.burlap.client.BurlapProxyFactory;
-import org.apache.commons.proxy.exception.ObjectProviderException;
+import org.apache.commons.proxy.exception.DelegateProviderException;
import java.net.MalformedURLException;
@@ -26,26 +27,26 @@
* @author James Carman
* @version 1.0
*/
-public class BurlapProvider<T> extends AbstractObjectProvider<T>
+public class BurlapProvider extends AbstractDelegateProvider
{
- private final Class<T> serviceInterface;
+ private final Class serviceInterface;
private final String url;
- public BurlapProvider( Class<T> serviceInterface, String url )
+ public BurlapProvider( Class serviceInterface, String url )
{
this.serviceInterface = serviceInterface;
this.url = url;
}
- public T getObject()
+ public Object getDelegate()
{
try
{
- return serviceInterface.cast( new BurlapProxyFactory().create( serviceInterface, url ) );
+ return new BurlapProxyFactory().create( serviceInterface, url );
}
catch( MalformedURLException e )
{
- throw new ObjectProviderException( "Invalid url given.", e );
+ throw new DelegateProviderException( "Invalid url given.", e );
}
}
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java Tue Aug 30 09:08:46 2005
@@ -1,34 +1,34 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.DelegateProvider;
import org.apache.commons.proxy.provider.cache.Cache;
/**
* @author James Carman
* @version 1.0
*/
-public class CachedProvider<T> extends ProviderDecorator<T>
+public class CachedProvider<T> extends ProviderDecorator
{
private final Object cacheKey = new Object();
-
private Cache cache;
- public CachedProvider( ObjectProvider<? extends T> inner )
+ public CachedProvider( DelegateProvider inner )
{
super( inner );
}
@@ -38,12 +38,12 @@
this.cache = cache;
}
- public T getObject()
+ public Object getDelegate()
{
- T object = ( T )cache.retrieveObject( cacheKey );
+ Object object = cache.retrieveObject( cacheKey );
if( object == null )
{
- object = super.getObject();
+ object = super.getDelegate();
cache.storeObject( cacheKey, object );
}
return object;
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
@@ -21,16 +22,16 @@
* @author James Carman
* @version 1.0
*/
-public class ConstantProvider<T> extends AbstractObjectProvider<T>
+public class ConstantProvider extends AbstractDelegateProvider
{
- private final T constant;
+ private final Object constant;
- public ConstantProvider( T constant )
+ public ConstantProvider( Object constant )
{
this.constant = constant;
}
- public T getObject()
+ public Object getDelegate()
{
return constant;
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,22 +1,23 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.exception.DelegateProviderException;
import java.net.MalformedURLException;
@@ -26,26 +27,26 @@
* @author James Carman
* @version 1.0
*/
-public class HessianProvider<T> extends AbstractObjectProvider<T>
+public class HessianProvider extends AbstractDelegateProvider
{
- private final Class<T> serviceInterface;
+ private final Class serviceInterface;
private final String url;
-
- public HessianProvider( Class<T> serviceInterface, String url )
+
+ public HessianProvider( Class serviceInterface, String url )
{
this.serviceInterface = serviceInterface;
this.url = url;
}
- public T getObject()
+ public Object getDelegate()
{
try
- {
- return serviceInterface.cast( new HessianProxyFactory().create( serviceInterface, url ) );
+ {
+ return new HessianProxyFactory().create( serviceInterface, url );
}
catch( MalformedURLException e )
{
- throw new ObjectProviderException( "Invalid url given.", e );
+ throw new DelegateProviderException( "Invalid url given.", e );
}
}
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,21 +1,22 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.exception.DelegateProviderException;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
@@ -30,9 +31,9 @@
* @author James Carman
* @version 1.0
*/
-public class JaxRpcProvider<T> extends AbstractObjectProvider<T>
+public class JaxRpcProvider extends AbstractDelegateProvider
{
- private final Class<? extends T> serviceInterface;
+ private final Class serviceInterface;
private String wsdlUrl;
private String serviceNamespaceUri;
private String serviceLocalPart;
@@ -41,26 +42,29 @@
private String portLocalPart;
private String portPrefix;
- public JaxRpcProvider( Class<? extends T> serviceInterface )
+ public JaxRpcProvider( Class serviceInterface )
{
this.serviceInterface = serviceInterface;
}
- public T getObject()
+ public Object getDelegate()
{
try
{
- final Service service = ( wsdlUrl == null ? ServiceFactory.newInstance().createService( getServiceQName() ) : ServiceFactory.newInstance().createService( new URL( wsdlUrl ), getServiceQName() ) );
+ 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 ) );
+ return portQName == null ? service.getPort( serviceInterface ) :
+ service.getPort( portQName, serviceInterface );
}
catch( ServiceException e )
{
- throw new ObjectProviderException( "Unable to create JAX-RPC service proxy.", e );
+ throw new DelegateProviderException( "Unable to create JAX-RPC service proxy.", e );
}
catch( MalformedURLException e )
{
- throw new ObjectProviderException( "Invalid URL given.", e );
+ throw new DelegateProviderException( "Invalid URL given.", e );
}
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,27 +1,28 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 class NullProvider extends ConstantProvider
{
public NullProvider()
{
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,24 +1,25 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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.DelegateProvider;
+import org.apache.commons.proxy.exception.DelegateProviderException;
import org.apache.commons.proxy.provider.cache.Cache;
import org.apache.commons.proxy.provider.cache.CacheEvictionEvent;
import org.apache.commons.proxy.provider.cache.CacheEvictionListener;
@@ -27,13 +28,13 @@
* @author James Carman
* @version 1.0
*/
-public class PooledProvider<T> extends ProviderDecorator<T> implements CacheEvictionListener
+public class PooledProvider extends ProviderDecorator implements CacheEvictionListener
{
private final Object cacheKey = new Object();
private final GenericObjectPool pool;
private Cache cache;
- public PooledProvider( ObjectProvider<? extends T> inner )
+ public PooledProvider( DelegateProvider inner )
{
super( inner );
pool = new GenericObjectPool( new Factory() );
@@ -57,23 +58,24 @@
}
}
- public T getObject()
+ public Object getDelegate()
{
try
{
log.debug( "Checking for object in cache in thread " + Thread.currentThread().getName() + "..." );
- T object = ( T ) cache.retrieveObject( cacheKey );
+ Object object = 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();
+ log.debug( "Did not object in cache; borrowing from pool in thread " +
+ Thread.currentThread().getName() + "..." );
+ object = pool.borrowObject();
cache.storeObject( cacheKey, object, this );
}
return object;
}
catch( Exception e )
{
- throw new ObjectProviderException( "Unable to borrow object from pool.", e );
+ throw new DelegateProviderException( "Unable to borrow object from pool.", e );
}
}
@@ -134,10 +136,10 @@
private class Factory extends BasePoolableObjectFactory
{
- public T makeObject() throws Exception
+ public Object makeObject() throws Exception
{
log.debug( "Creating new object for pool in thread " + Thread.currentThread().getName() + "..." );
- return inner.getObject();
+ return inner.getDelegate();
}
}
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,37 +1,38 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.DelegateProvider;
/**
* @author James Carman
* @version 1.0
*/
-public class ProviderDecorator<T> extends AbstractObjectProvider<T>
+public class ProviderDecorator extends AbstractDelegateProvider
{
- protected ObjectProvider<? extends T> inner;
+ protected DelegateProvider inner;
- public ProviderDecorator( ObjectProvider<? extends T> inner )
+ public ProviderDecorator( DelegateProvider inner )
{
this.inner = inner;
}
- public T getObject()
+ public Object getDelegate()
{
- return inner.getObject();
+ return inner.getDelegate();
}
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,21 +1,22 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.DelegateProvider;
/**
* @author James Carman
@@ -23,23 +24,23 @@
*/
public class ProviderUtils
{
- public static <T> ObjectProvider<T> constantProvider( T value )
+ public static DelegateProvider constantProvider( Object value )
{
- return new ConstantProvider<T>( value );
+ return new ConstantProvider( value );
}
- public static <T> ObjectProvider<T> beanProvider( Class<T> beanClass )
+ public static DelegateProvider beanProvider( Class beanClass )
{
- return new BeanProvider<T>( beanClass );
+ return new BeanProvider( beanClass );
}
- public static <T> ObjectProvider<T> singletonProvider( ObjectProvider<T> inner )
+ public static DelegateProvider singletonProvider( DelegateProvider inner )
{
- return new SingletonProvider<T>( inner );
+ return new SingletonProvider( inner );
}
- public static <T> ObjectProvider<T> synchronizedProvider( ObjectProvider<T> inner )
+ public static DelegateProvider synchronizedProvider( DelegateProvider inner )
{
- return new SynchronizedProvider<T>( inner );
+ 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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,21 +1,22 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.exception.DelegateProviderException;
import java.rmi.AccessException;
import java.rmi.NotBoundException;
@@ -26,67 +27,65 @@
/**
* Provides an object by looking it up in an RMI registry.
- *
+ *
* @author James Carman
* @version 1.0
*/
-public class RmiProvider<T> extends AbstractObjectProvider<T>
+public class RmiProvider extends AbstractDelegateProvider
{
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 )
+ public RmiProvider( String name )
{
this.name = name;
- this.serviceInterface = serviceInterface;
+
}
- public RmiProvider( String host, String name, Class<T> serviceInterface )
+ public RmiProvider( String host, String name )
{
this.host = host;
this.name = name;
- this.serviceInterface = serviceInterface;
}
- public RmiProvider( String host, int port, String name, Class<T> serviceInterface )
+ public RmiProvider( String host, int port, String name )
{
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 )
+ public RmiProvider( String host, int port, RMIClientSocketFactory clientSocketFactory, String name )
{
this.host = host;
this.port = port;
this.clientSocketFactory = clientSocketFactory;
this.name = name;
- this.serviceInterface = serviceInterface;
}
- public T getObject()
+ public Object getDelegate()
{
Registry reg = null;
try
{
reg = getRegistry();
- return serviceInterface.cast( reg.lookup( name ) );
+ return reg.lookup( name );
}
catch( NotBoundException e )
{
- throw new ObjectProviderException( "Name " + name + " not found in registry at " + host + ":" + port + ".", e );
+ throw new DelegateProviderException( "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 );
+ throw new DelegateProviderException( "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 + "." );
+ throw new DelegateProviderException(
+ "Unable to lookup service named " + name + " in registry at " + host + ":" + port + "." );
}
}
@@ -97,7 +96,8 @@
{
if( clientSocketFactory != null )
{
- log.debug( "Looking up RMI registry at " + host + ":" + port + " using specified client socket factory..." );
+ log.debug( "Looking up RMI registry at " + host + ":" + port +
+ " using specified client socket factory..." );
return LocateRegistry.getRegistry( host, port, clientSocketFactory );
}
else
@@ -108,7 +108,7 @@
}
catch( RemoteException e )
{
- throw new ObjectProviderException( "Unable to locate registry at " + host + ":" + port + ".", e );
+ throw new DelegateProviderException( "Unable to locate registry at " + host + ":" + port + ".", e );
}
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,42 +1,43 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.DelegateProvider;
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.
+ * Wraps another delegate 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>
+public class SingletonProvider extends ProviderDecorator
{
- private T instance;
+ private Object instance;
private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
- public SingletonProvider( ObjectProvider<? extends T> inner )
+ public SingletonProvider( DelegateProvider inner )
{
super( inner );
}
- public T getObject()
+ public Object getDelegate()
{
rwl.readLock().lock();
if( instance == null )
@@ -45,7 +46,7 @@
rwl.writeLock().lock();
if( instance == null )
{
- instance = super.getObject();
+ instance = super.getDelegate();
inner = null; // Garbage collection
}
rwl.readLock().lock();
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,48 +1,50 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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 org.apache.commons.proxy.DelegateProvider;
/**
- * Wraps another object provider, making it synchronized.
+ * Wraps another delegate provider, making it synchronized.
+ *
* @author James Carman
* @version 1.0
*/
-public class SynchronizedProvider<T> extends ProviderDecorator<T>
+public class SynchronizedProvider extends ProviderDecorator
{
private final Object monitor;
- public SynchronizedProvider( ObjectProvider<T> inner, Object monitor )
+ public SynchronizedProvider( DelegateProvider inner, Object monitor )
{
super( inner );
this.monitor = monitor;
}
- public SynchronizedProvider( ObjectProvider<T> inner )
+ public SynchronizedProvider( DelegateProvider inner )
{
super( inner );
monitor = this;
}
- public T getObject()
+ public Object getDelegate()
{
synchronized( monitor )
{
- return super.getObject();
+ return super.getDelegate();
}
}
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
@@ -50,7 +51,8 @@
getCachedObjectMap().remove( cacheKey );
if( cachedObject.getListener() != null )
{
- cachedObject.getListener().objectEvicted( new CacheEvictionEvent( cacheKey, cachedObject.getObject() ) );
+ cachedObject.getListener()
+ .objectEvicted( new CacheEvictionEvent( cacheKey, cachedObject.getObject() ) );
}
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
@@ -22,7 +23,10 @@
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();
}
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -1,17 +1,18 @@
-/*
- * Copyright 2005 The Apache Software Foundation
+/* $Id$
*
- * 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
+ * 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.
+ * 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;
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=264802&r1=264801&r2=264802&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 Tue Aug 30 09:08:46 2005
@@ -43,7 +43,7 @@
public void testCreateProxy()
{
- final Echo echo = ( Echo ) factory.createProxy( singletonProvider( beanProvider( EchoImpl.class ) ), Echo.class );
+ final Echo echo = ( Echo ) factory.createDelegatingProxy( singletonProvider( beanProvider( EchoImpl.class ) ), Echo.class );
echo.echo();
assertEquals( "message", echo.echoBack( "message" ) );
assertEquals( "ab", echo.echoBack( "a", "b" ) );
@@ -51,8 +51,8 @@
public void testCreateInterceptorProxy()
{
- final Echo target = ( Echo ) factory.createProxy( singletonProvider( beanProvider( EchoImpl.class ) ), Echo.class );
- final Echo proxy = ( Echo ) factory.createInterceptorProxy( target, new SuffixMethodInterceptor( " suffix" ), Echo.class );
+ final Echo target = ( Echo ) factory.createDelegatingProxy( singletonProvider( beanProvider( EchoImpl.class ) ), Echo.class );
+ final Echo proxy = ( Echo ) factory.createInterceptingProxy( target, new SuffixMethodInterceptor( " suffix" ), Echo.class );
proxy.echo();
assertEquals( "message suffix", proxy.echoBack( "message" ) );
}
@@ -61,7 +61,7 @@
{
final MethodInvocationTester tester = new MethodInvocationTester();
final EchoImpl target = new EchoImpl();
- final Echo proxy = ( Echo ) factory.createInterceptorProxy( target, tester, Echo.class );
+ final Echo proxy = ( Echo ) factory.createInterceptingProxy( target, tester, Echo.class );
proxy.echo();
assertNull( tester.arguments );
assertEquals( Echo.class.getMethod( "echo" ), tester.method );
@@ -82,7 +82,7 @@
public void testProxyWithCheckedException() throws Exception
{
- final Echo proxy = ( Echo ) factory.createProxy( constantProvider( new EchoImpl() ), Echo.class );
+ final Echo proxy = ( Echo ) factory.createDelegatingProxy( constantProvider( new EchoImpl() ), Echo.class );
try
{
proxy.ioException();
@@ -95,7 +95,7 @@
public void testProxyWithUncheckedException() throws Exception
{
- final Echo proxy = ( Echo ) factory.createProxy( constantProvider( new EchoImpl() ), Echo.class );
+ final Echo proxy = ( Echo ) factory.createDelegatingProxy( constantProvider( new EchoImpl() ), Echo.class );
try
{
proxy.illegalArgument();
@@ -108,7 +108,7 @@
public void testInterceptorProxyWithUncheckedException() throws Exception
{
- final Echo proxy = ( Echo ) factory.createInterceptorProxy( new EchoImpl(), new NoOpMethodInterceptor(), Echo.class );
+ final Echo proxy = ( Echo ) factory.createInterceptingProxy( new EchoImpl(), new NoOpMethodInterceptor(), Echo.class );
try
{
proxy.illegalArgument();
@@ -121,7 +121,7 @@
public void testInterceptorProxyWithCheckedException() throws Exception
{
- final Echo proxy = ( Echo ) factory.createInterceptorProxy( new EchoImpl(), new NoOpMethodInterceptor(), Echo.class );
+ final Echo proxy = ( Echo ) factory.createInterceptingProxy( new EchoImpl(), new NoOpMethodInterceptor(), Echo.class );
try
{
proxy.ioException();
@@ -134,14 +134,14 @@
public void testWithNonAccessibleTargetType()
{
- final Echo proxy = ( Echo ) factory.createInterceptorProxy( new PrivateEcho(), new NoOpMethodInterceptor(), Echo.class );
+ final Echo proxy = ( Echo ) factory.createInterceptingProxy( new PrivateEcho(), new NoOpMethodInterceptor(), Echo.class );
proxy.echo();
}
public void testChangingArguments()
{
- final Echo proxy = ( Echo ) factory.createInterceptorProxy( new EchoImpl(), new ChangeArgumentInterceptor(), Echo.class );
+ final Echo proxy = ( Echo ) factory.createInterceptingProxy( new EchoImpl(), new ChangeArgumentInterceptor(), Echo.class );
assertEquals( "something different", proxy.echoBack( "whatever" ) );
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestFilteredMethodInterceptor.java Tue Aug 30 09:08:46 2005
@@ -30,13 +30,13 @@
{
public void testFilterAccepts()
{
- Echo echo = ( Echo ) new MethodInterceptorChain( new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter( "echoBack" ) ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject();
+ Echo echo = ( Echo ) new MethodInterceptorChain( new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter( "echoBack" ) ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getDelegate();
assertEquals( "messagea", echo.echoBack( "message" ) );
}
public void testFilterDenies()
{
- Echo echo = ( Echo ) new MethodInterceptorChain( new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter() ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getObject();
+ Echo echo = ( Echo ) new MethodInterceptorChain( new FilteredMethodInterceptor( new SuffixMethodInterceptor( "a" ), new SimpleMethodFilter() ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl() ).getDelegate();
assertEquals( "message", echo.echoBack( "message" ) );
}
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/interceptor/TestMethodInterceptorChain.java Tue Aug 30 09:08:46 2005
@@ -29,13 +29,13 @@
{
public void testWithSingleInterceptor()
{
- Echo echo = ( Echo ) new MethodInterceptorChain( new SuffixMethodInterceptor( "a" ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), Echo.class ).getObject();
+ Echo echo = ( Echo ) new MethodInterceptorChain( new SuffixMethodInterceptor( "a" ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), Echo.class ).getDelegate();
assertEquals( "messagea", echo.echoBack( "message" ) );
}
public void testWithMultipleInterceptors()
{
- Echo echo = ( Echo ) new MethodInterceptorChain( new SuffixMethodInterceptor( "a" ), new SuffixMethodInterceptor( "b" ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), Echo.class ).getObject();
+ Echo echo = ( Echo ) new MethodInterceptorChain( new SuffixMethodInterceptor( "a" ), new SuffixMethodInterceptor( "b" ) ).createProxyProvider( new CglibProxyFactory(), new EchoImpl(), Echo.class ).getDelegate();
assertEquals( "messageba", echo.echoBack( "message" ) );
}
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/CountingProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/CountingProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/CountingProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/CountingProvider.java Tue Aug 30 09:08:46 2005
@@ -15,25 +15,25 @@
*/
package org.apache.commons.proxy.provider;
-import org.apache.commons.proxy.ObjectProvider;
+import org.apache.commons.proxy.DelegateProvider;
/**
* @author James Carman
* @version 1.0
*/
-public class CountingProvider<T> extends ProviderDecorator<T>
+public class CountingProvider extends ProviderDecorator
{
private int count = 0;
- public CountingProvider( ObjectProvider<? extends T> inner )
+ public CountingProvider( DelegateProvider inner )
{
super( inner );
}
- public synchronized T getObject()
+ public synchronized Object getDelegate()
{
count++;
- return super.getObject();
+ return super.getDelegate();
}
public synchronized int getCount()
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestBeanProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestBeanProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestBeanProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestBeanProvider.java Tue Aug 30 09:08:46 2005
@@ -16,7 +16,7 @@
package org.apache.commons.proxy.provider;
import junit.framework.TestCase;
-import org.apache.commons.proxy.exception.ObjectProviderException;
+import org.apache.commons.proxy.exception.DelegateProviderException;
public class TestBeanProvider extends TestCase
{
@@ -24,10 +24,10 @@
{
try
{
- new BeanProvider( Number.class ).getObject();
+ new BeanProvider( Number.class ).getDelegate();
fail();
}
- catch( ObjectProviderException e )
+ catch( DelegateProviderException e )
{
}
@@ -37,10 +37,10 @@
{
try
{
- new BeanProvider( MyBean.class ).getObject();
+ new BeanProvider( MyBean.class ).getDelegate();
fail();
}
- catch( ObjectProviderException e )
+ catch( DelegateProviderException e )
{
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestCachedProvider.java Tue Aug 30 09:08:46 2005
@@ -27,20 +27,20 @@
{
public void testWithSimpleCache()
{
- final CountingProvider<Echo> counter = new CountingProvider<Echo>( new ConstantProvider<Echo>( new EchoImpl() ) );
- final CachedProvider<Echo> provider = new CachedProvider<Echo>( counter );
+ final CountingProvider counter = new CountingProvider( new ConstantProvider( new EchoImpl() ) );
+ final CachedProvider provider = new CachedProvider( counter );
provider.setCache( new SimpleCache() );
for( int i = 0; i < 10; ++i )
{
- provider.getObject().echoBack( "Hello, World" );
+ ( ( Echo )provider.getDelegate() ).echoBack( "Hello, World" );
}
assertEquals( 1, counter.getCount() );
}
public void testWithThreadLocalCache() throws Exception
{
- final CountingProvider<Echo> counter = new CountingProvider<Echo>( new ConstantProvider<Echo>( new EchoImpl() ) );
- final CachedProvider<Echo> provider = new CachedProvider<Echo>( counter );
+ final CountingProvider counter = new CountingProvider( new ConstantProvider( new EchoImpl() ) );
+ final CachedProvider provider = new CachedProvider( counter );
final ThreadLocalCache cache = new ThreadLocalCache();
provider.setCache( cache );
final CountDownLatch latch = new CountDownLatch( 10 );
@@ -50,7 +50,7 @@
{
public void run()
{
- provider.getObject().echoBack( "Hello, World" );
+ ( ( Echo )provider.getDelegate() ).echoBack( "Hello, World" );
cache.clearCache();
latch.countDown();
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestConstantProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestConstantProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestConstantProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestConstantProvider.java Tue Aug 30 09:08:46 2005
@@ -26,7 +26,7 @@
public void testGetObject() throws Exception
{
final String s = "Hello, World!";
- final ConstantProvider<String> provider = new ConstantProvider<String>( s );
- assertSame( s, provider.getObject() );
+ final ConstantProvider provider = new ConstantProvider( s );
+ assertSame( s, provider.getDelegate() );
}
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestJaxRpcProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestJaxRpcProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestJaxRpcProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestJaxRpcProvider.java Tue Aug 30 09:08:46 2005
@@ -21,12 +21,12 @@
{
public void testGetObject() throws Exception
{
- final JaxRpcProvider provider = new JaxRpcProvider<QuoteService>( QuoteService.class );
+ final JaxRpcProvider provider = new JaxRpcProvider( QuoteService.class );
provider.setWsdlUrl( "http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl" );
provider.setServiceNamespaceUri( "http://www.themindelectric.com/wsdl/net.xmethods.services.stockquote.StockQuote/" );
provider.setServiceLocalPart( "net.xmethods.services.stockquote.StockQuoteService" );
provider.setPortLocalPart( "net.xmethods.services.stockquote.StockQuotePort" );
- final QuoteService quote = ( QuoteService )provider.getObject();
+ final QuoteService quote = ( QuoteService )provider.getDelegate();
assertNotNull( quote );
}
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestNullProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestNullProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestNullProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestNullProvider.java Tue Aug 30 09:08:46 2005
@@ -26,6 +26,6 @@
public void testGetObject()
{
final NullProvider provider = new NullProvider();
- assertNull( provider.getObject() );
+ assertNull( provider.getDelegate() );
}
}
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestPooledProvider.java Tue Aug 30 09:08:46 2005
@@ -29,13 +29,13 @@
{
public void testWithSimpleCache()
{
- final CountingProvider<Echo> counter = new CountingProvider<Echo>( constantProvider( new EchoImpl() ) );
- final PooledProvider<Echo> provider = new PooledProvider<Echo>( counter );
+ final CountingProvider counter = new CountingProvider( constantProvider( new EchoImpl() ) );
+ final PooledProvider provider = new PooledProvider( counter );
final SimpleCache cache = new SimpleCache();
provider.setCache( cache );
for( int i = 0; i < 10; ++i )
{
- provider.getObject().echoBack( "Hello, World" );
+ ( ( Echo )provider.getDelegate() ).echoBack( "Hello, World" );
cache.clearCache();
}
assertEquals( 1, counter.getCount() );
@@ -44,8 +44,8 @@
public void testWithThreadLocalCache() throws Exception
{
- final CountingProvider<Echo> counter = new CountingProvider<Echo>( constantProvider( new EchoImpl() ) );
- final PooledProvider<Echo> provider = new PooledProvider<Echo>( counter );
+ final CountingProvider counter = new CountingProvider( constantProvider( new EchoImpl() ) );
+ final PooledProvider provider = new PooledProvider( counter );
provider.setMaxActive( 10 );
provider.setMinIdle( 5 );
provider.setWhenExhaustedAction( GenericObjectPool.WHEN_EXHAUSTED_GROW );
@@ -67,12 +67,12 @@
{
try
{
- provider.getObject().echoBack( "Hello, World" );
+ ( ( Echo )provider.getDelegate() ).echoBack( "Hello, World" );
borrowedLatch.countDown();
goLatch.await();
for( int i = 0; i < 10; ++i )
{
- provider.getObject().echoBack( "Hello, World" );
+ ( ( Echo )provider.getDelegate() ).echoBack( "Hello, World" );
}
cache.clearCache();
Modified: jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java?rev=264802&r1=264801&r2=264802&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/test/org/apache/commons/proxy/provider/TestRmiProvider.java Tue Aug 30 09:08:46 2005
@@ -30,8 +30,8 @@
{
final Registry registry = LocateRegistry.createRegistry( Registry.REGISTRY_PORT );
registry.bind( "echo", new RmiEchoImpl() );
- final RmiProvider<RmiEcho> provider = new RmiProvider<RmiEcho>( "echo", RmiEcho.class );
- final RmiEcho echo = provider.getObject();
+ final RmiProvider provider = new RmiProvider( "echo" );
+ final RmiEcho echo = ( RmiEcho )provider.getDelegate();
assertEquals( "Hello, World!", echo.echoBack( "Hello, World!" ) );
}
}
Added: jakarta/commons/sandbox/proxy/trunk/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/xdocs/index.xml?rev=264802&view=auto
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/xdocs/index.xml (added)
+++ jakarta/commons/sandbox/proxy/trunk/xdocs/index.xml Tue Aug 30 09:08:46 2005
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<document>
+ <properties>
+ <title>Overview</title>
+ <author email="commons-dev AT jakarta DOT apache DOT org">Jakarta Commons Development Team</author>
+ <author email="jcarman AT apache DOT org">James Carman</author>
+ </properties>
+
+ <body>
+ <section name="Commons Proxy: Dynamic Proxies Made Easy">
+ <p>
+ The <em>Proxy</em> design pattern (<a href="http://www.amazon.com/exec/obidos/tg/detail/-/0201633612/qid=1125413337/sr=1-1/ref=sr_1_1/104-0714405-6441551?v=glance&s=books">GoF</a>)
+ allows you to provide "a surrogate or placeholder for another object to control access to it".
+ Proxies can be used in many ways. Some of which are:
+ <ul>
+ <li><b>Lazy initialization</b> - the proxy acts as a "stand-in" for the actual implementation allowing
+ it to be instantiated only when absolutely necessary.</li>
+ <li><b>Security</b> - the proxy object can verify that the user actually has the permission to execute
+ the method (a la EJB).</li>
+ <li><b>Logging</b> - the proxy can log evey method invocation, providing valuable debugging information.</li>
+ <li><b>Performance Monitoring</b> - the proxy can log each method invocation to a performance monitor
+ allowing system administrators to see what parts of the system are potentially bogged down.</li>
+ </ul>
+ <em>Commons Proxy</em> supports dynamic proxy generation using proxy factories, delegate providers, and
+ method interceptors.
+ </p>
+ <subsection name="Proxy Factories">
+ <p>
+ <a href="apidocs/org/apache/commons/proxy/ProxyFactory.html">Proxy factories</a>
+ encapsulate all necessary proxying logic away from your code. Switching proxying
+ techniques/technologies is as simple as using a different proxy factory implementation class.
+ Currently, <em>Commons Proxy</em> provides proxy factory implementations using JDK proxies,
+ <a href="http://cglib.sourceforge.net">CGLIB</a>, and
+ <a href="http://www.jboss.org/products/javassist">Javassist</a>. Proxy factories allow you to create
+ two different types of proxy objects:
+ <ul>
+ <li><b>Delegating Proxies</b> - a proxy that merely delegates each method invocation to an
+ object provided by a delegate provider.</li>
+ <li><b>Intercepting Proxies</b> - a proxy that allows a method interceptor to intercept each
+ method invocation.</li>
+ </ul>
+
+ </p>
+ </subsection>
+ <subsection name="Delegate Providers">
+ <p>
+ <a href="apidocs/org/apache/commons/proxy/provider/package-summary.html">Delegate Providers</a>
+ provide the
+ objects which will be the "target" of a proxy. There are two types of delegate providers:
+
+ <ul>
+ <li><b>Core Delegate Provider</b> - a provider which provides the core implementation
+ object.</li>
+ <li><b>Decorating Delegate Provider</b> - a provider which decorates the delegate returned by
+ another provider.</li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Method Interceptors">
+ <p>
+ <cm>Commons Proxy</cm> uses the <a href="http://aopalliance.sourceforge.net">AOP Alliance</a> API
+ for method interceptor support. Method interceptors provide <em>rudimentary</em> aspect-oriented
+ programming support, allowing you to alter the results/effects of a method invocation without actually
+ changing the implementation of the method itself. <em>Commons Proxy</em> provides a
+ <a href="apidocs/org/apache/commons/proxy/interceptor/FilteredMethodInterceptor.html">filtered</a>
+ method interceptor implementation allowing you to specify which methods are intercepted using a
+ <a href="apidocs/org/apache/commons/proxy/interceptor/MethodFilter.html">method filter</a>.
+ </p>
+ </subsection>
+ </section>
+
+ <section name="Status">
+ <p>
+ <ul>
+ <li>This code is in the commons <i>sandbox</i>.</li>
+ <li>The code is unreleased.</li>
+ <li>Methods and classes can and will appear and disappear without warning.</li>
+ <li>If you like the code and want to push it towards a release, join the mailing list!</li>
+ </ul>
+ </p>
+ </section>
+ </body>
+</document>
Propchange: jakarta/commons/sandbox/proxy/trunk/xdocs/index.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/commons/sandbox/proxy/trunk/xdocs/index.xml
------------------------------------------------------------------------------
svn:keywords = Id
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org