//
// Beanshell script to run the aop tree cache demo
//
import org.jboss.cache.PropertyConfigurator;
import org.jboss.cache.aop.PojoCache;
import org.jboss.cache.aop.test.*;

show();  // verbose mode

tree = new PojoCache();
config = new PropertyConfigurator();
// configure tree cache. 
config.configure(tree, "META-INF/replSync-service.xml");

joe = new Person();
joe.setName("Joe Black");
joe.setAge(31);

addr = new Address();
addr.setCity("Sunnyvale");
addr.setStreet("123 Albert Ave");
addr.setZip(94086);

joe.setAddress(addr);

tree.startService();  // kick start tree cache

tree.putObject("/aop/joe", joe); // add aop sanctioned object

// since it is aop-sanctioned, use of plain get/set methods will take care of cache content automatically.
joe.setAge(41);

// tree.stopService(); // will stop the cache
