Modeshape Config for MSSQL
singhl1 Feb 10, 2014 10:00 AMI have a working mode-shape config that works on a Spring, Java, MSSQL, Web based system.
The data is written to the file system with the following json file
{
"name": "repository",
"jndiName": "",
"workspaces": {
"predefined": ["Library"],
"default": "Library",
"allowCreation": true
},
"security": {
"anonymous": {
"roles": ["readonly", "readwrite", "admin"],
"useOnFailedLogin": true
}
},
"storage": {
"cacheName": "repository",
"binaryStorage": {
"type": "file",
"directory": /Library/binaries"
}
},
"query": {
"enabled": true,
"enableFullTextSearch": true,
"indexStorage": {
"type": "filesystem",
"location": "/Library/indexes",
"lockingStrategy": "native",
"fileSystemAccessType": "auto"
},
"indexing": {
"rebuildOnStartup": {
"when": "if_missing",
"mode": "async"
}
},
"textExtracting": {
"extractors": {
"tikaExtractor": {
"name": "Tika content-based extractor",
"classname": "tika"
}
}
}
},
"sequencing": {
"removeDerivedContentWithOriginal": true,
"sequencers": {
"Images in separate location": {
"classname": "ImageSequencer",
"pathExpression": "default://(*.(gif|png|pict|jpg))/jcr:content[@jcr:data] => default:/sequenced/images/$1"
}
}
},
"node-types": ["common_mixin.cnd"]
}
And the following java code:
repositoryConfiguration = RepositoryConfiguration.read(jcrconfigresource.getFile()); |
// Create the Infinispan configuration via a Local Environment ... | |
ConfigurationBuilder builder = new ConfigurationBuilder(); | |
Configuration cacheConfig = builder.transaction() | |
.transactionManagerLookup(getInfinispanTransactionmanager) | |
.transactionMode(TransactionMode.TRANSACTIONAL) | |
.autoCommit(true) | |
.lockingMode(LockingMode.PESSIMISTIC) | |
.loaders() | |
.passivation(false) | |
.shared(false) | |
.preload(false) | |
.addFileCacheStore() | |
.async() | |
.threadPoolSize(10) | |
.enabled(true) | |
.fetchPersistentState(false) | |
.purgeOnStartup(false) | |
.addProperty("location", "/Library/content") | |
.build(); |
environment = new LocalEnvironment(); | |
Configuration newConfig = environment.defineCache(repositoryConfiguration.getCacheName(), cacheConfig); | |
repositoryConfiguration = repositoryConfiguration.with(environment); |
I want to change this to save everything to a database (MSSQL for production and H2 for dev/test), this means everything, the storage, query and sequencing, is this:
possible?
if so I have seen the post for https://github.com/ModeShape/modeshape-examples/tree/master/modeshape-jdbc-store-example
how can this be adapted to fit my scenario. A lot of the stuff seems to be configured for filesystem - not database?
Also is it possible to port an existing file based repo to this new db based repo?
Many thanks in advance.