dsName = createDatasource();
}
List params = new ArrayList();
params.add(new SimpleParameterEntry("source-name", dsName));
params.add(new SimpleParameterEntry("db-type", "generic"));
params.add(new SimpleParameterEntry("multi-db", isMultiDb ? "true" : "false"));
params.add(new SimpleParameterEntry("update-storage", "true"));
params.add(new SimpleParameterEntry("max-buffer-size", "204800"));
if (dbDialect != null)
{
params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, dbDialect));
}
else if (entry.getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT) != null)
{
params.add(new SimpleParameterEntry(JDBCWorkspaceDataContainer.DB_DIALECT, entry
.getParameterValue(JDBCWorkspaceDataContainer.DB_DIALECT)));
}
String oldSwap = entry.getParameterValue("swap-directory");
String newSwap = oldSwap.substring(0, oldSwap.lastIndexOf('/')) + '/' + wsName;
params.add(new SimpleParameterEntry("swap-directory", newSwap));
ContainerEntry containerEntry =
new ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer",
(ArrayList)params);
containerEntry.setParameters(params);
if (vsPath != null)
{
ArrayList<ValueStorageFilterEntry> vsparams = new ArrayList<ValueStorageFilterEntry>();
ValueStorageFilterEntry filterEntry = new ValueStorageFilterEntry();
filterEntry.setPropertyType("Binary");
vsparams.add(filterEntry);
ValueStorageEntry valueStorageEntry =
new ValueStorageEntry("org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage", vsparams);
ArrayList<SimpleParameterEntry> spe = new ArrayList<SimpleParameterEntry>();
spe.add(new SimpleParameterEntry("path", vsPath));
valueStorageEntry.setId(IdGenerator.generate());
valueStorageEntry.setParameters(spe);
valueStorageEntry.setFilters(vsparams);
// containerEntry.setValueStorages();
containerEntry.setParameters(params);
ArrayList list = new ArrayList(1);
list.add(valueStorageEntry);
containerEntry.setValueStorages(list);
}
// Indexer
ArrayList qParams = new ArrayList();
qParams.add(new SimpleParameterEntry("indexDir", "target/temp/index/" + IdGenerator.generate()));
QueryHandlerEntry qEntry =
new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", qParams);
WorkspaceEntry workspaceEntry =
new WorkspaceEntry(wsName != null ? wsName : IdGenerator.generate(), "nt:unstructured");
workspaceEntry.setContainer(containerEntry);
ArrayList cacheParams = new ArrayList();
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");
workspaceEntry.setCache(cacheEntry);
workspaceEntry.setQueryHandler(qEntry);
LockManagerEntry lockManagerEntry = new LockManagerEntry();
lockManagerEntry.setTimeout(900000);
LockPersisterEntry lockPersisterEntry = new LockPersisterEntry();
lockPersisterEntry.setType("org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister");
ArrayList<SimpleParameterEntry> lockPersisterParameters = new ArrayList<SimpleParameterEntry>();
lockPersisterParameters.add(new SimpleParameterEntry("path", "target/temp/lock/" + wsName));
lockPersisterEntry.setParameters(lockPersisterParameters);
lockManagerEntry.setPersister(lockPersisterEntry);
workspaceEntry.setLockManager(lockManagerEntry);