protected void restoreWorkspace() throws WorkspaceRestoreException
{
try
{
// get current workspace configuration
WorkspaceEntry wEntry = null;;
for (WorkspaceEntry entry : repositoryService.getRepository(repositoryName).getConfiguration()
.getWorkspaceEntries())
{
if (entry.getName().equals(this.wEntry.getName()))
{
wEntry = entry;
break;
}
}
if (wEntry == null)
{
throw new WorkspaceRestoreException("Workspace " + this.wEntry.getName()
+ " did not found in current repository " + repositoryName + " configuration");
}
// get all backupable components
List<Backupable> backupable =
repositoryService.getRepository(repositoryName).getWorkspaceContainer(wEntry.getName())
.getComponentInstancesOfType(Backupable.class);
// close all session
forceCloseSession(repositoryName, wEntry.getName());
repositoryService.getRepository(repositoryName).removeWorkspace(wEntry.getName());
// clean
for (Backupable component : backupable)
{
component.clean();
}
super.restoreWorkspace();
}
catch (Throwable t)
{
throw new WorkspaceRestoreException("Workspace " + wEntry.getName() + " was not restored", t);
}
}