コード例 #1
0
 public ConstructionInfo(Class<?> clazz, int index, long constructorHash, Advisor advisor) {
   super(advisor, clazz);
   try {
     this.index = index;
     this.constructor = MethodHashing.findConstructorByHash(clazz, constructorHash);
     this.setAdvisor(advisor);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
コード例 #2
0
  /**
   * Invoke a method on the virtual EJB bean. The method must be one of the methods defined in one
   * of the business interfaces (or home interface) of the bean.
   *
   * <p>TODO: work in progress
   *
   * @param factory the originating end point
   * @param id unique identifier (primary key), can be null for stateless
   * @param method the business or home method to invoke
   * @param args the arguments for the method
   * @param provider for asynchronous usage
   * @deprecated Use "invoke" as defined by InvokableContext
   */
  @Deprecated
  public Object invoke(SessionProxyFactory factory, Object id, Method method, Object args[])
      throws Throwable {
    ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
    pushEnc();
    try {
      long hash = MethodHashing.calculateHash(method);
      MethodInfo info = getAdvisor().getMethodInfo(hash);
      if (info == null) {
        throw new RuntimeException(
            "Could not resolve beanClass method from proxy call: " + method.toString());
      }

      // Handled now by SessionSpecContainer
      // Method unadvisedMethod = info.getUnadvisedMethod();
      //         if (unadvisedMethod != null && isHomeMethod(unadvisedMethod))
      //         {
      //            return invokeHomeMethod(factory, info, args);
      //         }
      //         else if (unadvisedMethod != null && isEJBObjectMethod(unadvisedMethod))
      //         {
      //            return invokeEJBObjectMethod(factory, id, info, args);
      //         }

      // FIXME: Ahem, stateful container invocation works on all.... (violating contract though)
      StatefulContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
      // StatefulSessionContainerMethodInvocation nextInvocation = new
      // StatefulSessionContainerMethodInvocation(info,null);
      // EJBContainerInvocation nextInvocation = new StatefulContainerInvocation(info, id);
      nextInvocation.setAdvisor(getAdvisor());
      nextInvocation.setArguments(args);

      // allow a container to supplement information into an invocation
      nextInvocation = populateInvocation(nextInvocation);

      return nextInvocation.invokeNext();
    } finally {
      Thread.currentThread().setContextClassLoader(oldLoader);
      popEnc();
    }
  }