exo-jcr SVN: r5597 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-09 10:46:42 -0500 (Thu, 09 Feb 2012)
New Revision: 5597
Modified:
jcr/trunk/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/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/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)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2012-02-09 15:46:42 UTC (rev 5597)
@@ -77,6 +77,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;
@@ -1025,23 +1026,22 @@
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)
@@ -1056,7 +1056,7 @@
{
throw new BackupException(e);
}
- catch (IOException e)
+ catch (PrivilegedActionException e)
{
throw new BackupException(e);
}
@@ -1106,14 +1106,13 @@
// 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 IOException, RepositoryConfigurationException
{
- 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()
@@ -1124,22 +1123,22 @@
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);
}
12 years, 4 months
exo-jcr SVN: r5596 - jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc.
by do-not-reply@jboss.org
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);
}
12 years, 4 months
exo-jcr SVN: r5595 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config and 8 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-09 08:32:39 -0500 (Thu, 09 Feb 2012)
New Revision: 5595
Added:
jcr/trunk/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
jcr/trunk/exo.jcr.component.ext/pom.xml
Log:
EXOJCR-1576: Adapted eXo JCR to GlusterFS
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DirectoryRestore.java 2012-02-09 13:32:39 UTC (rev 5595)
@@ -16,8 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.backup.rdbms;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.backup.DataRestore;
import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
@@ -27,6 +27,7 @@
import java.io.File;
import java.io.IOException;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
@@ -96,27 +97,35 @@
*/
public void clean() throws BackupException
{
- for (int i = 0; i < dataDirs.size(); i++)
+ try
{
- File dataDir = dataDirs.get(i);
-
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- File tmpDir = new File(tempDir, PREFIX + IdGenerator.generate());
- PrivilegedFileHelper.mkdirs(tmpDir);
- tmpDirs.add(tmpDir);
+ public Void run() throws IOException
+ {
+ for (int i = 0; i < dataDirs.size(); i++)
+ {
+ File dataDir = dataDirs.get(i);
- if (PrivilegedFileHelper.exists(dataDir))
- {
- DirectoryHelper.copyDirectory(dataDir, tmpDir);
- DirectoryHelper.removeDirectory(dataDir);
+ File tmpDir = new File(tempDir, PREFIX + IdGenerator.generate());
+ tmpDir.mkdirs();
+ tmpDirs.add(tmpDir);
+
+ if (dataDir.exists())
+ {
+ DirectoryHelper.copyDirectory(dataDir, tmpDir);
+ DirectoryHelper.removeDirectory(dataDir);
+ }
+ }
+
+ return null;
}
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ });
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
}
/**
@@ -124,27 +133,37 @@
*/
public void restore() throws BackupException
{
- for (int i = 0; i < zipFiles.size(); i++)
+ try
{
- File zipFile = zipFiles.get(i);
- File dataDir = dataDirs.get(i);
-
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- if (PrivilegedFileHelper.isDirectory(zipFile))
+ public Void run() throws IOException
{
- DirectoryHelper.uncompressEveryFileFromDirectory(zipFile, dataDir);
+
+ for (int i = 0; i < zipFiles.size(); i++)
+ {
+ File zipFile = zipFiles.get(i);
+ File dataDir = dataDirs.get(i);
+
+ if (zipFile.isDirectory())
+ {
+ DirectoryHelper.uncompressEveryFileFromDirectory(zipFile, dataDir);
+ }
+ else
+ {
+ DirectoryHelper.uncompressDirectory(zipFile, dataDir);
+ }
+ }
+
+ return null;
}
- else
- {
- DirectoryHelper.uncompressDirectory(zipFile, dataDir);
- }
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ });
+
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
}
/**
@@ -159,25 +178,33 @@
*/
public void rollback() throws BackupException
{
- for (int i = 0; i < tmpDirs.size(); i++)
+ try
{
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- File tmpDir = tmpDirs.get(i);
- File dataDir = dataDirs.get(i);
+ public Void run() throws IOException
+ {
+ for (int i = 0; i < tmpDirs.size(); i++)
+ {
+ File tmpDir = tmpDirs.get(i);
+ File dataDir = dataDirs.get(i);
- if (PrivilegedFileHelper.exists(dataDir))
- {
- DirectoryHelper.removeDirectory(dataDir);
+ if (dataDir.exists())
+ {
+ DirectoryHelper.removeDirectory(dataDir);
+ }
+
+ DirectoryHelper.copyDirectory(tmpDir, dataDir);
+ }
+
+ return null;
}
-
- DirectoryHelper.copyDirectory(tmpDir, dataDir);
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ });
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
}
/**
@@ -185,17 +212,25 @@
*/
public void close() throws BackupException
{
- for (File tmpDir : tmpDirs)
+ try
{
- try
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- DirectoryHelper.removeDirectory(tmpDir);
- }
- catch (IOException e)
- {
- throw new BackupException(e);
- }
+ public Void run() throws IOException
+ {
+ for (File tmpDir : tmpDirs)
+ {
+ DirectoryHelper.removeDirectory(tmpDir);
+ }
+
+ return null;
+ }
+ });
}
+ catch (IOException e)
+ {
+ throw new BackupException(e);
+ }
dataDirs.clear();
zipFiles.clear();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2012-02-09 13:32:39 UTC (rev 5595)
@@ -173,17 +173,25 @@
else
{
URL filePath = configurationService.getURL(param.getValue());
- File sourceConfig = new File(filePath.toURI());
+ final File sourceConfig = new File(filePath.toURI());
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmm");
- File backUp = new File(sourceConfig.getAbsoluteFile() + "_" + format.format(new Date()));
+ final File backUp = new File(sourceConfig.getAbsoluteFile() + "_" + format.format(new Date()));
+
try
{
- DirectoryHelper.renameFile(sourceConfig, backUp);
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws IOException
+ {
+ DirectoryHelper.deleteDstAndRename(sourceConfig, backUp);
+ return null;
+ }
+ });
}
catch (IOException ioe)
{
throw new RepositoryException("Can't back up configuration on path "
- + PrivilegedFileHelper.getAbsolutePath(sourceConfig), ioe);
+ + PrivilegedFileHelper.getAbsolutePath(sourceConfig), ioe);
}
saveStream = PrivilegedFileHelper.fileOutputStream(sourceConfig);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java 2012-02-09 13:32:39 UTC (rev 5595)
@@ -16,7 +16,7 @@
*/
package org.exoplatform.services.jcr.impl.core.query;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.core.query.lucene.OfflinePersistentIndex;
import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
@@ -33,6 +33,7 @@
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.io.Serializable;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
@@ -140,21 +141,27 @@
public Serializable execute(Serializable[] args) throws Throwable
{
- int indexDirLen = PrivilegedFileHelper.getAbsolutePath(indexDirectory).length();
-
- ArrayList<String> result = new ArrayList<String>();
- for (File file : DirectoryHelper.listFiles(indexDirectory))
+ return SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<ArrayList<String>>()
{
- if (!file.isDirectory())
+ public ArrayList<String> run() throws IOException
{
- // if parent directory is not "offline" then add this file. Otherwise skip it.
- if (!file.getParent().endsWith(OfflinePersistentIndex.NAME))
+ int indexDirLen = indexDirectory.getAbsolutePath().length();
+
+ ArrayList<String> result = new ArrayList<String>();
+ for (File file : DirectoryHelper.listFiles(indexDirectory))
{
- result.add(PrivilegedFileHelper.getAbsolutePath(file).substring(indexDirLen));
+ if (!file.isDirectory())
+ {
+ // if parent directory is not "offline" then add this file. Otherwise skip it.
+ if (!file.getParent().endsWith(OfflinePersistentIndex.NAME))
+ {
+ result.add(file.getAbsolutePath().substring(indexDirLen));
+ }
+ }
}
+ return result;
}
- }
- return result;
+ });
}
});
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2012-02-09 13:32:39 UTC (rev 5595)
@@ -1620,7 +1620,17 @@
{
try
{
- DirectoryHelper.removeDirectory(getIndexDirectory());
+ final File indexDir = getIndexDirectory();
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws IOException
+ {
+ DirectoryHelper.removeDirectory(indexDir);
+
+ return null;
+ }
+ });
}
catch (IOException e)
{
@@ -1635,22 +1645,30 @@
/**
* {@inheritDoc}}
*/
- public void backup(File storageDir) throws BackupException
+ public void backup(final File storageDir) throws BackupException
{
try
{
- File indexDir = getIndexDirectory();
+ final File indexDir = getIndexDirectory();
- if (!PrivilegedFileHelper.exists(indexDir))
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- throw new BackupException("Can't backup index. Directory "
- + PrivilegedFileHelper.getCanonicalPath(indexDir) + " doesn't exists");
- }
- else
- {
- File destZip = new File(storageDir, getStorageName() + ".zip");
- DirectoryHelper.compressDirectory(indexDir, destZip);
- }
+ public Void run() throws IOException
+ {
+ if (!indexDir.exists())
+ {
+ throw new IOException("Can't backup index. Directory " + indexDir.getCanonicalPath()
+ + " doesn't exists");
+ }
+ else
+ {
+ File destZip = new File(storageDir, getStorageName() + ".zip");
+ DirectoryHelper.compressDirectory(indexDir, destZip);
+ }
+
+ return null;
+ }
+ });
}
catch (RepositoryConfigurationException e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java 2012-02-09 13:32:39 UTC (rev 5595)
@@ -22,6 +22,7 @@
import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex;
+import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
import java.io.File;
import java.io.FileFilter;
@@ -221,15 +222,27 @@
*/
public boolean rename(final String from, final String to)
{
- return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Boolean>()
+ final File src = new File(baseDir, from);
+ final File dest = new File(baseDir, to);
+
+ try
{
- public Boolean run()
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- File src = new File(baseDir, from);
- File dest = new File(baseDir, to);
- return src.renameTo(dest);
- }
- });
+ public Void run() throws IOException
+ {
+ DirectoryHelper.renameFile(src, dest);
+
+ return null;
+ }
+ });
+ }
+ catch (IOException e)
+ {
+ return false;
+ }
+
+ return true;
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/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)
@@ -109,8 +109,8 @@
/**
* Indicates if the statistics has to be enabled.
*/
- public static final boolean STATISTICS_ENABLED =
- Boolean.valueOf(PrivilegedSystemHelper.getProperty("JDBCWorkspaceDataContainer.statistics.enabled"));
+ public static final boolean STATISTICS_ENABLED = Boolean.valueOf(PrivilegedSystemHelper
+ .getProperty("JDBCWorkspaceDataContainer.statistics.enabled"));
static
{
@@ -487,8 +487,8 @@
// by default
if (dbSourceName != null)
{
- return new GenericConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
+ return new GenericConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider,
+ maxBufferSize, swapDirectory, swapCleaner);
}
return new GenericConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
@@ -538,8 +538,8 @@
}
// MULTIDB
- if (!wsEntry.getContainer().getParameterValue(MULTIDB).equals(
- wsConfig.getContainer().getParameterValue(MULTIDB)))
+ if (!wsEntry.getContainer().getParameterValue(MULTIDB)
+ .equals(wsConfig.getContainer().getParameterValue(MULTIDB)))
{
throw new RepositoryConfigurationException("All workspaces must be " + MULTIDB + " or " + SINGLEDB
+ ". But " + wsEntry.getName() + "- multi-db=" + wsEntry.getContainer().getParameterValue(MULTIDB)
@@ -660,14 +660,14 @@
this.connFactory = defaultConnectionFactory();
dbInitializer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL || dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8 ||
- dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
+ else if (dbDialect == DBConstants.DB_DIALECT_MYSQL || dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8
+ || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
if (dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
- LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only" +
- " if you don't expect any support and performances in read accesses are more important than the consistency" +
- " in your use-case. This dialect is only dedicated to the community.");
+ LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only"
+ + " if you don't expect any support and performances in read accesses are more important than the consistency"
+ + " in your use-case. This dialect is only dedicated to the community.");
}
if (dbSourceName != null)
{
@@ -721,8 +721,8 @@
if (dbSourceName != null)
{
this.connFactory =
- new HSQLDBConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
+ new HSQLDBConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider,
+ maxBufferSize, swapDirectory, swapCleaner);
}
else
{
@@ -1027,11 +1027,20 @@
{
for (ValueStorageEntry valueStorage : wsConfig.getContainer().getValueStorages())
{
- File valueStorageDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
- if (PrivilegedFileHelper.exists(valueStorageDir))
+ final File valueStorageDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- DirectoryHelper.removeDirectory(valueStorageDir);
- }
+ public Void run() throws IOException
+ {
+ if (valueStorageDir.exists())
+ {
+ DirectoryHelper.removeDirectory(valueStorageDir);
+ }
+
+ return null;
+ }
+ });
}
}
}
@@ -1056,7 +1065,7 @@
/**
* {@inheritDoc}
*/
- public void backup(File storageDir) throws BackupException
+ public void backup(final File storageDir) throws BackupException
{
ObjectWriter backupInfo = null;
@@ -1097,19 +1106,28 @@
// backup value storage
if (wsConfig.getContainer().getValueStorages() != null)
{
- for (ValueStorageEntry valueStorage : wsConfig.getContainer().getValueStorages())
+ for (final ValueStorageEntry valueStorage : wsConfig.getContainer().getValueStorages())
{
- File srcDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
- if (!PrivilegedFileHelper.exists(srcDir))
+ final File srcDir = new File(valueStorage.getParameterValue(FileValueStorage.PATH));
+
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- throw new BackupException("Can't backup value storage. Directory " + srcDir.getName()
- + " doesn't exists");
- }
- else
- {
- File zipFile = new File(storageDir, "values-" + valueStorage.getId() + ".zip");
- DirectoryHelper.compressDirectory(srcDir, zipFile);
- }
+ public Void run() throws IOException
+ {
+ if (!srcDir.exists())
+ {
+ throw new IOException("Can't backup value storage. Directory " + srcDir.getName()
+ + " doesn't exists");
+ }
+ else
+ {
+ File zipFile = new File(storageDir, "values-" + valueStorage.getId() + ".zip");
+ DirectoryHelper.compressDirectory(srcDir, zipFile);
+ }
+
+ return null;
+ }
+ });
}
}
}
@@ -1152,7 +1170,7 @@
ObjectReader backupInfo = null;
try
{
- File storageDir = (File) context.getObject(DataRestoreContext.STORAGE_DIR);
+ File storageDir = (File)context.getObject(DataRestoreContext.STORAGE_DIR);
Connection jdbcConn = null;
if (context.getObject(DataRestoreContext.DB_CONNECTION) == null)
@@ -1174,11 +1192,11 @@
}
else
{
- jdbcConn = (Connection) context.getObject(DataRestoreContext.DB_CONNECTION);
+ jdbcConn = (Connection)context.getObject(DataRestoreContext.DB_CONNECTION);
}
backupInfo =
- new ObjectReaderImpl(PrivilegedFileHelper.fileInputStream(new File(storageDir,
+ new ObjectReaderImpl(PrivilegedFileHelper.fileInputStream(new File(storageDir,
"JDBCWorkspaceDataContainer.info")));
String srcContainerName = backupInfo.readString();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java 2012-02-09 13:32:39 UTC (rev 5595)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.impl.storage.value.cas.ValueContentAddressStorage;
import org.exoplatform.services.jcr.impl.storage.value.fs.CASableIOSupport;
import org.exoplatform.services.jcr.impl.storage.value.fs.FileDigestOutputStream;
+import org.exoplatform.services.jcr.impl.util.io.DirectoryHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.util.IdGenerator;
@@ -175,11 +176,16 @@
// make sure parent dir exists
vcasFile.getParentFile().mkdirs();
+
// rename propetynamed file to hashnamed one
- if (!tempFile.renameTo(vcasFile))
+ try
{
+ DirectoryHelper.renameFile(tempFile, vcasFile);
+ }
+ catch (IOException e)
+ {
throw new VCASException("File " + tempFile.getAbsolutePath() + " can't be renamed to VCAS-named "
- + vcasFile.getAbsolutePath());
+ + vcasFile.getAbsolutePath(), e);
}
} // else - CASed Value already exists
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java 2012-02-09 13:32:39 UTC (rev 5595)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.util.io;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -56,12 +56,12 @@
{
List<File> result = new ArrayList<File>();
- if (!PrivilegedFileHelper.isDirectory(srcPath))
+ if (!srcPath.isDirectory())
{
- throw new IOException(PrivilegedFileHelper.getAbsolutePath(srcPath) + " is a directory");
+ throw new IOException(srcPath.getAbsolutePath() + " is a directory");
}
- for (File subFile : PrivilegedFileHelper.listFiles(srcPath))
+ for (File subFile : srcPath.listFiles())
{
result.add(subFile);
if (subFile.isDirectory())
@@ -85,14 +85,14 @@
*/
public static void copyDirectory(File srcPath, File dstPath) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(srcPath))
+ if (srcPath.isDirectory())
{
- if (!PrivilegedFileHelper.exists(dstPath))
+ if (!dstPath.exists())
{
- PrivilegedFileHelper.mkdirs(dstPath);
+ dstPath.mkdirs();
}
- String files[] = PrivilegedFileHelper.list(srcPath);
+ String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
copyDirectory(new File(srcPath, files[i]), new File(dstPath, files[i]));
@@ -105,8 +105,8 @@
try
{
- in = PrivilegedFileHelper.fileInputStream(srcPath);
- out = PrivilegedFileHelper.fileOutputStream(dstPath);
+ in = new FileInputStream(srcPath);
+ out = new FileOutputStream(dstPath);
transfer(in, out);
}
@@ -136,23 +136,23 @@
*/
public static void removeDirectory(File dir) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(dir))
+ if (dir.isDirectory())
{
- for (File subFile : PrivilegedFileHelper.listFiles(dir))
+ for (File subFile : dir.listFiles())
{
removeDirectory(subFile);
}
- if (!PrivilegedFileHelper.delete(dir))
+ if (!dir.delete())
{
- throw new IOException("Can't remove folder : " + PrivilegedFileHelper.getCanonicalPath(dir));
+ throw new IOException("Can't remove folder : " + dir.getCanonicalPath());
}
}
else
{
- if (!PrivilegedFileHelper.delete(dir))
+ if (!dir.delete())
{
- throw new IOException("Can't remove file : " + PrivilegedFileHelper.getCanonicalPath(dir));
+ throw new IOException("Can't remove file : " + dir.getCanonicalPath());
}
}
}
@@ -172,12 +172,12 @@
*/
public static void compressDirectory(File rootPath, File dstZipPath) throws IOException
{
- ZipOutputStream zip = PrivilegedFileHelper.zipOutputStream(dstZipPath);
+ ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(dstZipPath));
try
{
- if (PrivilegedFileHelper.isDirectory(rootPath))
+ if (rootPath.isDirectory())
{
- String files[] = PrivilegedFileHelper.list(rootPath);
+ String files[] = rootPath.list();
for (int i = 0; i < files.length; i++)
{
compressDirectory("", new File(rootPath, files[i]), zip);
@@ -203,12 +203,12 @@
*/
private static void compressDirectory(String relativePath, File srcPath, ZipOutputStream zip) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(srcPath))
+ if (srcPath.isDirectory())
{
zip.putNextEntry(new ZipEntry(relativePath + "/" + srcPath.getName() + "/"));
zip.closeEntry();
- String files[] = PrivilegedFileHelper.list(srcPath);
+ String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
compressDirectory(relativePath + "/" + srcPath.getName(), new File(srcPath, files[i]), zip);
@@ -216,7 +216,7 @@
}
else
{
- InputStream in = PrivilegedFileHelper.fileInputStream(srcPath);
+ InputStream in = new FileInputStream(srcPath);
try
{
zip.putNextEntry(new ZipEntry(relativePath + "/" + srcPath.getName()));
@@ -247,7 +247,7 @@
*/
public static void uncompressDirectory(File srcZipPath, File dstDirPath) throws IOException
{
- ZipInputStream in = PrivilegedFileHelper.zipInputStream(srcZipPath);
+ ZipInputStream in = new ZipInputStream(new FileInputStream(srcZipPath));
ZipEntry entry = null;
try
@@ -255,15 +255,15 @@
while ((entry = in.getNextEntry()) != null)
{
File dstFile = new File(dstDirPath, entry.getName());
- PrivilegedFileHelper.mkdirs(dstFile.getParentFile());
+ dstFile.getParentFile().mkdirs();
if (entry.isDirectory())
{
- PrivilegedFileHelper.mkdirs(dstFile);
+ dstFile.mkdirs();
}
else
{
- OutputStream out = PrivilegedFileHelper.fileOutputStream(dstFile);
+ OutputStream out = new FileOutputStream(dstFile);
try
{
transfer(in, out);
@@ -296,14 +296,14 @@
*/
public static void uncompressEveryFileFromDirectory(File srcPath, File dstPath) throws IOException
{
- if (PrivilegedFileHelper.isDirectory(srcPath))
+ if (srcPath.isDirectory())
{
- if (!PrivilegedFileHelper.exists(dstPath))
+ if (!dstPath.exists())
{
- PrivilegedFileHelper.mkdirs(dstPath);
+ dstPath.mkdirs();
}
- String files[] = PrivilegedFileHelper.list(srcPath);
+ String files[] = srcPath.list();
for (int i = 0; i < files.length; i++)
{
uncompressEveryFileFromDirectory(new File(srcPath, files[i]), new File(dstPath, files[i]));
@@ -316,10 +316,10 @@
try
{
- in = PrivilegedFileHelper.zipInputStream(srcPath);
+ in = new ZipInputStream(new FileInputStream(srcPath));
in.getNextEntry();
- out = PrivilegedFileHelper.fileOutputStream(dstPath);
+ out = new FileOutputStream(dstPath);
transfer(in, out);
}
@@ -354,7 +354,9 @@
}
/**
- * Rename file.
+ * Rename file. Trying to remove destination first.
+ * If file can't be renamed in standard way the coping
+ * data will be used instead.
*
* @param srcFile
* source file
@@ -363,34 +365,45 @@
* @throws IOException
* if any exception occurred
*/
- public static synchronized void renameFile(File srcFile, File dstFile) throws IOException
+ public static void deleteDstAndRename(File srcFile, File dstFile) throws IOException
{
- /* This is not atomic. If the program crashes between the call to
- delete() and the call to renameTo() then we're screwed, but I've
- been unable to figure out how else to do this... */
-
- if (PrivilegedFileHelper.exists(dstFile))
- if (!PrivilegedFileHelper.delete(dstFile))
+ if (dstFile.exists())
+ {
+ if (!dstFile.delete())
+ {
throw new IOException("Cannot delete " + dstFile);
+ }
+ }
+ renameFile(srcFile, dstFile);
+ }
+
+ /**
+ * Rename file. If file can't be renamed in standard way the coping
+ * data will be used instead.
+ *
+ * @param srcFile
+ * source file
+ * @param dstFile
+ * destination file
+ * @throws IOException
+ * if any exception occurred
+ */
+ public static void renameFile(File srcFile, File dstFile) throws IOException
+ {
// Rename the srcFile file to the new one. Unfortunately, the renameTo()
// method does not work reliably under some JVMs. Therefore, if the
// rename fails, we manually rename by copying the srcFile file to the new one
- if (!PrivilegedFileHelper.renameTo(srcFile, dstFile))
+ if (!srcFile.renameTo(dstFile))
{
InputStream in = null;
OutputStream out = null;
try
{
- in = PrivilegedFileHelper.fileInputStream(srcFile);
- out = PrivilegedFileHelper.fileOutputStream(dstFile);
- // see if the buffer needs to be initialized. Initialization is
- // only done on-demand since many VM's will never run into the renameTo
- // bug and hence shouldn't waste 1K of mem for no reason.
+ in = new FileInputStream(srcFile);
+ out = new FileOutputStream(dstFile);
+
transfer(in, out);
-
- // delete the srcFile file.
- PrivilegedFileHelper.delete(srcFile);
}
catch (IOException ioe)
{
@@ -410,6 +423,9 @@
out.close();
}
}
+
+ // delete the srcFile file.
+ srcFile.delete();
}
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2012-02-09 13:32:39 UTC (rev 5595)
@@ -39,3 +39,6 @@
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.testPropertyValueSearch=addNode
org.exoplatform.services.jcr.cluster.functional.WebdavQueryTest.assertQuery=sqlQuery,xpathQuery
org.exoplatform.services.jcr.cluster.functional.WebdavVersionTest.testVersioning=addNode,getNode
+org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressEmptyDirectory=compressDirectory
+org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressDirectory=compressDirectory,uncompressDirectory
+org.exoplatform.services.jcr.impl.utils.io.TestDirectoryHelper.testCompressFile=compressDirectory,uncompressDirectory
Modified: jcr/trunk/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/pom.xml 2012-02-09 13:25:01 UTC (rev 5594)
+++ jcr/trunk/exo.jcr.component.ext/pom.xml 2012-02-09 13:32:39 UTC (rev 5595)
@@ -160,6 +160,7 @@
<include>**/*.xls</include>
<include>**/*.groovy</include>
<include>**/login.conf</include>
+ <include>**/tsm-excludes.properties</include>
</includes>
</testResource>
</testResources>
Added: jcr/trunk/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties (rev 0)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/tsm-excludes.properties 2012-02-09 13:32:39 UTC (rev 5595)
@@ -0,0 +1,2 @@
+org.exoplatform.services.jcr.ext.backup.AbstractBackupTestCase.removeRepositoryFully=removeDirectory
+org.exoplatform.services.jcr.ext.backup.AbstractBackupTestCase.removeWorkspaceFully=removeDirectory
\ No newline at end of file
12 years, 4 months
exo-jcr SVN: r5594 - in jcr/branches/1.14-RSYNC: exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn and 1 other directory.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2012-02-09 08:25:01 -0500 (Thu, 09 Feb 2012)
New Revision: 5594
Added:
jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/RsyncIndexInfos.java
jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RSyncJob.java
Modified:
jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java
jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
Log:
EXOJCR-1745 : ISPN-based RSync indexing concept implementation.
Added: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RSyncJob.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RSyncJob.java (rev 0)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RSyncJob.java 2012-02-09 13:25:01 UTC (rev 5594)
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2003-2012 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.core.query.jbosscache;
+
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : eXoPlatform
+ * exo(a)exoplatform.com
+ * Feb 6, 2012
+ */
+/**
+ * Wrapper of native process calling RSYNC utility
+ */
+public class RSyncJob
+{
+ final Log log = ExoLogger.getLogger("exo.jcr.component.core.RsyncJob");
+
+ private final static String RSYNC_USER_SYSTEM_PROPERTY = "USER";
+
+ private final static String RSYNC_PASSWORD_SYSTEM_PROPERTY = "RSYNC_PASSWORD";
+
+ private Process process;
+
+ private final String src;
+
+ private final String dst;
+
+ private String userName;
+
+ private String password;
+
+ public RSyncJob(String src, String dst, String userName, String password)
+ {
+ this.src = src.endsWith(File.separator) ? src : src + File.separator;
+ this.dst = dst;
+ this.userName = userName;
+ this.password = password;
+ }
+
+ /**
+ * Executes RSYNC synchronization job
+ *
+ * @throws IOException
+ */
+ public void execute() throws IOException
+ {
+ // Future todo: Use JNI and librsync library?
+ Runtime run = Runtime.getRuntime();
+ try
+ {
+ String command = "rsync -rv --delete " + src + " " + dst;
+ if (log.isDebugEnabled())
+ {
+ log.debug("Rsync job started: " + command);
+ }
+ if (userName != null && password != null)
+ {
+ String[] envProperties =
+ new String[]{RSYNC_USER_SYSTEM_PROPERTY + "=" + userName,
+ RSYNC_PASSWORD_SYSTEM_PROPERTY + "=" + password};
+ process = run.exec(command, envProperties);
+ }
+ else
+ {
+ process = run.exec(command);
+ }
+
+ // Handle process Standard and Error output
+ InputStream stderr = process.getErrorStream();
+ InputStreamReader isrErr = new InputStreamReader(stderr);
+ BufferedReader brErr = new BufferedReader(isrErr);
+
+ InputStream stdout = process.getInputStream();
+ InputStreamReader isrStd = new InputStreamReader(stdout);
+ BufferedReader brStd = new BufferedReader(isrStd);
+
+ String val = null;
+ StringBuilder stringBuilderErr = new StringBuilder();
+ StringBuilder stringBuilderStd = new StringBuilder();
+ while ((val = brStd.readLine()) != null)
+ {
+ stringBuilderStd.append(val);
+ stringBuilderStd.append('\n');
+ }
+
+ while ((val = brErr.readLine()) != null)
+ {
+ stringBuilderErr.append(val);
+ stringBuilderErr.append('\n');
+ }
+
+ Integer returnCode = null;
+ // wait for thread
+ while (returnCode == null)
+ {
+ try
+ {
+ returnCode = process.waitFor();
+ }
+ catch (InterruptedException e)
+ {
+ // oops, this can happen sometimes
+ }
+ }
+ if (log.isDebugEnabled())
+ {
+ log.debug("Rsync job finished: " + returnCode + ". Error stream output \n"
+ + stringBuilderErr.toString() + " Standard stream output \n" + stringBuilderStd.toString());
+ }
+ if (returnCode != 0)
+ {
+ throw new IOException("RSync job finished with exit code is " + returnCode + ". Error stream output: \n"
+ + stringBuilderErr.toString());
+ }
+ }
+ finally
+ {
+ process = null;
+ }
+ }
+
+ public void forceCancel()
+ {
+ if (process != null)
+ {
+ process.destroy();
+ }
+ }
+}
\ No newline at end of file
Property changes on: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RSyncJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java 2012-02-09 12:59:53 UTC (rev 5593)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/RsyncIndexInfos.java 2012-02-09 13:25:01 UTC (rev 5594)
@@ -27,11 +27,8 @@
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jgroups.stack.IpAddress;
-import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.io.Serializable;
import java.util.Set;
@@ -45,7 +42,7 @@
public class RsyncIndexInfos extends JBossCacheIndexInfos
{
- private final Log log = ExoLogger.getLogger("exo.jcr.component.core.RsyncIndexInfos");
+ final Log log = ExoLogger.getLogger("exo.jcr.component.core.RsyncIndexInfos");
private final String indexPath;
@@ -156,122 +153,4 @@
}
}
- /**
- * Wrapper of native process calling RSYNC utility
- */
- private class RSyncJob
- {
- private final static String RSYNC_USER_SYSTEM_PROPERTY = "USER";
-
- private final static String RSYNC_PASSWORD_SYSTEM_PROPERTY = "RSYNC_PASSWORD";
-
- private Process process;
-
- private final String src;
-
- private final String dst;
-
- private String userName;
-
- private String password;
-
- public RSyncJob(String src, String dst, String userName, String password)
- {
- this.src = src.endsWith(File.separator) ? src : src + File.separator;
- this.dst = dst;
- this.userName = userName;
- this.password = password;
- }
-
- /**
- * Executes RSYNC synchronization job
- *
- * @throws IOException
- */
- public void execute() throws IOException
- {
- // Future todo: Use JNI and librsync library?
- Runtime run = Runtime.getRuntime();
- try
- {
- String command = "rsync -rv --delete " + src + " " + dst;
- if (log.isDebugEnabled())
- {
- log.debug("Rsync job started: " + command);
- }
- if (userName != null && password != null)
- {
- String[] envProperties =
- new String[]{RSYNC_USER_SYSTEM_PROPERTY + "=" + userName,
- RSYNC_PASSWORD_SYSTEM_PROPERTY + "=" + password};
- process = run.exec(command, envProperties);
- }
- else
- {
- process = run.exec(command);
- }
-
- // Handle process Standard and Error output
- InputStream stderr = process.getErrorStream();
- InputStreamReader isrErr = new InputStreamReader(stderr);
- BufferedReader brErr = new BufferedReader(isrErr);
-
- InputStream stdout = process.getInputStream();
- InputStreamReader isrStd = new InputStreamReader(stdout);
- BufferedReader brStd = new BufferedReader(isrStd);
-
- String val = null;
- StringBuilder stringBuilderErr = new StringBuilder();
- StringBuilder stringBuilderStd = new StringBuilder();
- while ((val = brStd.readLine()) != null)
- {
- stringBuilderStd.append(val);
- stringBuilderStd.append('\n');
- }
-
- while ((val = brErr.readLine()) != null)
- {
- stringBuilderErr.append(val);
- stringBuilderErr.append('\n');
- }
-
- Integer returnCode = null;
- // wait for thread
- while (returnCode == null)
- {
- try
- {
- returnCode = process.waitFor();
- }
- catch (InterruptedException e)
- {
- // oops, this can happen sometimes
- }
- }
- if (log.isDebugEnabled())
- {
- log.debug("Rsync job finished: " + returnCode + ". Error stream output \n" + stringBuilderErr.toString()
- + " Standard stream output \n" + stringBuilderStd.toString());
- }
- if (returnCode != 0)
- {
- throw new IOException("RSync job finished with exit code is " + returnCode + ". Error stream output: \n"
- + stringBuilderErr.toString());
- }
- }
- finally
- {
- process = null;
- }
- }
-
- public void forceCancel()
- {
- if (process != null)
- {
- process.destroy();
- }
- }
- }
-
}
Modified: jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java 2012-02-09 12:59:53 UTC (rev 5593)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexChangesFilter.java 2012-02-09 13:25:01 UTC (rev 5594)
@@ -27,6 +27,8 @@
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
+import org.exoplatform.services.jcr.impl.core.query.lucene.IndexInfos;
+import org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex;
import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
@@ -66,7 +68,21 @@
* Unique workspace identifier.
*/
private final String wsId;
+
+ // RSYNC SERVER CONFIGURATION
+ public static final String PARAM_RSYNC_ENTRY_NAME = "rsync-entry-name";
+
+ public static final String PARAM_RSYNC_ENTRY_PATH = "rsync-entry-path";
+
+ public static final String PARAM_RSYNC_PORT = "rsync-port";
+
+ public static final int PARAM_RSYNC_PORT_DEFAULT = 873;
+
+ public static final String PARAM_RSYNC_USER = "rsync-user";
+
+ public static final String PARAM_RSYNC_PASSWORD = "rsync-password";
+
/**
* ISPNIndexChangesFilter constructor.
*/
@@ -94,19 +110,54 @@
if (!parentHandler.isInitialized())
{
- parentHandler.setIndexInfos(new ISPNIndexInfos(searchManager.getWsId(), cache, true, modeHandler));
+ parentHandler.setIndexInfos(createIndexInfos(true, modeHandler, config, parentHandler));
parentHandler.setIndexUpdateMonitor(new ISPNIndexUpdateMonitor(searchManager.getWsId(), cache, true,
modeHandler));
parentHandler.init();
}
if (!handler.isInitialized())
{
- handler.setIndexInfos(new ISPNIndexInfos(searchManager.getWsId(), cache, false, modeHandler));
+ handler.setIndexInfos(createIndexInfos(false, modeHandler, config, handler));
handler.setIndexUpdateMonitor(new ISPNIndexUpdateMonitor(searchManager.getWsId(), cache, false, modeHandler));
handler.init();
}
}
+
+ /**
+ * Factory method for creating corresponding IndexInfos class. RSyncIndexInfos created if RSync configured
+ * and JBossCacheIndexInfos otherwise
+ *
+ * @param system
+ * @param modeHandler
+ * @param config
+ * @param handler
+ * @return
+ * @throws RepositoryConfigurationException
+ */
+ private IndexInfos createIndexInfos(Boolean system, IndexerIoModeHandler modeHandler, QueryHandlerEntry config,
+ QueryHandler handler) throws RepositoryConfigurationException
+ {
+ // read RSYNC configuration
+ String rsyncEntryName = config.getParameterValue(PARAM_RSYNC_ENTRY_NAME, null);
+ String rsyncEntryPath = config.getParameterValue(PARAM_RSYNC_ENTRY_PATH, null);
+ String rsyncUserName = config.getParameterValue(PARAM_RSYNC_USER, null);
+ String rsyncPassword = config.getParameterValue(PARAM_RSYNC_PASSWORD, null);
+ int rsyncPort = config.getParameterInteger(PARAM_RSYNC_PORT, PARAM_RSYNC_PORT_DEFAULT);
+
+ // rsync configured
+ if (rsyncEntryName != null)
+ {
+ return new RsyncIndexInfos(wsId, cache, system, modeHandler, ((SearchIndex)handler).getContext()
+ .getIndexDirectory(), rsyncPort, rsyncEntryName, rsyncEntryPath, rsyncUserName, rsyncPassword);
+ }
+ else
+ {
+ return new ISPNIndexInfos(wsId, cache, true, modeHandler);
+ }
+
+ }
+
protected Log getLogger()
{
return log;
Modified: jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java 2012-02-09 12:59:53 UTC (rev 5593)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java 2012-02-09 13:25:01 UTC (rev 5594)
@@ -70,17 +70,17 @@
/**
* ISPN cache.
*/
- private final Cache<Serializable, Object> cache;
+ protected final Cache<Serializable, Object> cache;
/**
* Used to retrieve the current mode.
*/
- private final IndexerIoModeHandler modeHandler;
+ protected final IndexerIoModeHandler modeHandler;
/**
* Cache key for storing index names.
*/
- private final IndexInfosKey namesKey;
+ protected final IndexInfosKey namesKey;
/**
* Need to write the index info out of the current transaction
@@ -211,22 +211,39 @@
Set<String> set = (Set<String>)event.getValue();
if (set != null)
{
- setNames(set);
-
- // callback multiIndex to refresh lists
- try
- {
- MultiIndex multiIndex = getMultiIndex();
- if (multiIndex != null)
- {
- multiIndex.refreshIndexList();
- }
- }
- catch (IOException e)
- {
- log.error("Failed to update indexes! " + e.getMessage(), e);
- }
+ refreshIndexes(set);
}
}
}
+
+
+
+ /**
+ * Update index configuration, when it changes on persistent storage
+ *
+ * @param set
+ */
+ protected void refreshIndexes(Set<String> set)
+ {
+ // do nothing if null is passed
+ if (set == null)
+ {
+ return;
+ }
+ setNames(set);
+ // callback multiIndex to refresh lists
+ try
+ {
+ MultiIndex multiIndex = getMultiIndex();
+ if (multiIndex != null)
+ {
+ multiIndex.refreshIndexList();
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("Failed to update indexes! " + e.getMessage(), e);
+ }
+ }
+
}
Added: jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/RsyncIndexInfos.java
===================================================================
--- jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/RsyncIndexInfos.java (rev 0)
+++ jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/RsyncIndexInfos.java 2012-02-09 13:25:01 UTC (rev 5594)
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2003-2012 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.core.query.ispn;
+
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
+import org.exoplatform.services.jcr.impl.core.query.jbosscache.RSyncJob;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.infinispan.Cache;
+import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.remoting.transport.jgroups.JGroupsAddress;
+import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jgroups.Channel;
+import org.jgroups.Event;
+import org.jgroups.stack.IpAddress;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * Created by The eXo Platform SAS
+ * Author : eXoPlatform
+ * exo(a)exoplatform.com
+ * Jan 11, 2012
+ */
+@CacheListener
+public class RsyncIndexInfos extends ISPNIndexInfos
+{
+
+ private final Log log = ExoLogger.getLogger("exo.jcr.component.core.RsyncIndexInfos");
+
+ private final String indexPath;
+
+ private final String urlFormatString;
+
+ private final String rsyncUserName;
+
+ private final String rsyncPassword;
+
+ public RsyncIndexInfos(String wsId, Cache<Serializable, Object> cache, boolean system,
+ IndexerIoModeHandler modeHandler, String indexPath, int rsyncPort, String rsyncEntryName, String rsyncEntryPath,
+ String rsyncUserName, String rsyncPassword) throws RepositoryConfigurationException
+ {
+ super(wsId, cache, system, modeHandler);
+ this.rsyncUserName = rsyncUserName;
+ this.rsyncPassword = rsyncPassword;
+
+ String absoluteRsyncEntryPath;
+ try
+ {
+ this.indexPath = new File(indexPath).getCanonicalPath();
+ absoluteRsyncEntryPath = new File(rsyncEntryPath).getCanonicalPath();
+ }
+ catch (IOException e)
+ {
+ throw new RepositoryConfigurationException("Index path or rsyncEntry path is invalid.", e);
+ }
+
+ if (this.indexPath.startsWith(absoluteRsyncEntryPath))
+ {
+ // in relation to RSync Server Entry
+ // i.e. absolute index path is /var/portal/data/index/repo1/ws2
+ // i.e. RSync Server Entry is "index" pointing to /var/portal/data/index
+ // then relative path is repo1/ws2
+ // and whole url is "rsync://<addr>:<port>/<entryName>/repo1/ws2"
+ String relativeIndexPath = this.indexPath.substring(absoluteRsyncEntryPath.length());
+
+ // if client is Windows OS, need to replace all '\' with '/' used in url
+ if (File.separatorChar == '\\')
+ {
+ relativeIndexPath = relativeIndexPath.replace(File.separatorChar, '/');
+ }
+ // generate ready-to-use formatter string with address variable
+ urlFormatString = "rsync://%s:" + rsyncPort + "/" + rsyncEntryName + relativeIndexPath + "/";
+ }
+ else
+ {
+ throw new RepositoryConfigurationException(
+ "Invalid RSync configuration. Index must be placed in folder that is a descendant of RSync Server Entry. Current RSync Server Entry Path is : "
+ + absoluteRsyncEntryPath
+ + " but it doesnt hold Index folder, that is : "
+ + this.indexPath
+ + ". Please fix configuration according to JCR Documentation and restart application.");
+ }
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void refreshIndexes(Set<String> set)
+ {
+ triggerRSyncSynchronization();
+ // call super, after indexes are synchronized
+ super.refreshIndexes(set);
+ }
+
+ @Override
+ public void read() throws IOException
+ {
+ // synchronizing indexes on read access to index list for Read-Only mode
+ // allowing to synchronize indexes on startup
+ triggerRSyncSynchronization();
+ super.read();
+ }
+
+ /**
+ * Call to system RSync binary implementation,
+ */
+ private void triggerRSyncSynchronization()
+ {
+ // Call RSync to retrieve actual index from coordinator
+ if (modeHandler.getMode() == IndexerIoMode.READ_ONLY)
+ {
+ EmbeddedCacheManager cacheManager = cache.getCacheManager();
+
+ if (cacheManager.getCoordinator() instanceof JGroupsAddress
+ && cacheManager.getTransport() instanceof JGroupsTransport)
+ {
+ JGroupsTransport transport = (JGroupsTransport)cacheManager.getTransport();
+ // Coordinator's address
+ org.jgroups.Address jgAddress = ((JGroupsAddress)cacheManager.getCoordinator()).getJGroupsAddress();
+ // if jgAddress is UUID address, not the physical one, then retrieve via channel
+ if (!(jgAddress instanceof IpAddress))
+ {
+ // this is the only way of getting physical address.
+ Channel channel = transport.getChannel();
+ jgAddress = (org.jgroups.Address)channel.down(new Event(Event.GET_PHYSICAL_ADDRESS, jgAddress));
+ }
+ if (jgAddress instanceof IpAddress)
+ {
+ String address = ((IpAddress)jgAddress).getIpAddress().getHostAddress();
+ RSyncJob rSyncJob =
+ new RSyncJob(String.format(urlFormatString, address), indexPath, rsyncUserName, rsyncPassword);
+ try
+ {
+ // synchronizing access to RSync Job.
+ // No parallel jobs allowed
+ synchronized (this)
+ {
+ rSyncJob.execute();
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("Failed to retrieve index using RSYNC", e);
+ }
+ }
+ else
+ {
+ log.error("Error triggering RSync synchronization, skipped. Unsupported Address object : "
+ + jgAddress.getClass().getName());
+ }
+ }
+ else
+ {
+ log.error("Error triggering RSync synchronization, skipped. Unsupported Address object : "
+ + cacheManager.getCoordinator().getClass().getName());
+ }
+ }
+ }
+}
Property changes on: jcr/branches/1.14-RSYNC/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/RsyncIndexInfos.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 4 months
exo-jcr SVN: r5593 - jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2012-02-09 07:59:53 -0500 (Thu, 09 Feb 2012)
New Revision: 5593
Modified:
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java
Log:
EXOJCR-1682 : one more test added.
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java 2012-02-09 11:02:51 UTC (rev 5592)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java 2012-02-09 12:59:53 UTC (rev 5593)
@@ -27,6 +27,8 @@
import org.infinispan.configuration.global.GlobalConfigurationBuilder;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.remoting.transport.jgroups.JGroupsAddress;
+import org.infinispan.remoting.transport.jgroups.JGroupsTransport;
import java.util.concurrent.TimeUnit;
@@ -76,7 +78,7 @@
assertTrue(cache.size() == 1);
assertTrue(cache.containsKey("key"));
- String value = (String)cache.remove("key");
+ String value = cache.remove("key");
assertTrue(value.equals("value"));
assertTrue(cache.isEmpty());
@@ -92,7 +94,27 @@
Thread.sleep(2000 + 500);
assertFalse(cache.containsKey("key"));
}
+
+ /**
+ * Infinispan-based RSync concept relies on some JGroups and ISPN interns, used to identify physical address
+ * of coodrinator node. This test used to identify any changed in those libraries to be able quickly update
+ * RSync components.
+ *
+ * @throws Exception
+ */
+ public void testJGroupTransportPhysicalAddress() throws Exception
+ {
+ GlobalConfiguration myGlobalConfig = new GlobalConfigurationBuilder().clusteredDefault().build();
+ // Create cache manager
+ EmbeddedCacheManager manager = new DefaultCacheManager(myGlobalConfig);
+ // Create a cache
+ Cache<String, String> cache = manager.getCache();
+
+ assertTrue(manager.getCoordinator() instanceof JGroupsAddress);
+ assertTrue(manager.getTransport() instanceof JGroupsTransport);
+ }
+
/**
* Test cluster cache and base operation.
*
@@ -111,7 +133,7 @@
assertTrue(cache.size() == 1);
assertTrue(cache.containsKey("key"));
- String value = (String)cache.remove("key");
+ String value = cache.remove("key");
assertTrue(value.equals("value"));
assertTrue(cache.isEmpty());
12 years, 4 months
exo-jcr SVN: r5592 - in core/trunk: exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc and 5 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-09 06:02:51 -0500 (Thu, 09 Feb 2012)
New Revision: 5592
Modified:
core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java
core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java
core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java
core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java
===================================================================
--- core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -92,10 +92,6 @@
{
return loadUnique(connection, query);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -137,10 +133,6 @@
{
loadInstances(connection, loadQuery, list);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -172,10 +164,6 @@
{
execute(connection, query, bean);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -204,10 +192,6 @@
{
return this.<E> loadDBField(connection, query);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -238,10 +222,6 @@
{
execute(connection, template, beans);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
Modified: core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java
===================================================================
--- core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -120,10 +120,6 @@
resultSet.close();
statement.close();
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
dao_.getExoDatasource().closeConnection(connection);
@@ -151,10 +147,6 @@
statement.close();
return list;
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
dao_.getExoDatasource().closeConnection(connection);
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -122,12 +122,10 @@
long id = childImpl.getDBObjectId();
execute(connection, eXoDS_.getQueryBuilder().createInsertQuery(type_, id), childImpl);
if (broadcast)
+ {
listenerService_.broadcast("organization.group.postSave", this, childImpl);
+ }
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -269,10 +269,6 @@
listenerService_.broadcast("organization.membership.postDelete", this, membershipImpl);
return membershipImpl;
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -319,10 +315,6 @@
}
return list;
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -30,6 +30,7 @@
import java.util.regex.Pattern;
import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
@@ -115,7 +116,7 @@
return;
}
}
- catch (Exception exp)
+ catch (NamingException exp)
{
if (LOG.isTraceEnabled())
{
Modified: core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -443,7 +443,7 @@
{
return ldapService.authenticate(userDN, password);
}
- catch (Exception exp)
+ catch (NamingException exp)
{
return false;
}
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -94,7 +94,7 @@
return DEFAULT_CONCURRENCY_LEVEL;
}
- catch (Exception e)
+ catch (NumberFormatException e)
{
LOG.error("Can't parse parameter " + INIT_PARAM_CONCURRENCY_LEVEL, e);
return DEFAULT_CONCURRENCY_LEVEL;
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -82,7 +82,7 @@
return DEFAULT_CONCURRENCY_LEVEL;
}
- catch (Exception e)
+ catch (NumberFormatException e)
{
LOG.error("Can't parse parameter " + INIT_PARAM_CONCURRENCY_LEVEL, e);
return DEFAULT_CONCURRENCY_LEVEL;
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -187,13 +187,34 @@
field.setAccessible(true);
password = (String)field.get(objectFromCallback);
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
if (LOG.isErrorEnabled())
{
LOG.error("Could not get credentials.", e);
}
}
+ catch (NoSuchFieldException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get credentials.", e);
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get credentials.", e);
+ }
+ }
+ catch (IllegalAccessException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get credentials.", e);
+ }
+ }
if (username == null || password == null)
{
@@ -207,19 +228,41 @@
{
String username = null;
Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+
try
{
Field field = digestAuthenticatorClazz.getDeclaredField("username");
field.setAccessible(true);
username = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
if (LOG.isErrorEnabled())
{
LOG.error("Could not get username.", e);
}
}
+ catch (IllegalAccessException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get username.", e);
+ }
+ }
+ catch (NoSuchFieldException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get username.", e);
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get username.", e);
+ }
+ }
return new UsernameCredential(username);
}
@@ -229,19 +272,41 @@
{
String password = null;
Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+
try
{
Field field = digestAuthenticatorClazz.getDeclaredField("response");
field.setAccessible(true);
password = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
if (LOG.isErrorEnabled())
{
LOG.error("Could not get password.", e);
}
}
+ catch (IllegalAccessException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get password.", e);
+ }
+ }
+ catch (NoSuchFieldException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get password.", e);
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get password.", e);
+ }
+ }
return password;
}
Modified: core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java
===================================================================
--- core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -26,6 +26,7 @@
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
@@ -81,10 +82,14 @@
}
}
}
- catch (Exception e)
+ catch (LoginException e)
{
LOG.error("Can't remove conversation state " + httpSession.getId());
}
+ catch (SecurityException e)
+ {
+ LOG.error("Can't remove conversation state " + httpSession.getId());
+ }
}
}
Modified: core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java 2012-02-09 10:56:35 UTC (rev 5591)
+++ core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java 2012-02-09 11:02:51 UTC (rev 5592)
@@ -126,10 +126,18 @@
else
LOG.error("XSLT schema not found: " + xsltSchema);
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
}
+ catch (TransformerException e)
+ {
+ LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
+ }
+ catch (NotSupportedIOTypeException e)
+ {
+ LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
+ }
}
}
}
12 years, 4 months
exo-jcr SVN: r5591 - core/trunk/exo.core.component.organization.jdbc.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-09 05:56:35 -0500 (Thu, 09 Feb 2012)
New Revision: 5591
Modified:
core/trunk/exo.core.component.organization.jdbc/pom.xml
Log:
EXOJCR-1682: fix dependency
Modified: core/trunk/exo.core.component.organization.jdbc/pom.xml
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/pom.xml 2012-02-09 09:56:04 UTC (rev 5590)
+++ core/trunk/exo.core.component.organization.jdbc/pom.xml 2012-02-09 10:56:35 UTC (rev 5591)
@@ -98,6 +98,10 @@
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.ow2.jotm</groupId>
+ <artifactId>jotm-core</artifactId>
+ </dependency>
</dependencies>
<build>
12 years, 4 months
exo-jcr SVN: r5590 - in core/trunk: exo.core.component.database and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-09 04:56:04 -0500 (Thu, 09 Feb 2012)
New Revision: 5590
Modified:
core/trunk/exo.core.component.database/pom.xml
core/trunk/pom.xml
Log:
EXOJCR-1682: fix dependency
Modified: core/trunk/exo.core.component.database/pom.xml
===================================================================
--- core/trunk/exo.core.component.database/pom.xml 2012-02-09 08:11:07 UTC (rev 5589)
+++ core/trunk/exo.core.component.database/pom.xml 2012-02-09 09:56:04 UTC (rev 5590)
@@ -116,6 +116,10 @@
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.ow2.jotm</groupId>
+ <artifactId>jotm-core</artifactId>
+ </dependency>
</dependencies>
<build>
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2012-02-09 08:11:07 UTC (rev 5589)
+++ core/trunk/pom.xml 2012-02-09 09:56:04 UTC (rev 5590)
@@ -380,10 +380,14 @@
<version>0.7</version>
</dependency>
+ <dependency>
+ <groupId>org.ow2.jotm</groupId>
+ <artifactId>jotm-core</artifactId>
+ <version>2.1.9</version>
+ <scope>test</scope>
+ </dependency>
-
-
- </dependencies>
+ </dependencies>
</dependencyManagement>
<dependencies>
12 years, 4 months
exo-jcr SVN: r5589 - in core/branches/2.5.x: exo.core.component.database/src/main/java/org/exoplatform/services/database/impl and 6 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-02-09 03:11:07 -0500 (Thu, 09 Feb 2012)
New Revision: 5589
Modified:
core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java
core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java
core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java
core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java
core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java
core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java
core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java
core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java
core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
Log:
EXOJCR-1725: Fixed the Blocker/Critical violations and the easiest Major ones raised by eXo Quality Level 1.2
Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DAO.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -92,10 +92,6 @@
{
return loadUnique(connection, query);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -137,10 +133,6 @@
{
loadInstances(connection, loadQuery, list);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -172,10 +164,6 @@
{
execute(connection, query, bean);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -204,10 +192,6 @@
{
return this.<E> loadDBField(connection, query);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -238,10 +222,6 @@
{
execute(connection, template, beans);
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/DBPageList.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -120,10 +120,6 @@
resultSet.close();
statement.close();
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
dao_.getExoDatasource().closeConnection(connection);
@@ -151,10 +147,6 @@
statement.close();
return list;
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
dao_.getExoDatasource().closeConnection(connection);
Modified: core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -34,6 +34,7 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.hibernate.HibernateException;
+import org.hibernate.MappingException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
@@ -263,14 +264,17 @@
{
Class<?> clazz = ClassLoading.loadClass(annotation, this);
conf_.addAnnotatedClass(clazz);
-
}
}
}
- catch (Exception ex)
+ catch (MappingException ex)
{
LOG.error(ex.getLocalizedMessage(), ex);
}
+ catch (ClassNotFoundException ex)
+ {
+ LOG.error(ex.getLocalizedMessage(), ex);
+ }
}
}
Modified: core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/GroupDAOImpl.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -122,12 +122,10 @@
long id = childImpl.getDBObjectId();
execute(connection, eXoDS_.getQueryBuilder().createInsertQuery(type_, id), childImpl);
if (broadcast)
+ {
listenerService_.broadcast("organization.group.postSave", this, childImpl);
+ }
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
Modified: core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/jdbc/MembershipDAOImpl.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -269,10 +269,6 @@
listenerService_.broadcast("organization.membership.postDelete", this, membershipImpl);
return membershipImpl;
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
@@ -319,10 +315,6 @@
}
return list;
}
- catch (Exception e)
- {
- throw e;
- }
finally
{
eXoDS_.closeConnection(connection);
Modified: core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/OrganizationLdapInitializer.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -30,6 +30,7 @@
import java.util.regex.Pattern;
import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
@@ -115,7 +116,7 @@
return;
}
}
- catch (Exception exp)
+ catch (NamingException exp)
{
if (LOG.isTraceEnabled())
{
Modified: core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.organization.ldap/src/main/java/org/exoplatform/services/organization/ldap/UserDAOImpl.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -443,7 +443,7 @@
{
return ldapService.authenticate(userDN, password);
}
- catch (Exception exp)
+ catch (NamingException exp)
{
return false;
}
Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/ConversationRegistry.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -94,7 +94,7 @@
return DEFAULT_CONCURRENCY_LEVEL;
}
- catch (Exception e)
+ catch (NumberFormatException e)
{
LOG.error("Can't parse parameter " + INIT_PARAM_CONCURRENCY_LEVEL, e);
return DEFAULT_CONCURRENCY_LEVEL;
Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/IdentityRegistry.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -82,7 +82,7 @@
return DEFAULT_CONCURRENCY_LEVEL;
}
- catch (Exception e)
+ catch (NumberFormatException e)
{
LOG.error("Can't parse parameter " + INIT_PARAM_CONCURRENCY_LEVEL, e);
return DEFAULT_CONCURRENCY_LEVEL;
Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/j2ee/DigestAuthenticationJettyLoginModule.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -187,13 +187,34 @@
field.setAccessible(true);
password = (String)field.get(objectFromCallback);
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
if (LOG.isErrorEnabled())
{
LOG.error("Could not get credentials.", e);
}
}
+ catch (NoSuchFieldException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get credentials.", e);
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get credentials.", e);
+ }
+ }
+ catch (IllegalAccessException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get credentials.", e);
+ }
+ }
if (username == null || password == null)
{
@@ -207,19 +228,41 @@
{
String username = null;
Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+
try
{
Field field = digestAuthenticatorClazz.getDeclaredField("username");
field.setAccessible(true);
username = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
if (LOG.isErrorEnabled())
{
LOG.error("Could not get username.", e);
}
}
+ catch (IllegalAccessException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get username.", e);
+ }
+ }
+ catch (NoSuchFieldException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get username.", e);
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get username.", e);
+ }
+ }
return new UsernameCredential(username);
}
@@ -229,19 +272,41 @@
{
String password = null;
Class<?> digestAuthenticatorClazz = DigestAuthenticator.class.getDeclaredClasses()[0];
+
try
{
Field field = digestAuthenticatorClazz.getDeclaredField("response");
field.setAccessible(true);
password = (String)field.get((((ObjectCallback)objectCallback[0]).getObject()));
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
if (LOG.isErrorEnabled())
{
LOG.error("Could not get password.", e);
}
}
+ catch (IllegalAccessException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get password.", e);
+ }
+ }
+ catch (NoSuchFieldException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get password.", e);
+ }
+ }
+ catch (SecurityException e)
+ {
+ if (LOG.isErrorEnabled())
+ {
+ LOG.error("Could not get password.", e);
+ }
+ }
return password;
}
Modified: core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java
===================================================================
--- core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.security.core/src/main/java/org/exoplatform/services/security/web/JAASConversationStateListener.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -26,6 +26,7 @@
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
@@ -81,10 +82,14 @@
}
}
}
- catch (Exception e)
+ catch (LoginException e)
{
LOG.error("Can't remove conversation state " + httpSession.getId());
}
+ catch (SecurityException e)
+ {
+ LOG.error("Can't remove conversation state " + httpSession.getId());
+ }
}
}
Modified: core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
===================================================================
--- core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java 2012-02-08 15:48:52 UTC (rev 5588)
+++ core/branches/2.5.x/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java 2012-02-09 08:11:07 UTC (rev 5589)
@@ -126,10 +126,18 @@
else
LOG.error("XSLT schema not found: " + xsltSchema);
}
- catch (Exception e)
+ catch (IllegalArgumentException e)
{
LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
}
+ catch (TransformerException e)
+ {
+ LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
+ }
+ catch (NotSupportedIOTypeException e)
+ {
+ LOG.error("Add new TRAXTemplates failed : " + e.getMessage());
+ }
}
}
}
12 years, 4 months
exo-jcr SVN: r5588 - in jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr: ispn and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-02-08 10:48:52 -0500 (Wed, 08 Feb 2012)
New Revision: 5588
Modified:
jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/cluster-config.xml
jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/ispn/ispn-integration.xml
Log:
EXOJCR-1735: ISPN integration chapter
Modified: jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/cluster-config.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/cluster-config.xml 2012-02-08 15:46:49 UTC (rev 5587)
+++ jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/cluster-config.xml 2012-02-08 15:48:52 UTC (rev 5588)
@@ -1,39 +1,54 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- This document was created with Syntext Serna Free. --><!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This document was created with Syntext Serna Free. -->
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="JCR.ClusterConfig">
-<?dbhtml filename="ch-cluster-config.html"?> <title>Configuring JBoss AS with eXo JCR in cluster</title>
+ <?dbhtml filename="ch-cluster-config.html"?>
+
+ <title>Configuring JBoss AS with eXo JCR in cluster</title>
+
<section>
<title>Launching Cluster</title>
+
<section>
<title>Deploying eXo JCR to JBoss As</title>
+
<para>To deploy eXo JCR to JBoss, do the following steps:</para>
+
<orderedlist>
<listitem>
- <para>Download the latest version of eXo JCR .ear file distribution.</para>
+ <para>Download the latest version of eXo JCR .ear file
+ distribution.</para>
</listitem>
+
<listitem>
<para>Copy <jcr.ear> into
<%jboss_home%/server/default/deploy></para>
</listitem>
+
<listitem>
<para>Put exo-configuration.xml to the root
<%jboss_home%/exo-configuration.xml></para>
</listitem>
+
<listitem>
<para>Configure JAAS by inserting XML fragment shown below into
<%jboss_home%/server/default/conf/login-config.xml></para>
-
- <programlisting language="xml"><application-policy name="exo-domain">
+
+ <programlisting language="xml"><application-policy name="exo-domain">
<authentication>
- <login-module code="org.exoplatform.services.security.j2ee.JbossLoginModule" flag="required"></login-module>
+ <login-module code="org.exoplatform.services.security.j2ee.JbossLoginModule" flag="required"></login-module>
</authentication>
</application-policy></programlisting>
</listitem>
+
<listitem>
- <para>Ensure that you use JBossTS <link linkend="Kernel.TransactionService">Transaction Service</link> and
- JBossCache <link linkend="JCR.JBossTransactionsService">Transaction Manager</link>. Your exo-configuration.xml must contain such
+ <para>Ensure that you use JBossTS <link
+ linkend="Kernel.TransactionService">Transaction Service</link> and
+ JBossCache <link linkend="JCR.JBossTransactionsService">Transaction
+ Manager</link>. Your exo-configuration.xml must contain such
parts:</para>
-
+
<programlisting language="xml"><component>
<key>org.jboss.cache.transaction.TransactionManagerLookup</key>
<type>org.jboss.cache.GenericTransactionManagerLookup</type>^
@@ -50,71 +65,79 @@
</init-params>
</component></programlisting>
</listitem>
+
<listitem>
<para>Start server:</para>
+
<itemizedlist>
<listitem>
<para>bin/run.sh for Unix</para>
</listitem>
+
<listitem>
<para>bin/run.bat for Windows</para>
</listitem>
</itemizedlist>
</listitem>
+
<listitem>
<para>Try accessing <uri>http://localhostu:8080/browser</uri> with
- root/exo as login/password if you have done everything right, you'll
+ root/exo as login/password if you have done everything right, you'll
get access to repository browser.</para>
</listitem>
</orderedlist>
</section>
+
<section id="JCR.ClusterConfig.JCRExternalConfig">
<title>Configuring JCR to use external configuration</title>
+
<itemizedlist>
<listitem>
<para>To manually configure repository, create a new configuration
- file (e.g., exo-jcr-configuration.xml). For details, see <link linkend="JCR.eXoJCRconfiguration">JCR Configuration</link>. Your
+ file (e.g., exo-jcr-configuration.xml). For details, see <link
+ linkend="JCR.eXoJCRconfiguration">JCR Configuration</link>. Your
configuration must look like:</para>
-
- <programlisting language="xml"><repository-service default-repository="repository1">
+
+ <programlisting language="xml"><repository-service default-repository="repository1">
<repositories>
- <repository name="repository1" system-workspace="ws1" default-workspace="ws1">
+ <repository name="repository1" system-workspace="ws1" default-workspace="ws1">
<security-domain>exo-domain</security-domain>
<access-control>optional</access-control>
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
<workspaces>
- <workspace name="ws1">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
- <property name="source-name" value="jdbcjcr" />
- <property name="dialect" value="oracle" />
- <property name="multi-db" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="../temp/swap/production" />
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="oracle" />
+ <property name="multi-db" value="false" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="../temp/swap/production" />
</properties>
<value-storages>
- see "<link linkend="conf_value_storage">Value storage configuration</link>" part.
+ see "<link linkend="conf_value_storage">Value storage configuration</link>" part.
</value-storages>
</container>
- <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
<properties>
- <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-nodetype" value="nt:unstructured" />
</properties>
</initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- see "<link linkend="conf_cache">Cache configuration</link>" part.
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ see "<link linkend="conf_cache">Cache configuration</link>" part.
</cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- see "<link linkend="conf_indexer">Indexer configuration</link>" part.
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ see "<link linkend="conf_indexer">Indexer configuration</link>" part.
</query-handler>
- <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
- see "<link linkend="conf_lock_manager">Lock Manager configuration</link>" part.
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ see "<link linkend="conf_lock_manager">Lock Manager configuration</link>" part.
</lock-manager>
</workspace>
- <workspace name="ws2">
+ <workspace name="ws2">
...
</workspace>
- <workspace name="wsN">
+ <workspace name="wsN">
...
</workspace>
</workspaces>
@@ -122,10 +145,11 @@
</repositories>
</repository-service> </programlisting>
</listitem>
+
<listitem>
- <para>Then, update RepositoryServiceConfiguration configuration in
+ <para>Then, update RepositoryServiceConfiguration configuration in
exo-configuration.xml to use this file:</para>
-
+
<programlisting language="xml"><component>
<key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
<type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
@@ -141,97 +165,139 @@
</itemizedlist>
</section>
</section>
+
<section>
<title>Requirements</title>
+
<section>
<title>Environment requirements</title>
+
<itemizedlist>
<listitem>
<para>Every node of cluster MUST have the same mounted Network File
System with the read and write permissions on it.</para>
- <para>"/mnt/tornado" - path to the mounted Network File System (all
+
+ <para>"/mnt/tornado" - path to the mounted Network File System (all
cluster nodes must use the same NFS).</para>
</listitem>
+
<listitem>
<para>Every node of cluster MUST use the same database.</para>
</listitem>
+
<listitem>
- <para>The same Clusters on different nodes MUST have the same
- names (e.g., if Indexer cluster in workspace production on the first
- node has the name "production_indexer_cluster", then indexer clusters in
+ <para>The same Clusters on different nodes MUST have the same names
+ (e.g., if Indexer cluster in workspace production on the first node
+ has the name "production_indexer_cluster", then indexer clusters in
workspace production on all other nodes MUST have the same name
- "production_indexer_cluster" ).</para>
+ "production_indexer_cluster" ).</para>
</listitem>
</itemizedlist>
</section>
+
<section>
<title>Configuration requirements</title>
+
<para>Configuration of every workspace in repository must contains of
such parts:</para>
+
<itemizedlist>
<listitem id="conf_value_storage">
<para>Value Storage configuration:</para>
-
+
<programlisting language="xml"><value-storages>
- <value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
<properties>
- <property name="path" value="/mnt/tornado/temp/values/production" /> <!--path within NFS where ValueStorage will hold it's data-->
+ <property name="path" value="/mnt/tornado/temp/values/production" /> <!--path within NFS where ValueStorage will hold it's data-->
</properties>
<filters>
- <filter property-type="Binary" />
+ <filter property-type="Binary" />
</filters>
</value-storage>
</value-storages></programlisting>
</listitem>
+
<listitem id="conf_cache">
<para>Cache configuration:</para>
-
- <programlisting language="xml"><cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+
+ <programlisting language="xml"><cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
<properties>
- <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-data.xml" /> <!-- path to JBoss Cache configuration for data storage -->
- <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
- <property name="jbosscache-cluster-name" value="JCR_Cluster_cache_production" /> <!-- JBoss Cache data storage cluster name -->
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-data.xml" /> <!-- path to JBoss Cache configuration for data storage -->
+ <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
+ <property name="jbosscache-cluster-name" value="JCR_Cluster_cache_production" /> <!-- JBoss Cache data storage cluster name -->
+ <property name="jgroups-multiplexer-stack" value="true" />
</properties>
</cache> </programlisting>
</listitem>
+
<listitem id="conf_indexer">
<para>Indexer configuration:</para>
-
- <programlisting language="xml"><query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+
+ <programlisting language="xml"><query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
- <property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
- <property name="index-dir" value="/mnt/tornado/temp/jcrlucenedb/production" /> <!-- path within NFS where ValueStorage will hold it's data -->
- <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-indexer.xml" /> <!-- path to JBoss Cache configuration for indexer -->
- <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
- <property name="jbosscache-cluster-name" value="JCR_Cluster_indexer_production" /> <!-- JBoss Cache indexer cluster name -->
- <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
+ <property name="index-dir" value="/mnt/tornado/temp/jcrlucenedb/production" /> <!-- path within NFS where ValueStorage will hold it's data -->
+ <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-indexer.xml" /> <!-- path to JBoss Cache configuration for indexer -->
+ <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
+ <property name="jbosscache-cluster-name" value="JCR_Cluster_indexer_production" /> <!-- JBoss Cache indexer cluster name -->
+ <property name="jgroups-multiplexer-stack" value="true" />
</properties>
</query-handler> </programlisting>
</listitem>
+
<listitem id="conf_lock_manager">
<para>Lock Manager configuration:</para>
-
- <programlisting language="xml"><lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+
+ <programlisting language="xml"><lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
<properties>
- <property name="time-out" value="15m" />
- <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-lock.xml" /> <!-- path to JBoss Cache configuration for lock manager -->
- <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
- <property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR_Cluster_lock_production" /> <!-- JBoss Cache locks cluster name -->
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-lock.xml" /> <!-- path to JBoss Cache configuration for lock manager -->
+ <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
+ <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jbosscache-cluster-name" value="JCR_Cluster_lock_production" /> <!-- JBoss Cache locks cluster name -->
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_production"/> <!-- the name of the DB table where lock's data will be stored -->
- <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
- <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_production_pk"/>
- <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>
- <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>
- <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>
- <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr"/>
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_production"/> <!-- the name of the DB table where lock's data will be stored -->
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_production_pk"/>
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn"/>
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node"/>
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent"/>
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr"/>
</properties>
</lock-manager></programlisting>
</listitem>
</itemizedlist>
</section>
</section>
+
+ <section>
+ <title>How properly stop the node</title>
+
+ <para>To be sure that all transactions are over and JCR is in consistent
+ state after stopping node, you need to follow next steps:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Connect using JMX to one of cluster's node which you won't need
+ to stop.</para>
+ </listitem>
+
+ <listitem>
+ <para>Use RepositorySuspendController suspend all repositories (see
+ <link linkend="JCR.SearchIndexBackup">37.1 Repository
+ suspending</link>)</para>
+ </listitem>
+
+ <listitem>
+ <para>Stop the node</para>
+ </listitem>
+
+ <listitem>
+ <para>Use RepositorySuspendController to resume all repositories (see
+ <link linkend="JCR.SearchIndexBackup">37.3 Repository
+ resuming</link>)</para>
+ </listitem>
+ </itemizedlist>
+ </section>
</chapter>
Modified: jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/ispn/ispn-integration.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/ispn/ispn-integration.xml 2012-02-08 15:46:49 UTC (rev 5587)
+++ jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/ispn/ispn-integration.xml 2012-02-08 15:48:52 UTC (rev 5588)
@@ -53,6 +53,26 @@
<section>
<title>Workspaces configuration requirements</title>
+ <para>Each mentioned below components uses instances of Infinispan Cache
+ product for caching in clustered environment. So every element has it's
+ own transport and has to be configured in a proper way. As usual,
+ workspaces have similar configuration. The simplest way to configure them
+ is to define their own configuration files for each component in each
+ workspace. There are several commons parameters. <abbrev></abbrev></para>
+
+ <para><abbrev>"infinispan-configuration"</abbrev> defines path to template
+ based configuration for Infinispan Cache instance. </para>
+
+ <para>JGroups is used by Infinispan Cache for network communications and
+ transport in a clustered environment. If property
+ <abbrev>"jgroups-configuration"</abbrev> is defined in component
+ configuration, it will be injected into the Infinispan Cache instance on
+ startup.</para>
+
+ <para>The another parameter is <abbrev>"infinispan-cluster-name".</abbrev>
+ This defines the name of the cluster. Needs to be the same for all nodes
+ in a cluster in order to find each other.</para>
+
<itemizedlist>
<listitem>
<para>Cache configuration:</para>
@@ -81,6 +101,17 @@
</properties>
</query-handler>
</programlisting>
+
+ <itemizedlist>
+ <listitem>
+ <para><abbrev>changesfilter-class</abbrev> - defines cluster-ready
+ index strategy based on Infinispan Cache, it can be either
+ <classname>org.exoplatform.services.jcr.impl.core.query.ispn.ISPNIndexChangesFilter</classname>
+ (for shared index) or
+ <classname>org.exoplatform.services.jcr.impl.core.query.ispn.LocalIndexChangesFilter</classname>
+ (for local index)</para>
+ </listitem>
+ </itemizedlist>
</listitem>
<listitem>
@@ -103,6 +134,51 @@
</properties>
</lock-manager>^
</programlisting>
+
+ <itemizedlist>
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.table.name</abbrev> - table
+ name</para>
+ </listitem>
+
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.table.create</abbrev> - is
+ true or false. Indicates whether to create table at start phase.
+ If true, the table is created if it does not already exist.</para>
+ </listitem>
+
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.table.drop</abbrev> - is
+ true or false. Indicates whether to drop the table at stop
+ phase.</para>
+ </listitem>
+
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.id.column</abbrev> - id
+ column name</para>
+ </listitem>
+
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.data.column</abbrev> - data
+ column name</para>
+ </listitem>
+
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.timestamp.column</abbrev> -
+ timestamp column name</para>
+ </listitem>
+
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.datasource</abbrev> - name
+ of configured in Container datasource, where you want to store
+ locks. The best idea is to use the same as for workspace.</para>
+ </listitem>
+
+ <listitem>
+ <para><abbrev>infinispan-cl-cache.jdbc.connectionFactory</abbrev>
+ - connection factories for use with the JDBC Cache Store.</para>
+ </listitem>
+ </itemizedlist>
</listitem>
</itemizedlist>
</section>
@@ -350,10 +426,6 @@
<row>
<entry>jgroups-configuration</entry>
</row>
-
- <row>
- <entry>infinispan-cachestore-classname</entry>
- </row>
</tbody>
</tgroup>
</table>
12 years, 4 months