Package org.jboss.aop.advice

Examples of org.jboss.aop.advice.Interceptor


   {
      // TODO we assume there is only one interceptor now.
      Interceptor[] interceptors = advisor.getInterceptors();
      // Step Check for cross references
      for (int i = 0; i < interceptors.length; i++) {
         Interceptor interceptor = interceptors[i];
         if (interceptor instanceof BaseInterceptor) {
               return interceptor;
         }
      }
      return null;
View Full Code Here


         InstanceAdvisor advisor = ((Advised) obj)._getInstanceAdvisor();
         if(advisor == null)
            throw new RuntimeException("_putObject(): InstanceAdvisor is null for: " +obj);

         // Step Check for cross references
         Interceptor interceptor = AopUtil.findCacheInterceptor(advisor);
         // Let's check for object graph, e.g., multiple and circular references first
         if (graphHandler_.objectGraphPut(fqn, interceptor, type, obj)) { // found cross references
            return oldValue;
         }
View Full Code Here

         }

         // Check for Collection field so we need to restore the original reference.
         if(value instanceof ClassProxy)
         {
            Interceptor interceptor = CollectionInterceptorUtil.getInterceptor((ClassProxy)value);
            Object ori = ((AbstractCollectionInterceptor)interceptor).getOriginalInstance();
            try {
               field.set(result, ori);
            } catch (IllegalAccessException e) {
               throw new CacheException("field access failed", e);
            }
         }
      }

      // batch remove
      cache_.removeData(fqn);

      // Determine if we want to keep the interceptor for later use.
      if(removeCacheInterceptor) {
         CacheInterceptor interceptor = (CacheInterceptor) AopUtil.findCacheInterceptor(advisor);
         // Remember to remove the interceptor from in-memory object but make sure it belongs to me first.
         if (interceptor != null)
         {
            if (log.isDebugEnabled()) {
               log.debug("regularRemoveObject(): removed cache interceptor fqn: " + fqn + " interceptor: "+interceptor);
            }
            advisor.removeInterceptor(interceptor.getName());
            cache_.addUndoInterceptor(advisor, interceptor, ModificationEntry.INTERCEPTOR_REMOVE);
         }
      }

   }
View Full Code Here

      if( !(obj instanceof ClassProxy))
      {
         throw new RuntimeException("CollectionClassHandler.collectionRemoveObject(): object is not a proxy :" +obj);
      }

      Interceptor interceptor = CollectionInterceptorUtil.getInterceptor((ClassProxy)obj);
      boolean removeFromCache = true;
      ((AbstractCollectionInterceptor)interceptor).detach(removeFromCache); // detach the interceptor. This will trigger a copy and remove.

      return true;
   }
View Full Code Here

      int interceptorsRemoved = 0;
      if (insertedInterceptors != null)
      {
         for (int i = 0; i < insertedInterceptors.size(); i++)
         {
            Interceptor interceptor = insertedInterceptors.get(i);
            if (interceptor.getName().equals(name))
            {
               ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
               newList.addAll(insertedInterceptors);
               newList.remove(i);
               insertedInterceptors = newList;
               interceptorsRemoved ++;
            }
         }
      }
      if (appendedInterceptors != null)
      {
         for (int i = 0; i < appendedInterceptors.size(); i++)
         {
            Interceptor interceptor = appendedInterceptors.get(i);
            if (interceptor.getName().equals(name))
            {
               ArrayList<Interceptor> newList = new ArrayList<Interceptor>();
               newList.addAll(appendedInterceptors);
               newList.remove(i);
               appendedInterceptors = newList;
View Full Code Here

      }
      int interceptorsAdded = 0;
      for (InterceptorFactory factory : stack.getInterceptorFactories())
      {
         if (!factory.isDeployed()) continue;
         Interceptor interceptor = factory.create(classAdvisor, null);
         if (interceptor == null)
         {
            continue;
         }
         insertInterceptor(interceptor);
View Full Code Here

      }
      int interceptorsAdded = 0;
      for (InterceptorFactory factory : stack.getInterceptorFactories())
      {
         if (!factory.isDeployed()) continue;
         Interceptor interceptor = factory.create(classAdvisor, null);
         if (interceptor == null)
         {
            continue;
         }
         appendInterceptor(interceptor);
View Full Code Here

      }
      int interceptorsRemoved = 0;
      for (InterceptorFactory factory : stack.getInterceptorFactories())
      {
         if (!factory.isDeployed()) continue;
         Interceptor interceptor = factory.create(classAdvisor, null);
         if (interceptor != null)
         {
            interceptorsRemoved += internalRemoveInterceptor(interceptor.getName());
         }
      }
      if (interceptorChainObserver != null)
      {
         this.interceptorChainObserver.instanceInterceptorsRemoved(this, interceptorsRemoved);
View Full Code Here

         {
            throw new RuntimeException("Before/After/Throwing is only supported for Generated Advisors");
         }
         if (factories[i].isDeployed())
         {
            Interceptor interceptor = factories[i].create(this, joinpoint);
            if (interceptor != null)
            {
               newinterceptors.add(interceptor);
            }
         }
View Full Code Here

      try
      {
         // Do lifecycle callbacks
         List<Class<?>> lifecycleInterceptorClasses = beanContainer.getInterceptorRegistry().getLifecycleInterceptorClasses();
         Advisor advisor = getAdvisor();
         Interceptor interceptors[] = LifecycleCallbacks.createLifecycleCallbackInterceptors(advisor, lifecycleInterceptorClasses, beanContext, callbackAnnotationClass);
        
         Constructor<?> constructor = beanClass.getConstructor();
         Object initargs[] = null;
         ConstructionInvocation invocation = new ConstructionInvocation(interceptors, constructor, initargs);
         invocation.setAdvisor(advisor);
View Full Code Here

TOP

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

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.