Author: andrew.plotnikov
Date: 2012-02-09 10:00:02 -0500 (Thu, 09 Feb 2012)
New Revision: 5596
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
Log:
EXOJCR-1576: Adapted eXo JCR to GlusterFS
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
---
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2012-02-09
13:32:39 UTC (rev 5595)
+++
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2012-02-09
15:00:02 UTC (rev 5596)
@@ -78,6 +78,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -1034,37 +1035,32 @@
if (wsConfig.getContainer().getValueStorages() != null)
{
- for (ValueStorageEntry valueStorage :
wsConfig.getContainer().getValueStorages())
+ SecurityHelper.doPrivilegedExceptionAction(new
PrivilegedExceptionAction<Void>()
{
- final File valueStorageDir = new
File(valueStorage.getParameterValue(FileValueStorage.PATH));
-
- SecurityHelper.doPrivilegedIOExceptionAction(new
PrivilegedExceptionAction<Void>()
+ public Void run() throws IOException, RepositoryConfigurationException
{
- public Void run() throws IOException
+ for (ValueStorageEntry valueStorage :
wsConfig.getContainer().getValueStorages())
{
+ File valueStorageDir = new
File(valueStorage.getParameterValue(FileValueStorage.PATH));
if (valueStorageDir.exists())
{
DirectoryHelper.removeDirectory(valueStorageDir);
}
-
- return null;
}
- });
- }
+
+ return null;
+ }
+ });
}
}
- catch (RepositoryConfigurationException e)
+ catch (DBCleanException e)
{
throw new BackupException(e);
}
- catch (IOException e)
+ catch (PrivilegedActionException e)
{
throw new BackupException(e);
}
- catch (DBCleanException e)
- {
- throw new BackupException(e);
- }
}
/**
@@ -1111,14 +1107,14 @@
// backup value storage
if (wsConfig.getContainer().getValueStorages() != null)
{
- for (final ValueStorageEntry valueStorage :
wsConfig.getContainer().getValueStorages())
+ SecurityHelper.doPrivilegedExceptionAction(new
PrivilegedExceptionAction<Void>()
{
- final File srcDir = new
File(valueStorage.getParameterValue(FileValueStorage.PATH));
-
- SecurityHelper.doPrivilegedIOExceptionAction(new
PrivilegedExceptionAction<Void>()
+ public Void run() throws RepositoryConfigurationException, IOException
{
- public Void run() throws IOException
+ for (ValueStorageEntry valueStorage :
wsConfig.getContainer().getValueStorages())
{
+ File srcDir = new
File(valueStorage.getParameterValue(FileValueStorage.PATH));
+
if (!srcDir.exists())
{
throw new IOException("Can't backup value storage.
Directory " + srcDir.getName()
@@ -1129,22 +1125,21 @@
File zipFile = new File(storageDir, "values-" +
valueStorage.getId() + ".zip");
DirectoryHelper.compressDirectory(srcDir, zipFile);
}
-
- return null;
}
- });
- }
+ return null;
+ }
+ });
}
}
catch (IOException e)
{
throw new BackupException(e);
}
- catch (RepositoryConfigurationException e)
+ catch (RepositoryException e)
{
throw new BackupException(e);
}
- catch (RepositoryException e)
+ catch (PrivilegedActionException e)
{
throw new BackupException(e);
}