There are three ways to configure ModeShape, and it depends on how you're deploying your application.
- ModeShape and JBoss AS7 - When ModeShape is installed into JBoss AS7, it is configured using the AS7 configuration and tools (e.g., the command line interface, or CLI). For more details, see Configuring ModeShape in EAP.
- ModeShape via JCA - When your application is to be deployed to an environment that supports the Java Connector Architecture (JCA), then you can deploy ModeShape repositories via ModeShape's JCA adapter (available in ModeShape 3.1 or later). See ModeShape's JCA Adapter for more details.
- Embedded ModeShape - In all other cases, ModeShape runs within your application, whether your application is a regular Java SE application or a web application deployed to a web container. This means that your application needs to create a single ModeShape engine, deploy a JSON configuration file for each of the repositories needed by your application, and shut down the engine when your application is shut down. See ModeShape in Java applications for more details.
In all cases, you still need to configure Infinispan. There are a few things to keep in mind:
- Minimally, the cache used by a repository needs to be transactional, since ModeShape internally uses transactions and works with client-initiated or container-managed JTA transactions.
- Applications that may be concurrently updating the same nodes should use Infinispan configured to use pessimistic locking. By default Infinispan will use optimistic locking; this is more efficient for applications that don't update the same nodes, but concurrently updating the same nodes with optimistic locking may very well cause some updates to be lost. If you're not sure, use pessimistic locking.
The following are some sample Infinispan configuration snippets using a FileCacheStore: