org.apache.aries.proxy
Interface ProxyManager


public interface ProxyManager

The proxy manager service allows clients to generate and manage proxies.


Method Summary
 Object createDelegatingInterceptingProxy(org.osgi.framework.Bundle clientBundle, Collection<Class<?>> classes, Callable<Object> dispatcher, Object template, InvocationListener wrapper)
          Creates a single proxy that both delegates and intercepts.
 Object createDelegatingProxy(org.osgi.framework.Bundle clientBundle, Collection<Class<?>> classes, Callable<Object> dispatcher, Object template)
          Create a proxy that delegates to an object instance which may change over time
 Object createInterceptingProxy(org.osgi.framework.Bundle clientBundle, Collection<Class<?>> classes, Object delegate, InvocationListener wrapper)
          Creates a proxy that invokes the supplied InvocationListener immediately before and after any non-private method is called.
 boolean isProxy(Object proxy)
          Returns true if and only if the specified object was generated by the ProxyManager.
 Callable<Object> unwrap(Object proxy)
          This method unwraps the provided proxy returning the target object.
 

Method Detail

createDelegatingProxy

Object createDelegatingProxy(org.osgi.framework.Bundle clientBundle,
                             Collection<Class<?>> classes,
                             Callable<Object> dispatcher,
                             Object template)
                             throws UnableToProxyException
Create a proxy that delegates to an object instance which may change over time

Parameters:
clientBundle - The bundle providing the class to be proxied
classes - The interfaces and/or classes to be proxied
dispatcher - A Callable that will called each time the proxy is invoked to locate the object to delegate to
template - A template object for the proxy, may be null if only interfaces need to be proxied. Supplying a templates typically offer a significant performance boost to the resulting proxy.
Returns:
A proxy object that delegates to real objects under the covers
Throws:
UnableToProxyException

createInterceptingProxy

Object createInterceptingProxy(org.osgi.framework.Bundle clientBundle,
                               Collection<Class<?>> classes,
                               Object delegate,
                               InvocationListener wrapper)
                               throws UnableToProxyException
Creates a proxy that invokes the supplied InvocationListener immediately before and after any non-private method is called.

Parameters:
clientBundle -
classes -
delegate -
wrapper -
Returns:
Throws:
UnableToProxyException

createDelegatingInterceptingProxy

Object createDelegatingInterceptingProxy(org.osgi.framework.Bundle clientBundle,
                                         Collection<Class<?>> classes,
                                         Callable<Object> dispatcher,
                                         Object template,
                                         InvocationListener wrapper)
                                         throws UnableToProxyException
Creates a single proxy that both delegates and intercepts. See {ProxyManager#createDelegatingProxy(Bundle, Collection, Callable) and {ProxyManagercreateInterceptingProxy(Bundle, Collection, Object, InvocationListener)

Parameters:
clientBundle -
classes -
dispatcher -
template - A template object for the proxy, may be null if only interfaces need to be proxied. Supplying a templates typically offer a significant performance boost to the resulting proxy.
wrapper -
Returns:
Throws:
UnableToProxyException

unwrap

Callable<Object> unwrap(Object proxy)
This method unwraps the provided proxy returning the target object.

Parameters:
proxy - the proxy to unwrap.
Returns:
the target object.

isProxy

boolean isProxy(Object proxy)
Returns true if and only if the specified object was generated by the ProxyManager. See ProxyManager#createDelegatingProxy(Bundle,Collection,Callable) for details on how to create a proxy.

Parameters:
proxy - The proxy object to test
Returns:
true if it is a proxy, false otherwise.


Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.