Examples of interceptor()


Examples of dynaop.Aspects.interceptor()

     * @param containerLoader the container loader.
     * @return the dynamically generated proxy.
     */
    static PicoContainer create(ContainerLoader containerLoader) {
        Aspects aspects = new Aspects();
        aspects.interceptor(Pointcuts.ALL_CLASSES, Pointcuts.ALL_METHODS, new PicoContainerProxy(containerLoader));
        aspects.interfaces(Pointcuts.ALL_CLASSES, new Class[]{PicoContainer.class});
        return (PicoContainer) ProxyFactory.getInstance(aspects).wrap(new Object());
    }

    public Object intercept(Invocation invocation) throws Throwable {
View Full Code Here

Examples of dynaop.Aspects.interceptor()

    AccessManager manager = new AccessManagerImpl(aclStore);
    MethodAccessManager methodAccessManager = new MethodAccessManagerImpl(manager, methodStore);

    // The we setup our aop to wrap objects
    Aspects aspects = new Aspects();
    aspects.interceptor(Pointcuts.instancesOf(SecureObject.class),
        Pointcuts.ALL_METHODS, new AccessInterceptor(methodAccessManager));

    ProxyFactory proxyFactory = ProxyFactory.getInstance(aspects);

    System.out.println("Setting our subject to \"We\" with empty principals.");
View Full Code Here

Examples of dynaop.Aspects.interceptor()

    this.callAccessManager = mock(MethodAccessManager.class);
  }

  public void testAnnotateWithMixin() {
    Aspects aspects = new Aspects();
    aspects.interceptor(Pointcuts.instancesOf(SecureObject.class),
        Pointcuts.ALL_METHODS, new AccessInterceptor((MethodAccessManager) callAccessManager.proxy()));
    aspects.mixin(Pointcuts.instancesOf(SecureObject.class),
        OwnableMixin.class, new Closure() {
          public void execute(Object o) {
          }
View Full Code Here

Examples of org.easetech.easytest.annotation.Duration.interceptor()

            if (interceptor != null) {
                provideProxyWrapperFor(interceptor.interceptor(), null, field, testInstance);
            } else {
                Duration duration = field.getAnnotation(Duration.class);
                if (duration != null) {
                    provideProxyWrapperFor(duration.interceptor(), duration.timeInMillis(), field, testInstance);
                }
            }

        }
    }
View Full Code Here

Examples of org.easetech.easytest.annotation.Intercept.interceptor()

        protected void instrumentClass(Class<?> testClass) throws IllegalArgumentException, IllegalAccessException, AopConfigException, InstantiationException{
            Field[] fields = testClass.getFields();
            for(Field field : fields){
                Intercept interceptor = field.getAnnotation(Intercept.class);
                if(interceptor != null){
                    Class<? extends MethodInterceptor> interceptorClass = interceptor.interceptor();
                    //This is the field we want to enhance
                    Object fieldInstance = field.get(testInstance);
                    ProxyFactory factory = new ProxyFactory();
                    factory.setTarget(fieldInstance);
                    factory.addAdvice(interceptorClass.newInstance());
View Full Code Here

Examples of org.easetech.easytest.annotation.Intercept.interceptor()

        protected void instrumentClass(Class<?> testClass) throws IllegalArgumentException, IllegalAccessException, AopConfigException, InstantiationException{
            Field[] fields = testClass.getFields();
            for(Field field : fields){
                Intercept interceptor = field.getAnnotation(Intercept.class);
                if(interceptor != null){
                    Class<? extends MethodInterceptor> interceptorClass = interceptor.interceptor();
                    //This is the field we want to enhance
                    Object fieldInstance = field.get(testInstance);
                    ProxyFactory factory = new ProxyFactory();
                    factory.setTarget(fieldInstance);
                    factory.addAdvice(interceptorClass.newInstance());
View Full Code Here

Examples of org.hibernate.SessionBuilder.interceptor()

    if ( session == null ) {
      SessionBuilder sessionBuilder = getEntityManagerFactory().getSessionFactory().withOptions();
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instanciate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
View Full Code Here

Examples of org.hibernate.SessionBuilder.interceptor()

    if ( session == null ) {
      SessionBuilder sessionBuilder = getEntityManagerFactory().getSessionFactory().withOptions();
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instanciate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
View Full Code Here

Examples of org.hibernate.SessionBuilder.interceptor()

    if ( session == null ) {
      SessionBuilder sessionBuilder = getEntityManagerFactory().getSessionFactory().withOptions();
      if (sessionInterceptorClass != null) {
        try {
          Interceptor interceptor = (Interceptor) sessionInterceptorClass.newInstance();
          sessionBuilder.interceptor( interceptor );
        }
        catch (InstantiationException e) {
          throw new PersistenceException("Unable to instanciate session interceptor: " + sessionInterceptorClass, e);
        }
        catch (IllegalAccessException e) {
View Full Code Here

Examples of org.hibernate.SessionBuilder.interceptor()

    ImplementingSession session = mock(ImplementingSession.class);
    SessionBuilder options = mock(SessionBuilder.class);
    Transaction tx = mock(Transaction.class);

    given(sf.withOptions()).willReturn(options);
    given(options.interceptor(entityInterceptor)).willReturn(options);
    given(options.openSession()).willReturn(session);
    given(session.beginTransaction()).willReturn(tx);
    given(session.isOpen()).willReturn(true);
    given(session.isConnected()).willReturn(true);
    given(session.connection()).willReturn(con);
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.