Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
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() {
}
- src/main/java/org/apache/servicemix/bean/BeanEndpoint.java (revision 677808)
-
@@ -99,6 +100,7 @@
public BeanEndpoint(BeanComponent component, ServiceEndpoint serviceEndpoint)
public void start() throws Exception {
@@ -105,6 +107,9 @@
super.start();
context = new EndpointComponentContext(this);
channel = context.getDeliveryChannel();
+ if (serviceEndpoint == null)
Object pojo = getBean();
if (pojo != null)
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); } }
}