tc-config.xml (Client)
 
 001:  <?xml version="1.0" encoding="UTF-8"?>
 002:  
 003:  <!--
 004:  
 005:  All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
 006:  
 007:  -->
 008:  
 009:  <tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-6.xsd" xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 010:    <!--Server is colocated with client and DSO is listening on
 011:         default port (9510).-->
 012:    <servers>
 013:      <server host="%i" name="sample"/>
 014:    </servers>
 015:    <!--Tell DSO where to put the generated client logs.
 016:         See the Terracotta Configuration Guide and Reference for additional
 017:         information.-->
 018:    <clients>
 019:      <logs>terracotta/client-logs/pojo/inventory/%D</logs>
 020:    </clients>
 021:    <application>
 022:      <dso>
 023:        <!--Our app requires these custom objects/classes to be shared - the following declarations
 024:             tells DSO which ones they are. When the app runs under DSO, instances of these classes
 025:             will broadcast changes in their state.
 026:  
 027:             A good idiom when writing an app thay you intend to cluster via TC DSO, is to group the 
 028:             classes you wish to share under a single package (although if you follow the MVC pattern
 029:             this tends to happen naturally) - this way the list of classes you wish to instrument
 030:             can be concise 
 031:  
 032:             Here we're telling DSO to instrument all of the classes found under the 'demo.inventory'
 033:             package-->
 034:        <instrumented-classes>
 035:          <include>
 036:            <class-expression>demo.inventory..*</class-expression>
 037:          </include>
 038:        </instrumented-classes>
 039:        <!--These methods (originating from local objects) operates on objects declared as shared. This
 040:             section tells DSO to assume a lock on those objects for the duration of the call; essentially this
 041:             section declares that all methods found for all classes found for all packages should assume the
 042:             behavior described-->
 043:        <locks>
 044:          <autolock>
 045:            <method-expression>void demo.inventory.Product.setPrice(double)</method-expression>
 046:            <lock-level>write</lock-level>
 047:          </autolock>
 048:          <autolock>
 049:            <method-expression>* demo.inventory.*.get*()</method-expression>
 050:            <lock-level>read</lock-level>
 051:          </autolock>
 052:        </locks>
 053:        <!--We declare the field 'demo.inventory.Main.stores' a root, making it 
 054:             available for all instances of our app that runs via DSO-->
 055:        <roots>
 056:          <root>
 057:            <field-name>demo.inventory.Main.store</field-name>
 058:          </root>
 059:        </roots>
 060:      </dso>
 061:    </application>
 062:  </tc:tc-config>