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
CacheEntry cacheEntry = null;
try
{
Class
.forName("org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache");
List<SimpleParameterEntry> cacheParams = new ArrayList<SimpleParameterEntry>();
cacheParams.add(new SimpleParameterEntry("infinispan-configuration",
"conf/standalone/test-infinispan-config.xml"));
cacheEntry = new CacheEntry(cacheParams);
cacheEntry.setEnabled(cacheEnabled);
cacheEntry
.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache");