Package org.jboss.aop.advice

Examples of org.jboss.aop.advice.AspectDefinition


    */
   public void testAspectFactory() throws Exception
   {
      AdviceBinding binding = new AdviceBinding(
            "execution(void *PreparedPOJO->someMethod(..))", null);
      AspectDefinition aspectDefinition = AspectManager.instance()
            .getAspectDefinition(AnnotatedAspectFactory.class.getName());
      assertNotNull(aspectDefinition);
      binding.addInterceptorFactory(new AdviceFactory(aspectDefinition,
            "advice"));
      AspectManager.instance().addBinding(binding);
View Full Code Here


    */
   public void testAspectFactory() throws Exception
   {
      AdviceBinding binding = new AdviceBinding(
            "execution(void *PreparedPOJO->someMethod(..))", null);
      AspectDefinition aspectDefinition = AspectManager.instance()
            .getAspectDefinition(AnnotatedAspectFactory.class.getName());
      assertNotNull(aspectDefinition);
      binding.addInterceptorFactory(new AdviceFactory(aspectDefinition,
            "advice"));
      AspectManager.instance().addBinding(binding);
View Full Code Here

      Class<?> clazz = loader.loadClass(TestAspect.class.getName());
      assertNotSame(TestAspect.class, clazz);
      assertSame(loader, clazz.getClassLoader());
     
      Aspect aspect = assertInstanceOf(getBean("Aspect"), Aspect.class, false);    
      AspectDefinition def = aspect.getDefinition();
      AspectFactory factory = def.getFactory();
     
      Object global = factory.createPerVM();
      assertSame(getClass().getClassLoader(), global.getClass().getClassLoader());

      AspectFactoryWithClassLoader factoryCl = assertInstanceOf(factory, AspectFactoryWithClassLoader.class);
View Full Code Here

               if (aspects != null && aspects.size() > 0)
               {
                  Iterator it = aspects.iterator();
                  while (it.hasNext())
                  {
                     AspectDefinition def = (AspectDefinition) it.next();
                     if (def instanceof ManagedAspectDefinition)
                     {
                        String name = ((ManagedAspectDefinition)def).getDependentAspectName();
                        if (name != null)
                        {
View Full Code Here

   public abstract boolean isValid();

   @Override
   public void removeAspectDefinition(String name)
   {
      AspectDefinition def = super.internalRemoveAspectDefintion(name);
      if (def != null)
      {
         myPerVMAspects.remove(name);
      }
   }
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

   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)
            {
               aspect = createPerVmAspect(def, adef, null);
            }
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

   public void cleanup()
   {
      //AspectDefinitions have strong links back to us
      for(Iterator it = perInstanceAspectDefinitions.iterator() ; it.hasNext() ; )
      {
         AspectDefinition def = (AspectDefinition)it.next();
         removePerInstanceAspect(def);
         def.unregisterAdvisor(this);
      }
     
      for(Iterator it = perInstanceJoinpointAspectDefinitions.keySet().iterator() ; it.hasNext() ; )
      {
         AspectDefinition def = (AspectDefinition)it.next();
         removePerInstanceJoinpointAspect(def);
         def.unregisterAdvisor(this);
      }

      AspectDefinition[] defs = (AspectDefinition[])adviceInterceptors.keySet().toArray(new AspectDefinition[adviceInterceptors.size()]);
      for(int i = 0 ; i < defs.length ; i++)
      {
View Full Code Here

      internalRemoveAspectDefintion(name);
   }
  
   protected AspectDefinition internalRemoveAspectDefintion(String name)
   {
      AspectDefinition def = (AspectDefinition) aspectDefinitions.remove(name);
      if (def != null)
      {
         def.undeploy();
         if (def.getScope() == Scope.PER_VM) perVMAspects.remove(def.getName());
      }
      return def;
   }
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.