exo-jcr SVN: r3806 - jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-01-13 08:17:04 -0500 (Thu, 13 Jan 2011)
New Revision: 3806
Modified:
jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
Log:
JCR-1574 : The problem with thread safe in IncrementalBackupJob was fixed.
Modified: jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-01-13 12:19:54 UTC (rev 3805)
+++ jcr/branches/1.12.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-01-13 13:17:04 UTC (rev 3806)
@@ -130,52 +130,55 @@
PendingChangesLog pendingChangesLog = new PendingChangesLog(changesLog, fileCleaner);
- if (pendingChangesLog.getConteinerType() == PendingChangesLog.Type.CHANGESLOG_WITH_STREAM)
+ synchronized (out)
{
-
- out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITH_STREAM);
- out.writeObject(changesLog);
-
- // Write FixupStream
- List<FixupStream> listfs = pendingChangesLog.getFixupStreams();
- out.writeInt(listfs.size());
-
- for (int i = 0; i < listfs.size(); i++)
+ if (pendingChangesLog.getConteinerType() == PendingChangesLog.Type.CHANGESLOG_WITH_STREAM)
{
- listfs.get(i).writeExternal(out);
+
+ out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITH_STREAM);
+ out.writeObject(changesLog);
+
+ // Write FixupStream
+ List<FixupStream> listfs = pendingChangesLog.getFixupStreams();
+ out.writeInt(listfs.size());
+
+ for (int i = 0; i < listfs.size(); i++)
+ {
+ listfs.get(i).writeExternal(out);
+ }
+
+ // write stream data
+ List<InputStream> listInputList = pendingChangesLog.getInputStreams();
+
+ // write file count
+ out.writeInt(listInputList.size());
+
+ for (int i = 0; i < listInputList.size(); i++)
+ {
+ File tempFile = getAsFile(listInputList.get(i));
+ FileInputStream fis = new FileInputStream(tempFile);
+
+ // write file size
+ out.writeLong(tempFile.length());
+
+ // write file content
+ writeContent(fis, out);
+
+ fis.close();
+ fileCleaner.addFile(tempFile);
+ }
+
+ // restore changes log worlds
+
}
-
- // write stream data
- List<InputStream> listInputList = pendingChangesLog.getInputStreams();
-
- // write file count
- out.writeInt(listInputList.size());
-
- for (int i = 0; i < listInputList.size(); i++)
+ else
{
- File tempFile = getAsFile(listInputList.get(i));
- FileInputStream fis = new FileInputStream(tempFile);
-
- // write file size
- out.writeLong(tempFile.length());
-
- // write file content
- writeContent(fis, out);
-
- fis.close();
- fileCleaner.addFile(tempFile);
+ out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITHOUT_STREAM);
+ out.writeObject(changesLog);
}
-
- // restore changes log worlds
-
+
+ out.flush();
}
- else
- {
- out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITHOUT_STREAM);
- out.writeObject(changesLog);
- }
-
- out.flush();
}
private File getAsFile(InputStream is) throws IOException
13 years, 5 months
exo-jcr SVN: r3805 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-01-13 07:19:54 -0500 (Thu, 13 Jan 2011)
New Revision: 3805
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
Log:
EXOJCR-1118 : The problem with thread safe in IncrementalBackupJob was fixed.
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-01-13 10:43:01 UTC (rev 3804)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-01-13 12:19:54 UTC (rev 3805)
@@ -124,59 +124,62 @@
}
}
- public synchronized void writeExternal(ObjectOutputStream out, TransactionChangesLog changesLog,
+ public void writeExternal(ObjectOutputStream out, TransactionChangesLog changesLog,
FileCleaner fileCleaner)
throws IOException
{
PendingChangesLog pendingChangesLog = new PendingChangesLog(changesLog, fileCleaner);
- if (pendingChangesLog.getConteinerType() == PendingChangesLog.Type.CHANGESLOG_WITH_STREAM)
+ synchronized (out)
{
+ if (pendingChangesLog.getConteinerType() == PendingChangesLog.Type.CHANGESLOG_WITH_STREAM)
+ {
- out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITH_STREAM);
- out.writeObject(changesLog);
+ out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITH_STREAM);
+ out.writeObject(changesLog);
- // Write FixupStream
- List<FixupStream> listfs = pendingChangesLog.getFixupStreams();
- out.writeInt(listfs.size());
+ // Write FixupStream
+ List<FixupStream> listfs = pendingChangesLog.getFixupStreams();
+ out.writeInt(listfs.size());
- for (int i = 0; i < listfs.size(); i++)
- {
- listfs.get(i).writeExternal(out);
- }
+ for (int i = 0; i < listfs.size(); i++)
+ {
+ listfs.get(i).writeExternal(out);
+ }
- // write stream data
- List<InputStream> listInputList = pendingChangesLog.getInputStreams();
+ // write stream data
+ List<InputStream> listInputList = pendingChangesLog.getInputStreams();
- // write file count
- out.writeInt(listInputList.size());
+ // write file count
+ out.writeInt(listInputList.size());
- for (int i = 0; i < listInputList.size(); i++)
- {
- File tempFile = getAsFile(listInputList.get(i));
- FileInputStream fis = PrivilegedFileHelper.fileInputStream(tempFile);
+ for (int i = 0; i < listInputList.size(); i++)
+ {
+ File tempFile = getAsFile(listInputList.get(i));
+ FileInputStream fis = PrivilegedFileHelper.fileInputStream(tempFile);
- // write file size
- out.writeLong(PrivilegedFileHelper.length(tempFile));
+ // write file size
+ out.writeLong(PrivilegedFileHelper.length(tempFile));
- // write file content
- writeContent(fis, out);
+ // write file content
+ writeContent(fis, out);
- fis.close();
- fileCleaner.addFile(tempFile);
+ fis.close();
+ fileCleaner.addFile(tempFile);
+ }
+
+ // restore changes log worlds
+
}
+ else
+ {
+ out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITHOUT_STREAM);
+ out.writeObject(changesLog);
+ }
- // restore changes log worlds
-
+ out.flush();
}
- else
- {
- out.writeInt(PendingChangesLog.Type.CHANGESLOG_WITHOUT_STREAM);
- out.writeObject(changesLog);
- }
-
- out.flush();
}
private File getAsFile(InputStream is) throws IOException
13 years, 5 months
exo-jcr SVN: r3804 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: util/jdbc/cleaner and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-01-13 05:43:01 -0500 (Thu, 13 Jan 2011)
New Revision: 3804
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java
Log:
EXOJCR-1154: fixed SingleDbCleaner query scripts, changed unregisteration for repository removal
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2011-01-13 10:39:50 UTC (rev 3803)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2011-01-13 10:43:01 UTC (rev 3804)
@@ -422,7 +422,7 @@
repositoryContainer.stop();
repositoryContainers.remove(name);
config.getRepositoryConfigurations().remove(repconfig);
- parentContainer.unregisterComponentByInstance(repositoryContainer);
+ parentContainer.unregisterComponent(repositoryContainer.getName());
}
catch (RepositoryConfigurationException e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java 2011-01-13 10:39:50 UTC (rev 3803)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java 2011-01-13 10:43:01 UTC (rev 3804)
@@ -66,7 +66,7 @@
.add("delete from JCR_SVALUE where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SVALUE.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME='"
+ containerName + "')");
commonSingleDBCleanScripts
- .add("delete from JCR_SVALUE where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SVALUE.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME='"
+ .add("delete from JCR_SREF where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SREF.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME='"
+ containerName + "')");
commonSingleDBCleanScripts.addAll(commonDBCleanScripts);
}
13 years, 5 months
exo-jcr SVN: r3803 - in kernel/trunk/exo.kernel.container/src: test/java/org/exoplatform/container and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-01-13 05:39:50 -0500 (Thu, 13 Jan 2011)
New Revision: 3803
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
Log:
EXOJCR-1154: fixed unregistration of component to consider lazy initialization, test added
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2011-01-13 10:35:21 UTC (rev 3802)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2011-01-13 10:39:50 UTC (rev 3803)
@@ -423,8 +423,19 @@
for (Iterator<ComponentAdapter> iterator = componentAdapters.iterator(); iterator.hasNext();)
{
ComponentAdapter componentAdapter = iterator.next();
- if (getInstance(componentAdapter).equals(componentInstance))
+ Object o;
+ try
{
+ o = getInstance(componentAdapter);
+ }
+ catch (Exception e)
+ {
+ // Ignore me,
+ // may be caused by lazy initialization mechanism
+ continue;
+ }
+ if (componentInstance.equals(o))
+ {
return unregisterComponent(componentAdapter.getComponentKey());
}
}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2011-01-13 10:35:21 UTC (rev 3802)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2011-01-13 10:39:50 UTC (rev 3803)
@@ -64,6 +64,17 @@
assertNotNull(container.getComponentInstanceOfType(CachedComponent.class));
container.unregisterComponent(CachedComponent.class);
assertNull(container.getComponentInstanceOfType(CachedComponent.class));
+
+ container.registerComponent(new DummyAdapter());
+ try
+ {
+ container.unregisterComponentByInstance(new Integer(0));
+ }
+ catch (Exception e)
+ {
+ fail("Component unregistration failed");
+ }
+ container.unregisterComponent("testKey");
}
public void testContainerLifecyclePlugin()
@@ -521,4 +532,32 @@
this.a = plugin.a;
}
}
-}
\ No newline at end of file
+
+ private class DummyAdapter implements ComponentAdapter
+ {
+
+ public void verify(PicoContainer arg0) throws PicoIntrospectionException
+ {
+ }
+
+ public Object getComponentKey()
+ {
+ return "testKey";
+ }
+
+ public Object getComponentInstance(PicoContainer arg0) throws PicoInitializationException,
+ PicoIntrospectionException
+ {
+ throw (PicoInitializationException)new Exception();
+ }
+
+ public Class getComponentImplementation()
+ {
+ return null;
+ }
+
+ public void accept(PicoVisitor arg0)
+ {
+ }
+ }
+}
13 years, 5 months
exo-jcr SVN: r3802 - in jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: util/jdbc/cleaner and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-01-13 05:35:21 -0500 (Thu, 13 Jan 2011)
New Revision: 3802
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java
Log:
JCR-1565: fixed SingleDbCleaner query scripts, changed unregisteration for repository removal
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2011-01-13 10:32:47 UTC (rev 3801)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2011-01-13 10:35:21 UTC (rev 3802)
@@ -43,9 +43,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.StringTokenizer;
import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.StringTokenizer;
import javax.jcr.NamespaceException;
import javax.jcr.NamespaceRegistry;
@@ -240,7 +239,7 @@
repositoryContainer.stop();
repositoryContainers.remove(name);
config.getRepositoryConfigurations().remove(repconfig);
- parentContainer.unregisterComponentByInstance(repositoryContainer);
+ parentContainer.unregisterComponent(repositoryContainer.getName());
}
catch (RepositoryConfigurationException e)
{
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java 2011-01-13 10:32:47 UTC (rev 3801)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/SingleDBCleaner.java 2011-01-13 10:35:21 UTC (rev 3802)
@@ -66,7 +66,7 @@
.add("delete from JCR_SVALUE where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SVALUE.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME='"
+ containerName + "')");
commonSingleDBCleanScripts
- .add("delete from JCR_SVALUE where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SVALUE.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME='"
+ .add("delete from JCR_SREF where exists(select * from JCR_SITEM where JCR_SITEM.ID=JCR_SREF.PROPERTY_ID and JCR_SITEM.CONTAINER_NAME='"
+ containerName + "')");
commonSingleDBCleanScripts.addAll(commonDBCleanScripts);
}
13 years, 5 months
exo-jcr SVN: r3801 - in kernel/branches/2.2.x/exo.kernel.container/src: test/java/org/exoplatform/container and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-01-13 05:32:47 -0500 (Thu, 13 Jan 2011)
New Revision: 3801
Modified:
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
Log:
JCR-1565: fixed unregistration of component to consider lazy initialization, test added
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2011-01-13 10:24:25 UTC (rev 3800)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ConcurrentPicoContainer.java 2011-01-13 10:32:47 UTC (rev 3801)
@@ -423,8 +423,19 @@
for (Iterator<ComponentAdapter> iterator = componentAdapters.iterator(); iterator.hasNext();)
{
ComponentAdapter componentAdapter = iterator.next();
- if (getInstance(componentAdapter).equals(componentInstance))
+ Object o;
+ try
{
+ o = getInstance(componentAdapter);
+ }
+ catch (Exception e)
+ {
+ // Ignore me,
+ // may be caused by lazy initialization mechanism
+ continue;
+ }
+ if (componentInstance.equals(o))
+ {
return unregisterComponent(componentAdapter.getComponentKey());
}
}
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2011-01-13 10:24:25 UTC (rev 3800)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2011-01-13 10:32:47 UTC (rev 3801)
@@ -64,6 +64,18 @@
assertNotNull(container.getComponentInstanceOfType(CachedComponent.class));
container.unregisterComponent(CachedComponent.class);
assertNull(container.getComponentInstanceOfType(CachedComponent.class));
+
+ container.registerComponent(new DummyAdapter());
+ try
+ {
+ container.unregisterComponentByInstance(new Integer(0));
+ }
+ catch (Exception e)
+ {
+ fail("Component unregistration failed");
+ }
+ container.unregisterComponent("testKey");
+
}
public void testContainerLifecyclePlugin()
@@ -521,4 +533,32 @@
this.a = plugin.a;
}
}
+
+ private class DummyAdapter implements ComponentAdapter
+ {
+
+ public void verify(PicoContainer arg0) throws PicoIntrospectionException
+ {
+ }
+
+ public Object getComponentKey()
+ {
+ return "testKey";
+ }
+
+ public Object getComponentInstance(PicoContainer arg0) throws PicoInitializationException,
+ PicoIntrospectionException
+ {
+ throw (PicoInitializationException)new Exception();
+ }
+
+ public Class getComponentImplementation()
+ {
+ return null;
+ }
+
+ public void accept(PicoVisitor arg0)
+ {
+ }
+ }
}
\ No newline at end of file
13 years, 5 months
exo-jcr SVN: r3800 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-01-13 05:24:25 -0500 (Thu, 13 Jan 2011)
New Revision: 3800
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java
Log:
EXOJCR-1096: Test on all supported database: oracle
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java 2011-01-13 09:10:00 UTC (rev 3799)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java 2011-01-13 10:24:25 UTC (rev 3800)
@@ -64,16 +64,6 @@
public static final String CONTENT_LEN_FILE_SUFFIX = ".len";
/**
- * Generic dialect.
- */
- public static final int DB_DIALECT_GENERIC = DBConstants.DB_DIALECT_GENERIC.hashCode();
-
- /**
- * HSQLDB dialect.
- */
- public static final int DB_DIALECT_HSQLDB = DBConstants.DB_DIALECT_HSQLDB.hashCode();
-
- /**
* MySQL dialect.
*/
public static final int DB_DIALECT_MYSQL = DBConstants.DB_DIALECT_MYSQL.hashCode();
@@ -224,23 +214,15 @@
for (int i = 0; i < columnCount; i++)
{
InputStream value;
- if (dialect == DB_DIALECT_HSQLDB || dialect == DB_DIALECT_SYBASE || dialect == DB_DIALECT_DB2
- || dialect == DB_DIALECT_DB2V8 || dialect == DB_DIALECT_PGSQL)
+ if (columnType[i] == Types.VARBINARY || columnType[i] == Types.LONGVARBINARY
+ || columnType[i] == Types.BLOB || columnType[i] == Types.BINARY)
{
- if (columnType[i] == Types.VARBINARY || columnType[i] == Types.LONGVARBINARY
- || columnType[i] == Types.BLOB || columnType[i] == Types.BINARY)
- {
- value = rs.getBinaryStream(i + 1);
- }
- else
- {
- String str = rs.getString(i + 1);
- value = str == null ? null : new ByteArrayInputStream(str.getBytes(Constants.DEFAULT_ENCODING));
- }
+ value = rs.getBinaryStream(i + 1);
}
else
{
- value = rs.getBinaryStream(i + 1);
+ String str = rs.getString(i + 1);
+ value = str == null ? null : new ByteArrayInputStream(str.getBytes(Constants.DEFAULT_ENCODING));
}
if (value == null)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java 2011-01-13 09:10:00 UTC (rev 3799)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java 2011-01-13 10:24:25 UTC (rev 3800)
@@ -462,29 +462,17 @@
String value = new String(readBuffer);
insertNode.setBoolean(targetIndex + 1, value.equals("true"));
}
+ else if (columnType.get(i) == Types.VARBINARY || columnType.get(i) == Types.LONGVARBINARY
+ || columnType.get(i) == Types.BLOB || columnType.get(i) == Types.BINARY)
+ {
+ insertNode.setBinaryStream(targetIndex + 1, stream, (int)len);
+ }
else
{
- if (dialect == BackupTables.DB_DIALECT_HSQLDB || dialect == BackupTables.DB_DIALECT_SYBASE
- || dialect == BackupTables.DB_DIALECT_DB2 || dialect == BackupTables.DB_DIALECT_DB2V8
- || dialect == BackupTables.DB_DIALECT_PGSQL)
- {
- if (columnType.get(i) == Types.VARBINARY || columnType.get(i) == Types.LONGVARBINARY
- || columnType.get(i) == Types.BLOB || columnType.get(i) == Types.BINARY)
- {
- insertNode.setBinaryStream(targetIndex + 1, stream, (int)len);
- }
- else
- {
- byte[] readBuffer = new byte[(int)len];
- stream.read(readBuffer);
+ byte[] readBuffer = new byte[(int)len];
+ stream.read(readBuffer);
- insertNode.setString(targetIndex + 1, new String(readBuffer, Constants.DEFAULT_ENCODING));
- }
- }
- else
- {
- insertNode.setBinaryStream(targetIndex + 1, stream, (int)len);
- }
+ insertNode.setString(targetIndex + 1, new String(readBuffer, Constants.DEFAULT_ENCODING));
}
}
else
13 years, 5 months
exo-jcr SVN: r3799 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-01-13 04:10:00 -0500 (Thu, 13 Jan 2011)
New Revision: 3799
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
Log:
EXOJCR-1118 : The problem with thread safe in IncrementalBackupJob was fixed.
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-01-13 08:58:58 UTC (rev 3798)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-01-13 09:10:00 UTC (rev 3799)
@@ -124,7 +124,8 @@
}
}
- public void writeExternal(ObjectOutputStream out, TransactionChangesLog changesLog, FileCleaner fileCleaner)
+ public synchronized void writeExternal(ObjectOutputStream out, TransactionChangesLog changesLog,
+ FileCleaner fileCleaner)
throws IOException
{
13 years, 5 months
exo-jcr SVN: r3798 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-01-13 03:58:58 -0500 (Thu, 13 Jan 2011)
New Revision: 3798
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java
Log:
EXOJCR-1096: Test on all supported database: postgreSQL
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java 2011-01-13 07:54:49 UTC (rev 3797)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/BackupTables.java 2011-01-13 08:58:58 UTC (rev 3798)
@@ -225,10 +225,10 @@
{
InputStream value;
if (dialect == DB_DIALECT_HSQLDB || dialect == DB_DIALECT_SYBASE || dialect == DB_DIALECT_DB2
- || dialect == DB_DIALECT_DB2V8)
+ || dialect == DB_DIALECT_DB2V8 || dialect == DB_DIALECT_PGSQL)
{
if (columnType[i] == Types.VARBINARY || columnType[i] == Types.LONGVARBINARY
- || columnType[i] == Types.BLOB)
+ || columnType[i] == Types.BLOB || columnType[i] == Types.BINARY)
{
value = rs.getBinaryStream(i + 1);
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java 2011-01-13 07:54:49 UTC (rev 3797)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/backup/util/RestoreTables.java 2011-01-13 08:58:58 UTC (rev 3798)
@@ -465,10 +465,11 @@
else
{
if (dialect == BackupTables.DB_DIALECT_HSQLDB || dialect == BackupTables.DB_DIALECT_SYBASE
- || dialect == BackupTables.DB_DIALECT_DB2 || dialect == BackupTables.DB_DIALECT_DB2V8)
+ || dialect == BackupTables.DB_DIALECT_DB2 || dialect == BackupTables.DB_DIALECT_DB2V8
+ || dialect == BackupTables.DB_DIALECT_PGSQL)
{
if (columnType.get(i) == Types.VARBINARY || columnType.get(i) == Types.LONGVARBINARY
- || columnType.get(i) == Types.BLOB)
+ || columnType.get(i) == Types.BLOB || columnType.get(i) == Types.BINARY)
{
insertNode.setBinaryStream(targetIndex + 1, stream, (int)len);
}
13 years, 5 months
exo-jcr SVN: r3797 - in jcr/branches/1.12.x: applications/exo.jcr.applications.backupconsole.dist/bin and 2 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-01-13 02:54:49 -0500 (Thu, 13 Jan 2011)
New Revision: 3797
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.cmd
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.sh
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/src/main/doc/readme.txt
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
Log:
JCR-1564: The problem with form authentication on Platform 3.0.2 was fixed.
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2011-01-13 07:40:37 UTC (rev 3796)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2011-01-13 07:54:49 UTC (rev 3797)
@@ -696,8 +696,7 @@
String result =
"\nThe backup service information : \n" + "\tfull backup type : "
- + info.getFullBackupType()
- + "\n" + "\tincremental backup type : "
+ + info.getFullBackupType() + "\n" + "\tincremental backup type : "
+ info.getIncrementalBackupType() + "\n" + "\tbackup log folder : "
+ info.getBackupLogDir() + "\n" + "\tdefault incremental job period : "
+ info.getDefaultIncrementalJobPeriod() + "\n\n";
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java 2011-01-13 07:40:37 UTC (rev 3796)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java 2011-01-13 07:54:49 UTC (rev 3797)
@@ -65,7 +65,7 @@
+ " <form auth parm> : form <method> <form path>\n"
+ " <method> : POST or GET\n"
+ " <form path> : /path/path?<paramName1>=<paramValue1>&<paramName2>=<paramValue2>...\n"
- + " Example to <url form authentication> : http://127.0.0.1:8080/portal/rest form POST \"/portal/login?username=root&password=gtn\"\n\n"
+ + " Example to <url form authentication> : http://127.0.0.1:8080/portal/rest form POST \"/portal/login?initialURI=/portal/private&username=root&password=gtn\"\n\n"
+ " <cmd> : start <repo[/ws]> <backup_dir> [<incr>] \n"
+ " stop <backup_id> \n"
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.cmd
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.cmd 2011-01-13 07:40:37 UTC (rev 3796)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.cmd 2011-01-13 07:54:49 UTC (rev 3797)
@@ -1,6 +1,7 @@
@echo off
set auth=-b
+set context=portal
if NOT "%1" == "-u" goto :help
shift
@@ -17,6 +18,12 @@
set auth=%1
shift
)
+if "%1" == "-c" (
+shift
+set context=%2
+shift
+)
+
if "%1" == "-b" (
shift
)
@@ -46,7 +53,7 @@
jcrbackup http://%user%:%pass%@%host%/rest/private %comm%
)
if "%auth%" == "-f" (
-jcrbackup http://%host%/portal/rest form POST /portal/login?username=%user%^^^&password=%pass% %comm%
+jcrbackup http://%host%/%context%/rest form POST /%context%/login?initialURI=/%context%/private^^^&username=%user%^^^&password=%pass% %comm%
)
@@ -55,8 +62,10 @@
echo -u ^<user^> -p ^<password^> [form_of_authentication] ^<host:port^> ^<command^>
echo.
echo [form_of_authentication] : -b - is used for basic authentication
-echo -f - is used for form authentication
+echo : -f [-c ^<context^>] - is used for form authentication with context portal
+echo if parameter context not specified
echo if no authentication set basic authentication is used
+echo -c ^<context^> : context, by default context is portal
echo.
echo ^<command^> : start ^<repo[/ws]^> ^<backup_dir^> [^<incr^>]
echo stop ^<backup_id^>
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.sh
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.sh 2011-01-13 07:40:37 UTC (rev 3796)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/bin/exobackup.sh 2011-01-13 07:54:49 UTC (rev 3797)
@@ -7,8 +7,9 @@
echo " -u <user> -p <password> [form_of_authentication] <host:port> <command> "
echo " "
echo " [form_of_authentication] : -b - is used for basic authentication "
-echo " -f - is used for form authentication "
+echo " -f [-c <context>] - is used for form authentication with context portal if parameter context not specified "
echo " if no authentication set basic authentication is used"
+echo " -c <context> : context, by default context is portal"
echo " <command> : start <repo[/ws]> <backup_dir> [<incr>] "
echo " stop <backup_id> "
echo " status <backup_id> "
@@ -45,8 +46,18 @@
if [ "$5" = "-f" ]
then
- host=${6#*"http://"}
- newargs="http://$host/portal/rest form POST /portal/login?username=$user&password=$pass ${args[@]:6}"
+
+ if [ "$6" = "-c" ]
+ then
+ context="$7"
+ host=${8#*"http://"}
+ newargs="http://$host/$context/rest form POST /$context/login?initialURI=/$context/private&username=$user&password=$pass ${args[@]:8}"
+ else
+ context="portal"
+ host=${6#*"http://"}
+ newargs="http://$host/$context/rest form POST /$context/login?initialURI=/$context/private&username=$user&password=$pass ${args[@]:6}"
+ fi
+
else
if [ "$5" = "-b" ]
then
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/src/main/doc/readme.txt
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/src/main/doc/readme.txt 2011-01-13 07:40:37 UTC (rev 3796)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole.dist/src/main/doc/readme.txt 2011-01-13 07:54:49 UTC (rev 3797)
@@ -9,7 +9,7 @@
<method> : POST or GET
<form_path> : /path/path?<paramName1>=<paramValue1>&<paramName2>=<paramValue2>...
- Example of <url_form_authentication> - http://127.0.0.1:8080/portal/rest form POST "/portal/login?username=root&password=gtn"
+ Example of <url_form_authentication> - http://127.0.0.1:8080/portal/rest form POST "/portal/login?initialURI=/portal/private&username=root&password=gtn"
<command> : start <repo[/ws]> <backup_dir> [<incr>]
stop <backup_id>
@@ -46,8 +46,9 @@
-u <user> -p <password> [form_of_authentication] <host:port> <command>
<form_of_authentication> : -b - is used for basic authentication
- -f - is used for form authentication
+ -f [-c <context>] - is used for form authentication with context portal if parameter context not specified
if no authentication set basic authentication is used
+ -c <context> : context, by default context is portal
<command> : start <repo[/ws]> <backup_dir> [<incr>]
stop <backup_id>
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2011-01-13 07:40:37 UTC (rev 3796)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2011-01-13 07:54:49 UTC (rev 3797)
@@ -982,7 +982,8 @@
command "info" with form authentication to GateIn :</para>
<para>./jcrbackup.sh http://127.0.0.1:8080/portal/rest form POST
- "/portal/login?username=root&password=gtn" info</para>
+ "/portal/login?initialURI=/portal/private&username=root&password=gtn"
+ info</para>
</highlights>
<para>Backup client is console application.</para>
@@ -999,7 +1000,7 @@
<form auth parm> : form <method> <form path>
<method> : POST or GET
<form path> : /path/path?<paramName1>=<paramValue1>&<paramName2>=<paramValue2>...
- Example to <url form authentication> : http://127.0.0.1:8080/portal/rest form POST "/portal/login?username=root&password=gtn"
+ Example to <url form authentication> : http://127.0.0.1:8080/portal/rest form POST "/portal/login?initialURI=/portal/private&username=root&password=gtn"
<cmd> : start <repo[/ws]> <backup_dir> [<incr>]
stop <backup_id>
@@ -1281,7 +1282,7 @@
</section>
<section>
- <title>Restoring workspace with original configuation </title>
+ <title>Restoring workspace with original configuation</title>
<para>Restore to workspace "backup" with original configuration of
workspace (the original configuration was stored in backup set), for
13 years, 5 months