Livespaces
Training Workshop - Entities Exercise
Exercise 2: Entities
By the end of this exercise you will:
- Know how to create
Entities
- See how to hook into Elvin and find or create a
RoomEntity
- Know how to use synchronisation when changing
Entity
values
- Know how to use
ec
to watch the Livespace events
Files involved:
- project
livespace.services.example
- package
livespace.workshop.examples
Hobbit.java
HobbitServer.java
HobbitFinder1.java
HobbitFinder2.java
HobbitFinder3.java
SpeechListener.java
TrainingUtils.java
Run targets:
- HobbitServer
- Livespace Browser App (localhost)
- HobbitFinder1
- HobbitFinder2
- HobbitFinder3
Steps:
- Run the local
elvin
daemon
- Open a cygwin shell
- Run the Elvin consumer tool
ec
and listen for Livespace events with the command:
ec -e elvin://localhost "require(Livespace-Protocol)"
- Open Eclipse from the desktop shortcut
- Look at
Hobbit.java
and note the boilerplate code
- constructors
ENTITY_TYPE
constant
getType()
method
- Look at
HobbitServer.java
main()
method
- Finding the Elvin connection
- Finding or creating the local
RoomEntity
- Creating a server
- Cleaning up resources
- constructor
- Creating the Hobbit
Entity
- Creating the
EntityRegistry
and adding listeners
- Creating the
EntityServer
dispose()
method
- Running the server using a different Hobbit name.
- Run the Livespace Browser Application pointed at the localhost
- Play with Hobbit properties
- Look at a basic client
HobbitFinder1.java
- Finding the Elvin connection
- Finding the local Room
- Clean up
HobbitFinder2.java
HobbitFinder3.java
- Make changes to our Hobbit
- Note use of synchronisation
- Run the HobbitServer but pointing it to
ics-linux
as the host.
- Change the name of your hobbit (first command line argument)
- Use the
-Dlivespace.elvin=elvin://ics-linux
command line switch to use ics-linux
- Use the Service Browser from your Livespace Dashboard to manipulate all the Hobbits.
- Questions
Revised on November 18, 2008 13:54
by
Matt