1
votes

I want to deploy a server-client architecture based on ModeShape but I can't figure out how to configure ModeShape and Infinispan to achieve my goal.

Here is a typical use case:

  • User A creates a node on the main server repository
  • User B retrieves this node locally and edits its subtree and properties offline
  • Once online again, user B pushes back this node to the main server repository and merges its content if necessary (i.e. the node has been also modified in the main repository)

So, my requirements are:

  • I need the main server repository to hold all the data.
  • I need each client to be able to fetch some specific nodes from the server repository and to store it locally.
  • I need each client to be able to work offline (i.e. the main server repository is not reachable) in its local repository
  • I need each client to be able to synchronize its local repository with the main repository once online and to merge the data if necessary

Do you have an idea how to get such a behavior by using the clustering options of ModeShape and/or Infinispan? Or maybe you can think of a better approach?

1

1 Answers

1
votes

The main server's configuration would be pretty conventional. ModeShape (and Infinispan) are pretty flexible here, so the harder part is deciding upon how/where you want to persist all of ModeShape's content. The project has quite a few complete examples with various configurations, and lots of configurations for test cases that may also be helpful.

As for the clients, I'd recommend having them store content in a local repository that persists to local disk, so that means using either Infinispan's JDBC cache store or the file system cache store. (With ModeShape 4.0, there are even a few other Infinispan cache stores that will work and perform even better.)

Then the question is how to synchronize the data. ModeShape has clustering built-in, but having all repository instances be identical isn't quite what you want. Unfortunately, there is nothing in ModeShape that directly supports this functionality, but it's something you could implement on your own. Then the client could connect and download the subset of the main repository content (or those nodes that changed, based upon the event journal information) and then update its local copy. Of course, you'd probably want to ensure that you didn't overwrite any local content that was updated by the client but not yet synchronized to the server.

Doing this will take some effort, but it is possible to do completely on top of ModeShape. Really, the bulk of the work entails merging the content of two independently-updated repositories using each repository's event journal (e.g., the journal of save transactions and what was changed in each transaction).