Package org.jboss.aop.advice

Examples of org.jboss.aop.advice.AspectDefinition


   public Object getPerVMAspect(String def)
   {
      Object aspect = perVMAspects.get(def);
      if (aspect == null)
      {
         AspectDefinition adef = aspectDefinitions.get(def);
         if (adef != null && adef.getScope() == Scope.PER_VM)
         {
            synchronized (adef)
            {
               // double check but, now, in a sync block
               aspect = perVMAspects.get(def);
View Full Code Here


      internalRemoveAspectDefintion(name);
   }

   protected AspectDefinition internalRemoveAspectDefintion(String name)
   {
      AspectDefinition def = aspectDefinitions.remove(name);
      if (def != null)
      {
         def.undeploy();
         if (def.getScope() == Scope.PER_VM) perVMAspects.remove(def.getName());
      }
      return def;
   }
View Full Code Here

               notMyPerVMAspects.put(def, Boolean.TRUE);
            }
            else
            {
               //We have a different version of the class deployed
               AspectDefinition aspectDefinition = getAspectDefinition(def);
               //Override the classloader to create the aspect instance
               aspect = createPerVmAspect(def, aspectDefinition, getClassLoader());
               myPerVMAspects.put(def, aspect);
            }
         }
View Full Code Here

      assertEquals(1, Interceptions.size());
      assertEquals(Interceptions.getConstructionName("MyInterceptor", "POJO"), Interceptions.get(0));
     
      AdviceBinding binding2 = new AdviceBinding("construction(org.jboss.test.aop.dynamicgenadvisor.POJO->new())", null);
      String name2 = binding2.getName();
      AspectDefinition myAspect = AspectManager.instance().getAspectDefinition("org.jboss.test.aop.dynamicgenadvisor.MyAspect");
      binding2.addInterceptorFactory(new AdviceFactory(myAspect, "intercept"));
      binding2.addInterceptor(MyInterceptor.class);
      AspectManager.instance().addBinding(binding2);
     
      Interceptions.clear();
View Full Code Here

      assertEquals(1, Interceptions.size());
      assertEquals(Interceptions.getMethodName("MyInterceptor", "POJO", "someMethod"), Interceptions.get(0));
     
      AdviceBinding binding2 = new AdviceBinding("execution(* org.jboss.test.aop.dynamicgenadvisor.POJO->someMethod(..))", null);
      String name2 = binding2.getName();
      AspectDefinition myAspect = AspectManager.instance().getAspectDefinition("org.jboss.test.aop.dynamicgenadvisor.MyAspect");
      binding2.addInterceptorFactory(new AdviceFactory(myAspect, "intercept"));
      binding2.addInterceptor(MyInterceptor.class);
      AspectManager.instance().addBinding(binding2);
     
      Interceptions.clear();
View Full Code Here

      assertEquals(Interceptions.getFieldWriteName("MyInterceptor", "POJO", "i"), Interceptions.get(0));
      assertEquals(Interceptions.getFieldReadName("MyInterceptor", "POJO", "i"), Interceptions.get(1));

      AdviceBinding binding3 = new AdviceBinding("field(* org.jboss.test.aop.dynamicgenadvisor.POJO->i)", null);
      String name3 = binding3.getName();
      AspectDefinition myAspect = AspectManager.instance().getAspectDefinition("org.jboss.test.aop.dynamicgenadvisor.MyAspect");
      binding3.addInterceptorFactory(new AdviceFactory(myAspect, "intercept"));
      binding3.addInterceptor(MyInterceptor.class);
      AspectManager.instance().addBinding(binding3);
     
      Interceptions.clear();
View Full Code Here

         bindingA.addInterceptor(MyInterceptor.class);
         getInstanceDomain(pojo1).addBinding(bindingA);
        
         AdviceBinding bindingB = new AdviceBinding("execution(* org.jboss.test.aop.dynamicgenadvisor.POJO->someMethod(..))", null);
         String nameB = bindingB.getName();
         AspectDefinition myAspect = AspectManager.instance().getAspectDefinition("org.jboss.test.aop.dynamicgenadvisor.MyAspect");
         bindingB.addInterceptorFactory(new AdviceFactory(myAspect, "intercept"));
         getInstanceDomain(pojo2).addBinding(bindingB);
        
         System.out.println("Added instance advices");
         Interceptions.clear();
View Full Code Here

      POJO pojo1 = new POJO();
      POJO pojo2 = new POJO();
     
      AdviceBinding binding = new AdviceBinding("set(* org.jboss.test.aop.dynamicgenadvisor.POJO->i)", null);
      String name = binding.getName();
      AspectDefinition myAspect = AspectManager.instance().getAspectDefinition("org.jboss.test.aop.dynamicgenadvisor.MyAspect");
      binding.addInterceptorFactory(new AdviceFactory(myAspect, "intercept"));
      getInstanceDomain(pojo2).addBinding(binding);
     
      Interceptions.clear();
      pojo1.i = 10;
View Full Code Here

         bindingA.addInterceptor(MyInterceptor.class);
         getInstanceDomain(pojo1).addBinding(bindingA);
        
         AdviceBinding bindingB = new AdviceBinding("get(* org.jboss.test.aop.dynamicgenadvisor.POJO->i)", null);
         String nameB = bindingB.getName();
         AspectDefinition myAspect = AspectManager.instance().getAspectDefinition("org.jboss.test.aop.dynamicgenadvisor.MyAspect");
         bindingB.addInterceptorFactory(new AdviceFactory(myAspect, "intercept"));
         getInstanceDomain(pojo2).addBinding(bindingB);
        
         System.out.println("Added instance advices");
         Interceptions.clear();
View Full Code Here

      POJO pojo1 = new POJO();
      AdviceBinding bindingTopA = new AdviceBinding("execution(* org.jboss.test.aop.dynamicgenadvisor.*POJO->someMethod*(..))", null);
      String nameTopA = bindingTopA.getName();
      try
      {
         AspectDefinition myAspect = AspectManager.instance().getAspectDefinition("org.jboss.test.aop.dynamicgenadvisor.MyAspect");
         bindingTopA.addInterceptorFactory(new AdviceFactory(myAspect, "intercept"));
         AspectManager.instance().addBinding(bindingTopA);

         Interceptions.clear();
         pojo1.someMethod(123);
View Full Code Here

TOP

Related Classes of org.jboss.aop.advice.AspectDefinition

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.