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