| ... | @@ -16,13 +16,24 @@ In case you haven't already installed the project or if you didn't manage to run |
... | @@ -16,13 +16,24 @@ In case you haven't already installed the project or if you didn't manage to run |
|
|
|
|
|
|
|
## Configuration Options
|
|
## Configuration Options
|
|
|
|
|
|
|
|
The former main class contains a few configuration options. These are currently implemented as static fields of the `Main` class. However, depending on the status of issue #3, this may change in the future.
|
|
Inspired by issue #3 there is now a way to save different run configurations. We opted to not use a textual format like XML or JSON, but introduced the Configuration Actors.
|
|
|
For now, the following configuration options exist:
|
|
On system startup you will be asked to select a configuration to run. These configurations *must* be stored in the `fucoin.configurations` package and *must* extend the `AbstractConfiguration` class provided in the same package.
|
|
|
|
A configuration consists of two methods: A `run()` method and an `onReceive()` method. The first is where you define your actual configuration code whereas the latter is to handle any messages, that the configuration actor receives.
|
|
|
|
For spawning the other actors we the `AbstractConfiguration` class offers the following methods:
|
|
|
|
|
|
|
|
* `numberOfWallets` (Default value: `2`): Number of (local) wallets which should be created during the initialisation
|
|
* `initSupervisor()` is used to spawn the supervisor actor and store the reference
|
|
|
* `createGUI` (Default value: `true`): If set to `true`, wallets will be created with a GUI.
|
|
* `spawnWallet(String name, boolean createGUI)` is used to create a new wallet with the first parameter being the name of the wallet node and the second parameter denoting, if the wallet should use a GUI.
|
|
|
|
* `spawnWallets(int n, boolean createGUI)` resembles the previous `main()` method the most, as it spawns n wallets and automatically assigns a name and creates a GUI as requested.
|
|
|
|
|
|
|
|
After changing a configuration value, the application has to be recompiled for the changes to take effect.
|
|
By default your configuration will be listed by the class name in the configuration selection menu. To change this, you can use the `@ConfigurationName` annotation. An example is given by the `DefaultConfiguration` and the `MassWalletConfiguration` classes.
|
|
|
|
|
|
|
|
*Note: The following might change in the next hours and days*
|
|
|
|
To issue a wallet to start a transaction with another wallet (i.e. to transfer money), you have to get a hand on an `ActorRef` for the wallet. These are stored in the `activeActors` property. To pick a random node, there is the `getRandomWallet` method, that does exactly what it says to do.
|
|
|
|
|
|
|
|
After the selection of a configuration on system startup the following steps happen:
|
|
|
|
|
|
|
|
1. The configuration actor is created the akka way using a `Props` object and a provided ConfigurationCreator.
|
|
|
|
2. The preStart method of the akka actor is called. This method is predefined to simply call the `run()` method.
|
|
|
|
|
|
|
|
## Remoting
|
|
## Remoting
|
|
|
|
|
|
| ... | |
... | |
| ... | | ... | |