Dynamic Scene Reloading

In this Lesson

You will learn

  • How the Soiree client obtains the scene definitions it needs
  • How you can save time when testing scene changes

Concepts

The Soiree client uses the scene definition to create the user interface. The client obtains the definitions from the server as they are needed. [ the one exception to this is the iOS client which has the option to either load the scenes dynamically or have all the solution’s scenes deployed with the client. If they are deployed with the client then dynamic reloading is disabled. ]

The Soiree client must obtain the scene at the following times

  • The first time the client receives a request to display the scene.
    The client then stores the scene definition in a local cache.
  • When the scene definition deployed on the server is modified.
    The client then stores the modified scene definition in the local cache.

You may recall that Soiree items, such as scenes, are translated to Soiree resources when the item is saved. These resources are the runtime version of the item definition. The Soiree resources used by the server are those found on the server’s Java classpath. The server registers all the resources on the classpath as the server is initializing. Copying new or modified resources into the Java classpath while the server is running will have no effect on the resources used by the server.

You may have noticed the development server in Eclipse restarts each time you save a Soiree item. This is done so that the server can see the modified resource.

Server Restart
Remember, the server will only restart automatically when resources change. It does not restart each time a Java class is modified. You must manually restart the server if you want it to see modified class files.
Tip
If you are making a lot of item changes and have no intention of testing them immediately you may want to stop the server so that it does restart after every change – especially if your workstation is a bit slow. [ or you get a faster machine ]

Restarting the Soiree client

Thanks to dynamic scene loading you do not have to close and restart the client each time you want to test a scene change.

  • You do NOT need to restart the client if the only thing you changed was the scene.
  • You DO need to restart the client if you changed something in a scheme [ the agent’s contract ] bound to a scene that is actively running in the client.
    Changing a mode, node, event, or conduit of a scheme running in the client will cause the ‘active’ scheme data in the client to no longer be consistent with the definition on the server and the client session will fail.

Observe dynamic scene loading

You will now change a scene and watch the client dynamically reload it.

  1. Start the party solution and advance to the party list layer
  2. Switch to Eclipse and open the PartyDefinition scene
  3. Modify the party list layer by adding the following label



  4. Save the item and wait for the server to restart
    Tip
    You can know exactly when the server has restarted by enabling the Beep when server listener starts option in Eclipse … Preferences … Soiree … SxServer
  5. Switch back to the client and press the Add button.
    The client downloads the new scene and restarts it.



  6. Press the Add button again to advance to the Add Party layer



  7. Return to the scene editor and remove the toot label from layer 1
  8. Save the item and wait for the server to restart
  9. Press the OK button
  10. Why does the scene return to layer 1?
    [ the only Visible By Default layer in the scene is layer 1 and since the scene is restarted, as if for the first time, only the the default layers are opened ]


Cause the client connection to fail

You will now make a change to an agent that will cause the client connection to fail.

  1. Advance the client to the Add Party layer
  2. Switch to Eclipse and open the Party agent item
  3. Click on the Nodes tab
  4. Rename the partyName node to partyNameMod



  5. Build the item
  6. Restart the server



  7. Return to the client and click the OK button
  8. The server will terminate the session and the client will display this dialog



  9. Click on Show Details



  10. Close the Severe Condition Notice
  11. Ask the client to start a new session



  12. Change the Party agent’s node back to “partyName” and rebuild the agent



  13. Restart the server
  14. Restart the client and ensure the Add party layer works as designed

Time to head off to the next lesson.