}
protected WorkspaceEntry makeWorkspaceEntry(String name, String sourceName)
{
WorkspaceEntry ws1e = (WorkspaceEntry) ws1Session.getContainer().getComponentInstanceOfType(WorkspaceEntry.class);
WorkspaceEntry ws1back = new WorkspaceEntry();
ws1back.setName(name);
// RepositoryContainer rcontainer = (RepositoryContainer)
// container.getComponentInstanceOfType(RepositoryContainer.class);
ws1back.setUniqueName(((RepositoryImpl) ws1Session.getRepository()).getName() + "_" + ws1back.getName()); // EXOMAN
ws1back.setAccessManager(ws1e.getAccessManager());
ws1back.setCache(ws1e.getCache());
// ws1back.setContainer(ws1e.getContainer());
ws1back.setLockManager(ws1e.getLockManager());
ws1back.setInitializer(ws1e.getInitializer());
// Indexer
ArrayList qParams = new ArrayList();
// qParams.add(new SimpleParameterEntry("indexDir", "target" + File.separator+ "temp" +
// File.separator +"index" + name));
qParams.add(new SimpleParameterEntry(QueryHandlerParams.PARAM_INDEX_DIR, "target/temp/index/" + name
+ System.currentTimeMillis()));
QueryHandlerEntry qEntry =
new QueryHandlerEntry("org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex", qParams);
ws1back.setQueryHandler(qEntry); // EXOMAN
ArrayList params = new ArrayList();
for (Iterator i = ws1e.getContainer().getParameters().iterator(); i.hasNext();)
{
SimpleParameterEntry p = (SimpleParameterEntry) i.next();
SimpleParameterEntry newp = new SimpleParameterEntry(p.getName(), p.getValue());
if (newp.getName().equals("source-name"))
newp.setValue(sourceName);
else if (newp.getName().equals("swap-directory"))
newp.setValue("target/temp/swap/" + name + System.currentTimeMillis());
params.add(newp);
}
ContainerEntry ce =
new ContainerEntry("org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer", params);
ArrayList<ValueStorageEntry> list = new ArrayList<ValueStorageEntry>();
// value storage
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.TreeFileValueStorage", vsparams);
ArrayList<SimpleParameterEntry> spe = new ArrayList<SimpleParameterEntry>();
spe.add(new SimpleParameterEntry("path", "target/temp/values/" + name + "_" + System.currentTimeMillis()));
valueStorageEntry.setId("draft");
valueStorageEntry.setParameters(spe);
valueStorageEntry.setFilters(vsparams);
// containerEntry.setValueStorages();
list.add(valueStorageEntry);
ce.setValueStorages(list);
ws1back.setContainer(ce);
return ws1back;
}