-
1. Re: Sample of replSync-service.xml done through API instead?
jiwils Oct 11, 2005 2:49 PM (in response to joereger)I guess the question is why do you want to use the programmatic API? Are you doing something that requires dynamic cache creation on the fly? If not, I might rethink part of my approach...
Specifically, it seems to me that for the JGroups configuration (what the setClusterConfig method pertains to), you could use a XML file packaged in a JAR, so you can pass an Element created from this file without too much effort. It should not be too hard to figure out which types of JGroups configurations you need, and you could prepackage them in this manner. Regardless of whether or not you will use dynamic caches, your JGroups settings should not be that dynamic (if they are, use an XML file that is external to the JAR). -
2. Re: Sample of replSync-service.xml done through API instead?
joereger Oct 12, 2005 12:42 AM (in response to joereger)Hi!
My app is downloadable. People can install into any number of enterprise or personal environments. I bundle Tomcat, MySql drivers, etc. When you start it up there's a wizard that allows you to configure your system. In this context, even things that are generally configured statically must be dynamic... database connection parameters, cache multicast ip's, upload directories, email server locations, etc.
I certainly agree that it's a lot easier for me to ask the user to edit an XML file, but it's easier for the user to answer a set of easy on-screen questions (with recommended default values) and have me take care of the back-end config (and validating what values they choose).
In this case, I'll likely make the following user-configurable via a UI:
- whether or not clustered caching is on
- multicast ip address, if on
- max number of objects in the cache
So, when the API's available, I opt to give the user simple control over it instead of hard-coding what works for me today. Generally saves me a lot of re-coding down the line when that one crazy user needs something special.
Best,
Joe -
3. Re: Sample of replSync-service.xml done through API instead?
brian.stansberry Oct 12, 2005 1:01 AM (in response to joereger)If creating an XML element is too big of a pain and you just want to substitute in a couple user-defined parameters into an otherwise static JGroups configuration, you might consider using an old fashioned JGroups configuration string and passing it to TreeCache.setClusterProperties(). If you look at the code for the TreeCache.getDefaultProperties() method, you'll see the format of such a string. The TreeCache.setClusterConfig() method actually just converts the passed Element into such a string anyway.