Examples of InterceptorFactory


Examples of com.buschmais.cdo.impl.interceptor.InterceptorFactory

        this.metadataProvider = metadataProvider;
        this.datastoreSession = datastoreSession;
        this.entityCache = new TransactionalCache<>();
        this.relationCache = new TransactionalCache<>();
        this.cdoTransaction = new CdoTransactionImpl(datastoreSession.getDatastoreTransaction());
        this.interceptorFactory = new InterceptorFactory(cdoTransaction, defaultTransactionAttribute, concurrencyMode);
        this.proxyFactory = new ProxyFactory(interceptorFactory, classLoader);
        this.instanceListenerService = new InstanceListenerService(instanceListenerTypes);
        this.entityPropertyManager = new EntityPropertyManager<>(this);
        this.relationPropertyManager = new RelationPropertyManager<>(this);
        this.relationInstanceManager = new RelationInstanceManager<>(this);
View Full Code Here

Examples of com.buschmais.xo.spi.interceptor.InterceptorFactory

        }
        Class<XODatastoreProvider> delegateProviderType = ClassHelper.getType(delegateProviderName);
        XODatastoreProvider<EntityMetadata, EntityDiscriminator, RelationMetadata, RelationDiscriminator> delegateProvider = ClassHelper.newInstance(delegateProviderType);
        Datastore<?, EntityMetadata, EntityDiscriminator, RelationMetadata, RelationDiscriminator> delegateDatastore = delegateProvider.createDatastore(xoUnit);
        TraceMonitor traceMonitor = new TraceMonitor(xoUnit);
        InterceptorFactory interceptorFactory = new InterceptorFactory(Arrays.asList(new TraceMonitorInterceptor(traceMonitor)));
        return new TraceDatastore<>(interceptorFactory.addInterceptor(delegateDatastore, Datastore.class), interceptorFactory, traceMonitor);
    }
View Full Code Here

Examples of dynaop.InterceptorFactory

    public void testCreate() throws Throwable {
        Mock methodInterceptorMock = mock(MethodInterceptor.class);

        pico.registerComponentInstance("interceptorComponentKey", methodInterceptorMock.proxy());

        InterceptorFactory interceptorFactory = new ContainerSuppliedInterceptorFactory(pico, "interceptorComponentKey");
        Interceptor interceptor = interceptorFactory.create(null);
        assertNotNull(interceptor);

        // verify that the dynaop interceptor delegates to the MethodInterceptor
        // in the container:
        methodInterceptorMock.expects(once()).method("invoke");
View Full Code Here

Examples of dynaop.InterceptorFactory

        interceptor.intercept(null);
    }

    public void testInterceptorNotFoundInContainer() {
        MutablePicoContainer container = new DefaultPicoContainer();
        InterceptorFactory interceptorFactory = new ContainerSuppliedInterceptorFactory(container,
                "interceptorComponentKey");
        try {
            interceptorFactory.create(null);
            fail("NullPointerException should have been raised");
        } catch (NullPointerException e) {
        }
    }
View Full Code Here

Examples of dynaop.InterceptorFactory

        } catch (NullPointerException e) {
        }
    }

    public void testPropertiesNotNull() {
        InterceptorFactory interceptorFactory = new ContainerSuppliedInterceptorFactory(pico, "interceptorComponentKey");
        assertNotNull(interceptorFactory.getProperties());
    }
View Full Code Here

Examples of org.jboss.aop.advice.InterceptorFactory

   }

   @Override
   public InterceptorFactory getInterceptorFactory(String name)
   {
      InterceptorFactory factory = null;
      if (parentFirst)
      {
         factory = parent.getInterceptorFactory(name);
         if (factory != null) return factory;
      }
View Full Code Here

Examples of org.jboss.aop.advice.InterceptorFactory

         {
            Element interceptorElement = (Element) children2.item(j);
            String tag2 = interceptorElement.getTagName();
            if (tag2.equals("interceptor"))
            {
               InterceptorFactory factory = deployInterceptor(interceptorElement);
               interceptors.add(factory);
            }
            else if (tag2.equals("interceptor-ref"))
            {
               String iname = interceptorElement.getAttribute("name");
               if (iname == null) throw new RuntimeException("interceptor-ref has null name attribute");
               InterceptorFactory factory = manager.getInterceptorFactory(iname);
               if (factory == null) throw new RuntimeException("unable to resolve interceptor-ref: " + iname);
               interceptors.add(factory);
            }
            else if (tag2.equals("stack-ref"))
            {
               String name = interceptorElement.getAttribute("name");
               AdviceStack stack = manager.getAdviceStack(name);
               if (stack == null) throw new Exception("there is no <stack> defined for name: " + name);
               interceptors.addAll(stack.getInterceptorFactories());
            }
            else
            {
               AdviceType type = null;
               if (!tag2.equals("advice"))
               {
                  try
                  {
                     type = Enum.valueOf(AdviceType.class, tag2.toUpperCase());
                  }
                  catch (IllegalArgumentException e)
                  {
                     StringBuffer message = new StringBuffer();
                     message.append("unexpected tag inside binding: \'");
                     message.append(tag2);
                     message.append("\'\n\t\t\t\t\t   should be one of: \n\t\t\t\t\t\t'interceptor\', \n\t\t\t\t\t\t'interceptor-ref\', \n\t\t\t\t\t\t'advice\', \n\t\t\t\t\t\t'");
                     for (AdviceType adviceType : AdviceType.values())
                     {
                        message.append(adviceType.getName());
                        message.append("\', \n\t\t\t\t\t\t'");
                     }
                     message.append("stack-ref\'.\n");
                     throw new RuntimeException(message.toString());
                  }
               }
               InterceptorFactory factory = deployAdvice(interceptorElement, type);
               interceptors.add(factory);
            }
         }
      }
      return interceptors;
View Full Code Here

Examples of org.jboss.ejb3.interceptors.InterceptorFactory

        
         InterceptorFactoryRef interceptorFactoryRef = (InterceptorFactoryRef) advisor.resolveAnnotation(InterceptorFactoryRef.class);
         if(interceptorFactoryRef == null)
            throw new IllegalStateException("No InterceptorFactory specified on " + advisor.getName());
         log.debug("interceptor factory class = " + interceptorFactoryRef.value());
         InterceptorFactory interceptorFactory = interceptorFactoryRef.value().newInstance();
        
         Map<Class<?>, Object> interceptors = new HashMap<Class<?>, Object>();
        
         Map<Class<? extends Annotation>, List<Interceptor>> lifeCycleInterceptors = new HashMap<Class<? extends Annotation>, List<Interceptor>>();
         for(Class<? extends Annotation> lifeCycleAnnotationClass : lifeCycleAnnotationClasses)
         {
            List<Interceptor> list = new ArrayList<Interceptor>();
            lifeCycleInterceptors.put(lifeCycleAnnotationClass, list);
         }
        
         DefaultInterceptors defaultInterceptorsAnnotation = (DefaultInterceptors) advisor.resolveAnnotation(DefaultInterceptors.class);
         List<BusinessMethodInterceptorMethodInterceptor> defaultInterceptors = new ArrayList<BusinessMethodInterceptorMethodInterceptor>();
         if(defaultInterceptorsAnnotation != null)
            createInterceptors(advisor, interceptorFactory, defaultInterceptorsAnnotation.value(), defaultInterceptors, interceptors, lifeCycleInterceptors);
        
         log.debug("Found class interceptors " + defaultInterceptors);
         // Default Interceptors
         instanceAdvisor.getMetaData().addMetaData(InterceptorsFactory.class, "defaultInterceptors", defaultInterceptors);
        
         Interceptors interceptorsAnnotation = (Interceptors) advisor.resolveAnnotation(Interceptors.class);
         List<BusinessMethodInterceptorMethodInterceptor> classInterceptors = new ArrayList<BusinessMethodInterceptorMethodInterceptor>();
         if(interceptorsAnnotation != null)
            createInterceptors(advisor, interceptorFactory, interceptorsAnnotation.value(), classInterceptors, interceptors, lifeCycleInterceptors);
        
         log.debug("Found class interceptors " + classInterceptors);
         // Class Interceptors
         instanceAdvisor.getMetaData().addMetaData(InterceptorsFactory.class, "classInterceptors", classInterceptors);
        
         Class<?> beanClass = advisor.getClazz();
         List<Interceptor> beanInterceptors = new ArrayList<Interceptor>();
         for(Method beanMethod : ClassHelper.getAllMethods(beanClass))
         {
            interceptorsAnnotation = (Interceptors) advisor.resolveAnnotation(beanMethod, Interceptors.class);
            if(interceptorsAnnotation != null)
            {
               List<Interceptor> businessMethodInterceptors = new ArrayList<Interceptor>();
               // TODO: use visitors?
               for(Class<?> interceptorClass : interceptorsAnnotation.value())
               {
                  Object interceptor = interceptors.get(interceptorClass);
                  if(interceptor == null)
                  {
                     interceptor = interceptorFactory.create(advisor, interceptorClass);
                     interceptors.put(interceptorClass, interceptor);
                  }
                  //Advisor interceptorAdvisor = ((Advised) interceptor)._getAdvisor();
                  //Advisor interceptorAdvisor = advisor.getManager().getAdvisor(interceptorClass);
                  ExtendedAdvisor interceptorAdvisor = ExtendedAdvisorHelper.getExtendedAdvisor(advisor, interceptor);
View Full Code Here

Examples of org.jboss.invocation.InterceptorFactory

                }
                serviceBuilder.addDependency(ContextNames.GLOBAL_CONTEXT_SERVICE_NAME, NamingStore.class, globalInjector);
                serviceBuilder.addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, NamingStore.class, jbossInjector);
            }
        });
        final InterceptorFactory interceptorFactory = new ImmediateInterceptorFactory(new NamespaceContextInterceptor(selector, context.getServiceTarget()));
        configuration.addPostConstructInterceptor(interceptorFactory, InterceptorOrder.ComponentPostConstruct.JNDI_NAMESPACE_INTERCEPTOR);
        configuration.addPreDestroyInterceptor(interceptorFactory, InterceptorOrder.ComponentPreDestroy.JNDI_NAMESPACE_INTERCEPTOR);
        if(description.isPassivationApplicable()) {
            configuration.addPrePassivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.JNDI_NAMESPACE_INTERCEPTOR);
            configuration.addPostActivateInterceptor(interceptorFactory, InterceptorOrder.ComponentPassivation.JNDI_NAMESPACE_INTERCEPTOR);
View Full Code Here

Examples of org.jboss.invocation.InterceptorFactory

    public boolean isOptional() {
        return false;
    }

    private static InterceptorFactory weaved(final Collection<InterceptorFactory> interceptorFactories) {
        return new InterceptorFactory() {
            @Override
            public Interceptor create(InterceptorFactoryContext context) {
                final Interceptor[] interceptors = new Interceptor[interceptorFactories.size()];
                final Iterator<InterceptorFactory> factories = interceptorFactories.iterator();
                for (int i = 0; i < interceptors.length; i++) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.