Providing an explicit default using the #defaultsTo method ends up
short-circuiting the Spring Environment's hierarchical property resolution
process. for example, if --port.useManualPortForwarding has a default
value of `false`, then the command line property source always returns a
value when its #getProperty method is invoked by the Environment. This
means that a lower-precedence property source never has the opportunity
to return its value. For example, if port.useManualPortForwarding had
been set to true in the filesystem property source
(at ${user.data.dir}/bitsquare.properties), this property value would
never be resolved because the default command line property source always
overrides it (thus the notion of "short circuiting" above).
This change eliminates the use of JOpt's #defaultsTo method in favor of
a simple approach to advertising default values (if any) in the option's
description string. The result is --help output that reads exactly the
same as it did before, but no actual default value is set at the command
line property source level.
Note that the default property source is still created, and default
values are still assigned in BitsquareEnvironment#defaultPropertySource.
This property source has the lowest precedence, and this means that any
and all other property sources have the opportunity to provide a value
and override the default.
- Use AtomicBoolean vs. SimpleBooleanProperty in TomP2PTests to avoid
use of javax.* classes where they aren't otherwise necessary.
- Reformat code globally to eliminate trailing whitespace and fix
indentation
- Optimize imports globally to eliminate unused imports
* cbeams:
Polish FeePolicy
Use BitcoinNetwork vs. BitcoinJ's NetworkParameters
Use #ofType in commandline parsing for type safety
Introduce customized JOptCommandLinePropertySource
Expose network information to GUI cleanly
Conflicts:
src/main/java/io/bitsquare/msg/tomp2p/TomP2PNode.java
- Convert static fields to final instance fields
- Remove commented code
- Rethrow any AddressFormatException as a BitsquareException instead of
logging and returning null (doing so would cause NPEs in BitcoinJ
internals).
BitcoinNetwork now supports a #getParameters method that returns the
BitcoinJ NetworkParameters instance associated with the given
BitcoinNetwork enum label (e.g. TESTNET.getParameters() returns
TestNet3Params, etc).
BitcoinModule#BITCOIN_NETWORK_KEY and #DEFAULT_BITCOIN_NETWORK have been
moved to BitcoinNetwork#KEY and BitcoinNetwork#DEFAULT respectively.
Customzing the bitcoin network to use on the command line has been
improved. Values may be upper or lower case (e.g. "testnet", "TESTNET"),
and the value passed is converted to the correct BitcoinNetwork enum
value with the new EnumValueConverter class.
Finally, a BitcoinNetwork instance is now made available for injection
by BitcoinModule as opposed to binding a NetworkParameters instance. All
injection targets (constructors) throughout the codebase have been
updated to reflect this change, and the result is cleaner, enum-based
processing everywhere possible. And where it's necessary to drop down to
BitcoinJ's NetworkParameters, that's easy to do by calling
BitcoinNetwork#getParameters.
This temporary subclass introduces the same change proposed in
spring-projects/spring-framework#693, and should be removed when that
pull request is merged and made available.
This commit introduces io.bitsquare.network.ClientNode--an interface
whose name and structure will surely change--as a simplistic abstraction
over TomP2PNode that allows for exposing information to the "Network"
tab of the Preferences section of the GUI without actually requiring the
injection of TomP2PNode and other tomp2p internals into the GUI layer.
Changes to 'network' and 'msg' packages:
----------------------------------------
- Move ConnectionType enum from test into main tree, and expose
ClientNode#getConnectionType.
- Both ClientNode and TomP2P are now available for injection. Both
types are bound to the same TomP2P singleton instance. Note
especially how NetworkPreferencesViewCB now receives a ClientNode
instead of a TomP2PNode.
- Restore package-private visibility to BootstrappedPeerFactory
- Remove no longer necessary TomP2PNode#getPeerDHT
- Expose getter for BootstrappedPeerFactory#bootstrapState
Changes to 'gui' package:
-------------------------
- NetworkPreferencesViewCB has been simplified. All no-op methods have
been removed, and the class now simply implements JavaFX's
Initializable interface as opposed to Bitsquare's own ViewCB
hierarchy, because the latter is not actually necessary (no caching
is required for the data handled by this controller, etc.
- In order to make the above possible, PreferencesViewCB now tolerates
adding non-ViewCB child controllers.
- NetworkPreferencesPM has been removed (perhaps temporarily), in an
experiment to see "just how simple" CB controller classes can be.
- Text fields in NetworkPreferencesView have been renamed.
Notes:
------
The data that now shows up in the "Network" tab is no longer formatted
as it once was; values are essentially nothing more than their #toString
representations. Again, this can be tweaked further, but leaving things
in this raw state provides an opportunity to discuss the current
presentation model approach, ViewCB hierarchy, etc.