Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cosmos-dev] Binding service


In the design meeting yesterday, we didn't come to a conclusion on the binding service discussion.  My view is that the code in the binding service class belong to the framework code and not extension code.  But Joel likes to give users the flexibility to control how the component objects get instantiated.  

I have a proposal here for discussion that can address both of our concerns.  We can provide an API for the component implementation to control how the class is instantiated through a factory class.  In fact, the assembly XML is already set up to do this.  For example:

<sink cosmos:factory="org.eclipse.cosmos.dc.sample.components.sink.StatisticalPersistor">

The cosmos:factory attribute defines the factory class that returns an instance of the component implementation.  We need to require all factory classes to implement a "getInstance" method that returns a reference to the component object.  The getInstance method will be invoked by the framework and not extension code.  The factory can return a singleton class or a new instance of the component and it allows the use of custom classloaders.  With this approach, you can replace the object instantiation code in the binding service with a call to this factory class, and push the rest of the code to the framework layer (i.e. InboundContext and OutboundContext).  

Joel and Don, what are your comments on this approach?  


Thanks,
_________________________
Hubert Leung
IBM Toronto Lab
hkyleung@xxxxxxxxxx
905-413-3382

Back to the top