org.apache.felix.ipojo.handlers.providedservice.strategy
Class ErrorPrintingServiceFactoryProxy

java.lang.Object
  extended by org.apache.felix.ipojo.handlers.providedservice.strategy.ErrorPrintingServiceFactoryProxy
All Implemented Interfaces:
InvocationHandler

public class ErrorPrintingServiceFactoryProxy
extends Object
implements InvocationHandler

This proxy class is here to wrap an iPOJO ServiceFactory. If the consumer of this service do not call the getService or ungetService methods, it will get an Exception with an explicit error message telling him that this service is only usable through iPOJO.

Author:
Felix Project Team

Constructor Summary
ErrorPrintingServiceFactoryProxy(IPOJOServiceFactory factory)
          Wraps a ServiceFactory in an InvocationHandler that will delegate only get/ungetService methods to the factory.
 
Method Summary
 Object invoke(Object proxy, Method method, Object[] args)
          'Invoke' methods called when a method is called on the proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorPrintingServiceFactoryProxy

public ErrorPrintingServiceFactoryProxy(IPOJOServiceFactory factory)
Wraps a ServiceFactory in an InvocationHandler that will delegate only get/ungetService methods to the factory. All other methods will be rejected with a meaningful error message.

Parameters:
factory - delegating iPOJO ServiceFactory
Method Detail

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws Exception
'Invoke' methods called when a method is called on the proxy.

Specified by:
invoke in interface InvocationHandler
Parameters:
proxy - the proxy
method - the method
args - the arguments
Returns:
the result
Throws:
Exception - if something wrong happens
See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])


Copyright © 2011 Apache Software Foundation. All Rights Reserved.