Additional changes during the process of isolating TomP2P. High-level
changes include:
- Beginning to break up the monolithic MessageFacade into modular
repository classes, starting with the OfferRepository interface and
its TomP2P implementation
- Major refactoring of the CreateOfferCoordinator class, eliminating
the never-completely-implemented resume logic. This class still needs
quite a bit of work, but it's now considerably simpler than it was
- Refactoring the Node and BootstrapNode types for greater clarity and
ease of use
- Most classes that use the net.tomp2p API have been moved into tomp2p
subpackages, e.g. io.bitsquare.offer.tomp2p. Classes within have been
made package private wherever possible.
- The Guice module structure has evolved. For example, note the
relationship between offer.OfferModule and offer.tomp2p.TomP2POfferModule,
and note how the latter is consumed by app.AppModule. This arrangement
provides for clear contracts as to what is required to assemble a
functioning Bitsquare application, while allowing implementation-specific
modules to be swapped in and out with ease and still allowing
implementation-specific classes to remain package-private.
See extended commit comments for further details.
* wip-cbeams:
Rename io.bitsquare.{Abstract=>}BitsquareModule
Move io.bitsquare.{network=>util}.tomp2p.BaseFutureUtil
Introduce app.gui.MainModule
Optimize imports
Introduce io.bitsquare.msg.tomp2p package
Introduce io.bitsquare.offer.tomp2p package
Extract isSuccess(BaseFuture) method into util class
Remove offer creation recovery from CreateOfferCoordinator
Remove unused MessageFacade from CreateOfferCoordinator
Inline BroadCastOfferFeeTx#run into CreateOfferCoordinator
Inline CreateOfferFeeTx#run into CreateOfferCoordinator
Replace VerifyOffer class with Offer#validate method
Inline CreateOfferCoordinator#onFailed
Rename methods used to implement *Handler lambdas
Rename *Handler methods
Move generic *Handler types to new util.task package
Replace AddOfferListener Result/Fault handlers
Introduce OfferRepository interface and TomP2P impl
The modeling of BootstrapNode as an enum implementing the Node interface
became awkward, requiring an ugly, package-private 'NodeImpl' class and
other problems.
This change eliminates NodeImpl, refactors Node from being an interface
to being a value type [1,2], and refactors BootstrapNode from being an
enum to being an interface (the #all method there takes the place of
what was the enum's inherited #values method). This is slightly more
verbose in the end than being modeled as an enum, but in the end, we
were never using BootstrapNode as an enum (e.g., never used in switch
statements or == equality comparisons, etc).
[1]: http://blog.joda.org/2014/03/valjos-value-java-objects.html
[2]: http://docs.oracle.com/javase/8/docs/api/java/lang/doc-files/ValueBased.html
- Introduce use of Node abstraction for concision
- Use to BootstrapNode#LOCALHOST and #DIGITAL_OCEAN1 vs. repeating info
- Make all configuration variables static and final constants
Recovery was never fully implemented, and removing it dramatically
simplifies things. We can return to this with a proper analysis of
finite state machine libraries when the time comes.
This change begins the process of simplifying the trade protocol by
eliminating extra callback layers such as AddOfferListener and task
layers such as PublishOfferToDHT in favor of calling directly into
Repository interfaces.
This change begins the process of breaking up the monolithic
MessageFacade abstraction into smaller, cohesive Repositories (in the
Domain-Driven Design sense of the word) that abstract callers away from
networking details.
It also begins the process of restructuring the msg.listeners package,
such that individual *Listener interfaces are co-located with their
respective Repositories