String id = IdGenerator.generate();
String wsName = "ws_" + id;
// container entry
List<SimpleParameterEntry> params = new ArrayList<SimpleParameterEntry>();
params.add(new SimpleParameterEntry("source-name", dsName));
params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_STRUCTURE_TYPE, dbStructureType.toString()));
params.add(new SimpleParameterEntry("max-buffer-size", "204800"));
params.add(new SimpleParameterEntry("dialect", "auto"));
params.add(new SimpleParameterEntry("swap-directory", "target/temp/swap/" + wsName));
ContainerEntry containerEntry =
new ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer", params);
containerEntry.setParameters(params);
// value storage
List<ValueStorageEntry> list = new ArrayList<ValueStorageEntry>();
if (valueStorageIds != null)
{
for (String vsId : valueStorageIds)
{
List<ValueStorageFilterEntry> vsparams = new ArrayList<ValueStorageFilterEntry>();
ValueStorageFilterEntry filterEntry = new ValueStorageFilterEntry();
filterEntry.setPropertyType("Binary");
vsparams.add(filterEntry);
List<SimpleParameterEntry> spe = new ArrayList<SimpleParameterEntry>();
spe.add(new SimpleParameterEntry("path", "target/temp/values/" + wsName + "-" + vsId));
ValueStorageEntry valueStorageEntry =
new ValueStorageEntry("org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage", spe);
valueStorageEntry.setId(vsId);
valueStorageEntry.setFilters(vsparams);
// containerEntry.setValueStorages();
containerEntry.setParameters(params);
list.add(valueStorageEntry);
}
}
containerEntry.setValueStorages(list);
// Indexer
params = new ArrayList<SimpleParameterEntry>();
params.add(new SimpleParameterEntry("index-dir", "target/temp/index/" + wsName));
QueryHandlerEntry qEntry =
new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", params);
// Cache
List<SimpleParameterEntry> cacheParams = new ArrayList<SimpleParameterEntry>();
cacheParams.add(new SimpleParameterEntry("maxSize", "2000"));
cacheParams.add(new SimpleParameterEntry("liveTime", "20m"));
CacheEntry cacheEntry = new CacheEntry(cacheParams);
cacheEntry.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl");
// Lock
LockManagerEntry lockManagerEntry = new LockManagerEntry();