Below is not what you asked for, but it does much the same thing and with it 
and your knowledge of Spring you should be able to get where you want.

JBC parses its config file into a instance of 
org.jboss.cache.config.Configuration.  Configuration is a Java Bean that uses 
property injection, so Spring should have no trouble creating one. See 
http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.1.GA/userguide_en/html/configuration.html
 particularly section 3.3 for more.

http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.0.1.GA/userguide_en/html/deployment.html#deployment.microcontainer
 shows an example of using JBoss Microcontainer to create a Configuration 
object and then using that object to create a cache.  The example uses JBoss MC 
and its XML schema, but what it's doing is all basic IOC stuff that Spring does 
too; you just need to modify the example to use the Spring schema.

Here's another example of building a Configuration using the JBoss MC schema. 
It includes all the complex stuff: buddy replication, cache loading and 
eviction. Perhaps a better example than what's in the JBC User Guide, since I 
know it works -- JBoss AS 5 uses it.  Again, just conver to the Spring schema.


  |       <bean name="StandardSFSBCacheConfig" 
class="org.jboss.cache.config.Configuration">
  | 
  |          <!--  No transaction manager lookup -->
  |                
  |          <!-- Name of cluster. Needs to be the same for all members -->
  |          <property 
name="clusterName">${jboss.partition.name:DefaultPartition}-SFSBCache</property>
  |          <!-- Use a UDP (multicast) based stack. Need JGroups flow control 
(FC)
  |               because we are using asynchronous replication. -->
  |          <property 
name="multiplexerStack">${jboss.default.jgroups.stack:udp}</property>
  |          <property name="fetchInMemoryState">true</property>
  |          
  |          <property name="nodeLockingScheme">PESSIMISTIC</property>
  |          <property name="isolationLevel">REPEATABLE_READ</property>
  |          <property name="cacheMode">REPL_ASYNC</property>
  |       
  |          <!-- Number of milliseconds to wait until all responses for a
  |               synchronous call have been received. Make this longer 
  |               than lockAcquisitionTimeout.-->
  |          <property name="syncReplTimeout">17500</property>
  |          <!-- Max number of milliseconds to wait for a lock acquisition -->
  |          <property name="lockAcquisitionTimeout">15000</property>
  |          <!-- The max amount of time (in milliseconds) we wait until the
  |           state (ie. the contents of the cache) are retrieved from
  |           existing members at startup. -->
  |          <property name="stateRetrievalTimeout">60000</property>
  |       
  |          <!--
  |           SFSBs use region-based marshalling to provide for partial state
  |           transfer during deployment/undeployment.
  |          -->
  |          <property name="useRegionBasedMarshalling">false</property>
  |          <!-- Must match the value of "useRegionBasedMarshalling" -->
  |          <property name="inactiveOnStartup">false</property>
  |          
  |          <!-- Disable asynchronous RPC marshalling/sending -->
  |          <property name="serializationExecutorPoolSize">0</property>        
  |          <!-- We have no asynchronous notification listeners -->
  |          <property name="listenerAsyncPoolSize">0</property>
  |            
  |          <property name="exposeManagementStatistics">true</property>
  |       
  |          <property name="buddyReplicationConfig">
  |             <bean class="org.jboss.cache.config.BuddyReplicationConfig">
  |                
  |                <!--  Just set to true to turn on buddy replication -->
  |                <property name="enabled">false</property>
  |                
  |                <!-- A way to specify a preferred replication group.  We try
  |                     and pick a buddy who shares the same pool name (falling 
  |                     back to other buddies if not available). -->
  |                <property name="buddyPoolName">default</property>
  |                
  |                <property name="buddyCommunicationTimeout">17500</property>
  |                
  |                <!-- Do not change these -->
  |                <property name="autoDataGravitation">false</property>
  |                <property name="dataGravitationRemoveOnFind">true</property>
  |                <property 
name="dataGravitationSearchBackupTrees">true</property>
  |                
  |                <property name="buddyLocatorConfig">
  |                   <bean 
class="org.jboss.cache.buddyreplication.NextMemberBuddyLocatorConfig">
  |                      <!-- The number of backup nodes we maintain -->
  |                      <property name="numBuddies">1</property>
  |                      <!-- Means that each node will *try* to select a buddy 
on 
  |                           a different physical host. If not able to do so 
  |                           though, it will fall back to colocated nodes. -->
  |                      <property name="ignoreColocatedBuddies">true</property>
  |                    </bean>
  |                </property>
  |             </bean>
  |          </property>
  |          <property name="cacheLoaderConfig">
  |             <bean class="org.jboss.cache.config.CacheLoaderConfig">
  |                    <!-- Do not change these -->
  |                    <property name="passivation">true</property>
  |                    <property name="shared">false</property>
  |                    
  |                    <property name="individualCacheLoaderConfigs">
  |                      <list>
  |                         <bean 
class="org.jboss.cache.loader.FileCacheLoaderConfig">
  |                            <!-- Where passivated sessions are stored -->
  |                            <property 
name="location">${jboss.server.data.dir}${/}sfsb</property>
  |                            <!-- Do not change these -->
  |                            <property name="async">false</property>
  |                            <property 
name="fetchPersistentState">true</property>
  |                            <property name="purgeOnStartup">true</property>
  |                            <property 
name="ignoreModifications">false</property>
  |                            <property 
name="checkCharacterPortability">false</property>
  |                         </bean>
  |                      </list>
  |                    </property>
  |             </bean>
  |          </property>
  |         
  |          <!-- EJBs use JBoss Cache eviction -->
  |          <property name="evictionConfig">
  |              <bean class="org.jboss.cache.config.EvictionConfig">
  |                <property name="wakeupInterval">5000</property>
  |                <!--  Overall default -->
  |                <property name="defaultEvictionRegionConfig">
  |                   <bean class="org.jboss.cache.config.EvictionRegionConfig">
  |                      <property name="regionName">/</property>
  |                      <property name="evictionAlgorithmConfig">
  |                         <bean 
class="org.jboss.cache.eviction.NullEvictionAlgorithmConfig"/>
  |                      </property>
  |                   </bean>
  |                </property>
  |                <!-- EJB3 integration code will programatically create
  |                     other regions as beans are deployed -->
  |             </bean>
  |          </property>
  |       </bean>      

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4198075#4198075

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4198075
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to