try
{
for (int rIndex = 0; rIndex < repoNamesList.size(); rIndex++)
{
RepositoryImpl jcrRepository = (RepositoryImpl)repoService.getRepository(repoNamesList.get(rIndex));
String[] workspaces = jcrRepository.getWorkspaceNames();
if (enabled.equals("true"))
{
// set ownName & participantsClusterList for test mode
if (testMode != null && "true".equals(testMode))
{
ownName = (rIndex == 0 ? "cluster_node_1" : "cluster_node_2");
participantsClusterList = new ArrayList<String>();
if (rIndex == 0)
{
ownPriority = 100;
participantsClusterList.add("cluster_node_2");
}
else
{
ownPriority = 50;
participantsClusterList.add("cluster_node_1");
}
}
for (int wIndex = 0; wIndex < workspaces.length; wIndex++)
try
{
// create the recovery for workspace
File dir =
new File(recoveryDir.getAbsolutePath() + File.separator + repoNamesList.get(rIndex) + "_"
+ workspaces[wIndex]);
dir.mkdirs();
String systemId = IdGenerator.generate();
String props = channelConfig.replaceAll(IP_ADRESS_TEMPLATE, bindIPAddress);
// get workspace container
WorkspaceContainer wContainer =
(WorkspaceContainer)jcrRepository.getSystemSession(workspaces[wIndex]).getContainer();
String uniqueNoame = jcrRepository.getName() + "_" + workspaces[wIndex];
if (testMode != null && "true".equals(testMode))
uniqueNoame = "Test_Channel234";
ReplicationChannelManager channelManager =
new ReplicationChannelManager(props, channelName + (channelName.equals("") ? "" : "_")
+ uniqueNoame);
WorkspaceContainerFacade wsFacade = jcrRepository.getWorkspaceContainer(workspaces[wIndex]);
WorkspaceEntry wconf = (WorkspaceEntry)wsFacade.getComponent(WorkspaceEntry.class);
int maxBufferSize =
wconf.getContainer().getParameterInteger(WorkspaceDataContainer.MAXBUFFERSIZE_PROP,
WorkspaceDataContainer.DEF_MAXBUFFERSIZE);
WorkspaceFileCleanerHolder wfcleaner =
(WorkspaceFileCleanerHolder)wsFacade.getComponent(WorkspaceFileCleanerHolder.class);
FileCleaner fileCleaner = wfcleaner.getFileCleaner();
// create the RecoveryManager
RecoveryManager recoveryManager =
new RecoveryManager(dir, ownName, systemId, participantsClusterList, waitConfirmation,
jcrRepository.getName(), workspaces[wIndex], channelManager, fileCleaner, maxBufferSize,
new ReaderSpoolFileHolder());
PersistentDataManager dataManager =
(PersistentDataManager)wsFacade.getComponent(PersistentDataManager.class);