exo-jcr SVN: r4488 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: storage/value/fs/operations and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-06-09 02:12:58 -0400 (Thu, 09 Jun 2011)
New Revision: 4488
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
Log:
EXOJCR-1346: fix violations
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-06-08 12:40:18 UTC (rev 4487)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-06-09 06:12:58 UTC (rev 4488)
@@ -1317,8 +1317,8 @@
}
}
- protected List<PropertyData> getChildPropertiesDataByPattern(final NodeData nodeData, final List<QPathEntryFilter> patternFilters)
- throws RepositoryException
+ protected List<PropertyData> getChildPropertiesDataByPattern(final NodeData nodeData,
+ final List<QPathEntryFilter> patternFilters) throws RepositoryException
{
if (!cache.isEnabled())
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2011-06-08 12:40:18 UTC (rev 4487)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2011-06-09 06:12:58 UTC (rev 4488)
@@ -184,9 +184,8 @@
// not succeeded - copy bytes, temp file will be deleted by transient ValueData
if (LOG.isDebugEnabled())
{
- LOG
- .debug("Value spool file move (rename) to Values Storage is not succeeded. Trying bytes copy. Spool file: "
- + tempFile.getAbsolutePath() + ". Destination: " + file.getAbsolutePath());
+ LOG.debug("Value spool file move (rename) to Values Storage is not succeeded. Trying bytes copy. Spool file: "
+ + tempFile.getAbsolutePath() + ". Destination: " + file.getAbsolutePath());
}
copyClose(new FileInputStream(tempFile), new FileOutputStream(file));
12 years, 11 months
exo-jcr SVN: r4487 - core/branches/2.3.x/patch/2.3.8/COR-228.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-06-08 08:40:18 -0400 (Wed, 08 Jun 2011)
New Revision: 4487
Modified:
core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
Log:
COR-228: patch updated
Modified: core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
===================================================================
--- core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch 2011-06-08 08:16:20 UTC (rev 4486)
+++ core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch 2011-06-08 12:40:18 UTC (rev 4487)
@@ -1,353 +1,3 @@
-Index: exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java
-===================================================================
---- exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java (revision 4476)
-+++ exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java (working copy)
-@@ -18,7 +18,6 @@
- */
- package org.exoplatform.services.document.test;
-
--import org.exoplatform.commons.utils.ISO8601;
- import org.exoplatform.services.document.DCMetaData;
- import org.exoplatform.services.document.DocumentReader;
- import org.exoplatform.services.document.DocumentReaderService;
-@@ -34,6 +33,22 @@
- {
- DocumentReaderService service;
-
-+ private void evalProps(Properties etalon, Properties testedProps, boolean testSize)
-+ {
-+ Iterator it = etalon.entrySet().iterator();
-+ while (it.hasNext())
-+ {
-+ Map.Entry prop = (Map.Entry)it.next();
-+ Object tval = testedProps.get(prop.getKey());
-+ assertNotNull(prop.getKey() + " property not founded. ", tval);
-+ assertEquals(prop.getKey() + " property value is incorrect", prop.getValue(), tval);
-+ }
-+ if (testSize)
-+ {
-+ assertEquals("size is incorrect", etalon.size(), testedProps.size());
-+ }
-+ }
-+
- @Override
- public void setUp() throws Exception
- {
-@@ -41,20 +56,21 @@
- service = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
- }
-
-- public void testPDFDocumentReaderServiceXMPMetadata() throws Exception
-+ public void testExcelDocumentReaderService() throws Exception
- {
-- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/MyTest.pdf");
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xls");
- try
- {
-- DocumentReader rdr = service.getDocumentReader("application/pdf");
-- Properties testprops = rdr.getProperties(is);
-+ Properties props = service.getDocumentReader("application/excel").getProperties(is);
- Properties etalon = new Properties();
-- etalon.put(DCMetaData.TITLE, "Test de convertion de fichier tif");
-- etalon.put(DCMetaData.CREATOR, "Christian Klaus");
-- etalon.put(DCMetaData.SUBJECT, "20080901 TEST Christian Etat OK");
-- Calendar c = ISO8601.parseEx("2008-09-01T08:01:10+00:00");
-- etalon.put(DCMetaData.DATE, c);
-- evalProps(etalon, testprops);
-+ etalon.put(DCMetaData.TITLE, "test-Title");
-+ etalon.put(DCMetaData.DATE, new Date(1283247293000L));
-+ etalon.put(DCMetaData.SUBJECT, "test-Subject");
-+ etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
-+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
-+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
-+
-+ evalProps(etalon, props, true);
- }
- finally
- {
-@@ -62,20 +78,111 @@
- }
- }
-
-- public void testWordDocumentReaderService() throws Exception
-+ public void testOODocumentReaderService() throws Exception
- {
-- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.doc");
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.odt");
- try
- {
-- Properties props = service.getDocumentReader("application/msword").getProperties(is);
-+ Properties props = service.getDocumentReader("application/vnd.oasis.opendocument.text").getProperties(is);
- Properties etalon = new Properties();
-+ Calendar date = Calendar.getInstance();
-+ date.setTimeInMillis(0);
-+ date.set(2010, 7, 31, 14, 13, 23);
-+
- etalon.put(DCMetaData.TITLE, "test-Title");
-- etalon.put(DCMetaData.DATE, new Date(1283247060000L));
-+ etalon.put(DCMetaData.LANGUAGE, "ru-RU");
-+ etalon.put(DCMetaData.DATE, "2010-08-31T14:13:23");
- etalon.put(DCMetaData.SUBJECT, "test-Subject");
-- etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
-- etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
-+ etalon.put(DCMetaData.CREATOR, "nikolaz ");
- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
-- evalProps(etalon, props);
-+
-+ evalProps(etalon, props, true);
-+ }
-+ finally
-+ {
-+ is.close();
-+ }
-+ }
-+
-+ public void testPDFDocumentReaderService() throws Exception
-+ {
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.pdf");
-+ DocumentReader rdr = service.getDocumentReader("application/pdf");
-+ Properties props = rdr.getProperties(is);
-+ assertTrue(props.isEmpty());
-+
-+ // Properties etalon = new Properties();
-+ // etalon.put(DCMetaData.PUBLISHER, "FOP 0.20.4");
-+ // evalProps(etalon, props, false);
-+ }
-+
-+ public void testPDFDocumentReaderServiceBrokenFile() throws Exception
-+ {
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/pfs_accapp.pdf");
-+ try
-+ {
-+
-+ DocumentReader rdr = service.getDocumentReader("application/pdf");
-+ Properties testprops = rdr.getProperties(is);
-+ Properties etalon = new Properties();
-+ etalon.put(DCMetaData.TITLE, "Personal Account Opening Form VN");
-+ etalon.put(DCMetaData.CREATOR, "mr");
-+ evalProps(etalon, testprops, false);
-+ }
-+ finally
-+ {
-+ is.close();
-+ }
-+ }
-+
-+ public void testPDFDocumentReaderServiceMetro() throws Exception
-+ {
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/metro.pdf");
-+ try
-+ {
-+
-+ DocumentReader rdr = service.getDocumentReader("application/pdf");
-+ Properties testprops = rdr.getProperties(is);
-+ Properties etalon = new Properties();
-+ etalon.put(DCMetaData.TITLE, "metro");
-+ etalon.put(DCMetaData.CREATOR, "Preview");
-+ evalProps(etalon, testprops, false);
-+ }
-+ finally
-+ {
-+ is.close();
-+ }
-+ }
-+
-+ public void testPDFDocumentReaderServiceXMPUsecase1() throws Exception
-+ {
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/MyTest.pdf");
-+ DocumentReader rdr = service.getDocumentReader("application/pdf");
-+
-+ Properties testprops = rdr.getProperties(is);
-+ // printProps(testprops);
-+
-+ Properties etalon = new Properties();
-+ etalon.put(DCMetaData.TITLE, "Test de convertion de fichier tif");
-+ etalon.put(DCMetaData.CREATOR, "Christian Klaus");
-+ etalon.put(DCMetaData.SUBJECT, "20080901 TEST Christian Etat OK");
-+ // Calendar c = ISO8601.parseEx("2008-09-01T08:01:10+00:00");
-+ // etalon.put(DCMetaData.DATE, c);
-+
-+ evalProps(etalon, testprops, false);
-+ }
-+
-+ public void testPDFDocumentReaderServiceXMPUsecase2() throws Exception
-+ {
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/Trait_union.06.Mai_2009.pdf");
-+ try
-+ {
-+ DocumentReader rdr = service.getDocumentReader("application/pdf");
-+ Properties testprops = rdr.getProperties(is);
-+ Properties etalon = new Properties();
-+ etalon.put(DCMetaData.TITLE, "journal interne mai 2009.qxp");
-+ etalon.put(DCMetaData.CREATOR, "presse");
-+ evalProps(etalon, testprops, false);
- }
- finally
- {
-@@ -96,7 +203,7 @@
- etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
- etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
-- evalProps(etalon, props);
-+ evalProps(etalon, props, true);
- }
- finally
- {
-@@ -104,21 +211,20 @@
- }
- }
-
-- public void testExcelDocumentReaderService() throws Exception
-+ public void testWordDocumentReaderService() throws Exception
- {
-- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xls");
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.doc");
- try
- {
-- Properties props = service.getDocumentReader("application/excel").getProperties(is);
-+ Properties props = service.getDocumentReader("application/msword").getProperties(is);
- Properties etalon = new Properties();
- etalon.put(DCMetaData.TITLE, "test-Title");
-- etalon.put(DCMetaData.DATE, new Date(1283247293000L));
-+ etalon.put(DCMetaData.DATE, new Date(1283247060000L));
- etalon.put(DCMetaData.SUBJECT, "test-Subject");
-- etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
-+ etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
- etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
--
-- evalProps(etalon, props);
-+ evalProps(etalon, props, true);
- }
- finally
- {
-@@ -126,27 +232,27 @@
- }
- }
-
-- public void testXWordDocumentReaderService() throws Exception
-+ public void testXExcelDocumentReaderService() throws Exception
- {
-- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.docx");
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xlsx");
- try
- {
- Properties props =
-- service.getDocumentReader("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
-+ service.getDocumentReader("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
- .getProperties(is);
- Properties etalon = new Properties();
- Calendar date = Calendar.getInstance();
- date.setTimeInMillis(0);
-- date.set(2010, 7, 31, 7, 53, 0);
-+ date.set(2010, 7, 31, 8, 7, 25);
-
- etalon.put(DCMetaData.TITLE, "test-Title");
- etalon.put(DCMetaData.DATE, date.getTime());
-- etalon.put(DCMetaData.SUBJECT, "Subject");
-- etalon.put(DCMetaData.CREATOR, "nikolaz");
-+ etalon.put(DCMetaData.SUBJECT, "test-Subject");
-+ etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
- etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
-
-- evalProps(etalon, props);
-+ evalProps(etalon, props, true);
- }
- finally
- {
-@@ -174,7 +280,7 @@
- etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
-
-- evalProps(etalon, props);
-+ evalProps(etalon, props, true);
- }
- finally
- {
-@@ -182,27 +288,27 @@
- }
- }
-
-- public void testXExcelDocumentReaderService() throws Exception
-+ public void testXWordDocumentReaderService() throws Exception
- {
-- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xlsx");
-+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.docx");
- try
- {
- Properties props =
-- service.getDocumentReader("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
-+ service.getDocumentReader("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
- .getProperties(is);
- Properties etalon = new Properties();
- Calendar date = Calendar.getInstance();
- date.setTimeInMillis(0);
-- date.set(2010, 7, 31, 8, 7, 25);
-+ date.set(2010, 7, 31, 7, 53, 0);
-
- etalon.put(DCMetaData.TITLE, "test-Title");
- etalon.put(DCMetaData.DATE, date.getTime());
-- etalon.put(DCMetaData.SUBJECT, "test-Subject");
-- etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
-+ etalon.put(DCMetaData.SUBJECT, "Subject");
-+ etalon.put(DCMetaData.CREATOR, "nikolaz");
- etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
-
-- evalProps(etalon, props);
-+ evalProps(etalon, props, true);
- }
- finally
- {
-@@ -210,47 +316,4 @@
- }
- }
-
-- public void testOODocumentReaderService() throws Exception
-- {
-- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.odt");
-- try
-- {
-- Properties props = service.getDocumentReader("application/vnd.oasis.opendocument.text").getProperties(is);
-- Properties etalon = new Properties();
-- Calendar date = Calendar.getInstance();
-- date.setTimeInMillis(0);
-- date.set(2010, 7, 31, 14, 13, 23);
--
-- etalon.put(DCMetaData.TITLE, "test-Title");
-- etalon.put(DCMetaData.LANGUAGE, "ru-RU");
-- etalon.put(DCMetaData.DATE, "2010-08-31T14:13:23");
-- etalon.put(DCMetaData.SUBJECT, "test-Subject");
-- etalon.put(DCMetaData.CREATOR, "nikolaz ");
-- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
--
-- evalProps(etalon, props);
-- }
-- finally
-- {
-- is.close();
-- }
-- }
--
-- private void evalProps(Properties etalon, Properties testedProps)
-- {
-- Iterator it = etalon.entrySet().iterator();
-- while (it.hasNext())
-- {
-- Map.Entry prop = (Map.Entry)it.next();
-- Object tval = testedProps.get(prop.getKey());
-- assertNotNull(prop.getKey() + " property not founded. ", tval);
-- if (tval instanceof Date)
-- {
-- System.out.println("was:" + ((Date)tval).getTime() + " expected: " + ((Date)prop.getValue()).getTime());
-- }
-- assertEquals(prop.getKey() + " property value is incorrect", prop.getValue(), tval);
-- }
-- assertEquals("size is incorrect", etalon.size(), testedProps.size());
-- }
--
- }
Index: exo.core.component.document/src/test/resources/Trait_union.06.Mai_2009.pdf
===================================================================
--- exo.core.component.document/src/test/resources/Trait_union.06.Mai_2009.pdf (revision 0)
@@ -40525,11 +40175,368 @@
Added: svn:mime-type
+ application/octet-stream
+Index: exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java
+===================================================================
+--- exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java (revision 4481)
++++ exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java (working copy)
+@@ -18,7 +18,6 @@
+ */
+ package org.exoplatform.services.document.test;
+
+-import org.exoplatform.commons.utils.ISO8601;
+ import org.exoplatform.services.document.DCMetaData;
+ import org.exoplatform.services.document.DocumentReader;
+ import org.exoplatform.services.document.DocumentReaderService;
+@@ -34,6 +33,22 @@
+ {
+ DocumentReaderService service;
+
++ private void evalProps(Properties etalon, Properties testedProps, boolean testSize)
++ {
++ Iterator it = etalon.entrySet().iterator();
++ while (it.hasNext())
++ {
++ Map.Entry prop = (Map.Entry)it.next();
++ Object tval = testedProps.get(prop.getKey());
++ assertNotNull(prop.getKey() + " property not founded. ", tval);
++ assertEquals(prop.getKey() + " property value is incorrect", prop.getValue(), tval);
++ }
++ if (testSize)
++ {
++ assertEquals("size is incorrect", etalon.size(), testedProps.size());
++ }
++ }
++
+ @Override
+ public void setUp() throws Exception
+ {
+@@ -41,20 +56,21 @@
+ service = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
+ }
+
+- public void testPDFDocumentReaderServiceXMPMetadata() throws Exception
++ public void testExcelDocumentReaderService() throws Exception
+ {
+- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/MyTest.pdf");
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xls");
+ try
+ {
+- DocumentReader rdr = service.getDocumentReader("application/pdf");
+- Properties testprops = rdr.getProperties(is);
++ Properties props = service.getDocumentReader("application/excel").getProperties(is);
+ Properties etalon = new Properties();
+- etalon.put(DCMetaData.TITLE, "Test de convertion de fichier tif");
+- etalon.put(DCMetaData.CREATOR, "Christian Klaus");
+- etalon.put(DCMetaData.SUBJECT, "20080901 TEST Christian Etat OK");
+- Calendar c = ISO8601.parseEx("2008-09-01T08:01:10+00:00");
+- etalon.put(DCMetaData.DATE, c);
+- evalProps(etalon, testprops);
++ etalon.put(DCMetaData.TITLE, "test-Title");
++ etalon.put(DCMetaData.DATE, new Date(1283247293000L));
++ etalon.put(DCMetaData.SUBJECT, "test-Subject");
++ etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
++ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
++ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
++
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -62,20 +78,25 @@
+ }
+ }
+
+- public void testWordDocumentReaderService() throws Exception
++ public void testOODocumentReaderService() throws Exception
+ {
+- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.doc");
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.odt");
+ try
+ {
+- Properties props = service.getDocumentReader("application/msword").getProperties(is);
++ Properties props = service.getDocumentReader("application/vnd.oasis.opendocument.text").getProperties(is);
+ Properties etalon = new Properties();
++ Calendar date = Calendar.getInstance();
++ date.setTimeInMillis(0);
++ date.set(2010, 7, 31, 14, 13, 23);
++
+ etalon.put(DCMetaData.TITLE, "test-Title");
+- etalon.put(DCMetaData.DATE, new Date(1283247060000L));
++ etalon.put(DCMetaData.LANGUAGE, "ru-RU");
++ etalon.put(DCMetaData.DATE, "2010-08-31T14:13:23");
+ etalon.put(DCMetaData.SUBJECT, "test-Subject");
+- etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
+- etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
++ etalon.put(DCMetaData.CREATOR, "nikolaz ");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+- evalProps(etalon, props);
++
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -83,6 +104,92 @@
+ }
+ }
+
++ public void testPDFDocumentReaderService() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.pdf");
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++ Properties props = rdr.getProperties(is);
++ assertTrue(props.isEmpty());
++
++ // Properties etalon = new Properties();
++ // etalon.put(DCMetaData.PUBLISHER, "FOP 0.20.4");
++ // evalProps(etalon, props, false);
++ }
++
++ public void testPDFDocumentReaderServiceBrokenFile() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/pfs_accapp.pdf");
++ try
++ {
++
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++ Properties testprops = rdr.getProperties(is);
++ Properties etalon = new Properties();
++ etalon.put(DCMetaData.TITLE, "Personal Account Opening Form VN");
++ etalon.put(DCMetaData.CREATOR, "mr");
++ evalProps(etalon, testprops, false);
++ }
++ finally
++ {
++ is.close();
++ }
++ }
++
++ public void testPDFDocumentReaderServiceMetro() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/metro.pdf");
++ try
++ {
++
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++ Properties testprops = rdr.getProperties(is);
++ Properties etalon = new Properties();
++ etalon.put(DCMetaData.TITLE, "metro");
++ etalon.put(DCMetaData.CREATOR, "Preview");
++ evalProps(etalon, testprops, false);
++ }
++ finally
++ {
++ is.close();
++ }
++ }
++
++ public void testPDFDocumentReaderServiceXMPUsecase1() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/MyTest.pdf");
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++
++ Properties testprops = rdr.getProperties(is);
++ // printProps(testprops);
++
++ Properties etalon = new Properties();
++ etalon.put(DCMetaData.TITLE, "Test de convertion de fichier tif");
++ etalon.put(DCMetaData.CREATOR, "Christian Klaus");
++ etalon.put(DCMetaData.SUBJECT, "20080901 TEST Christian Etat OK");
++ // Calendar c = ISO8601.parseEx("2008-09-01T08:01:10+00:00");
++ // etalon.put(DCMetaData.DATE, c);
++
++ evalProps(etalon, testprops, false);
++ }
++
++ public void testPDFDocumentReaderServiceXMPUsecase2() throws Exception
++ {
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/Trait_union.06.Mai_2009.pdf");
++ try
++ {
++ DocumentReader rdr = service.getDocumentReader("application/pdf");
++ Properties testprops = rdr.getProperties(is);
++ Properties etalon = new Properties();
++ etalon.put(DCMetaData.TITLE, "journal interne mai 2009.qxp");
++ etalon.put(DCMetaData.CREATOR, "presse");
++ evalProps(etalon, testprops, false);
++ }
++ finally
++ {
++ is.close();
++ }
++ }
++
+ public void testPPTDocumentReaderService() throws Exception
+ {
+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.ppt");
+@@ -96,7 +203,7 @@
+ etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -104,21 +211,20 @@
+ }
+ }
+
+- public void testExcelDocumentReaderService() throws Exception
++ public void testWordDocumentReaderService() throws Exception
+ {
+- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xls");
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.doc");
+ try
+ {
+- Properties props = service.getDocumentReader("application/excel").getProperties(is);
++ Properties props = service.getDocumentReader("application/msword").getProperties(is);
+ Properties etalon = new Properties();
+ etalon.put(DCMetaData.TITLE, "test-Title");
+- etalon.put(DCMetaData.DATE, new Date(1283247293000L));
++ etalon.put(DCMetaData.DATE, new Date(1283247060000L));
+ etalon.put(DCMetaData.SUBJECT, "test-Subject");
+- etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
++ etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+-
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -126,27 +232,27 @@
+ }
+ }
+
+- public void testXWordDocumentReaderService() throws Exception
++ public void testXExcelDocumentReaderService() throws Exception
+ {
+- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.docx");
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xlsx");
+ try
+ {
+ Properties props =
+- service.getDocumentReader("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
++ service.getDocumentReader("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
+ .getProperties(is);
+ Properties etalon = new Properties();
+ Calendar date = Calendar.getInstance();
+ date.setTimeInMillis(0);
+- date.set(2010, 7, 31, 7, 53, 0);
++ date.set(2010, 7, 31, 8, 7, 25);
+
+ etalon.put(DCMetaData.TITLE, "test-Title");
+ etalon.put(DCMetaData.DATE, date.getTime());
+- etalon.put(DCMetaData.SUBJECT, "Subject");
+- etalon.put(DCMetaData.CREATOR, "nikolaz");
++ etalon.put(DCMetaData.SUBJECT, "test-Subject");
++ etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -174,7 +280,7 @@
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -182,27 +288,27 @@
+ }
+ }
+
+- public void testXExcelDocumentReaderService() throws Exception
++ public void testXWordDocumentReaderService() throws Exception
+ {
+- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.xlsx");
++ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.docx");
+ try
+ {
+ Properties props =
+- service.getDocumentReader("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
++ service.getDocumentReader("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
+ .getProperties(is);
+ Properties etalon = new Properties();
+ Calendar date = Calendar.getInstance();
+ date.setTimeInMillis(0);
+- date.set(2010, 7, 31, 8, 7, 25);
++ date.set(2010, 7, 31, 7, 53, 0);
+
+ etalon.put(DCMetaData.TITLE, "test-Title");
+ etalon.put(DCMetaData.DATE, date.getTime());
+- etalon.put(DCMetaData.SUBJECT, "test-Subject");
+- etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
++ etalon.put(DCMetaData.SUBJECT, "Subject");
++ etalon.put(DCMetaData.CREATOR, "nikolaz");
+ etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
+ etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+
+- evalProps(etalon, props);
++ evalProps(etalon, props, true);
+ }
+ finally
+ {
+@@ -210,47 +316,4 @@
+ }
+ }
+
+- public void testOODocumentReaderService() throws Exception
+- {
+- InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.odt");
+- try
+- {
+- Properties props = service.getDocumentReader("application/vnd.oasis.opendocument.text").getProperties(is);
+- Properties etalon = new Properties();
+- Calendar date = Calendar.getInstance();
+- date.setTimeInMillis(0);
+- date.set(2010, 7, 31, 14, 13, 23);
+-
+- etalon.put(DCMetaData.TITLE, "test-Title");
+- etalon.put(DCMetaData.LANGUAGE, "ru-RU");
+- etalon.put(DCMetaData.DATE, "2010-08-31T14:13:23");
+- etalon.put(DCMetaData.SUBJECT, "test-Subject");
+- etalon.put(DCMetaData.CREATOR, "nikolaz ");
+- etalon.put(DCMetaData.DESCRIPTION, "test-Comments");
+-
+- evalProps(etalon, props);
+- }
+- finally
+- {
+- is.close();
+- }
+- }
+-
+- private void evalProps(Properties etalon, Properties testedProps)
+- {
+- Iterator it = etalon.entrySet().iterator();
+- while (it.hasNext())
+- {
+- Map.Entry prop = (Map.Entry)it.next();
+- Object tval = testedProps.get(prop.getKey());
+- assertNotNull(prop.getKey() + " property not founded. ", tval);
+- if (tval instanceof Date)
+- {
+- System.out.println("was:" + ((Date)tval).getTime() + " expected: " + ((Date)prop.getValue()).getTime());
+- }
+- assertEquals(prop.getKey() + " property value is incorrect", prop.getValue(), tval);
+- }
+- assertEquals("size is incorrect", etalon.size(), testedProps.size());
+- }
+-
+ }
Index: exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java
===================================================================
--- exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java (revision 4481)
+++ exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java (working copy)
-@@ -18,37 +18,31 @@
+@@ -18,37 +18,28 @@
*/
package org.exoplatform.services.document.impl;
@@ -40559,11 +40566,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
+-import java.security.AccessController;
+-import java.security.PrivilegedActionException;
+-import java.security.PrivilegedExceptionAction;
+-import java.text.ParseException;
+import java.io.UnsupportedEncodingException;
- import java.security.AccessController;
- import java.security.PrivilegedActionException;
- import java.security.PrivilegedExceptionAction;
--import java.text.ParseException;
import java.util.Calendar;
-import java.util.HashMap;
+import java.util.List;
@@ -40576,8 +40583,125 @@
/**
* Created by The eXo Platform SAS A parser of Adobe PDF files.
*
-@@ -168,204 +162,269 @@
+@@ -79,79 +70,51 @@
*/
+ public String getContentAsText(final InputStream is) throws IOException, DocumentReadException
+ {
+-
++ if (is == null)
++ {
++ throw new NullPointerException("InputStream is null.");
++ }
++ PDDocument pdDocument = null;
++ StringWriter sw = new StringWriter();
+ try
+ {
+- return (String)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
+- {
+- public Object run() throws Exception
+- {
+- if (is == null)
+- {
+- throw new NullPointerException("InputStream is null.");
+- }
+- PDDocument pdDocument = null;
+- StringWriter sw = new StringWriter();
+- try
+- {
+- if (is.available() == 0)
+- return "";
++ if (is.available() == 0)
++ return "";
+
+- try
+- {
+- pdDocument = PDDocument.load(is);
+- }
+- catch (IOException e)
+- {
+- throw new DocumentReadException("Can not load PDF document.", e);
+- }
+-
+- PDFTextStripper stripper = new PDFTextStripper();
+- stripper.setStartPage(1);
+- stripper.setEndPage(Integer.MAX_VALUE);
+- stripper.writeText(pdDocument, sw);
+- }
+- finally
+- {
+- if (pdDocument != null)
+- try
+- {
+- pdDocument.close();
+- }
+- catch (IOException e)
+- {
+- }
+- if (is != null)
+- try
+- {
+- is.close();
+- }
+- catch (IOException e)
+- {
+- }
+- }
+- return sw.toString();
+- }
+- });
+-
+- }
+- catch (PrivilegedActionException pae)
+- {
+- Throwable cause = pae.getCause();
+- if (cause instanceof IOException)
++ try
+ {
+- throw (IOException)cause;
++ pdDocument = PDDocument.load(is);
+ }
+- else if (cause instanceof RuntimeException)
++ catch (IOException e)
+ {
+- throw (RuntimeException)cause;
++ throw new DocumentReadException("Can not load PDF document.", e);
+ }
+- else
+- {
+- throw new RuntimeException(cause);
+- }
++
++ PDFTextStripper stripper = new PDFTextStripper();
++ stripper.setStartPage(1);
++ stripper.setEndPage(Integer.MAX_VALUE);
++ stripper.writeText(pdDocument, sw);
+ }
+-
++ finally
++ {
++ if (pdDocument != null)
++ try
++ {
++ pdDocument.close();
++ }
++ catch (IOException e)
++ {
++ }
++ if (is != null)
++ try
++ {
++ is.close();
++ }
++ catch (IOException e)
++ {
++ }
++ }
++ return sw.toString();
+ }
+
+ public String getContentAsText(InputStream is, String encoding) throws IOException, DocumentReadException
+@@ -168,204 +131,269 @@
+ */
public Properties getProperties(InputStream is) throws IOException, DocumentReadException
{
-
@@ -41013,7 +41137,7 @@
}
Index: packaging/module/src/main/javascript/core.packaging.module.js
===================================================================
---- packaging/module/src/main/javascript/core.packaging.module.js (revision 4476)
+--- packaging/module/src/main/javascript/core.packaging.module.js (revision 4481)
+++ packaging/module/src/main/javascript/core.packaging.module.js (working copy)
@@ -39,6 +39,7 @@
module.component.documents =
12 years, 11 months
exo-jcr SVN: r4486 - in jcr/trunk/exo.jcr.component.core: src/test/java/org/exoplatform/services/jcr/impl/core and 4 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-06-08 04:16:20 -0400 (Wed, 08 Jun 2011)
New Revision: 4486
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/query/
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/query/TestErrorMultithreading.java
Removed:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestErrorMultithreading.java
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/RemoveSameNameSiblingTest.java
Log:
EXOJCR-1364: fix some tests and remove from excluded
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-08 06:59:34 UTC (rev 4485)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-08 08:16:20 UTC (rev 4486)
@@ -409,19 +409,14 @@
<include>org/exoplatform/services/jcr/impl/**/Test*.java</include>
</includes>
<excludes>
- <exclude>org/exoplatform/services/jcr/**/TestQueryUsecases.java</exclude>
<exclude>org/exoplatform/services/jcr/**/api/TestAll.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestErrorMultithreading.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestRollbackBigFiles.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationStream.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/RemoveSameNameSiblingTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/TestQueryWithNumberAndSpace.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/SQLBenchmarkTest.java</exclude>
</excludes>
</configuration>
@@ -754,19 +749,14 @@
<include>org/apache/jackrabbit/test/api/version/*Test.java</include>
</includes>
<excludes>
- <exclude>org/exoplatform/services/jcr/**/TestQueryUsecases.java</exclude>
<exclude>org/exoplatform/services/jcr/**/api/TestAll.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestErrorMultithreading.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/TestRollbackBigFiles.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
+ <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceManagement.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestRepositoryManagement.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationStream.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationVersionRestore.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/RemoveSameNameSiblingTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/**/TestQueryWithNumberAndSpace.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/usecases/BaseUsecasesTest.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/SQLBenchmarkTest.java</exclude>
<!-- From TCK -->
<exclude>org/apache/jackrabbit/test/api/TestAll.java</exclude>
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java 2011-06-08 06:59:34 UTC (rev 4485)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestWorkspaceManagement.java 2011-06-08 08:16:20 UTC (rev 4486)
@@ -251,6 +251,23 @@
// e.printStackTrace();
// ok;
}
+ catch (Throwable e)
+ {
+ boolean isRepoConfEx = false;
+ Throwable tempe = e;
+ do
+ {
+ if (tempe instanceof RepositoryConfigurationException)
+ {
+ isRepoConfEx = true;
+ break;
+ }
+ tempe = tempe.getCause();
+ }
+ while ((tempe != null));
+
+ assertTrue(isRepoConfEx);
+ }
}
public void testRemoveSystemWorkspace() throws Exception
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestErrorMultithreading.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestErrorMultithreading.java 2011-06-08 06:59:34 UTC (rev 4485)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/query/TestErrorMultithreading.java 2011-06-08 08:16:20 UTC (rev 4486)
@@ -1,281 +0,0 @@
-/*
- * Copyright (C) 2003-2007 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;
-
-import org.exoplatform.services.jcr.core.CredentialsImpl;
-import org.exoplatform.services.jcr.impl.core.NodeImpl;
-import org.exoplatform.services.jcr.impl.core.SessionImpl;
-import org.exoplatform.services.jcr.util.IdGenerator;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.Calendar;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.jcr.Credentials;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Session;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-
-/**
- * Created by The eXo Platform SAS Author : Sergey Karpenko <sergey.karpenko(a)exoplatform.com.ua>
- *
- * @version $Id: $
- */
-
-public class TestErrorMultithreading extends BaseQueryTest
-{
- public static final int COUNT = 5;
-
- public static final int NODE_COUNT = 10;
-
- public static final int THREADS_COUNT = 10;
-
- public static final String THREAD_NAME = "name";
-
- public void tearDown()
- {
-
- }
-
- public void testRunActions() throws Exception
- {
- // fillRepo();
- // checkRepo();
- // checkRepoByContent();
- loadLargeFiles();
- }
-
- private void loadLargeFiles() throws Exception
- {
- class Writer extends Thread
- {
- public String name;
-
- public Session sess;
-
- File file = new File("src/test/resources/LARGE.txt");
-
- public FileInputStream fis = null;
-
- Writer(String name, Session s)
- {
- this.name = name;
- this.sess = s;
- }
-
- public void run()
- {
- System.out.println(name + " - START");
- try
- {
- Node root = sess.getRootNode();
- for (int i = 0; i < 100000; i++)
- {
-
- IdGenerator obj;
- String fileName = IdGenerator.generate();// + "_" + i;
- NodeImpl node = (NodeImpl)root.addNode(fileName, "nt:file");
- NodeImpl cont = (NodeImpl)node.addNode("jcr:content", "nt:resource");
- cont.setProperty("jcr:mimeType", "text/plain");
- cont.setProperty("jcr:lastModified", Calendar.getInstance());
- fis = new FileInputStream(file);
- cont.setProperty("jcr:data", fis);
- root.save();
- System.out.println(fileName + " saved");
- fis.close();
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- System.out.println(name + " - STOP");
- }
- }
-
- Set<Writer> writers = new HashSet<Writer>();
-
- // create
- for (int t = 0; t < 10; t++)
- {
- Credentials credentials = new CredentialsImpl("admin", "admin".toCharArray());
-
- Session ss = (SessionImpl)repository.login(credentials, "ws");
- Writer wr = new Writer(THREAD_NAME + t, ss);
- writers.add(wr);
- }
-
- // start
- Iterator<Writer> it = writers.iterator();
- while (it.hasNext())
- {
- it.next().start();
- }
-
- // join
- it = writers.iterator();
- while (it.hasNext())
- {
- it.next().join();
- }
-
- }
-
- private void fillRepo() throws Exception
- {
-
- class Writer extends Thread
- {
- public String name;
-
- public Session sess;
-
- Writer(String name, Session s)
- {
- this.name = name;
- this.sess = s;
-
- super.setName(this.name); // super.getName() + ", " +
- }
-
- public void run()
- {
- System.out.println(name + " - START");
- try
- {
- Node root = sess.getRootNode();
-
- for (int i = 0; i < COUNT; i++)
- {
- for (int j = 0; j < NODE_COUNT; j++)
- {
- int num = i * NODE_COUNT * 10 + j;
- String n = name + "_" + num;
- root.addNode(n);
- System.out.println("ADD " + n);
- }
- root.save();
- System.out.println(name + " - SAVE");
- }
- }
- catch (Exception e)
- {
- System.out.println();
- System.out.println(name + "-thread error");
- e.printStackTrace();
- }
- System.out.println(name + " - FINISH");
- }
- }
-
- Set<Writer> writers = new HashSet<Writer>();
-
- // create
- for (int t = 0; t < THREADS_COUNT; t++)
- {
- Credentials credentials = new CredentialsImpl("admin", "admin".toCharArray());
-
- Session ss = (SessionImpl)repository.login(credentials, "ws");
- Writer wr = new Writer(THREAD_NAME + t, ss);
- writers.add(wr);
- }
-
- // start
- Iterator<Writer> it = writers.iterator();
- while (it.hasNext())
- {
- it.next().start();
- }
-
- // join
- it = writers.iterator();
- while (it.hasNext())
- {
- it.next().join();
- }
-
- System.out.println("FINISH!");
- Object obj = new Object();
- synchronized (obj)
- {
- try
- {
- obj.wait(10000);
- }
- catch (Exception e)
- {
-
- }
- }
- }
-
- private void checkRepo() throws Exception
- {
- QueryManager qman = this.workspace.getQueryManager();
-
- for (int t = 0; t < THREADS_COUNT; t++)
- {
- String name = THREAD_NAME + t;
-
- for (int i = 0; i < COUNT; i++)
- {
- for (int j = 0; j < NODE_COUNT; j++)
- {
- int num = i * NODE_COUNT * 10 + j;
- String n = name + "_" + num;
- Query q = qman.createQuery("SELECT * FROM nt:unstructured WHERE jcr:path LIKE '/" + n + "'", Query.SQL);
- QueryResult res = q.execute();
-
- if (res.getNodes().getSize() != 1)
- {
- System.out.println("Thread " + t + " " + n + " NO");
- }
- }
- }
- }
- }
-
- private void checkRepoByContent() throws Exception
- {
- QueryManager qman = this.workspace.getQueryManager();
- Node root = session.getRootNode();
- NodeIterator it = root.getNodes();
- System.out.append("SEARCH START");
- System.out.println("Nodes: " + it.getSize());
- while (it.hasNext())
- {
- Node node = it.nextNode();
- String name = node.getName();
- Query q = qman.createQuery("SELECT * FROM nt:unstructured WHERE jcr:path LIKE '/" + name + "'", Query.SQL);
- QueryResult res = q.execute();
-
- if (res.getNodes().getSize() != 1)
- {
- System.out.println(name + " NO");
- }
- }
- System.out.append("SEARCH STOP");
-
- }
-}
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/query/TestErrorMultithreading.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/query/TestErrorMultithreading.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/query/TestErrorMultithreading.java 2011-06-08 08:16:20 UTC (rev 4486)
@@ -0,0 +1,282 @@
+/*
+ * Copyright (C) 2003-2007 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.lab.query;
+
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.impl.core.query.BaseQueryTest;
+import org.exoplatform.services.jcr.util.IdGenerator;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.jcr.Credentials;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Session;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+
+/**
+ * Created by The eXo Platform SAS Author : Sergey Karpenko <sergey.karpenko(a)exoplatform.com.ua>
+ *
+ * @version $Id: $
+ */
+
+public class TestErrorMultithreading extends BaseQueryTest
+{
+ public static final int COUNT = 5;
+
+ public static final int NODE_COUNT = 10;
+
+ public static final int THREADS_COUNT = 10;
+
+ public static final String THREAD_NAME = "name";
+
+ public void tearDown()
+ {
+
+ }
+
+ public void testRunActions() throws Exception
+ {
+ // fillRepo();
+ // checkRepo();
+ // checkRepoByContent();
+ loadLargeFiles();
+ }
+
+ private void loadLargeFiles() throws Exception
+ {
+ class Writer extends Thread
+ {
+ public String name;
+
+ public Session sess;
+
+ File file = new File("src/test/resources/LARGE.txt");
+
+ public FileInputStream fis = null;
+
+ Writer(String name, Session s)
+ {
+ this.name = name;
+ this.sess = s;
+ }
+
+ public void run()
+ {
+ System.out.println(name + " - START");
+ try
+ {
+ Node root = sess.getRootNode();
+ for (int i = 0; i < 100000; i++)
+ {
+
+ IdGenerator obj;
+ String fileName = IdGenerator.generate();// + "_" + i;
+ NodeImpl node = (NodeImpl)root.addNode(fileName, "nt:file");
+ NodeImpl cont = (NodeImpl)node.addNode("jcr:content", "nt:resource");
+ cont.setProperty("jcr:mimeType", "text/plain");
+ cont.setProperty("jcr:lastModified", Calendar.getInstance());
+ fis = new FileInputStream(file);
+ cont.setProperty("jcr:data", fis);
+ root.save();
+ System.out.println(fileName + " saved");
+ fis.close();
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ System.out.println(name + " - STOP");
+ }
+ }
+
+ Set<Writer> writers = new HashSet<Writer>();
+
+ // create
+ for (int t = 0; t < 10; t++)
+ {
+ Credentials credentials = new CredentialsImpl("admin", "admin".toCharArray());
+
+ Session ss = (SessionImpl)repository.login(credentials, "ws");
+ Writer wr = new Writer(THREAD_NAME + t, ss);
+ writers.add(wr);
+ }
+
+ // start
+ Iterator<Writer> it = writers.iterator();
+ while (it.hasNext())
+ {
+ it.next().start();
+ }
+
+ // join
+ it = writers.iterator();
+ while (it.hasNext())
+ {
+ it.next().join();
+ }
+
+ }
+
+ private void fillRepo() throws Exception
+ {
+
+ class Writer extends Thread
+ {
+ public String name;
+
+ public Session sess;
+
+ Writer(String name, Session s)
+ {
+ this.name = name;
+ this.sess = s;
+
+ super.setName(this.name); // super.getName() + ", " +
+ }
+
+ public void run()
+ {
+ System.out.println(name + " - START");
+ try
+ {
+ Node root = sess.getRootNode();
+
+ for (int i = 0; i < COUNT; i++)
+ {
+ for (int j = 0; j < NODE_COUNT; j++)
+ {
+ int num = i * NODE_COUNT * 10 + j;
+ String n = name + "_" + num;
+ root.addNode(n);
+ System.out.println("ADD " + n);
+ }
+ root.save();
+ System.out.println(name + " - SAVE");
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println();
+ System.out.println(name + "-thread error");
+ e.printStackTrace();
+ }
+ System.out.println(name + " - FINISH");
+ }
+ }
+
+ Set<Writer> writers = new HashSet<Writer>();
+
+ // create
+ for (int t = 0; t < THREADS_COUNT; t++)
+ {
+ Credentials credentials = new CredentialsImpl("admin", "admin".toCharArray());
+
+ Session ss = (SessionImpl)repository.login(credentials, "ws");
+ Writer wr = new Writer(THREAD_NAME + t, ss);
+ writers.add(wr);
+ }
+
+ // start
+ Iterator<Writer> it = writers.iterator();
+ while (it.hasNext())
+ {
+ it.next().start();
+ }
+
+ // join
+ it = writers.iterator();
+ while (it.hasNext())
+ {
+ it.next().join();
+ }
+
+ System.out.println("FINISH!");
+ Object obj = new Object();
+ synchronized (obj)
+ {
+ try
+ {
+ obj.wait(10000);
+ }
+ catch (Exception e)
+ {
+
+ }
+ }
+ }
+
+ private void checkRepo() throws Exception
+ {
+ QueryManager qman = this.workspace.getQueryManager();
+
+ for (int t = 0; t < THREADS_COUNT; t++)
+ {
+ String name = THREAD_NAME + t;
+
+ for (int i = 0; i < COUNT; i++)
+ {
+ for (int j = 0; j < NODE_COUNT; j++)
+ {
+ int num = i * NODE_COUNT * 10 + j;
+ String n = name + "_" + num;
+ Query q = qman.createQuery("SELECT * FROM nt:unstructured WHERE jcr:path LIKE '/" + n + "'", Query.SQL);
+ QueryResult res = q.execute();
+
+ if (res.getNodes().getSize() != 1)
+ {
+ System.out.println("Thread " + t + " " + n + " NO");
+ }
+ }
+ }
+ }
+ }
+
+ private void checkRepoByContent() throws Exception
+ {
+ QueryManager qman = this.workspace.getQueryManager();
+ Node root = session.getRootNode();
+ NodeIterator it = root.getNodes();
+ System.out.append("SEARCH START");
+ System.out.println("Nodes: " + it.getSize());
+ while (it.hasNext())
+ {
+ Node node = it.nextNode();
+ String name = node.getName();
+ Query q = qman.createQuery("SELECT * FROM nt:unstructured WHERE jcr:path LIKE '/" + name + "'", Query.SQL);
+ QueryResult res = q.execute();
+
+ if (res.getNodes().getSize() != 1)
+ {
+ System.out.println(name + " NO");
+ }
+ }
+ System.out.append("SEARCH STOP");
+
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/RemoveSameNameSiblingTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/RemoveSameNameSiblingTest.java 2011-06-08 06:59:34 UTC (rev 4485)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/RemoveSameNameSiblingTest.java 2011-06-08 08:16:20 UTC (rev 4486)
@@ -132,10 +132,16 @@
n2 = subRoot.getNode("child[2]");
log.debug(">>>> SAME NAME start " + n2.getPath() + " " + n2.getIndex());
n2.remove(); // reindex child[3] --> child[2]
- // root.save();
+ session.save();
+ assertEquals("Same-name siblings path must be reindexed", "/u1/child[2]", n3.getPath());
+ assertEquals("Same-name siblings path must be reindexed", "/u1/child[3]/n1/n2", n3_n1n2.getPath());
+ session.refresh(true);
assertEquals("Same-name siblings path must be reindexed", "/u1/child[2]/n1/n2", n3_n1n2.getPath());
+ n3_n1n2 = n3.getNode("n1").getNode("n2");
+ assertEquals("Same-name siblings path must be reindexed", "/u1/child[2]/n1/n2", n3_n1n2.getPath());
+
try
{
NodeIterator chns = n3_n1n2.getNodes();
@@ -390,7 +396,8 @@
// TODO there is a problem, we can't see deep subtree of reindexed same-name-siblings now.
// after save it will be ok.
// See http://jira.exoplatform.org/browse/JCR-340
- assertEquals("/snsRemoveTest/_node/node3", node2.getNode("node3").getPath());
+ //assertEquals("/snsRemoveTest/_node/node3", node2.getNode("node3").getPath());
+ assertEquals("/snsRemoveTest/_node[2]/node3", node2.getNode("node3").getPath());
}
catch (RepositoryException e)
12 years, 11 months
exo-jcr SVN: r4485 - jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-06-08 02:59:34 -0400 (Wed, 08 Jun 2011)
New Revision: 4485
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java
Log:
JCR-1631 log error messages in ERROR more rather than DEBUG
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java 2011-06-07 18:31:03 UTC (rev 4484)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java 2011-06-08 06:59:34 UTC (rev 4485)
@@ -208,9 +208,9 @@
catch (TransactionException e)
{
commitException = e;
- if (LOG.isDebugEnabled())
+ if (LOG.isErrorEnabled())
{
- LOG.debug("Commit Error. Xid:" + xid + ", session: " + getSessionInfo() + ", " + this, e);
+ LOG.error("Commit Error. Xid:" + xid + ", session: " + getSessionInfo() + ", " + this, e);
}
throw new XASessionException(e.toString(), e.getErrorCode());
12 years, 11 months
exo-jcr SVN: r4484 - in jcr/trunk/exo.jcr.component.core: src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent and 4 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-06-07 14:31:03 -0400 (Tue, 07 Jun 2011)
New Revision: 4484
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-1359: PROBLEMS during functional testing: test TestUserTransaction is in failure.
1. The unit has been modified in order to suspend the current Tx before calling session.save for the parent remove in order to prevent being enlisted to the global tx
2. To be able to fails even with MyISAM, the parent node is removed before before commit
3. TransactionableResourceManager.isGlobalTxActive returned true even if the tx was suspended which is a wrong behavior
4. MVCC has been enabled in the config to prevent any deadlocks on global Tx
5. The resource-connector has been added to the dependencies with the scope set to test since it is necessary when we want to test the JCR with JOTM
6. Removed Incorrect Override annotation
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -228,6 +228,11 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-06-07 18:31:03 UTC (rev 4484)
@@ -644,7 +644,6 @@
/**
* {@inheritDoc}
*/
- @Override
public int getLastOrderNumber(final NodeData nodeData) throws RepositoryException
{
final WorkspaceStorageConnection con = dataContainer.openConnection();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java 2011-06-07 18:31:03 UTC (rev 4484)
@@ -144,7 +144,16 @@
public boolean isGlobalTxActive()
{
TransactionContext ctx;
- return (ctx = contexts.get()) != null && ctx.getXidContext() != null;
+ try
+ {
+ // We need to check the status also to be able to manage properly suspend and resume
+ return (ctx = contexts.get()) != null && ctx.getXidContext() != null && tm.getStatus() != Status.STATUS_NO_TRANSACTION;
+ }
+ catch (SystemException e)
+ {
+ log.warn("Could not check if a global Tx has been started", e);
+ }
+ return false;
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/xa/TestUserTransaction.java 2011-06-07 18:31:03 UTC (rev 4484)
@@ -30,6 +30,7 @@
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.naming.InitialContext;
+import javax.transaction.Transaction;
import javax.transaction.UserTransaction;
/**
@@ -231,13 +232,18 @@
repository.login(new SimpleCredentials("admin", "admin".toCharArray()), session.getWorkspace().getName());
Node tx1 = s1.getRootNode().getNode("pretx").addNode("tx1");
- s1.save();
Node tx2 = s2.getRootNode().getNode("pretx").addNode("tx2");
- s2.save();
+ // keep this change out of the current Tx, this is necessary since
+ // we have now auto-enlistment mechanism that is triggered at session save
+ Transaction tx = txService.getTransactionManager().suspend();
s0.save(); // save that parent of tx1 removed
+ txService.getTransactionManager().resume(tx);
+ s1.save();
+ s2.save();
+
try
{
ut.commit();
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -267,7 +267,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is active -->
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -267,7 +267,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is active -->
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is active -->
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is active -->
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is active -->
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2011-06-07 09:06:06 UTC (rev 4483)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2011-06-07 18:31:03 UTC (rev 4484)
@@ -249,7 +249,8 @@
<name>ref-addresses</name>
<description>ref-addresses</description>
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
- <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal"/>
+ <!-- MVCC configured to prevent possible deadlocks when a global Tx is active -->
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portal;hsqldb.tx=mvcc"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
</properties-param>
12 years, 11 months
exo-jcr SVN: r4483 - core/branches/2.3.x/patch/2.3.8/COR-228.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-06-07 05:06:06 -0400 (Tue, 07 Jun 2011)
New Revision: 4483
Modified:
core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
Log:
COR-228: patch updated
Modified: core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch
===================================================================
--- core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch 2011-06-07 08:29:22 UTC (rev 4482)
+++ core/branches/2.3.x/patch/2.3.8/COR-228/COR-228.patch 2011-06-07 09:06:06 UTC (rev 4483)
@@ -40527,7 +40527,7 @@
Index: exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java
===================================================================
---- exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java (revision 4476)
+--- exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java (revision 4481)
+++ exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java (working copy)
@@ -18,37 +18,31 @@
*/
@@ -40576,7 +40576,7 @@
/**
* Created by The eXo Platform SAS A parser of Adobe PDF files.
*
-@@ -168,204 +162,264 @@
+@@ -168,204 +162,269 @@
*/
public Properties getProperties(InputStream is) throws IOException, DocumentReadException
{
@@ -40589,28 +40589,25 @@
- byte[] metadata = reader.getMetadata();
-
- if (metadata != null)
-- {
++ PDDocument pdDocument = PDDocument.load(is);
++ Properties props = new Properties();
++ try
+ {
- // there is XMP metadata try exctract it
- props = getPropertiesFromMetadata(metadata);
- }
-
- if (props == null)
-+ PDDocument pdDocument = PDDocument.load(is);
-+ Properties props = new Properties();
-+ try
- {
+- {
- // it's old pdf document version
- props = getPropertiesFromInfo(reader.getInfo());
- }
- reader.close();
- if (is != null)
- try
-- {
-- is.close();
-- }
-- catch (IOException e)
+ if (pdDocument.isEncrypted())
{
+- is.close();
+ try
+ {
+ pdDocument.decrypt("");
@@ -40624,8 +40621,16 @@
+ throw new DocumentReadException(e.getMessage(), e);
+ }
}
+- catch (IOException e)
++
++ PDDocumentCatalog catalog = pdDocument.getDocumentCatalog();
++ PDMetadata meta = catalog.getMetadata();
++ if (meta != null)
+ {
+- }
- return props;
- }
++ XMPMetadata metadata = meta.exportXMPMetadata();
- /**
- * Extract properties from XMP xml.
@@ -40637,45 +40642,6 @@
- */
- protected Properties getPropertiesFromMetadata(byte[] metadata) throws IOException, DocumentReadException
- {
--
-- Properties props = null;
--
-- // parse xml
--
-- Document doc;
-- try
-- {
-- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-- DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-- doc = docBuilder.parse(new ByteArrayInputStream(metadata));
-- }
-- catch (SAXException e)
-- {
-- throw new DocumentReadException(e.getMessage(), e);
-- }
-- catch (ParserConfigurationException e)
-- {
-- throw new DocumentReadException(e.getMessage(), e);
-- }
--
-- // Check is there PDF/A-1 XMP
-- String version = "";
-- NodeList list = doc.getElementsByTagName("pdfaid:conformance");
-- if (list != null && list.item(0) != null)
-- {
-- version += list.item(0).getTextContent() + "-";
-- }
-+ PDDocumentCatalog catalog = pdDocument.getDocumentCatalog();
-+ PDMetadata meta = catalog.getMetadata();
-+ if (meta != null)
-+ {
-+ XMPMetadata metadata = meta.exportXMPMetadata();
-
-- list = doc.getElementsByTagName("pdfaid:part");
-- if (list != null && list.item(0) != null)
-- {
-- version += list.item(0).getTextContent();
-- }
+ XMPSchemaDublinCore dc = metadata.getDublinCoreSchema();
+ if (dc != null)
+ {
@@ -40698,11 +40664,7 @@
+ log.warn("getSubject failed: " + e);
+ }
-- // PDF/A-1a or PDF/A-1b
-- if (version.equalsIgnoreCase("A-1"))
-- {
-- props = getPropsFromPDFAMetadata(doc);
-- }
+- Properties props = null;
+ try
+ {
+ if (dc.getCreators() != null)
@@ -40719,25 +40681,28 @@
+ log.warn("getCreator failed: " + e);
+ }
-- return props;
-- }
+- // parse xml
+ try
+ {
+ if (dc.getDates() != null)
+ {
+ List<Calendar> list = dc.getDates();
-- /**
-- * Extracts properties from PDF Info hash set.
-- *
-- * @param Pdf Info hash set
-- * @return Extracted properties
-- * @throws Exception if extracting fails
-- */
-- @SuppressWarnings("unchecked")
-- protected Properties getPropertiesFromInfo(HashMap info) throws IOException
-- {
-- Properties props = new Properties();
+- Document doc;
+- try
+- {
+- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+- DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+- doc = docBuilder.parse(new ByteArrayInputStream(metadata));
+- }
+- catch (SAXException e)
+- {
+- throw new DocumentReadException(e.getMessage(), e);
+- }
+- catch (ParserConfigurationException e)
+- {
+- throw new DocumentReadException(e.getMessage(), e);
+- }
+ for (Calendar date : list)
+ {
+ props.put(DCMetaData.DATE, date);
@@ -40750,10 +40715,12 @@
+ }
+ }
-- String title = (String)info.get("Title");
-- if (title != null)
+- // Check is there PDF/A-1 XMP
+- String version = "";
+- NodeList list = doc.getElementsByTagName("pdfaid:conformance");
+- if (list != null && list.item(0) != null)
- {
-- props.put(DCMetaData.TITLE, title);
+- version += list.item(0).getTextContent() + "-";
- }
+ XMPSchemaBasic basic = metadata.getBasicSchema();
+ if (basic != null)
@@ -40779,10 +40746,10 @@
+ }
+ }
-- String author = (String)info.get("Author");
-- if (author != null)
+- list = doc.getElementsByTagName("pdfaid:part");
+- if (list != null && list.item(0) != null)
- {
-- props.put(DCMetaData.CREATOR, author);
+- version += list.item(0).getTextContent();
- }
+ if (props.isEmpty())
+ {
@@ -40790,10 +40757,10 @@
+ // usefull data, try to use the document information instead
+ PDDocumentInformation docInfo = pdDocument.getDocumentInformation();
-- String subject = (String)info.get("Subject");
-- if (subject != null)
+- // PDF/A-1a or PDF/A-1b
+- if (version.equalsIgnoreCase("A-1"))
- {
-- props.put(DCMetaData.SUBJECT, subject);
+- props = getPropsFromPDFAMetadata(doc);
- }
+ if (docInfo != null)
+ {
@@ -40818,10 +40785,25 @@
+ try
+ {
-- String creationDate = (String)info.get("CreationDate");
-- if (creationDate != null)
+- return props;
+- }
+-
+- /**
+- * Extracts properties from PDF Info hash set.
+- *
+- * @param Pdf Info hash set
+- * @return Extracted properties
+- * @throws Exception if extracting fails
+- */
+- @SuppressWarnings("unchecked")
+- protected Properties getPropertiesFromInfo(HashMap info) throws IOException
+- {
+- Properties props = new Properties();
+-
+- String title = (String)info.get("Title");
+- if (title != null)
- {
-- props.put(DCMetaData.DATE, PdfDate.decode(creationDate));
+- props.put(DCMetaData.TITLE, title);
+ if (docInfo.getKeywords() != null)
+ props.put(DCMetaData.SUBJECT, docInfo.getKeywords());
+ }
@@ -40860,22 +40842,40 @@
+ }
}
-
-- String modDate = (String)info.get("ModDate");
-- if (modDate != null)
+- String author = (String)info.get("Author");
+- if (author != null)
+ finally
{
-- props.put(DCMetaData.DATE, PdfDate.decode(modDate));
+- props.put(DCMetaData.CREATOR, author);
+ if (pdDocument != null)
+ {
+ pdDocument.close();
+ }
}
+- String subject = (String)info.get("Subject");
+- if (subject != null)
+- {
+- props.put(DCMetaData.SUBJECT, subject);
+- }
+-
+- String creationDate = (String)info.get("CreationDate");
+- if (creationDate != null)
+- {
+- props.put(DCMetaData.DATE, PdfDate.decode(creationDate));
+- }
+-
+- String modDate = (String)info.get("ModDate");
+- if (modDate != null)
+- {
+- props.put(DCMetaData.DATE, PdfDate.decode(modDate));
+- }
+-
return props;
}
- private Properties getPropsFromPDFAMetadata(Document doc) throws IOException, DocumentReadException
-+ private String fixEncoding(String str)
++ private String fixEncoding(String str) throws DocumentReadException
{
- Properties props = new Properties();
- // get properties
@@ -40884,7 +40884,11 @@
+ try
{
- for (int i = 0; i < list.getLength(); i++)
-- {
++ String encoding = null;
++ int orderMaskOffset = 0;
++
++ if (str.startsWith("\\000\\000\\376\\377"))
+ {
-
- Node n = list.item(i);
- // dc:title - TITLE
@@ -40893,9 +40897,7 @@
- String title = n.getLastChild().getTextContent();
- props.put(DCMetaData.TITLE, title);
- }
-+ String encoding = null;
-+ int orderMaskOffset = 0;
-
+-
- // dc:creator - CREATOR
- if (n.getParentNode().getParentNode().getNodeName().equals("dc:creator"))
- {
@@ -40910,8 +40912,6 @@
- props.put(DCMetaData.SUBJECT, description);
- // props.put(DCMetaData.DESCRIPTION, description);
- }
-+ if (str.startsWith("\\000\\000\\376\\377"))
-+ {
+ encoding = "UTF-32BE";
+ orderMaskOffset = 16;
}
@@ -40933,7 +40933,7 @@
- }
+ encoding = "UTF-32LE";
+ orderMaskOffset = 16;
-+ }
+ }
+ else if (str.startsWith("\\376\\377"))
+ {
+ encoding = "UTF-16BE";
@@ -40943,7 +40943,7 @@
+ {
+ encoding = "UTF-16LE";
+ orderMaskOffset = 8;
- }
++ }
- // xmp:ModifyDate - DATE
- list = doc.getElementsByTagName("xmp:ModifyDate");
@@ -40978,15 +40978,21 @@
+ }
+ catch (NumberFormatException e)
+ {
-+ log.warn(
-+ "PDF metadata exctraction warning: can not decode octal code - "
-+ + str.substring(i - 1, i + 3) + ".", e);
++ if (log.isDebugEnabled())
++ {
++ log.debug(
++ "PDF metadata exctraction warning: can not decode octal code - "
++ + str.substring(i - 1, i + 3) + ".", e);
++ }
+ }
+ }
+ else
+ {
-+ log.warn("PDF metadata exctraction warning: octal code is not complete - "
-+ + str.substring(i - 1, len));
++ if (log.isDebugEnabled())
++ {
++ log.debug("PDF metadata exctraction warning: octal code is not complete - "
++ + str.substring(i - 1, len));
++ }
+ }
+ }
+ sb.append(c);
@@ -40999,9 +41005,7 @@
- catch (ParseException e)
+ catch (UnsupportedEncodingException e)
{
-- throw new DocumentReadException(e.getMessage(), e);
-+ log.warn("PDF metadata exctraction warning: can not convert metadata string " + str, e);
-+ return "";
+ throw new DocumentReadException(e.getMessage(), e);
}
- return props;
}
12 years, 11 months
exo-jcr SVN: r4481 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/storage/value/fs and 2 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-06-07 02:15:08 -0400 (Tue, 07 Jun 2011)
New Revision: 4481
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.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/storage/value/fs/operations/DeleteValues.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java
jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties
Log:
EXOJCR-1365: reduce privileged blocks
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -480,7 +480,7 @@
* {@inheritDoc}
*/
@Override
- public int getChildNodesCount(NodeData parent) throws RepositoryException
+ public int getChildNodesCount(final NodeData parent) throws RepositoryException
{
if (cache.isEnabled())
{
@@ -490,8 +490,13 @@
return childCount;
}
}
-
- return super.getChildNodesCount(parent);
+ return executeAction(new PrivilegedExceptionAction<Integer>()
+ {
+ public Integer run() throws RepositoryException
+ {
+ return CacheableWorkspaceDataManager.super.getChildNodesCount(parent);
+ }
+ });
}
/**
@@ -606,7 +611,13 @@
}
else
{
- return super.getItemData(parentData, name, itemType);
+ return executeAction(new PrivilegedExceptionAction<ItemData>()
+ {
+ public ItemData run() throws RepositoryException
+ {
+ return CacheableWorkspaceDataManager.super.getItemData(parentData, name, itemType);
+ }
+ });
}
}
@@ -663,7 +674,13 @@
}
else
{
- return super.getItemData(identifier);
+ return executeAction(new PrivilegedExceptionAction<ItemData>()
+ {
+ public ItemData run() throws RepositoryException
+ {
+ return CacheableWorkspaceDataManager.super.getItemData(identifier);
+ }
+ });
}
}
@@ -999,12 +1016,18 @@
}
}
- protected List<NodeData> getChildNodesDataByPattern(NodeData parentData, List<QPathEntryFilter> patternFilters)
+ protected List<NodeData> getChildNodesDataByPattern(final NodeData parentData, final List<QPathEntryFilter> patternFilters)
throws RepositoryException
{
if (!cache.isEnabled())
{
- return super.getChildNodesData(parentData, patternFilters);
+ return executeAction(new PrivilegedExceptionAction<List<NodeData>>()
+ {
+ public List<NodeData> run() throws RepositoryException
+ {
+ return CacheableWorkspaceDataManager.super.getChildNodesData(parentData, patternFilters);
+ }
+ });
}
if (!cache.isPatternSupported())
@@ -1020,9 +1043,9 @@
return childNodesList;
}
- Map<String, NodeData> childNodesMap = new HashMap<String, NodeData>();
+ final Map<String, NodeData> childNodesMap = new HashMap<String, NodeData>();
- Set<QPathEntryFilter> uncachedPatterns = new HashSet<QPathEntryFilter>();
+ final Set<QPathEntryFilter> uncachedPatterns = new HashSet<QPathEntryFilter>();
for (int i = 0; i < patternFilters.size(); i++)
{
if (patternFilters.get(i).isExactName())
@@ -1116,42 +1139,50 @@
// execute all patterns and put result in cache
if (!uncachedPatterns.isEmpty())
{
- List<NodeData> persistedItemList =
- super.getChildNodesData(parentData, new ArrayList<QPathEntryFilter>(uncachedPatterns));
-
- if (persistedItemList.size() > 0)
+ executeAction(new PrivilegedExceptionAction<Void>()
{
- NodeData parent = (NodeData)getItemData(parentData.getIdentifier());
- if (parent != null)
+ public Void run() throws RepositoryException
{
- // filter nodes list for each exact name
- patternIterator = uncachedPatterns.iterator();
- while (patternIterator.hasNext())
+ List<NodeData> persistedItemList =
+ CacheableWorkspaceDataManager.super.getChildNodesData(parentData,
+ new ArrayList<QPathEntryFilter>(uncachedPatterns));
+
+ if (persistedItemList.size() > 0)
{
- QPathEntryFilter pattern = patternIterator.next();
- List<NodeData> persistedNodeData = (List<NodeData>)pattern.accept(persistedItemList);
- if (pattern.isExactName())
+ NodeData parent = (NodeData)getItemData(parentData.getIdentifier());
+ if (parent != null)
{
- if (persistedNodeData.isEmpty())
+ // filter nodes list for each exact name
+ Iterator<QPathEntryFilter> patternIterator = uncachedPatterns.iterator();
+ while (patternIterator.hasNext())
{
- cache.put(new NullNodeData(parentData, pattern.getQPathEntry()));
+ QPathEntryFilter pattern = patternIterator.next();
+ List<NodeData> persistedNodeData = (List<NodeData>)pattern.accept(persistedItemList);
+ if (pattern.isExactName())
+ {
+ if (persistedNodeData.isEmpty())
+ {
+ cache.put(new NullNodeData(parentData, pattern.getQPathEntry()));
+ }
+ else
+ {
+ cache.put(persistedNodeData.get(0));
+ }
+ }
+ else
+ {
+ cache.addChildNodes(parent, pattern, persistedNodeData);
+ }
+ for (NodeData node : persistedItemList)
+ {
+ childNodesMap.put(node.getIdentifier(), node);
+ }
}
- else
- {
- cache.put(persistedNodeData.get(0));
- }
}
- else
- {
- cache.addChildNodes(parent, pattern, persistedNodeData);
- }
- for (NodeData node : persistedItemList)
- {
- childNodesMap.put(node.getIdentifier(), node);
- }
}
+ return null;
}
- }
+ });
}
}
finally
@@ -1286,12 +1317,18 @@
}
}
- protected List<PropertyData> getChildPropertiesDataByPattern(NodeData nodeData, List<QPathEntryFilter> patternFilters)
+ protected List<PropertyData> getChildPropertiesDataByPattern(final NodeData nodeData, final List<QPathEntryFilter> patternFilters)
throws RepositoryException
{
if (!cache.isEnabled())
{
- return super.getChildPropertiesData(nodeData, patternFilters);
+ return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
+ {
+ public List<PropertyData> run() throws RepositoryException
+ {
+ return CacheableWorkspaceDataManager.super.getChildPropertiesData(nodeData, patternFilters);
+ }
+ });
}
if (!cache.isPatternSupported())
@@ -1306,9 +1343,9 @@
return childPropsList;
}
- Map<String, PropertyData> childPropsMap = new HashMap<String, PropertyData>();
+ final Map<String, PropertyData> childPropsMap = new HashMap<String, PropertyData>();
- Set<QPathEntryFilter> uncachedPatterns = new HashSet<QPathEntryFilter>();
+ final Set<QPathEntryFilter> uncachedPatterns = new HashSet<QPathEntryFilter>();
for (int i = 0; i < patternFilters.size(); i++)
{
if (patternFilters.get(i).isExactName())
@@ -1405,43 +1442,52 @@
// execute all patterns and put result in cache
if (!uncachedPatterns.isEmpty())
{
- List<PropertyData> persistedItemList =
- super.getChildPropertiesData(nodeData, new ArrayList<QPathEntryFilter>(uncachedPatterns));
-
- if (persistedItemList.size() > 0)
+ executeAction(new PrivilegedExceptionAction<Void>()
{
- NodeData parent = (NodeData)getItemData(nodeData.getIdentifier());
- if (parent != null)
+ public Void run() throws RepositoryException
{
- // filter properties list for each exact name
- patternIterator = uncachedPatterns.iterator();
- while (patternIterator.hasNext())
+ List<PropertyData> persistedItemList =
+ CacheableWorkspaceDataManager.super.getChildPropertiesData(nodeData,
+ new ArrayList<QPathEntryFilter>(uncachedPatterns));
+
+ if (persistedItemList.size() > 0)
{
- QPathEntryFilter pattern = patternIterator.next();
- List<PropertyData> persistedPropData = (List<PropertyData>)pattern.accept(persistedItemList);
- if (pattern.isExactName())
+ NodeData parent = (NodeData)getItemData(nodeData.getIdentifier());
+ if (parent != null)
{
- if (persistedPropData.isEmpty())
+ // filter properties list for each exact name
+ Iterator<QPathEntryFilter> patternIterator = uncachedPatterns.iterator();
+ while (patternIterator.hasNext())
{
- cache.put(new NullPropertyData(parent, pattern.getQPathEntry()));
+ QPathEntryFilter pattern = patternIterator.next();
+ List<PropertyData> persistedPropData =
+ (List<PropertyData>)pattern.accept(persistedItemList);
+ if (pattern.isExactName())
+ {
+ if (persistedPropData.isEmpty())
+ {
+ cache.put(new NullPropertyData(parent, pattern.getQPathEntry()));
+ }
+ else
+ {
+ cache.put(persistedPropData.get(0));
+ }
+ }
+ else
+ {
+ cache.addChildProperties(parent, pattern, persistedPropData);
+ }
+
+ for (PropertyData node : persistedItemList)
+ {
+ childPropsMap.put(node.getIdentifier(), node);
+ }
}
- else
- {
- cache.put(persistedPropData.get(0));
- }
}
- else
- {
- cache.addChildProperties(parent, pattern, persistedPropData);
- }
-
- for (PropertyData node : persistedItemList)
- {
- childPropsMap.put(node.getIdentifier(), node);
- }
}
+ return null;
}
- }
+ });
}
}
finally
@@ -1531,7 +1577,7 @@
* @throws RepositoryException
* Repository error
*/
- protected List<PropertyData> listChildPropertiesData(NodeData nodeData, boolean forcePersistentRead)
+ protected List<PropertyData> listChildPropertiesData(final NodeData nodeData, boolean forcePersistentRead)
throws RepositoryException
{
@@ -1559,18 +1605,25 @@
return propertiesList;
}
}
- propertiesList = super.listChildPropertiesData(nodeData);
- // TODO propertiesList.size() > 0 for SDB
- if (propertiesList.size() > 0 && cache.isEnabled())
+ return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
{
- NodeData parentData = (NodeData)getItemData(nodeData.getIdentifier());
+ public List<PropertyData> run() throws RepositoryException
+ {
+ List<PropertyData> propertiesList =
+ CacheableWorkspaceDataManager.super.listChildPropertiesData(nodeData);
+ // TODO propertiesList.size() > 0 for SDB
+ if (propertiesList.size() > 0 && cache.isEnabled())
+ {
+ NodeData parentData = (NodeData)getItemData(nodeData.getIdentifier());
- if (parentData != null)
- {
- cache.addChildPropertiesList(parentData, propertiesList);
+ if (parentData != null)
+ {
+ cache.addChildPropertiesList(parentData, propertiesList);
+ }
+ }
+ return propertiesList;
}
- }
- return propertiesList;
+ });
}
finally
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,9 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
@@ -44,7 +43,7 @@
FileDigestOutputStream(File file, MessageDigest digest) throws IOException
{
- super(PrivilegedFileHelper.fileOutputStream(file), digest);
+ super(new FileOutputStream(file), digest);
this.file = file;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
@@ -46,7 +45,7 @@
public final static String PATH = "path";
/**
- * Temporary directory name under storage root dir.
+ * Temporarory directopry name under stoprage root dir.
*/
public static final String TEMP_DIR_NAME = "temp";
@@ -58,6 +57,7 @@
/**
* FileValueStorage constructor.
+ *
*/
public FileValueStorage(FileCleaner cleaner)
{
@@ -67,7 +67,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void init(Properties props, ValueDataResourceHolder resources) throws IOException,
RepositoryConfigurationException
{
@@ -78,7 +77,6 @@
/**
* {@inheritDoc}
*/
- @Override
public void checkConsistency(WorkspaceStorageConnection dataConnection)
{
@@ -107,23 +105,22 @@
{
this.rootDir = new File(rootDirPath);
- if (!PrivilegedFileHelper.exists(rootDir))
+ if (!rootDir.exists())
{
- if (PrivilegedFileHelper.mkdirs(rootDir))
+ if (rootDir.mkdirs())
{
- log.info("Directory created: " + PrivilegedFileHelper.getAbsolutePath(rootDir));
+ log.info("Directory created: " + rootDir.getAbsolutePath());
// create internal temp dir
File tempDir = new File(rootDir, TEMP_DIR_NAME);
- PrivilegedFileHelper.mkdirs(tempDir);
+ tempDir.mkdirs();
- if (PrivilegedFileHelper.exists(tempDir) && PrivilegedFileHelper.isDirectory(tempDir))
+ if (tempDir.exists() && tempDir.isDirectory())
{
// care about storage temp dir cleanup
- for (File tmpf : PrivilegedFileHelper.listFiles(tempDir))
- if (!PrivilegedFileHelper.delete(tmpf))
- log.warn("Storage temporary directory contains un-deletable file "
- + PrivilegedFileHelper.getAbsolutePath(tmpf)
+ for (File tmpf : tempDir.listFiles())
+ if (!tmpf.delete())
+ log.warn("Storage temporary directory contains un-deletable file " + tmpf.getAbsolutePath()
+ ". It's recommended to leave this directory for JCR External Values Storage private use.");
}
else
@@ -132,12 +129,12 @@
}
else
{
- log.warn("Directory IS NOT created: " + PrivilegedFileHelper.getAbsolutePath(rootDir));
+ log.warn("Directory IS NOT created: " + rootDir.getAbsolutePath());
}
}
else
{
- if (!PrivilegedFileHelper.isDirectory(rootDir))
+ if (!rootDir.isDirectory())
{
throw new RepositoryConfigurationException("File exists but is not a directory " + rootDirPath);
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
@@ -72,6 +71,6 @@
@Override
protected File[] getFiles(String propertyId) throws IOException
{
- return PrivilegedFileHelper.listFiles(rootDir, new PropertyIDFilter(propertyId));
+ return rootDir.listFiles(new PropertyIDFilter(propertyId));
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,14 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import java.io.File;
-import java.security.PrivilegedAction;
/**
* Created by The eXo Platform SAS
@@ -57,16 +54,7 @@
@Override
public boolean delete()
{
-
- PrivilegedAction<Boolean> action = new PrivilegedAction<Boolean>()
- {
- public Boolean run()
- {
- return TreeFile.super.delete();
- }
- };
- boolean res = SecurityHelper.doPrivilegedAction(action);
-
+ boolean res = super.delete();
if (res)
deleteParent(new File(getParent()));
@@ -76,28 +64,27 @@
protected boolean deleteParent(File fp)
{
boolean res = false;
- String fpPath = PrivilegedFileHelper.getAbsolutePath(fp);
- String rootPath = PrivilegedFileHelper.getAbsolutePath(rootDir);
+ String fpPath = fp.getAbsolutePath();
+ String rootPath = rootDir.getAbsolutePath();
if (fpPath.startsWith(rootPath) && fpPath.length() > rootPath.length())
if (fp.isDirectory())
{
- String[] ls = PrivilegedFileHelper.list(fp);;
+ String[] ls = fp.list();
if (ls != null && ls.length <= 0)
{
- if (res = PrivilegedFileHelper.delete(fp))
+ if (res = fp.delete())
{
res = deleteParent(new File(fp.getParent()));
}
else
{
- fLog.warn("Parent directory can not be deleted now. " + PrivilegedFileHelper.getAbsolutePath(fp));
- cleaner.addFile(new TreeFile(PrivilegedFileHelper.getAbsolutePath(fp), cleaner, rootDir));
+ fLog.warn("Parent directory can not be deleted now. " + fp.getAbsolutePath());
+ cleaner.addFile(new TreeFile(fp.getAbsolutePath(), cleaner, rootDir));
}
}
}
else
- fLog.warn("Parent can not be a file but found " + PrivilegedFileHelper.getAbsolutePath(fp));
+ fLog.warn("Parent can not be a file but found " + fp.getAbsolutePath());
return res;
}
-
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
@@ -53,26 +52,21 @@
@Override
protected File getFile(final String propertyId, final int orderNumber) throws IOException
{
-
final TreeFile tfile =
- new TreeFile(PrivilegedFileHelper.getAbsolutePath(rootDir) + makeFilePath(propertyId, orderNumber), cleaner,
- rootDir);
-
- PrivilegedFileHelper.mkdirs(tfile.getParentFile());
-
+ new TreeFile(rootDir.getAbsolutePath() + makeFilePath(propertyId, orderNumber), cleaner, rootDir);
+ mkdirs(tfile.getParentFile()); // make dirs on path
return tfile;
}
@Override
protected File[] getFiles(final String propertyId) throws IOException
{
- final File dir = new File(PrivilegedFileHelper.getAbsolutePath(rootDir) + buildPath(propertyId));
- String[] fileNames = PrivilegedFileHelper.list(dir);
+ final File dir = new File(rootDir.getAbsolutePath() + buildPath(propertyId));
+ String[] fileNames = dir.list();
File[] files = new File[fileNames.length];
for (int i = 0; i < fileNames.length; i++)
{
- files[i] =
- new TreeFile(PrivilegedFileHelper.getAbsolutePath(dir) + File.separator + fileNames[i], cleaner, rootDir);
+ files[i] = new TreeFile(dir.getAbsolutePath() + File.separator + fileNames[i], cleaner, rootDir);
}
return files;
}
@@ -164,14 +158,13 @@
try
{
mkdirsLock.acquire();
- return PrivilegedFileHelper.mkdirs(dir);
+ return dir.mkdirs();
}
catch (InterruptedException e)
{
// chLog.error("mkdirs error on " + dir.getAbsolutePath() + ". " + e, e);
// return false;
- throw new IllegalStateException("mkdirs error on " + PrivilegedFileHelper.getAbsolutePath(dir) + " due to "
- + e, e);
+ throw new IllegalStateException("mkdirs error on " + dir.getAbsolutePath() + " due to " + e, e);
}
finally
{
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 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
@@ -161,27 +160,26 @@
}
catch (RecordAlreadyExistsException e)
{
- if (tempFile != null && PrivilegedFileHelper.exists(tempFile) && !PrivilegedFileHelper.delete(tempFile))
+ if (tempFile != null && tempFile.exists() && !tempFile.delete())
{
- LOG.warn("Can't delete CAS temp file. Added to file cleaner. "
- + PrivilegedFileHelper.getAbsolutePath(tempFile));
+ LOG.warn("Can't delete CAS temp file. Added to file cleaner. " + tempFile.getAbsolutePath());
cleaner.addFile(tempFile);
}
throw new RecordAlreadyExistsException("Write error: " + e, e);
}
- if (!PrivilegedFileHelper.exists(vcasFile))
+ if (!vcasFile.exists())
{
// it's new CAS Value, we have to move temp to vcas location
// use RENAME only, don't copy - as copy will means that destination already exists etc.
// make sure parent dir exists
- PrivilegedFileHelper.mkdirs(vcasFile.getParentFile());
+ vcasFile.getParentFile().mkdirs();
// rename propetynamed file to hashnamed one
- if (!PrivilegedFileHelper.renameTo(tempFile, vcasFile))
+ if (!tempFile.renameTo(vcasFile))
{
- throw new VCASException("File " + PrivilegedFileHelper.getAbsolutePath(tempFile)
- + " can't be renamed to VCAS-named " + PrivilegedFileHelper.getAbsolutePath(vcasFile));
+ throw new VCASException("File " + tempFile.getAbsolutePath() + " can't be renamed to VCAS-named "
+ + vcasFile.getAbsolutePath());
}
} // else - CASed Value already exists
@@ -195,7 +193,7 @@
finally
{
// remove temp file
- PrivilegedFileHelper.delete(tempFile); // should be ok without file cleaner
+ tempFile.delete(); // should be ok without file cleaner
fileLock.unlock();
}
@@ -211,7 +209,7 @@
try
{
// delete temp file - it's new file add
- PrivilegedFileHelper.delete(tempFile); // should be ok without file cleaner
+ tempFile.delete(); // should be ok without file cleaner
}
finally
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/DeleteValues.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/DeleteValues.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/DeleteValues.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
@@ -101,7 +100,7 @@
{
for (File f : files)
{
- if (!PrivilegedFileHelper.delete(f))
+ if (!f.delete())
// TODO possible place of error: FileNotFoundException when we delete/update existing
// Value and then add/update again.
// After the time the Cleaner will delete the file which is mapped to the Value.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.FilePersistedValueData;
@@ -73,17 +72,18 @@
* @throws IOException
* if error
*/
- protected ValueData readValue(final File file, final int orderNum, final int maxBufferSize) throws IOException
+ protected ValueData readValue(File file, int orderNum, int maxBufferSize) throws IOException
{
- long fileSize = PrivilegedFileHelper.length(file);
+ long fileSize = file.length();
+
if (fileSize > maxBufferSize)
{
return new FilePersistedValueData(orderNum, file);
}
else
{
- FileInputStream is = PrivilegedFileHelper.fileInputStream(file);
+ FileInputStream is = new FileInputStream(file);
try
{
int buffSize = (int)fileSize;
@@ -137,9 +137,9 @@
* @throws IOException
* if error occurs
*/
- protected void writeByteArrayValue(final File file, final ValueData value) throws IOException
+ protected void writeByteArrayValue(File file, ValueData value) throws IOException
{
- OutputStream out = PrivilegedFileHelper.fileOutputStream(file);
+ OutputStream out = new FileOutputStream(file);
try
{
out.write(value.getAsByteArray());
@@ -160,9 +160,8 @@
* @throws IOException
* if error occurs
*/
- protected void writeStreamedValue(final File file, final ValueData value) throws IOException
+ protected void writeStreamedValue(File file, ValueData value) throws IOException
{
- // do what you want
// stream Value
if (value instanceof StreamPersistedValueData)
{
@@ -171,7 +170,7 @@
if (streamed.isPersisted())
{
// already persisted in another Value, copy it to this Value
- copyClose(streamed.getAsStream(), PrivilegedFileHelper.fileOutputStream(file));
+ copyClose(streamed.getAsStream(), new FileOutputStream(file));
}
else
{
@@ -180,23 +179,23 @@
if ((tempFile = streamed.getTempFile()) != null)
{
// it's spooled Value, try move its file to VS
- if (!PrivilegedFileHelper.renameTo(tempFile, file))
+ if (!tempFile.renameTo(file))
{
// not succeeded - copy bytes, temp file will be deleted by transient ValueData
if (LOG.isDebugEnabled())
{
- LOG.debug("Value spool file move (rename) to Values Storage is not succeeded. "
- + "Trying bytes copy. Spool file: " + PrivilegedFileHelper.getAbsolutePath(tempFile)
- + ". Destination: " + PrivilegedFileHelper.getAbsolutePath(file));
+ LOG
+ .debug("Value spool file move (rename) to Values Storage is not succeeded. Trying bytes copy. Spool file: "
+ + tempFile.getAbsolutePath() + ". Destination: " + file.getAbsolutePath());
}
- copyClose(PrivilegedFileHelper.fileInputStream(tempFile), PrivilegedFileHelper.fileOutputStream(file));
+ copyClose(new FileInputStream(tempFile), new FileOutputStream(file));
}
}
else
{
// not spooled, use client InputStream
- copyClose(streamed.getStream(), PrivilegedFileHelper.fileOutputStream(file));
+ copyClose(streamed.getStream(), new FileOutputStream(file));
}
// link this Value to file in VS
@@ -206,7 +205,7 @@
else
{
// copy from Value stream to the file, e.g. from FilePersistedValueData to this Value
- copyClose(value.getAsStream(), PrivilegedFileHelper.fileOutputStream(file));
+ copyClose(value.getAsStream(), new FileOutputStream(file));
}
}
@@ -244,7 +243,7 @@
in = streamed.getStream();
if (in == null)
{
- in = PrivilegedFileHelper.fileInputStream(streamed.getTempFile());
+ in = new FileInputStream(streamed.getTempFile());
}
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,8 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.storage.value.ValueOperation;
import org.exoplatform.services.jcr.impl.storage.value.fs.FileLockException;
@@ -32,8 +30,6 @@
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
/**
* Created by The eXo Platform SAS.
@@ -63,6 +59,26 @@
protected static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.ValueFileOperation");
/**
+ * The local internet address
+ */
+ private static String LOCAL_ADDRESS;
+ static
+ {
+ // TODO this info may be is not necessary
+ try
+ {
+ // get the inet address
+ InetAddress local = InetAddress.getLocalHost();
+ LOCAL_ADDRESS = local.getHostAddress() + " (" + local.getHostName() + ")";
+ }
+ catch (UnknownHostException e)
+ {
+ LOG.warn("Cannot read host address " + e);
+ LOCAL_ADDRESS = "no address, " + e;
+ }
+ }
+
+ /**
* File cleaner.
*/
protected final FileCleaner cleaner;
@@ -128,7 +144,7 @@
// lock file in temp directory
lockFile = new File(tempDir, targetFile.getName() + LOCK_FILE_EXTENSION);
- FileOutputStream lout = PrivilegedFileHelper.fileOutputStream(lockFile, true);
+ FileOutputStream lout = new FileOutputStream(lockFile, true);
lout.write(operationInfo.getBytes()); // TODO write info
lout.getChannel().lock(); // wait for unlock (on Windows will wait for this JVM too)
@@ -158,13 +174,13 @@
if (lockFileStream != null)
lockFileStream.close();
- if (!PrivilegedFileHelper.delete(lockFile))
+ if (!lockFile.delete())
{ // TODO don't use FileCleaner, delete should be enough
- LOG.warn("Cannot delete lock file " + PrivilegedFileHelper.getAbsolutePath(lockFile)
- + ". Add to the FileCleaner");
+ LOG.warn("Cannot delete lock file " + lockFile.getAbsolutePath() + ". Add to the FileCleaner");
cleaner.addFile(lockFile);
}
}
+
}
/**
@@ -202,11 +218,11 @@
// lock in JVM (wait for unlock if required)
try
{
- return resources.aquire(PrivilegedFileHelper.getAbsolutePath(file), new ValueFileLockHolder(file));
+ return resources.aquire(file.getAbsolutePath(), new ValueFileLockHolder(file));
}
catch (InterruptedException e)
{
- throw new FileLockException("Lock error on " + PrivilegedFileHelper.getAbsolutePath(file), e);
+ throw new FileLockException("Lock error on " + file.getAbsolutePath(), e);
}
}
@@ -219,7 +235,7 @@
*/
public boolean unlock() throws IOException
{
- return resources.release(PrivilegedFileHelper.getAbsolutePath(file));
+ return resources.release(file.getAbsolutePath());
}
}
@@ -241,48 +257,7 @@
this.tempDir = tempDir;
- // TODO this info may be is not neccesary
- String localAddr;
- try
- {
- // get the inet address
- InetAddress local = null;
- PrivilegedExceptionAction<InetAddress> action = new PrivilegedExceptionAction<InetAddress>()
- {
- public InetAddress run() throws Exception
- {
- return InetAddress.getLocalHost();
- }
- };
- try
- {
- local = SecurityHelper.doPrivilegedExceptionAction(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof UnknownHostException)
- {
- throw (UnknownHostException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
-
- localAddr = local.getHostAddress() + " (" + local.getHostName() + ")";
- }
- catch (UnknownHostException e)
- {
- LOG.warn("Cannot read host address " + e);
- localAddr = "no address, " + e;
- }
- operationInfo = System.currentTimeMillis() + " " + localAddr;
+ operationInfo = System.currentTimeMillis() + " " + LOCAL_ADDRESS;
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java 2011-06-07 06:15:08 UTC (rev 4481)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
@@ -99,7 +98,7 @@
try
{
// be sure the destination dir exists (case for Tree-style storage)
- PrivilegedFileHelper.mkdirs(file.getParentFile());
+ file.getParentFile().mkdirs();
// write value to the file
writeValue(file, value);
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 2011-06-06 11:52:05 UTC (rev 4480)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/tsm-excludes.properties 2011-06-07 06:15:08 UTC (rev 4481)
@@ -5,4 +5,25 @@
org.exoplatform.services.jcr.api.xa.TestXATransaction.testSimpleGlobalTransaction=begin,commit
org.exoplatform.services.jcr.api.xa.TestXATransaction.test2GlobalTransactions=begin,commit,suspend,resume
org.exoplatform.services.jcr.api.xa.TestXATransaction.test2GlobalTransactions2=begin,commit,suspend,resume,rollback
-org.exoplatform.services.jcr.api.xa.TestXATransaction.testLockInTransactions=begin,commit
\ No newline at end of file
+org.exoplatform.services.jcr.api.xa.TestXATransaction.testLockInTransactions=begin,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.write=write,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.writeRead=write,commit,read
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.writeDelete=write,commit,delete
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.writeSameMultivalued=write,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.writeUniqueMultivalued=write,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.writeSameProperties=write,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.writeUniqueProperties=write,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.deleteSameProperty=write,commit,delete
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.deleteUniqueProperty=write,commit,delete
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.addDeleteSharedMultivalued=write,commit,delete
+org.exoplatform.services.jcr.impl.storage.value.fs.CASableFileIOChannelTestBase.writeExisting=write,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileIOChannel.testDelete=write,commit,delete
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileIOChannel.testRead=read,delete,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileIOChannel.testWriteAdd=write,commit,delete
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileIOChannel.testWriteUpdate=writeUpdate
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileIOChannel.testConcurrentRead=write,commit,delete
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileIOChannel.testDeleteLockedFile=write,commit
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileValueIO.testReadByteArrayValueData=testReadValue
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileValueIO.testReadFileValueData=testReadValue
+org.exoplatform.services.jcr.impl.storage.value.fs.TestFileValueIO.testWriteFileValueData=testWriteValue,testReadValue
+org.exoplatform.services.jcr.impl.storage.value.fs.TestRemoveFromValueStorage.testRemoveValue=read,getFile
\ No newline at end of file
12 years, 11 months
exo-jcr SVN: r4480 - in core/trunk/exo.core.component.document/src: test/java/org/exoplatform/services/document/test and 1 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-06-06 07:52:05 -0400 (Mon, 06 Jun 2011)
New Revision: 4480
Added:
core/trunk/exo.core.component.document/src/test/resources/Trait_union.06.Mai_2009.pdf
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java
Log:
EXOJCR-1373: pdf documents metadata UTF-16 encoding support added
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java 2011-06-06 10:00:20 UTC (rev 4479)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java 2011-06-06 11:52:05 UTC (rev 4480)
@@ -37,6 +37,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.Calendar;
@@ -204,7 +205,7 @@
try
{
if (dc.getTitle() != null)
- props.put(DCMetaData.TITLE, dc.getTitle());
+ props.put(DCMetaData.TITLE, fixEncoding(dc.getTitle()));
}
catch (Exception e)
{
@@ -213,7 +214,7 @@
try
{
if (dc.getDescription() != null)
- props.put(DCMetaData.DESCRIPTION, dc.getDescription());
+ props.put(DCMetaData.DESCRIPTION, fixEncoding(dc.getDescription()));
}
catch (Exception e)
{
@@ -226,7 +227,7 @@
{
for (String creator : dc.getCreators())
{
- props.put(DCMetaData.CREATOR, creator);
+ props.put(DCMetaData.CREATOR, fixEncoding(creator));
}
}
}
@@ -257,7 +258,7 @@
try
{
if (pdf.getKeywords() != null)
- props.put(DCMetaData.SUBJECT, pdf.getKeywords());
+ props.put(DCMetaData.SUBJECT, fixEncoding(pdf.getKeywords()));
}
catch (Exception e)
{
@@ -267,7 +268,7 @@
try
{
if (pdf.getProducer() != null)
- props.put(DCMetaData.PUBLISHER, pdf.getProducer());
+ props.put(DCMetaData.PUBLISHER, fixEncoding(pdf.getProducer()));
}
catch (Exception e)
{
@@ -296,18 +297,12 @@
{
log.warn("getModificationDate failed: " + e);
}
- // try
- // {
- // if (basic.getCreatorTool() != null)
- // props.put(DCMetaData.PUBLISHER, basic.getCreatorTool());
- // }
- // catch (Exception e)
- // {
- // log.warn("getCreatorTool failed: " + e);
- // }
+
+ // DCMetaData.PUBLISHER - basic.getCreatorTool()
}
}
- else
+
+ if (props.isEmpty())
{
// The pdf doesn't contain any metadata, try to use the document
// information instead
@@ -434,4 +429,87 @@
}
}
+ private String fixEncoding(String str)
+ {
+ try
+ {
+ String encoding = null;
+ int orderMaskOffset = 0;
+
+ if (str.startsWith("\\000\\000\\376\\377"))
+ {
+ encoding = "UTF-32BE";
+ orderMaskOffset = 16;
+ }
+ else if (str.startsWith("\\377\\376\\000\\000"))
+ {
+ encoding = "UTF-32LE";
+ orderMaskOffset = 16;
+ }
+ else if (str.startsWith("\\376\\377"))
+ {
+ encoding = "UTF-16BE";
+ orderMaskOffset = 8;
+ }
+ else if (str.startsWith("\\377\\376"))
+ {
+ encoding = "UTF-16LE";
+ orderMaskOffset = 8;
+ }
+
+ if (encoding == null)
+ {
+ // return default
+ return str;
+ }
+ else
+ {
+ int i = orderMaskOffset, len = str.length();
+ char c;
+ StringBuilder sb = new StringBuilder(len);
+ while (i < len)
+ {
+ c = str.charAt(i++);
+ if (c == '\\')
+ {
+ if (i + 3 <= len)
+ {
+ //extract octal-code
+ try
+ {
+ c = (char)Integer.parseInt(str.substring(i, i + 3), 8);
+ i += 3;
+ }
+ catch (NumberFormatException e)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug(
+ "PDF metadata exctraction warning: can not decode octal code - "
+ + str.substring(i - 1, i + 3) + ".", e);
+ }
+ }
+ }
+ else
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("PDF metadata exctraction warning: octal code is not complete - "
+ + str.substring(i - 1, len));
+ }
+ }
+ }
+ sb.append(c);
+ }
+
+ byte[] bytes = sb.toString().getBytes();
+ return new String(bytes, encoding);
+ }
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ log.warn("PDF metadata exctraction warning: can not convert metadata string " + str, e);
+ return "";
+ }
+ }
}
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java 2011-06-06 10:00:20 UTC (rev 4479)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java 2011-06-06 11:52:05 UTC (rev 4480)
@@ -107,6 +107,24 @@
}
}
+ public void testPDFDocumentReaderServiceXMPUsecase1() throws Exception
+ {
+ InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/Trait_union.06.Mai_2009.pdf");
+ try
+ {
+ DocumentReader rdr = service.getDocumentReader("application/pdf");
+ Properties testprops = rdr.getProperties(is);
+ Properties etalon = new Properties();
+ etalon.put(DCMetaData.TITLE, "journal interne mai 2009.qxp");
+ etalon.put(DCMetaData.CREATOR, "presse");
+ evalProps(etalon, testprops, false);
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+
public void testWordDocumentReaderService() throws Exception
{
InputStream is = TestPropertiesExtracting.class.getResourceAsStream("/test.doc");
Added: core/trunk/exo.core.component.document/src/test/resources/Trait_union.06.Mai_2009.pdf
===================================================================
(Binary files differ)
Property changes on: core/trunk/exo.core.component.document/src/test/resources/Trait_union.06.Mai_2009.pdf
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
12 years, 11 months
exo-jcr SVN: r4478 - kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-06-06 04:48:55 -0400 (Mon, 06 Jun 2011)
New Revision: 4478
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
Log:
EXOJCR-1365: commented out code: use privileged action only when SecurityManager is installed.
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java 2011-06-06 08:10:53 UTC (rev 4477)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java 2011-06-06 08:48:55 UTC (rev 4478)
@@ -281,12 +281,12 @@
*/
public static <E> E doPrivilegedAction(PrivilegedAction<E> action)
{
-// if (System.getSecurityManager() != null)
+ if (System.getSecurityManager() != null)
{
// A security manager has been established
return AccessController.doPrivileged(action);
}
-// return action.run();
+ return action.run();
}
/**
@@ -299,18 +299,18 @@
public static <E> E doPrivilegedExceptionAction(PrivilegedExceptionAction<E> action)
throws PrivilegedActionException
{
-// if (System.getSecurityManager() != null)
+ if (System.getSecurityManager() != null)
{
// A security manager has been established
return AccessController.doPrivileged(action);
}
-/* try
+ try
{
return action.run();
}
catch (Exception e)
{
throw new PrivilegedActionException(e);
- }*/
+ }
}
}
12 years, 11 months
exo-jcr SVN: r4476 - in jcr/trunk: applications/exo.jcr.applications.config and 4 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-06-03 17:18:48 -0400 (Fri, 03 Jun 2011)
New Revision: 4476
Modified:
jcr/trunk/applications/exo.jcr.applications.config/pom.xml
jcr/trunk/applications/exo.jcr.ear/pom.xml
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.ext/pom.xml
jcr/trunk/packaging/module/src/main/javascript/jcr.packaging.module.js
jcr/trunk/pom.xml
Log:
EXOJCR-1372: Align dependencies with EAP 5.1 (jcr)
Modified: jcr/trunk/applications/exo.jcr.applications.config/pom.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.applications.config/pom.xml 2011-06-03 21:16:43 UTC (rev 4475)
+++ jcr/trunk/applications/exo.jcr.applications.config/pom.xml 2011-06-03 21:18:48 UTC (rev 4476)
@@ -89,5 +89,18 @@
<artifactId>jaxb-impl</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.11.1.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-cachestore-jdbc</artifactId>
+ </dependency>
</dependencies>
</project>
Modified: jcr/trunk/applications/exo.jcr.ear/pom.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.ear/pom.xml 2011-06-03 21:16:43 UTC (rev 4475)
+++ jcr/trunk/applications/exo.jcr.ear/pom.xml 2011-06-03 21:18:48 UTC (rev 4476)
@@ -112,6 +112,19 @@
<artifactId>exo.jcr.component.webdav</artifactId>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.11.1.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-cachestore-jdbc</artifactId>
+ </dependency>
</dependencies>
<build>
<finalName>exo-jcr-ear</finalName>
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-03 21:16:43 UTC (rev 4475)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-06-03 21:18:48 UTC (rev 4476)
@@ -30,8 +30,14 @@
<name>eXo JCR :: Component :: Core Service</name>
<description>eXo JCR Service core component</description>
<properties>
- <jcr.test.configuration.file>/conf/standalone/test-configuration.xml</jcr.test.configuration.file>
+ <jcr.test.configuration.file>/conf/standalone/test-configuration-jbc.xml</jcr.test.configuration.file>
<jbosscache.shareable>true</jbosscache.shareable>
+ <jbc.specific.1>**/jbc/**</jbc.specific.1>
+ <jbc.specific.2>**/jbosscache/**</jbc.specific.2>
+ <ispn.specific.1>**/ispn/**</ispn.specific.1>
+ <ispn.specific.2>**/infinispan/**</ispn.specific.2>
+ <impl.specific.exclude.1>${ispn.specific.1}</impl.specific.exclude.1>
+ <impl.specific.exclude.2>${ispn.specific.2}</impl.specific.exclude.2>
</properties>
<dependencies>
<dependency>
@@ -162,6 +168,7 @@
<dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
+ <version>2.6.20.Final</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -201,10 +208,12 @@
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-cachestore-jdbc</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
@@ -701,7 +710,8 @@
org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testConfiguration
org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersionable
org.apache.jackrabbit.test.api.nodetype.PredefinedNodeTypeTest#testVersion
- org.apache.jackrabbit.test.api.NamespaceRegistryTest#testRegisterNamespace</value>
+ org.apache.jackrabbit.test.api.NamespaceRegistryTest#testRegisterNamespace
+ </value>
</property>
<!-- Uncomment the line below if you want to enable the statistics -->
<!--property>
@@ -757,6 +767,9 @@
<exclude>org/apache/jackrabbit/test/api/TestAll.java</exclude>
<exclude>org/apache/jackrabbit/test/api/**/Abstract*.java</exclude>
<exclude>org/apache/jackrabbit/test/api/**/FrozenNodeTest.java</exclude>
+ <!-- Implementation Specific Excludes -->
+ <exclude>${impl.specific.exclude.1}</exclude>
+ <exclude>${impl.specific.exclude.2}</exclude>
</excludes>
</configuration>
</plugin>
@@ -823,5 +836,62 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>sjdbc</id>
+ <properties>
+ <jcr.test.configuration.file>/conf/standalone/test-configuration-sjdbc-jbc.xml</jcr.test.configuration.file>
+ </properties>
+ </profile>
+ <profile>
+ <id>cluster</id>
+ <properties>
+ <jcr.test.configuration.file>/conf/standalone/cluster/test-configuration-jbc.xml</jcr.test.configuration.file>
+ </properties>
+ </profile>
+ <profile>
+ <id>ispn</id>
+ <properties>
+ <jcr.test.configuration.file>/conf/standalone/test-configuration.xml</jcr.test.configuration.file>
+ <impl.specific.exclude.1>${jbc.specific.1}</impl.specific.exclude.1>
+ <impl.specific.exclude.2>${jbc.specific.2}</impl.specific.exclude.2>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.11.1.Final</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>ispn-sjdbc</id>
+ <properties>
+ <jcr.test.configuration.file>/conf/standalone/test-configuration-sjdbc.xml</jcr.test.configuration.file>
+ <impl.specific.exclude.1>${jbc.specific.1}</impl.specific.exclude.1>
+ <impl.specific.exclude.2>${jbc.specific.2}</impl.specific.exclude.2>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.11.1.Final</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>ispn-cluster</id>
+ <properties>
+ <jcr.test.configuration.file>/conf/standalone/cluster/test-configuration.xml</jcr.test.configuration.file>
+ <impl.specific.exclude.1>${jbc.specific.1}</impl.specific.exclude.1>
+ <impl.specific.exclude.2>${jbc.specific.2}</impl.specific.exclude.2>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>2.11.1.Final</version>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
</project>
Modified: jcr/trunk/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/pom.xml 2011-06-03 21:16:43 UTC (rev 4475)
+++ jcr/trunk/exo.jcr.component.ext/pom.xml 2011-06-03 21:18:48 UTC (rev 4476)
@@ -109,10 +109,6 @@
<artifactId>commons-chain</artifactId>
</dependency>
<dependency>
- <groupId>org.jgroups</groupId>
- <artifactId>jgroups</artifactId>
- </dependency>
- <dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</dependency>
Modified: jcr/trunk/packaging/module/src/main/javascript/jcr.packaging.module.js
===================================================================
--- jcr/trunk/packaging/module/src/main/javascript/jcr.packaging.module.js 2011-06-03 21:16:43 UTC (rev 4475)
+++ jcr/trunk/packaging/module/src/main/javascript/jcr.packaging.module.js 2011-06-03 21:18:48 UTC (rev 4476)
@@ -21,9 +21,9 @@
addDependency(core.component.documents) .
addDependency(new Project("jcr", "jcr", "jar", "1.0")).
addDependency(new Project("concurrent", "concurrent", "jar", "1.3.4")).
- addDependency(new Project("org.jgroups", "jgroups", "jar", "2.11.1.Final")).
+ addDependency(new Project("org.jgroups", "jgroups", "jar", "2.6.20.Final")).
addDependency(new Project("commons-io", "commons-io", "jar", "1.3.2")).
- addDependency(new Project("org.jboss.cache","jbosscache-core","jar","3.2.6.GA")).
+ addDependency(new Project("org.jboss.cache","jbosscache-core","jar","3.2.7.GA")).
addDependency(new Project("jboss.jbossts","jbossjts","jar","4.6.1.GA")).
addDependency(new Project("jboss.jbossts","jbossts-common","jar","4.6.1.GA")).
addDependency(new Project("org.apache.ws.commons","ws-commons-util","jar","1.0.1")).
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2011-06-03 21:16:43 UTC (rev 4475)
+++ jcr/trunk/pom.xml 2011-06-03 21:18:48 UTC (rev 4476)
@@ -344,11 +344,6 @@
<version>2.0.0</version>
</dependency>
<dependency>
- <groupId>org.jgroups</groupId>
- <artifactId>jgroups</artifactId>
- <version>2.11.1.Final</version>
- </dependency>
- <dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
@@ -371,7 +366,7 @@
<dependency>
<groupId>org.jboss.cache</groupId>
<artifactId>jbosscache-core</artifactId>
- <version>3.2.6.GA</version>
+ <version>3.2.7.GA</version>
<exclusions>
<exclusion>
<groupId>jgroups</groupId>
12 years, 11 months