Uploaded image for project: 'ServiceMix Components'
  1. ServiceMix Components
  2. SMXCOMP-339

Decouple smx-bean support base classes from smx-bean BeanEndpoint class to facilitate deployment of bean classes to container classpath if desired

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      I would like the ability to place commonly used smx-bean classes that extend the new bean support abstract classes on the container classpath to ease packaging and deployment. The following patch decouples the bean support classes from the BeanEndpoint class to facilitate this activity.

      Index: src/main/java/org/apache/servicemix/bean/support/BeanSupport.java
      ===================================================================
      — src/main/java/org/apache/servicemix/bean/support/BeanSupport.java (revision 677808)
      +++ src/main/java/org/apache/servicemix/bean/support/BeanSupport.java (working copy)
      @@ -29,6 +29,7 @@
      import javax.jbi.messaging.MessagingException;
      import javax.jbi.messaging.NormalizedMessage;
      import javax.jbi.messaging.RobustInOnly;
      +import javax.jbi.servicedesc.ServiceEndpoint;
      import javax.management.ObjectName;
      import javax.xml.namespace.QName;

      @@ -35,7 +36,6 @@
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      import org.apache.servicemix.JbiConstants;
      -import org.apache.servicemix.bean.BeanEndpoint;
      import org.apache.servicemix.components.util.CopyTransformer;
      import org.apache.servicemix.components.util.MessageHelper;
      import org.apache.servicemix.components.util.MessageTransformer;
      @@ -58,7 +58,7 @@
      private DeliveryChannel channel;

      @Resource

      • private BeanEndpoint beanEndpoint;
        + private ServiceEndpoint serviceEndpoint;

      private ObjectName extensionMBeanName;
      private MessageExchangeFactory exchangeFactory;
      @@ -112,12 +112,12 @@
      this.context = context;
      }

      • public BeanEndpoint getBeanEndpoint() {
      • return beanEndpoint;
        + public ServiceEndpoint getServiceEndpoint() { + return serviceEndpoint; }
      • public void setBeanEndpoint(BeanEndpoint beanEndpoint) {
      • this.beanEndpoint = beanEndpoint;
        + public void setServiceEndpoint(ServiceEndpoint serviceEndpoint) { + this.serviceEndpoint = serviceEndpoint; }

      /**
      @@ -409,8 +409,8 @@

      protected QName getService() {
      QName service = null;

      • if (beanEndpoint != null) {
      • service = beanEndpoint.getService();
        + if (serviceEndpoint != null) { + service = serviceEndpoint.getServiceName(); }

        return service;
        }
        @@ -417,8 +417,8 @@

      protected String getEndpoint() {
      String endpoint = null;

      • if (beanEndpoint != null) {
      • endpoint = beanEndpoint.getEndpoint();
        + if (serviceEndpoint != null) { + endpoint = serviceEndpoint.getEndpointName(); }

        return endpoint;
        }
        Index: src/main/java/org/apache/servicemix/bean/BeanEndpoint.java
        ===================================================================

          • src/main/java/org/apache/servicemix/bean/BeanEndpoint.java (revision 677808)
            +++ src/main/java/org/apache/servicemix/bean/BeanEndpoint.java (working copy)
            @@ -92,7 +92,8 @@
            private ThreadLocal<Request> currentRequest = new ThreadLocal<Request>();
            private ComponentContext context;
            private DeliveryChannel channel;
            -
            + private ServiceEndpoint serviceEndpoint;
            +
            public BeanEndpoint() {
            }

      @@ -99,6 +100,7 @@
      public BeanEndpoint(BeanComponent component, ServiceEndpoint serviceEndpoint)

      { super(component, serviceEndpoint); this.applicationContext = component.getApplicationContext(); + this.serviceEndpoint = serviceEndpoint; }

      public void start() throws Exception {
      @@ -105,6 +107,9 @@
      super.start();
      context = new EndpointComponentContext(this);
      channel = context.getDeliveryChannel();
      + if (serviceEndpoint == null)

      { + serviceEndpoint = context.getEndpoint(getService(), getEndpoint()); + }

      Object pojo = getBean();
      if (pojo != null)

      { injectBean(pojo); @@ -346,6 +351,8 @@ ReflectionUtils.setField(f, target, ctx); }

      else if (DeliveryChannel.class.isAssignableFrom(f.getType()))

      { ReflectionUtils.setField(f, target, ch); + }

      else if (ServiceEndpoint.class.isAssignableFrom(f.getType()))

      { + ReflectionUtils.setField(f, target, BeanEndpoint.this.serviceEndpoint); }

      }
      }

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            gnodet Guillaume Nodet
            rgavlin Ron Gavlin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment