Package org.jboss.aop.proxy.container

Examples of org.jboss.aop.proxy.container.GeneratedAOPProxyFactory


/*     */   public static <T> T createProxy(T target, Class<T> interfaceClass)
/*     */   {
/* 160 */     if (target == null) {
/* 161 */       return null;
/*     */     }
/* 163 */     GeneratedAOPProxyFactory proxyFactory = new GeneratedAOPProxyFactory();
/* 164 */     AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
/* 165 */     params.setInterfaces(new Class[] { interfaceClass });
/* 166 */     params.setObjectAsSuperClass(true);
/* 167 */     params.setTarget(target);
/* 168 */     Object proxy = proxyFactory.createAdvisedProxy(params);
/* 169 */     if (trace)
/* 170 */       log.trace("Created proxy: " + proxy.getClass() + "@" + System.identityHashCode(proxy) + " target: " + target.getClass());
/* 171 */     return interfaceClass.cast(proxy);
/*     */   }
View Full Code Here


         if (interfaces != null && interfaces.isEmpty() == false)
         {
            ClassLoader cl = Configurator.getClassLoader(context.getBeanMetaData());
            params.setInterfaces(getClasses(kernel.getConfigurator(), interfaces, cl));
         }
         GeneratedAOPProxyFactory factory = new GeneratedAOPProxyFactory();
         return factory.createAdvisedProxy(params);
      }
      finally
      {
         MetaDataStack.unmask();
      }
View Full Code Here

      params.setMixins(new AOPProxyFactoryMixin[] {
            new AOPProxyFactoryMixin(OtherMixin.class, new Class[] {OtherMixinInterface.class, OtherMixinInterface2.class}, "20")
      });
     
      params.setTarget(new SerializablePOJO());
      AOPProxyFactory factory = new GeneratedAOPProxyFactory();
      SomeInterface si = (SomeInterface)factory.createAdvisedProxy(params);
     
      TestInterceptor.invoked = false;
      TestInterceptor2.invoked = false;
      si.helloWorld();
      assertTrue(TestInterceptor.invoked);
View Full Code Here

      params.setMixins(new AOPProxyFactoryMixin[] {
            new AOPProxyFactoryMixin(OtherMixin.class, new Class[] {OtherMixinInterface.class, OtherMixinInterface2.class}, "20")
      });
     
      params.setTarget(new SerializablePOJO());
      AOPProxyFactory factory = new GeneratedAOPProxyFactory();
      SomeInterface si = (SomeInterface)factory.createAdvisedProxy(params);
     
      TestInterceptor.invoked = false;
      TestInterceptor2.invoked = false;
      TestInterceptor3.invoked = false;
      TestInterceptor4.invoked = false;
View Full Code Here

      params.setMixins(new AOPProxyFactoryMixin[] {
            new AOPProxyFactoryMixin(OtherMixin.class, new Class[] {OtherMixinInterface.class, OtherMixinInterface2.class}, "20")
      });
     
      params.setTarget(new SerializablePOJO());
      AOPProxyFactory factory = new GeneratedAOPProxyFactory();
      SomeInterface si = (SomeInterface)factory.createAdvisedProxy(params);
     
      //DO NOT CALL THE PROXY HERE!!! (The intention of this test is to make sure that the per_instance and per_joinpoint aspects
      //and interceptors will still work although we have never made a call)
     
     
View Full Code Here

      URL url = getURLRelativeToProjectRoot("/src/resources/test/serialization/simple/manual-aop.xml");
      AspectXmlLoader.deployXML(url);

      AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
      params.setTarget(tgt);
      GeneratedAOPProxyFactory factory = new GeneratedAOPProxyFactory();
      Proxied proxied = (Proxied)factory.createAdvisedProxy(params);
     
      proxied.someMethod();
      assertTrue(SimpleInterceptor.invoked);
     
      byte[] bytes = serialize(proxied);
View Full Code Here

     
      AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
      params.setTarget(tgt);
      params.setInterfaces(new Class[] {SomeInterface.class});
      params.setMixins(new AOPProxyFactoryMixin[] {new AOPProxyFactoryMixin(Mixin.class, new Class<?>[] {MixinInterface.class})});
      GeneratedAOPProxyFactory factory = new GeneratedAOPProxyFactory();
      Proxied proxied = (Proxied)factory.createAdvisedProxy(params);
     
      SimpleInterceptor.intercepted = false;
      proxied.someMethod();
      assertTrue(SimpleInterceptor.intercepted);
     
View Full Code Here

      SimpleMetaData data = new SimpleMetaData();
      data.addMetaData("TEST", "value", "metadata");
      params.setSimpleMetaData(data);
     
      params.setTarget(new SerializablePOJO());
      AOPProxyFactory factory = new GeneratedAOPProxyFactory();
      SomeInterface si = (SomeInterface)factory.createAdvisedProxy(params);
     
      SimpleMetaDataInterceptor.data = null;
      si.helloWorld();
      assertNotNull(SimpleMetaDataInterceptor.data);
      assertEquals("metadata", SimpleMetaDataInterceptor.data);
View Full Code Here

      POJOProxy pojo = new POJOProxy();
      AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
      params.setTarget(pojo);

      GeneratedAOPProxyFactory factory = new GeneratedAOPProxyFactory();
      POJOProxy proxy = (POJOProxy)factory.createAdvisedProxy(params);

      reset();
      proxy.method();
      assertInterceptors(true, false);
View Full Code Here

      URL url = getURLRelativeToProjectRoot("/src/resources/test/nameddomain/manual-aop.xml");
      AspectXmlLoader.deployXML(url);
     
      AOPProxyFactoryParameters params = new AOPProxyFactoryParameters();
      params.setTarget(tgt);
      GeneratedAOPProxyFactory factory = new GeneratedAOPProxyFactory();
      Proxied proxied = (Proxied)factory.createAdvisedProxy(params);
     
      proxied.someMethod();
     
      Advisor advisor = ((AspectManaged)proxied).getAdvisor();
      assertNotNull(advisor);
View Full Code Here

TOP

Related Classes of org.jboss.aop.proxy.container.GeneratedAOPProxyFactory

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.