[Rxtx] Which Java folder in source?

Adrian Crum adrian.crum at sandglass-software.com
Mon Feb 28 19:32:12 MST 2011


Just to make sure I'm understanding you correctly, anyone porting RxTx 
to a new platform would have to do the following:

1. Write their own Java implementation of an abstract Dispatcher class.
2. Write a native (JNI or JNA) interface for the abstract class 
implementation.
3. Write all of the native (or non-native) code to implement the native 
interface.

Is that correct? If yes, how is that easier than the simple 
implementation the current rewrite design uses?

On a side note: there is no requirement to write native code using C++. 
If C++ is a real obstacle to adoption, then regular C could be used 
instead. In that case, there would be a Dispatcher.c file that contains 
function protoypes that need to be implemented. Dispatcher.c would still 
maintain the same role as Dispatcher.cpp - which is to shield native 
code developers from the details of JNI. Just build out the missing 
functions using C data types and you're ready to go.

-Adrian

On 2/28/2011 5:59 PM, iqzw2r602 at sneakemail.com wrote:
> On Tue, Mar 1, 2011 at 10:24 AM, Adrian Crum 
> adrian.crum-at-sandglass-software.com 
> <http://adrian.crum-at-sandglass-software.com> |rxtx.org 
> <http://rxtx.org> mailing list/Example Allow| 
> <ausj4cmytt at sneakemail.com <mailto:ausj4cmytt at sneakemail.com>> wrote:
>
>     What you're suggesting would require a great deal more effort than
>     necessary.
>
>
> No, I don't think so; it'd be a quite simple refactoring task:
> * Copy Dispatcher.java into NativeDispatcher.java and change 
> constructor name. Make it derive from Dispatcher
> * Make all methods in the original Dispatcher.java abstract except for 
> getInstance(). That method does System.getProperty("os.name 
> <http://os.name>") to decide which implementation to instantiate. On 
> Windows (and other platforms that implement the C++ interface), it 
> instantiates NativeDispatcher. On yet others, it would instantiate the 
> MyOSNameHereDispatcher
> * Rename Dispatcher.cpp to NativeDispatcher.cpp and rename 
> corresponding C++ class
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qbang.org/pipermail/rxtx/attachments/20110228/5e6df06f/attachment-0360.htm>


More information about the Rxtx mailing list