Package com.caucho.config.gen

Examples of com.caucho.config.gen.ApiClass


   */
  @Override
  public void setEJBClass(Class type) throws ConfigException {
    super.setEJBClass(type);

    ApiClass ejbClass = getEJBClassWrapper();

    if (ejbClass.isAbstract())
      throw error(L
          .l(
             "'{0}' must not be abstract.  Session bean implementations must be fully implemented.",
             ejbClass.getName()));

    if (ejbClass.isAnnotationPresent(Stateless.class)) {
      Stateless stateless = ejbClass.getAnnotation(Stateless.class);

      if (getEJBName() == null && !"".equals(stateless.name()))
        setEJBName(stateless.name());

      _sessionType = Stateless.class;
    } else if (ejbClass.isAnnotationPresent(Stateful.class)) {
      Stateful stateful = ejbClass.getAnnotation(Stateful.class);

      if (getEJBName() == null && !"".equals(stateful.name()))
        setEJBName(stateful.name());

      _sessionType = Stateful.class;
    }

    if (getEJBName() == null)
      setEJBName(ejbClass.getSimpleName());

    /*
     * if (! ejbClass.isAssignableTo(SessionBean.class) && !
     * ejbClass.isAnnotationPresent(Stateless.class) && !
     * ejbClass.isAnnotationPresent(Stateful.class)) throwerror(L.l(
View Full Code Here


  /**
   * Creates the bean generator for the session bean.
   */
  @Override
  protected BeanGenerator createBeanGenerator() {
    ApiClass ejbClass = getEJBClassWrapper();

    fillClassDefaults(ejbClass);

    if (Stateless.class.equals(getSessionType())) {
      _sessionBean = new StatelessGenerator(getEJBName(), ejbClass,
View Full Code Here

   * Obtain and apply initialization from annotations.
   */
  public void initIntrospect() throws ConfigException {
    super.initIntrospect();

    ApiClass type = getEJBClassWrapper();

    // XXX: ejb/0f78
    if (type == null)
      return;

    // ejb/0j20
    if (!type.isAnnotationPresent(Stateful.class)
        && !type.isAnnotationPresent(Stateless.class) && !isAllowPOJO())
      return;

    /*
     * TCK: ejb/0f6d: bean with local and remote interfaces if (_localHome !=
     * null || _localList.size() != 0 || _remoteHome != null ||
     * _remoteList.size() != 0) return;
     */

    ArrayList<ApiClass> interfaceList = new ArrayList<ApiClass>();

    for (ApiClass localApi : type.getInterfaces()) {
      Class javaApi = localApi.getJavaClass();

      Local local = (Local) javaApi.getAnnotation(Local.class);

      if (local != null) {
        setLocalWrapper(localApi);
        continue;
      }

      javax.ejb.Remote remote = (javax.ejb.Remote) javaApi
          .getAnnotation(javax.ejb.Remote.class);

      if (remote != null || java.rmi.Remote.class.isAssignableFrom(javaApi)) {
        setRemoteWrapper(localApi);
        continue;
      }

      if (javaApi.getName().equals("java.io.Serializable"))
        continue;

      if (javaApi.getName().equals("java.io.Externalizable"))
        continue;

      if (javaApi.getName().startsWith("javax.ejb"))
        continue;

      if (javaApi.getName().equals("java.rmi.Remote"))
        continue;

      if (!interfaceList.contains(localApi))
        interfaceList.add(localApi);
    }

    Local local = type.getAnnotation(Local.class);
    if (local != null && local.value() != null) {
      _localList.clear();

      for (Class api : local.value()) {
        // XXX: grab from type?
        _localList.add(new ApiClass(api));
      }
    }

    Remote remote = type.getAnnotation(Remote.class);
    if (remote != null && remote.value() != null) {
      _remoteList.clear();

      for (Class api : remote.value()) {
        // XXX: grab from type?
        _remoteList.add(new ApiClass(api));
      }
    }

    // if (getLocalList().size() != 0 || getRemoteList().size() != 0) {
    if (_localHome != null || _localList.size() != 0 || _remoteHome != null
        || _remoteList.size() != 0) {
    } else if (interfaceList.size() == 0) {
      // Session bean no-interface view.
    } else if (interfaceList.size() != 1)
      throw new ConfigException(
          L
              .l(
                 "'{0}' has multiple interfaces, but none are marked as @Local or @Remote.\n{1}",
                 type.getName(), interfaceList.toString()));
    else {
      setLocalWrapper(interfaceList.get(0));
    }

    // XXX: Check ejb30/bb/session/stateless/migration/twothree/annotated
    // There is a conflict between 2.1 and 3.0 interfaces.

    // ejb/0f6f
    // The session bean might have @RemoteHome for EJB 2.1 and
    // the @Remote interface for EJB 3.0 (same with @LocalHome and @Local).
    // TCK: ejb30/bb/session/stateful/sessioncontext/annotated

    ApiClass ejbClass = getEJBClassWrapper();

    LocalHome localHomeAnn = ejbClass.getAnnotation(LocalHome.class);

    // ejb/0f6f
    if (localHomeAnn != null) {
      Class localHome = localHomeAnn.value();
      setLocalHome(localHome);
    }

    RemoteHome remoteHomeAnn = ejbClass.getAnnotation(RemoteHome.class);

    // ejb/0f6f
    if (remoteHomeAnn != null) {
      Class home = remoteHomeAnn.value();
      setHome(home);
View Full Code Here

  protected String getBeanType() {
    return getSessionType().getSimpleName();
  }

  private void introspectSession() throws ConfigException {
    ApiClass ejbClass = getEJBClassWrapper();

    if (ejbClass.isAnnotationPresent(Stateless.class))
      introspectStateless(ejbClass);
    else if (ejbClass.isAnnotationPresent(Stateful.class))
      introspectStateful(ejbClass);
  }
View Full Code Here

   * each.
   */
  @Override
  public void introspect()
  {
    ApiClass apiClass = getViewClass();

    for (ApiMethod apiMethod : apiClass.getMethods()) {
      Method javaMethod = apiMethod.getJavaMember();

      if (javaMethod.getDeclaringClass().equals(Object.class))
        continue;
      if (javaMethod.getDeclaringClass().getName().startsWith("javax.ejb.")
View Full Code Here

   * each.
   */
  @Override
  public void introspect()
  {
    ApiClass apiClass = getViewClass();

    for (ApiMethod apiMethod : apiClass.getMethods()) {
      Method javaMethod = apiMethod.getJavaMember();

      if (javaMethod.getDeclaringClass().equals(Object.class))
        continue;
      if (javaMethod.getDeclaringClass().getName().startsWith("javax.ejb.")
View Full Code Here

   * Introspects the APIs methods, producing a business method for
   * each.
   */
  private void introspectImpl()
  {
    ApiClass apiClass = getViewClass();
   
    for (ApiMethod apiMethod : apiClass.getMethods()) {
      Method javaMethod = apiMethod.getJavaMember();
     
      if (javaMethod.getDeclaringClass().equals(Object.class))
        continue;
      if (javaMethod.getDeclaringClass().getName().startsWith("javax.ejb."))
View Full Code Here

    throws ConfigException
  {
    // ejb/0fbm
    super.initIntrospect();

    ApiClass type = getEJBClassWrapper();

    // ejb/0j40
    if (! type.isAnnotationPresent(MessageDriven.class)
        && ! type.isAnnotationPresent(MessageDriven.class)
        && ! isAllowPOJO())
      return;

    // XXX: annotations in super classes?

    if (! type.isAnnotationPresent(TransactionAttribute.class)) {
      type.addAnnotation(XaAnnotation.create(TransactionAttributeType.REQUIRED));
    }

    javax.ejb.MessageDriven messageDriven
      = type.getAnnotation(javax.ejb.MessageDriven.class);

    if (messageDriven != null) {
      ActivationConfigProperty[] properties
        = messageDriven.activationConfig();

      if (properties != null) {
        for (ActivationConfigProperty property : properties)
          addActivationConfigProperty(property.propertyName(),
                                      property.propertyValue());
      }

      Class messageListenerInterface
        = messageDriven.messageListenerInterface();

      if (messageListenerInterface != null)
        setMessagingType(messageListenerInterface);

      TransactionManagement transaction = type.getAnnotation(TransactionManagement.class);
      if (transaction == null)
        setTransactionType("Container");
      else if (TransactionManagementType.BEAN.equals(transaction.value()))
        setTransactionType("Bean");
      else
View Full Code Here

  @Override
  protected BeanGenerator createBeanGenerator()
  {
    _messageBean = new MessageGenerator(getEJBName(), getEJBClassWrapper());

    _messageBean.setApi(new ApiClass(_messagingType));

    return _messageBean;
  }
View Full Code Here

      Class<X> instanceClass = null;

      if (_isGenerateInterception) {
        if (! _beanType.isAnnotationPresent(javax.interceptor.Interceptor.class)
            && ! _beanType.isAnnotationPresent(javax.decorator.Decorator.class)) {
          ApiClass apiClass = new ApiClass(_beanType, true);

          PojoBean bean = new PojoBean(apiClass);
          bean.introspect();

          instanceClass = (Class<X>) bean.generateClass();
View Full Code Here

TOP

Related Classes of com.caucho.config.gen.ApiClass

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.