This reverts a number of changes made in commit 3033a19. Primary changes
include:
- Restoring the immutability of the Node class
- The argparse4j Namespace object is no longer passed down through
Guice modules
- Instead, arguments are eagerly read from the Namespace object by the
#main method and these values are used to populate the Properties
object that is already supplied to each Guice module
Other changes include:
- The addition of a BootstrapNodes#DEFAULT_BOOTSTRAP_NODE field as
a convenient alias to BootstrapNodes#DIGITAL_OCEAN_1 (or whatever the
future default bootstrap node may be)
- A Node#getPortAsString method has been added for convenience when
dealing with String-based properties
- A variant of the Node#at static factory method has been added which
accepts the port value as a String vs. an int--again this is for
convenience when dealing with String-based properties
- Tests have been added to NodeTests to reflect the above
Prior to this commit, Gradle was configured to take a -Pargs property
and split the value on whitespace, passing the result to the Gradle
application plugin's 'args' property, for example:
gradle run -Pargs="--id=foo --ip=1.1.1.1 --port=10001"
While this approach works fine when passing a single argument (i.e. when
no space delimiters are required), when multiple arguments are passed,
such as in the example above, it would result in the following error
from Gradle's own command line parser:
Unknown command-line option '--ip'
This commit simply splits the value of -Pargs on commas rather than
spaces, meaning that now multiple -Pargs values should be supplied as
follows:
gradle run -Pargs="--id=foo,--ip=1.1.1.1,--port=10001"
Resolves#264
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.