... | ... | @@ -104,3 +104,56 @@ Once the configuration file and its associated environment files have been defin |
|
|
|
|
|
Cameo is very flexible and accepts different combinations for an application to be controlled by Cameo.
|
|
|
|
|
|
## *This* initialized with the *arguments* variable
|
|
|
|
|
|
Usually to benefit from the Cameo services inside an application, the *This* object is initialized by passing the arguments of the program. In C++:
|
|
|
```cpp
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
|
|
// Initialize This.
|
|
|
cameo::application::This::init(argc, argv);
|
|
|
```
|
|
|
|
|
|
In Java:
|
|
|
```java
|
|
|
import fr.ill.ics.cameo.base.This;
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
// Initialize This.
|
|
|
This.init(args);
|
|
|
```
|
|
|
|
|
|
In Python:
|
|
|
```python
|
|
|
import sys
|
|
|
import cameopy
|
|
|
|
|
|
# Initialize This.
|
|
|
cameopy.This.init(sys.argv)
|
|
|
```
|
|
|
|
|
|
Once *This* is initialized it can be used for example to get a reference to the Cameo server that started it. When *This* is initialized with the *arguments* variable, there are two cases:
|
|
|
* **Registered application**: If the application is registered in the configuration file, then *info_arg* must be set to *yes* which is the default value. Otherwise the application will not start.
|
|
|
* **Not registered application**: If the application is not registered in the configuration file, it is possible to start directly the app by adding a last argument that contains the Cameo server reference and its name. For instance:
|
|
|
```
|
|
|
$ /users/ics/app1 "{\"name\":\"App1\", \"server\":\"tcp://localhost:10000\"}"
|
|
|
```
|
|
|
Then if the informations are correct, *This* will initialize and the application will become **attached** to the Cameo server referenced by the endpoint in the *server* member.
|
|
|
|
|
|
## *This* initialized with explicit arguments
|
|
|
|
|
|
It is not mandatory to initialize *This* with the program arguments. It is possible to pass an explicit endpoint. In C++:
|
|
|
```cpp
|
|
|
cameo::application::This::init("App1", "tcp://localhost:10000");
|
|
|
```
|
|
|
In Java:
|
|
|
```java
|
|
|
This.init("App1", "tcp://localhost:10000");
|
|
|
```
|
|
|
In Python:
|
|
|
```python
|
|
|
cameopy.This.init("App1", "tcp://localhost:10000")
|
|
|
```
|
|
|
|
|
|
|