Package org.jboss.aop.joinpoint

Examples of org.jboss.aop.joinpoint.Invocation


      return getTxType(invocation.getAdvisor(), ((MethodInvocation) invocation).getActualMethod());
   }

   public static UserTransaction getUserTransaction(BeanContext<?> ctx)
   {
      Invocation invocation = CurrentInvocation.getCurrentInvocation();
     
      // TODO: these checks are real ugly
      // getUserTransaction is not allowed during construction and injection EJB 3 4.4.1 and EJB 3 4.5.2
      // We're constructing the bean
      if(invocation == null)
         throw new IllegalStateException("It's not allowed to get the UserTransaction during construction and injection " + ctx);
      // Is construction happening from within another bean?
      if(ctx.getInstance() != invocation.getTargetObject())
         throw new IllegalStateException("It's not allowed to get the UserTransaction during construction and injection " + ctx);
     
      Advisor advisor = invocation.getAdvisor();
      TransactionManagementType type = TxUtil.getTransactionManagementType(advisor);
      if (type != TransactionManagementType.BEAN) throw new IllegalStateException("Container " + advisor.getName() + ": it is illegal to inject UserTransaction into a CMT bean");

      return new UserTransactionImpl();  
   }
View Full Code Here


         {
            initParameterTypes = unadvisedMethod.getParameterTypes();
            initParameterValues = statefulInvocation.getArguments();
         }

         Invocation invocation = invokeInit(statefulInvocation.getMetaData(), unadvisedMethod, sessionId, initParameterTypes, initParameterValues);
        
         // Get JNDI Registrar
         JndiSessionRegistrarBase sfsbJndiRegistrar = this.getJndiRegistrar();

         // Determine if local/remote
         boolean isLocal = EJBLocalObject.class.isAssignableFrom(unadvisedMethod.getDeclaringClass());

         // Get the metadata
         JBossSessionBeanMetaData smd = this.getMetaData();

         // Get the appropriate JNDI Name
         String jndiName = isLocal ? smd.getLocalJndiName() : smd.getJndiName();

         // Find the Proxy Factory Key for this SFSB
         String proxyFactoryKey = sfsbJndiRegistrar.getProxyFactoryRegistryKey(jndiName, smd, isLocal);

         // Lookup the Proxy Factory in the Object Store
         StatefulSessionProxyFactory proxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey,
               StatefulSessionProxyFactory.class);

         // Create a new EJB2.x Proxy
         Object proxy = proxyFactory.createProxyEjb2x(sessionId);

         InvocationResponse response = marshallResponse(statefulInvocation, proxy, invocation.getResponseContextInfo());
         response.addAttachment(StatefulConstants.NEW_ID, sessionId);
         return response;
      }
      else if (unadvisedMethod.getName().equals("remove"))
      {
View Full Code Here

         {
            initParameterTypes = unadvisedMethod.getParameterTypes();
            initParameterValues = statefulInvocation.getArguments();
         }

         Invocation invocation = invokeInit(statefulInvocation.getMetaData(), unadvisedMethod, sessionId, initParameterTypes, initParameterValues);
        
         // Get JNDI Registrar
         JndiSessionRegistrarBase sfsbJndiRegistrar = this.getJndiRegistrar();

         // Determine if local/remote
         boolean isLocal = EJBLocalObject.class.isAssignableFrom(unadvisedMethod.getDeclaringClass());

         // Get the metadata
         JBossSessionBeanMetaData smd = this.getMetaData();

         // Get the appropriate JNDI Name
         String jndiName = isLocal ? smd.getLocalJndiName() : smd.getJndiName();

         // Find the Proxy Factory Key for this SFSB
         String proxyFactoryKey = sfsbJndiRegistrar.getProxyFactoryRegistryKey(jndiName, smd, isLocal);

         // Lookup the Proxy Factory in the Object Store
         StatefulSessionProxyFactory proxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey,
               StatefulSessionProxyFactory.class);

         // Create a new EJB2.x Proxy
         Object proxy = proxyFactory.createProxyEjb2x(sessionId);

         InvocationResponse response = marshallResponse(statefulInvocation, proxy, invocation.getResponseContextInfo());
         response.addAttachment(StatefulConstants.NEW_ID, sessionId);
         return response;
      }
      else if (unadvisedMethod.getName().equals("remove"))
      {
View Full Code Here

    @return
    */
   public static ContainerMethodInvocation getCurrentInvocation()
   {
      // Obtain current invocation
      Invocation currentInvocation = CurrentInvocation.getCurrentInvocation();

      // Cast and return
      try
      {
         return ContainerMethodInvocation.class.cast(currentInvocation);
      }
      catch (ClassCastException cce)
      {
         throw new RuntimeException("Current invocation is not of type " + ContainerMethodInvocation.class.getName()
               + " but instead is " + currentInvocation.getClass().getName(), cce);
      }
   }
View Full Code Here

         {
            initParameterTypes = unadvisedMethod.getParameterTypes();
            initParameterValues = statefulInvocation.getArguments();
         }

         Invocation invocation = invokeInit(statefulInvocation.getMetaData(), unadvisedMethod, sessionId, initParameterTypes, initParameterValues);
        
         // Get JNDI Registrar
         JndiSessionRegistrarBase sfsbJndiRegistrar = this.getJndiRegistrar();

         // Determine if local/remote
         boolean isLocal = EJBLocalObject.class.isAssignableFrom(unadvisedMethod.getDeclaringClass());

         // Get the metadata
         JBossSessionBeanMetaData smd = this.getMetaData();

         // Get the appropriate JNDI Name
         String jndiName = isLocal ? smd.getLocalJndiName() : smd.getJndiName();

         // Find the Proxy Factory Key for this SFSB
         String proxyFactoryKey = sfsbJndiRegistrar.getProxyFactoryRegistryKey(jndiName, smd, isLocal);

         // Lookup the Proxy Factory in the Object Store
         StatefulSessionProxyFactory proxyFactory = Ejb3RegistrarLocator.locateRegistrar().lookup(proxyFactoryKey,
               StatefulSessionProxyFactory.class);

         // Create a new EJB2.x Proxy
         Object proxy = proxyFactory.createProxyEjb2x(sessionId);

         InvocationResponse response = marshallResponse(statefulInvocation, proxy, invocation.getResponseContextInfo());
         response.addAttachment(StatefulConstants.NEW_ID, sessionId);
         return response;
      }
      else if (unadvisedMethod.getName().equals("remove"))
      {
View Full Code Here

      // Get the existing SecurityContext
      final SecurityContext sc = SecurityActions.getSecurityContext();

      // Copy the invocation (must be done for Thread safety, as we spawn this off and
      // subsequent calls can mess with the internal interceptor index
      final Invocation nextInvocation = invocation.copy();

      // Make the asynchronous task from the invocation
      final Callable<Object> asyncTask = new AsyncInvocationTask<Object>(nextInvocation, sc);

      // Short-circuit the invocation into new Thread
View Full Code Here

    * Deregisters the current invocation
    */
   static void deregisterCurrentInvocation()
   {
      // Pop
      Invocation current = CurrentInvocation.getRegistry().pop();

      // Log and pop
      logger
            .trace("Cleared Thread " + Thread.currentThread().toString() + " of association with Invocation " + current);
   }
View Full Code Here

      return invocation.invokeNext();
   }
  
   protected Object invokeLocal(Invocation invocation, Container container) throws Throwable
   {
      Invocation copy = marshallOrPass(invocation, Invocation.class);
      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS);
      try
      {
         // Invoke upon the container
         SessionContainer sc = (SessionContainer) container;
         InvocationResponse response = sc.dynamicInvoke(copy);
         // it could really have been a copy
         invocation.setResponseContextInfo(response.getContextInfo());
         return marshallOrPass(response.getResponse(), Object.class);
      }
      // TODO: Either Throwable (as it used to be) or Exception (which is better)
      catch(Throwable t)
      {
         throw marshallOrPass(t, Throwable.class);
      }
      finally
      {
         copy.getMetaData().removeMetaData(IS_LOCAL, IS_LOCAL);
      }
   }
View Full Code Here

      throw new RuntimeException("NOT IMPLEMENTED");
   }

   public Invocation copy()
   {
      final Invocation copy = new StatefulRemoteInvocation(this.interceptors, this.methodHash, this.advisedMethod,
            this.unadvisedMethod, this.advisor, this.id);
      copy.setMetaData(this.getMetaData());
      return copy;
   }
View Full Code Here

      return invocation.invokeNext();
   }
  
   protected Object invokeLocal(Invocation invocation, Container container) throws Throwable
   {
      Invocation copy = (Invocation) new MarshalledObjectForLocalCalls(invocation).get();
      copy.getMetaData().addMetaData(IS_LOCAL, IS_LOCAL, Boolean.TRUE, PayloadKey.AS_IS);
      org.jboss.aop.joinpoint.InvocationResponse response = null;

      /*
       * EJBTHREE-1385
       *
 
View Full Code Here

TOP

Related Classes of org.jboss.aop.joinpoint.Invocation

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.