Package org.apache.aries.proxy

Examples of org.apache.aries.proxy.InvocationListener


                Bundle b = FrameworkUtil.getBundle(original.getClass());
                if (b == null) {
                  // we have a class from the framework parent, so use our bundle for proxying.
                  b = blueprintContainer.getBundleContext().getBundle();
                }
                InvocationListener collaborator = new Collaborator(cm, interceptors);

                intercepted = blueprintContainer.getProxyManager().createInterceptingProxy(b,
                        getClassesForProxying(original), original, collaborator);
            } catch (Exception u) {
                Bundle b = blueprintContainer.getBundleContext().getBundle();
View Full Code Here


  public ProxyHandler(AbstractProxyManager abstractProxyManager, Callable<Object> dispatcher, InvocationListener listener)
  {
    target = dispatcher;
    proxyManager = abstractProxyManager;
    final InvocationListener nonNullListener;
    if (listener == null) {
      nonNullListener = new DefaultWrapper();
    } else {
      nonNullListener = listener;
    }
   
    core = new InvocationHandler() {
      public Object invoke(Object proxy, Method method, Object[] args)
          throws Throwable
      {
        Object result = null;
        Object token = null;
        boolean inInvoke = false;
        try {
          token = nonNullListener.preInvoke(proxy, method, args);
          inInvoke = true;
          result = method.invoke(target.call(), args);
          inInvoke = false;
          nonNullListener.postInvoke(token, proxy, method, result);

        } catch (Throwable e) {
          // whether the the exception is an error is an application decision
          // if we catch an exception we decide carefully which one to
          // throw onwards
          Throwable exceptionToRethrow = null;
          // if the exception came from a precall or postcall
          // we will rethrow it
          if (!inInvoke) {
            exceptionToRethrow = e;
          }
          // if the exception didn't come from precall or postcall then it
          // came from invoke
          // we will rethrow this exception if it is not a runtime
          // exception, but we must unwrap InvocationTargetExceptions
          else {
            if (e instanceof InvocationTargetException) {
              e = ((InvocationTargetException) e).getTargetException();
            }
           
            if (!(e instanceof RuntimeException)) {
              exceptionToRethrow = e;
            }
          }
          try {
            nonNullListener.postInvokeExceptionalReturn(token, proxy, method, e);
          } catch (Exception f) {
            // we caught an exception from
            // postInvokeExceptionalReturn
            // if we haven't already chosen an exception to rethrow then
            // we will throw this exception
View Full Code Here

                Bundle b = FrameworkUtil.getBundle(original.getClass());
                if (b == null) {
                  // we have a class from the framework parent, so use our bundle for proxying.
                  b = blueprintContainer.getBundleContext().getBundle();
                }
                InvocationListener collaborator = new Collaborator(cm, interceptors);

                intercepted = blueprintContainer.getProxyManager().createInterceptingProxy(b,
                        getClassesForProxying(original), original, collaborator);
            } catch (Exception u) {
                Bundle b = blueprintContainer.getBundleContext().getBundle();
View Full Code Here

                        }
                    }
                }
            }

            InvocationListener il = new ProxyInvocationListener(originalRef);
            try {
                return pm.createInterceptingProxy(originalRef.getBundle(), allClasses, svc, il);
            } catch (UnableToProxyException e) {
                throw new RuntimeException(e);
            }
View Full Code Here

                Bundle b = FrameworkUtil.getBundle(original.getClass());
                if (b == null) {
                  // we have a class from the framework parent, so use our bundle for proxying.
                  b = blueprintContainer.getBundleContext().getBundle();
                }
                InvocationListener collaborator = new Collaborator(cm, interceptors);

                intercepted = BlueprintExtender.getProxyManager().createInterceptingProxy(b,
                        getClassesForProxying(), original, collaborator);
            } catch (Exception u) {
                Bundle b = blueprintContainer.getBundleContext().getBundle();
View Full Code Here

                Bundle b = FrameworkUtil.getBundle(original.getClass());
                if (b == null) {
                  // we have a class from the framework parent, so use our bundle for proxying.
                  b = blueprintContainer.getBundleContext().getBundle();
                }
                InvocationListener collaborator = new Collaborator(cm, interceptors);

                intercepted = blueprintContainer.getProxyManager().createInterceptingProxy(b,
                        getClassesForProxying(original), original, collaborator);
            } catch (Exception u) {
                Bundle b = blueprintContainer.getBundleContext().getBundle();
View Full Code Here

                        }
                    }
                }
            }

            InvocationListener il = new ProxyInvocationListener(originalRef);
            try {
                return pm.createInterceptingProxy(originalRef.getBundle(), allClasses, svc, il);
            } catch (UnableToProxyException e) {
                throw new RuntimeException(e);
            }
View Full Code Here

                Bundle b = FrameworkUtil.getBundle(original.getClass());
                if (b == null) {
                  // we have a class from the framework parent, so use our bundle for proxying.
                  b = blueprintContainer.getBundleContext().getBundle();
                }
                InvocationListener collaborator = new Collaborator(cm, interceptors);

                intercepted = blueprintContainer.getProxyManager().createInterceptingProxy(b,
                        getClassesForProxying(original), original, collaborator);
            } catch (Exception u) {
                Bundle b = blueprintContainer.getBundleContext().getBundle();
View Full Code Here

TOP

Related Classes of org.apache.aries.proxy.InvocationListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.