### Bean Example

This is a simple example of a Hello World Plain Old Java Object (POJO) using Rio. The bean is dynamically remoted by Rio, turning the bean into a Jini service. This document is organized as follows :

- POJO Basics
- Building the Example
- Example Source Files
- Running the Example

POJO Basics
Rio provides the capability to build dynamic applications using Plain Old Java Objects (POJOs). Developing a POJO is simple: Rio turns the POJO into a dynamic service, providing transparent Jini technology remoting, with built-in management, fault detection and automated deployment.
The POJO in this example is very simple, it does not contain or reference any infrastructure (Rio or Jini) code
Building the Example
Building the example is straight forward, you must have Ant and the JDK. If these requirements are met :
$ cd <rio-home>/examples/bean
$ ant

Example Source Files
Source code is located in <rio-home>/examples/bean directory

File Name | Location | Description
Hello.java | /src/main/java/bean | The interface for the bean
HelloClient.java | /src/test/java/bean/client | Provides a command line interface for running the example
HelloImpl.java | /src/main/java/bean/service | The bean implementation
bean.xml | /src/main/conf | The opstring for the example
build.xml | . | The ant build file
readme.html | . | This file

Running the Example

How to run the example :

1. Start Rio services :
   $ cd <rio-home>/bin
   $ startall
2. Deploy the example
   - Using the Rio CLI
     $ cd <rio-home>/bin
     $ rio deploy ../examples/bean/src/main/conf/bean.xml
   - Using Ant deploy task
     $ cd <rio-home>/examples/bean
     $ ant deploy

3. Run the client using ant
   $ cd <rio-home>/examples/bean
   $ ant client
   Buildfile: build.xml
   client:
   [java] Discovering Hello service ...
   [java] Discovered Hello service
   [java] Invoking Hello service ...
   [java] Received: Hello vistor : 3 from Hello service
   BUILD SUCCESSFUL
   Total time: 1 second
   $
4. Undeploy the example using of the of following methods
   - Using the Rio CLI
     $ cd <rio-home>/bin
     $ rio undeploy ../examples/bean/src/main/conf/bean.xml
   - Using Ant deploy task
   $ cd <rio-home>/examples/bean
   $ ant undeploy