[ 
https://issues.apache.org/activemq/browse/SM-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42282#action_42282
 ] 

Ron Gavlin commented on SM-1305:
--------------------------------

Thanks.

As far as getService() / getEndpoint() are concerned, here are my proposed 
implementations that would appear in BeanSupport.java:

protected QName getService() {
                QName service = null;
                ComponentContext context = getComponentContext();
                if (context != null && context instanceof 
EndpointComponentContext) {
                        EndpointComponentContext endpointContext = 
(EndpointComponentContext) context;
                        service = endpointContext.getEndpoint().getService();
                }
                return service;
        }

protected String getEndpoint() {
                String endpoint = null;
                ComponentContext context = getComponentContext();
                if (context != null && context instanceof 
EndpointComponentContext) {
                        EndpointComponentContext endpointContext = 
(EndpointComponentContext) context;
                        endpoint = endpointContext.getEndpoint().getEndpoint();
                }
                return endpoint;
        }

As far as a use case for getService() and getEndpoint() are concerned, take one 
of my SMX-Beans that includes the method below. This SMX-Bean requires standard 
SMX StoreFactory/Store implementations. The method uses getService() and 
getEndpoint() for its implementation. Does this make sense? 

@PostConstruct
        public void init() throws IOException {
                if (messageExchangeStore == null) {
                        if (storeFactory == null) {
                                storeFactory = new MemoryStoreFactory();
                        }
                        messageExchangeStore = 
storeFactory.open(getService().toString()
                                        + getEndpoint());
                }
        }

Also, within the TransformBeanSupport, supporting a standard eip-like 
exchange-target element makes sense.

Thanks,

- Ron



> Provide convenient base classes to simplify servicemix-bean component 
> development (including IN-only MEP Transforms)
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: SM-1305
>                 URL: https://issues.apache.org/activemq/browse/SM-1305
>             Project: ServiceMix
>          Issue Type: New Feature
>          Components: servicemix-bean
>    Affects Versions: 3.2.1
>            Reporter: Ron Gavlin
>         Attachments: lw2smbean.zip
>
>
> The deprecated, LightWeight container provided a convenient base class, 
> TransformComponentSupport, that made it easy for non-JBI experts to write 
> simple transforms in Java. In order to accomplish the same task with 
> servicemix-bean, a developer must have have in-depth, JBI knowledge. A helper 
> class or base class should be created to make it easier for developers to 
> write transforms using servicemix-bean. A base class would also be useful to 
> ease the implementation of non-Transform servicemix-beans. 
> I suggest the following class names for the proposed two base classes:
> 1. org.apache.servicemix.bean.support.BeanSupport.java - this class provides 
> servicemix-bean specific functionality currently offered by the combination 
> of "org.apache.servicemix.components.util.PojoSupport.java" and 
> "org.apache.servicemix.components.util.ComponentSupport.java"
> 2. org.apache.servicemix.bean.support.TransformBeanSupport.java - this class 
> extends "org.apache.servicemix.bean.support.BeanSupport.java" (above), 
> implements MessageExchangeListener, and provides servicemix-bean specific 
> functionality currently offered by 
> "org.apache.servicemix.components.util.TransformComponentSupport.java"

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to