[Asterisk-java-devel] ChannelFactory for Live
Brought to you by:
srt
From: Colin W. <co...@bi...> - 2011-03-04 20:02:20
|
Following along on the recent addition of a ChannelFactory for the agi package, I was thinking of implementing something similar for the live package. I have a question regarding architecture before anything significant can be accomplished. It seems like in the actual meat of the live package, nothing uses the interfaces, they all use direct references to the *Impl classes. For example, in the ChannelManager.addNewChannel method, it directly creates an AsteriskChannelImpl object. For example, > final AsteriskChannelImpl channel = new AsteriskChannelImpl(server, name, > uniqueId, dateOfCreation); as opposed to > final AsteriskChannel channel = new AsteriskChannelImpl(server, name, > uniqueId, dateOfCreation); In addition, many of the methods called on these objects are only available in the AsteriskChannelImpl object, and so the objects are all stored as Impl's. This works great, but poses a problem with the addition of a ChannelFactory. In order to correctly implement a ChannelFactory, it must either: 1. return subclasses of AsteriskChannelImpl. This would force the AsteriskChannelImpl object into public scope, which is probably not a good idea. 2. return classes that implement the AsteriskChannel interface. This would be a more correct method to follow, but it would also require significant refactoring of at least the channel tracking portions of the live package, and possibly more. This could break backwards compatibility with the API, as some methods may need to be moved from the AsteriskChannelImpl class to the AsteriskChannel interface. If there are additional options, I'd love to hear them. I don't have a problem with doing all the refactoring mentioned in the second option, but I'd prefer to get confirmation that such sweeping changes have a chance of being accepted back into the master branch. I'd very much prefer to contribute the changes back into the project than keep them to myself or fork. Thanks for any advice, --Colin -- Colin Williams |