Package org.jboss.aop.joinpoint

Examples of org.jboss.aop.joinpoint.MethodInvocation


         // Cast
         assert invocation instanceof MethodInvocation : AOPBasedSingletonContainer.class.getName()
               + ".dynamicInoke supports only " + MethodInvocation.class.getSimpleName() + ", but has been passed: "
               + invocation.getClass();
  
         MethodInvocation methodInvocation = (MethodInvocation) invocation;
  
         // Get the method hash
         long methodHash = methodInvocation.getMethodHash();
         if (logger.isTraceEnabled())
         {
            logger.trace("Received dynamic invocation for method with hash: " + methodHash);
         }
  
         // Get the Method via MethodInfo from the Advisor
         Advisor advisor = this.getAdvisor();
         MethodInfo methodInfo = advisor.getMethodInfo(methodHash);
  
         // create a container invocation
         AOPBasedContainerInvocation containerInvocation = new AOPBasedContainerInvocation(methodInfo,
               methodInvocation.getArguments());
         try
         {
            // TODO: This is legacy code copied from StatelessContainer/SessionSpecContainer of ejb3-core
            // Get the invoked method from invocation metadata
            Object objInvokedMethod = invocation.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,
View Full Code Here


         // Cast
         assert invocation instanceof MethodInvocation : SessionContainer.class.getName()
               + ".dynamicInoke supports only " + MethodInvocation.class.getSimpleName()
               + ", but has been passed: " + invocation;
         MethodInvocation si = (MethodInvocation) invocation;

         // Get the method hash
         long methodHash = si.getMethodHash();
         log.debug("Received dynamic invocation for method with hash: " + methodHash);

         // Get the Method via MethodInfo from the Advisor
         Advisor advisor = this.getAdvisor();
         MethodInfo info = advisor.getMethodInfo(methodHash);
         Method unadvisedMethod = info.getMethod();
         SerializableMethod unadvisedMethodSerializable = new SerializableMethod(unadvisedMethod);
        
         try
         {
            invokeStats.callIn();
           
            /*
             * Set the invoked method
             */
            //TODO Remove when CurrentInvocation is ironed out
           
            // Get the invoked method from invocation metadata
            Object objInvokedMethod = si.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,SessionSpecRemotingMetadata.KEY_INVOKED_METHOD);
            assert objInvokedMethod !=null : "Invoked Method must be set on invocation metadata";
            assert objInvokedMethod instanceof SerializableMethod : "Invoked Method set on invocation metadata is not of type " + SerializableMethod.class.getName() + ", instead: " + objInvokedMethod;
            SerializableMethod invokedMethod = (SerializableMethod)objInvokedMethod;
           
            Class<?> invokedBusinessInterface = Class.forName(invokedMethod.getActualClassName(), false, this
                  .getClassloader());
            if (!this.getBusinessInterfaces().contains(invokedBusinessInterface))
            {
               // Required because SerializableMethod will automatically set the actual class name to the declaring class name
               invokedBusinessInterface = null;
            }

            Map responseContext = null;
            Object rtn = null;
            if (unadvisedMethod != null && isHomeMethod(unadvisedMethodSerializable))
            {
               rtn = invokeHomeMethod(info, si);
            }
            else if (info != null && unadvisedMethod != null && isEjbObjectMethod(unadvisedMethodSerializable))
            {
               rtn = invokeEJBObjectMethod(info, si);
            }
            else
            {

               newSi = new SessionContainerInvocation<StatelessContainer, StatelessBeanContext>(
                     invokedBusinessInterface, info, this.getAsynchronousExecutor());
               newSi.setArguments(si.getArguments());
               newSi.setMetaData(si.getMetaData());
               //newSi.setAdvisor(getAdvisor());              
              
               try
               {
                  rtn = newSi.invokeNext();
View Full Code Here

       *
       * This is going to be intercepted by the Container's "dynamicInvoke"
       * because the Container itself will be registered w/ Remoting Dispatcher
       * via ProxyTestClassProxyHack
       */
      MethodInvocation sri = new StatefulRemoteInvocation(this.getInterceptors(), hash, dynamicInvokeMethod,
            dynamicInvokeMethod, null, this.getSessionId());

      // Manually add metadata for invoked method
      sri.getMetaData().addMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,
            SessionSpecRemotingMetadata.KEY_INVOKED_METHOD, serializableMethod, PayloadKey.AS_IS);

      return sri;
   }
View Full Code Here

      long start = System.currentTimeMillis();

      ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
      StatefulContainerInvocation newSi = null;

      MethodInvocation si = (MethodInvocation) invocation;
      MethodInfo info = getAdvisor().getMethodInfo(si.getMethodHash());
      Method method = info.getUnadvisedMethod();
      try
      {
         invokeStats.callIn();

         Thread.currentThread().setContextClassLoader(classloader);

         if (info == null)
         {
            throw new RuntimeException("Could not resolve beanClass method from proxy call");
         }
         newSi = new StatefulContainerInvocation(info, null, null, this.getDeployment().getAsynchronousProcessor());
         newSi.setArguments(si.getArguments());
         newSi.setMetaData(si.getMetaData());
         newSi.setAdvisor(getAdvisor());

         newSi = populateInvocation(newSi);

         Object rtn = null;
View Full Code Here

   {
      // Only need to set Method because fields will already have been set.
      if (invocation instanceof MethodInvocation)
      {
         Interceptor[] aspects = null;
         MethodInvocation methodInvocation = (MethodInvocation) invocation;
         long hash = methodInvocation.getMethodHash();
         MethodInfo info = methodInfos.getMethodInfo(hash);
         aspects = info.getInterceptors();
         if (aspects == null) aspects = new Interceptor[0];
         if (target != null && target instanceof Advised)
         {
            InstanceAdvised advised = (InstanceAdvised) target;
            aspects = advised._getInstanceAdvisor().getInterceptors(aspects);
         }
         MethodInvocation nextInvocation = new MethodInvocation(info, aspects);
         nextInvocation.setMetaData(invocation.getMetaData());
         nextInvocation.setTargetObject(target);
         nextInvocation.setArguments(methodInvocation.getArguments());
         nextInvocation.setAdvisor(this);
         InvocationResponse response = new InvocationResponse(nextInvocation.invokeNext());
         response.setContextInfo(nextInvocation.getResponseContextInfo());
         return response;
      }
      throw new RuntimeException("dynamic field invocations not supported yet!");
   }
View Full Code Here

   }

   public RemotableFuture execute(MethodInvocation invocation) throws Exception
   {
      final MethodInvocation copy = (MethodInvocation) invocation.copy();
      final ClassLoader cl = Thread.currentThread().getContextClassLoader();
     
      java.util.concurrent.Future future = executor.submit(new Callable()
      {
         public Object call() throws Exception
         {
            try
            {
               Thread.currentThread().setContextClassLoader(cl);
               return copy.invokeNext();
            }
            catch (Throwable throwable)
            {
               if (throwable instanceof Exception)
               {
View Full Code Here

         return null;
      }
     
      Interceptor[] interceptors = instanceAdvisor.getInterceptors();
      long hash = MethodHashing.calculateHash(method);
      MethodInvocation invocation = new MethodInvocation(interceptors, hash, method, method, null);
      invocation.setInstanceResolver(instanceAdvisor.getMetaData());
      invocation.setArguments(args);
      return invocation.invokeNext();
   }
View Full Code Here

      // Cast
      assert invocation instanceof MethodInvocation : AOPBasedSingletonContainer.class.getName()
            + ".dynamicInoke supports only " + MethodInvocation.class.getSimpleName() + ", but has been passed: "
            + invocation.getClass();

      MethodInvocation methodInvocation = (MethodInvocation) invocation;

      // Get the method hash
      long methodHash = methodInvocation.getMethodHash();
      if (logger.isTraceEnabled())
      {
         logger.trace("Received dynamic invocation for method with hash: " + methodHash);
      }

      // Get the Method via MethodInfo from the Advisor
      Advisor advisor = this.getAdvisor();
      MethodInfo methodInfo = advisor.getMethodInfo(methodHash);

      // create a container invocation
      AOPBasedContainerInvocation containerInvocation = new AOPBasedContainerInvocation(methodInfo,
            methodInvocation.getArguments());
      try
      {
         // TODO: This is legacy code copied from StatelessContainer/SessionSpecContainer of ejb3-core
         // Get the invoked method from invocation metadata
         Object objInvokedMethod = invocation.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,
View Full Code Here

    */
   protected JBossMessageEndpointFactory getMessageEndpointFactory(Invocation invocation)
   {
      if (endpointFactory == null)
      {
         MethodInvocation mi = (MethodInvocation)invocation;
         endpointFactory = (JBossMessageEndpointFactory) mi.getResponseAttachment(MESSAGE_ENDPOINT_FACTORY);
      }
      return endpointFactory;
   }
View Full Code Here

         // Cast
         assert invocation instanceof MethodInvocation : AOPBasedSingletonContainer.class.getName()
               + ".dynamicInoke supports only " + MethodInvocation.class.getSimpleName() + ", but has been passed: "
               + invocation.getClass();
  
         MethodInvocation methodInvocation = (MethodInvocation) invocation;
  
         // Get the method hash
         long methodHash = methodInvocation.getMethodHash();
         if (logger.isTraceEnabled())
         {
            logger.trace("Received dynamic invocation for method with hash: " + methodHash);
         }
  
         // Get the Method via MethodInfo from the Advisor
         Advisor advisor = this.getAdvisor();
         MethodInfo methodInfo = advisor.getMethodInfo(methodHash);
  
         // create a container invocation
         AOPBasedContainerInvocation containerInvocation = new AOPBasedContainerInvocation(methodInfo,
               methodInvocation.getArguments());
         try
         {
            // TODO: This is legacy code copied from StatelessContainer/SessionSpecContainer of ejb3-core
            // Get the invoked method from invocation metadata
            Object objInvokedMethod = invocation.getMetaData(SessionSpecRemotingMetadata.TAG_SESSION_INVOCATION,
                  SessionSpecRemotingMetadata.KEY_INVOKED_METHOD);
            assert objInvokedMethod != null : "Invoked Method must be set on invocation metadata";
            assert objInvokedMethod instanceof SerializableMethod : "Invoked Method set on invocation metadata is not of type "
                  + SerializableMethod.class.getName() + ", instead: " + objInvokedMethod;
            SerializableMethod invokedMethod = (SerializableMethod) objInvokedMethod;

            // set the AOP metadata
            containerInvocation.setMetaData(methodInvocation.getMetaData());
  
            // pass the control to the simple singleton container
            Object result = this.delegate.invoke(containerInvocation);
  
            // create an InvocationResponse out of the result
View Full Code Here

TOP

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

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.