exo-jcr SVN: r4821 - jcr/trunk/exo.jcr.component.core.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-08-31 14:16:31 -0400 (Wed, 31 Aug 2011)
New Revision: 4821
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
Log:
temporary exclude deps
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-31 15:00:42 UTC (rev 4820)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-31 18:16:31 UTC (rev 4821)
@@ -272,7 +272,7 @@
<scope>test</scope>
</dependency>
<!-- For IBM DB2 support (local-jcr repository) -->
- <dependency>
+ <!--dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc</artifactId>
<version>9.7</version>
@@ -283,7 +283,7 @@
<artifactId>db2jcc_license_cu</artifactId>
<version>9.7</version>
<scope>test</scope>
- </dependency>
+ </dependency-->
<!-- For MS SQL 7/2000/2005 and Sybase ASE/Anywhere support (jTDS driver) -->
<!-- dependency>
<groupId>net.sourceforge.jtds</groupId>
@@ -292,12 +292,12 @@
<scope>test</scope>
</dependency -->
<!-- For MS SQL 2005 support (Microsoft JDBC driver) (local-jcr repository) -->
- <dependency>
+ <!--dependency>
<groupId>com.microsoft</groupId>
<artifactId>sqljdbc</artifactId>
<version>3.0.1301.101</version>
<scope>test</scope>
- </dependency>
+ </dependency-->
<!-- For Apache Derby support (aka JavaDB) -->
<!-- dependency>
<groupId>org.apache.derby</groupId>
12 years, 7 months
exo-jcr SVN: r4820 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-08-31 11:00:42 -0400 (Wed, 31 Aug 2011)
New Revision: 4820
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
Log:
EXOJCR-1485 : The feature for support relative path in backup chain log was added.
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2011-08-31 14:03:56 UTC (rev 4819)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryBackupChainLog.java 2011-08-31 15:00:42 UTC (rev 4820)
@@ -160,7 +160,8 @@
writer.flush();
}
- public synchronized void write(RepositoryBackupConfig config, String fullBackupType, String incrementalBackupType)
+ public synchronized void write(RepositoryBackupConfig config, String fullBackupType,
+ String incrementalBackupType, File serviceBackupDir)
throws XMLStreamException, IOException
{
writer.writeStartElement("repository-backup-config");
@@ -179,8 +180,21 @@
if (config.getBackupDir() != null)
{
+ String backupDir = PrivilegedFileHelper.getCanonicalPath(config.getBackupDir());
+ String serviceBackupDirPath = PrivilegedFileHelper.getCanonicalPath(serviceBackupDir);
+ if (backupDir.startsWith(serviceBackupDirPath))
+ {
+
+ backupDir = "." + backupDir.replace(serviceBackupDirPath, "");
+
+ if (File.separator.equals("\\"))
+ {
+ backupDir = backupDir.replaceAll("\\\\", "/");
+ }
+ }
+
writer.writeStartElement("backup-dir");
- writer.writeCharacters(PrivilegedFileHelper.getCanonicalPath(config.getBackupDir()));
+ writer.writeCharacters(backupDir);
writer.writeEndElement();
}
@@ -502,6 +516,19 @@
conf.setBackupDir(new File(path));
}
+ else if (dir.startsWith("./"))
+ {
+ String path = PrivilegedFileHelper.getCanonicalPath(logFile.getParentFile());
+
+ dir = dir.replace("./", "/");
+
+ if (File.separator.equals("\\"))
+ {
+ dir = dir.replaceAll("/", "\\\\");
+ }
+
+ conf.setBackupDir(new File(path + dir));
+ }
else
{
conf.setBackupDir(new File(Deserializer.resolveVariables(dir)));
@@ -636,7 +663,7 @@
this.originalRepositoryEntry = rEntry;
logWriter = new LogWriter(log);
- logWriter.write(config, fullBackupType, incrementalBackupType);
+ logWriter.write(config, fullBackupType, incrementalBackupType, logDirectory);
logWriter.writeSystemWorkspaceName(systemWorkspace);
logWriter.writeBackupsPath(wsLogFilePathList, config);
logWriter.writeRepositoryEntry(rEntry, repositoryServiceConfiguration);
12 years, 7 months
exo-jcr SVN: r4819 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-08-31 10:03:56 -0400 (Wed, 31 Aug 2011)
New Revision: 4819
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java
Log:
EXOJCR-1195: Imrove RDBBS reindexing for Sybase
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java 2011-08-31 09:29:30 UTC (rev 4818)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseConnectionFactory.java 2011-08-31 14:03:56 UTC (rev 4819)
@@ -130,6 +130,6 @@
@Override
public boolean isReindexingSupport()
{
- return false;
+ return true;
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java 2011-08-31 09:29:30 UTC (rev 4818)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseMultiDbJDBCConnection.java 2011-08-31 14:03:56 UTC (rev 4819)
@@ -118,7 +118,7 @@
SELECT_LIMIT_OFFSET_NODES_INTO_TEMPORARY_TABLE =
"select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM into "
+ SybaseJDBCConnectionHelper.TEMP_A_TABLE_NAME
- + " from JCR_MITEM I where I.I_CLASS=1 AND I.ID > ? order by I.ID ASC";
+ + " from JCR_MITEM I (index index JCR_PK_MITEM) where I.I_CLASS=1 AND I.ID > ? order by I.ID ASC";
COUNT_NODES_IN_TEMPORARY_TABLE = "select count(*) from " + SybaseJDBCConnectionHelper.TEMP_A_TABLE_NAME;
@@ -133,8 +133,7 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_MVALUE V, JCR_MITEM P, "
+ SybaseJDBCConnectionHelper.TEMP_B_TABLE_NAME + " where P.PARENT_ID = "
+ SybaseJDBCConnectionHelper.TEMP_B_TABLE_NAME
- + ".ID and P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by "
- + SybaseJDBCConnectionHelper.TEMP_B_TABLE_NAME + ".ID";
+ + ".ID and P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by ID";
DELETE_TEMPORARY_TABLE_A = "drop table " + SybaseJDBCConnectionHelper.TEMP_A_TABLE_NAME;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java 2011-08-31 09:29:30 UTC (rev 4818)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/SybaseSingleDbJDBCConnection.java 2011-08-31 14:03:56 UTC (rev 4819)
@@ -118,7 +118,7 @@
SELECT_LIMIT_OFFSET_NODES_INTO_TEMPORARY_TABLE =
"select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM into "
+ SybaseJDBCConnectionHelper.TEMP_A_TABLE_NAME
- + " from JCR_SITEM I where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID ASC";
+ + " from JCR_SITEM I (index JCR_PK_SITEM) where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID ASC";
COUNT_NODES_IN_TEMPORARY_TABLE = "select count(*) from " + SybaseJDBCConnectionHelper.TEMP_A_TABLE_NAME;
@@ -133,8 +133,7 @@
+ " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P, "
+ SybaseJDBCConnectionHelper.TEMP_B_TABLE_NAME + " where P.PARENT_ID = "
+ SybaseJDBCConnectionHelper.TEMP_B_TABLE_NAME
- + ".ID and P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by "
- + SybaseJDBCConnectionHelper.TEMP_B_TABLE_NAME + ".ID";
+ + ".ID and P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by ID";
DELETE_TEMPORARY_TABLE_A = "drop table " + SybaseJDBCConnectionHelper.TEMP_A_TABLE_NAME;
12 years, 7 months
exo-jcr SVN: r4818 - core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-08-31 05:29:30 -0400 (Wed, 31 Aug 2011)
New Revision: 4818
Modified:
core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
Log:
EXOJCR-1501: Set minConnection and maxConnection params from the ldap configuration via system properties
Modified: core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-08-31 09:23:53 UTC (rev 4817)
+++ core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-08-31 09:29:30 UTC (rev 4818)
@@ -89,13 +89,16 @@
if (config.getMinConnection() > 0)
{
- env.put("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
- env.put("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
+ PrivilegedSystemHelper.setProperty("com.sun.jndi.ldap.connect.pool.initsize",
+ Integer.toString(config.getMinConnection()));
+ PrivilegedSystemHelper.setProperty("com.sun.jndi.ldap.connect.pool.prefsize",
+ Integer.toString(config.getMinConnection()));
}
if (config.getMaxConnection() > 0)
{
- env.put("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
+ PrivilegedSystemHelper.setProperty("com.sun.jndi.ldap.connect.pool.maxsize",
+ Integer.toString(config.getMaxConnection()));
}
env.put("com.sun.jndi.ldap.connect.pool", "true");
12 years, 7 months
exo-jcr SVN: r4817 - core/branches/2.3.x/patch/2.3.10/COR-237.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-08-31 05:23:53 -0400 (Wed, 31 Aug 2011)
New Revision: 4817
Modified:
core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch
Log:
COR-237: patch updated
Modified: core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch
===================================================================
--- core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch 2011-08-30 16:19:12 UTC (rev 4816)
+++ core/branches/2.3.x/patch/2.3.10/COR-237/COR-237.patch 2011-08-31 09:23:53 UTC (rev 4817)
@@ -1,6 +1,6 @@
Index: exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
===================================================================
---- exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java (revision 4461)
+--- exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java (revision 4816)
+++ exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java (working copy)
@@ -86,6 +86,17 @@
// TODO move it in configuration ?
@@ -8,13 +8,13 @@
+ if (config.getMinConnection() > 0)
+ {
-+ env.put("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
-+ env.put("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
++ System.setProperty("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
++ System.setProperty("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
+ }
+
+ if (config.getMaxConnection() > 0)
+ {
-+ env.put("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
++ System.setProperty("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
+ }
+
env.put("com.sun.jndi.ldap.connect.pool", "true");
12 years, 7 months
exo-jcr SVN: r4816 - in core/branches/2.3.x: patch/2.3.10/COR-237 and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-08-30 12:19:12 -0400 (Tue, 30 Aug 2011)
New Revision: 4816
Removed:
core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt
Modified:
core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
Log:
COR-237: reverted
Modified: core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
===================================================================
--- core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-08-30 15:08:14 UTC (rev 4815)
+++ core/branches/2.3.x/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2011-08-30 16:19:12 UTC (rev 4816)
@@ -86,17 +86,6 @@
// TODO move it in configuration ?
env.put("com.sun.jndi.ldap.connect.timeout", "60000");
- if (config.getMinConnection() > 0)
- {
- env.put("com.sun.jndi.ldap.connect.pool.initsize", Integer.toString(config.getMinConnection()));
- env.put("com.sun.jndi.ldap.connect.pool.prefsize", Integer.toString(config.getMinConnection()));
- }
-
- if (config.getMaxConnection() > 0)
- {
- env.put("com.sun.jndi.ldap.connect.pool.maxsize", Integer.toString(config.getMaxConnection()));
- }
-
env.put("com.sun.jndi.ldap.connect.pool", "true");
env.put("java.naming.ldap.version", config.getVerion());
env.put("java.naming.ldap.attributes.binary", "tokenGroups");
Deleted: core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt
===================================================================
--- core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt 2011-08-30 15:08:14 UTC (rev 4815)
+++ core/branches/2.3.x/patch/2.3.10/COR-237/readme.txt 2011-08-30 16:19:12 UTC (rev 4816)
@@ -1,67 +0,0 @@
-Summary
-
- * Status: minConnection and maxConnection params in the ldap configuration are not used
- * CCP Issue: CCP-1032, Product Jira Issue: COR-237.
- * Complexity: N/A
-
-The Proposal
-Problem description
-
-What is the problem to fix?
-
- * minConnection and maxConnection params in the ldap configuration are not used
-
-Fix description
-
-How is the problem fixed?
-Use minConnection and maxConnection to set up com.sun.jndi.ldap.connect.pool.initsize and com.sun.jndi.ldap.connect.pool.prefsize, precisely:
- * com.sun.jndi.ldap.connect.pool.initsize and com.sun.jndi.ldap.connect.pool.prefsize are set to minConnection if minConnection > 0
- * com.sun.jndi.ldap.connect.pool.maxsize are set to maxConnection if maxConnection > 0
-
-Patch file: COR-237.patch
-
-Tests to perform
-
-Reproduction test
-
- * org.exoplatform.services.ldap.impl.LDAPServiceImpl does not use minConnection and maxConnection params to init the ldap connection pool (should be used for com.sun.jndi.ldap.connect.pool.initsize and com.sun.jndi.ldap.connect.pool.maxsize env params).
-
-Tests performed at DevLevel
-*
-
-Tests performed at QA/Support Level
-*
-Documentation changes
-
-Documentation changes:
-* No
-
-Configuration changes
-
-Configuration changes:
-* No
-
-Will previous configuration continue to work?
-* Yes
-
-Risks and impacts
-
-Can this bug fix have any side effects on current client projects?
-
- * Function or ClassName change: no
-
-Is there a performance risk/cost?
-* No
-
-Validation (PM/Support/QA)
-
-PM Comment
-
- * Patch approved.
-
-Support Comment
-
- * Patch validated on behalf of Support.
-
-QA Feedbacks
-*
12 years, 7 months
exo-jcr SVN: r4815 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-08-30 11:08:14 -0400 (Tue, 30 Aug 2011)
New Revision: 4815
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
Log:
EXOJCR-1488: Use hints in query for reindixing for MySQL DB
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2011-08-30 14:36:07 UTC (rev 4814)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLMultiDbJDBCConnection.java 2011-08-30 15:08:14 UTC (rev 4815)
@@ -80,8 +80,8 @@
FIND_NODES_AND_PROPERTIES =
"select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
- + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_MVALUE V, JCR_MITEM P use index(JCR_IDX_MITEM_PARENT_ID)"
- + " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_MVALUE V, JCR_MITEM P"
+ + " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_MITEM I force index(PRIMARY)"
+ " where I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
+ " where P.I_CLASS=2 and V.PROPERTY_ID=P.ID order by J.ID";
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2011-08-30 14:36:07 UTC (rev 4814)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/MySQLSingleDbJDBCConnection.java 2011-08-30 15:08:14 UTC (rev 4815)
@@ -80,8 +80,8 @@
FIND_NODES_AND_PROPERTIES =
"select J.*, P.ID AS P_ID, P.NAME AS P_NAME, P.VERSION AS P_VERSION, P.P_TYPE, P.P_MULTIVALUED,"
- + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P use index(JCR_IDX_SITEM_PARENT_ID)"
- + " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I"
+ + " V.DATA, V.ORDER_NUM, V.STORAGE_DESC from JCR_SVALUE V, JCR_SITEM P"
+ + " join (select I.ID, I.PARENT_ID, I.NAME, I.VERSION, I.I_INDEX, I.N_ORDER_NUM from JCR_SITEM I force index(PRIMARY)"
+ " where I.CONTAINER_NAME=? AND I.I_CLASS=1 AND I.ID > ? order by I.ID LIMIT ? OFFSET ?) J on P.PARENT_ID = J.ID"
+ " where P.I_CLASS=2 and P.CONTAINER_NAME=? and V.PROPERTY_ID=P.ID order by J.ID";
}
12 years, 7 months
exo-jcr SVN: r4814 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/api/core/query and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-08-30 10:36:07 -0400 (Tue, 30 Aug 2011)
New Revision: 4814
Removed:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryIndexReordering.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
Log:
EXOJCR-1239: patch from JCR-1571 temporary reverted
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java 2011-08-30 13:45:20 UTC (rev 4813)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChildAxisQuery.java 2011-08-30 14:36:07 UTC (rev 4814)
@@ -538,14 +538,15 @@
{
if (position != LocationStepQueryNode.NONE)
{
- Document node = reader.document(i, FieldSelectors.UUID_AND_PARENT_AND_INDEX);
+ Document node = reader.document(i, FieldSelectors.UUID_AND_PARENT);
String parentId = node.get(FieldNames.PARENT);
String id = node.get(FieldNames.UUID);
try
{
+ //NodeState state = (NodeState) itemMgr.getItemState(parentId);
+ NodeData state = (NodeData)itemMgr.getItemData(parentId);
if (nameTest == null)
{
- NodeData state = (NodeData)itemMgr.getItemData(parentId);
// only select this node if it is the child at
// specified position
if (position == LocationStepQueryNode.LAST)
@@ -573,7 +574,6 @@
// specified position
if (position == LocationStepQueryNode.LAST)
{
- NodeData state = (NodeData)itemMgr.getItemData(parentId);
// only select last
if (state == null)
@@ -591,11 +591,6 @@
}
}
}
- else if (version.getVersion() >= IndexFormatVersion.V4.getVersion())
- {
- if (Integer.valueOf(node.get(FieldNames.INDEX)) != position)
- return false;
- }
else
{
NodeData nodeData = (NodeData)itemMgr.getItemData(id);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java 2011-08-30 13:45:20 UTC (rev 4813)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldNames.java 2011-08-30 14:36:07 UTC (rev 4814)
@@ -64,11 +64,6 @@
public static final String LOCAL_NAME = "_:LOCAL_NAME".intern();
/**
- * Name of the field that contains the index of the item.
- */
- public static final String INDEX = "_:INDEX".intern();
-
- /**
* Name of the field that contains the namespace URI of the node name. Terms
* are not tokenized.
*/
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java 2011-08-30 13:45:20 UTC (rev 4813)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FieldSelectors.java 2011-08-30 14:36:07 UTC (rev 4814)
@@ -63,25 +63,4 @@
}
}
};
-
- public static final FieldSelector UUID_AND_PARENT_AND_INDEX = new FieldSelector() {
- /**
- * Accepts {@link FieldNames#UUID}, {@link FieldNames#PARENT}
- * and {@link FieldNames#INDEX}.
- *
- * @param fieldName the field name to check.
- * @return result.
- */
- public FieldSelectorResult accept(String fieldName) {
- if (FieldNames.UUID == fieldName) {
- return FieldSelectorResult.LOAD;
- } else if (FieldNames.PARENT == fieldName) {
- return FieldSelectorResult.LOAD;
- } else if (FieldNames.INDEX == fieldName) {
- return FieldSelectorResult.LOAD;
- } else {
- return FieldSelectorResult.NO_LOAD;
- }
- }
- };
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java 2011-08-30 13:45:20 UTC (rev 4813)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexFormatVersion.java 2011-08-30 14:36:07 UTC (rev 4814)
@@ -16,10 +16,10 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
-import org.apache.lucene.index.IndexReader;
-
import java.util.Collection;
+import org.apache.lucene.index.IndexReader;
+
/**
* This class indicates the lucene index format that is used.
* <ul>
@@ -52,16 +52,11 @@
public static final IndexFormatVersion V2 = new IndexFormatVersion(2);
/**
- * V3 is the index format for Jackrabbit releases 1.5.x
+ * V3 is the index format for Jackrabbit releases >= 1.5
*/
public static final IndexFormatVersion V3 = new IndexFormatVersion(3);
/**
- * V4 is the index format for Jackrabbit releases >= 1.6
- */
- public static final IndexFormatVersion V4 = new IndexFormatVersion(4);
-
- /**
* The used version of the index format
*/
private final int version;
@@ -109,9 +104,7 @@
public static IndexFormatVersion getVersion(IndexReader indexReader) {
Collection fields = indexReader.getFieldNames(
IndexReader.FieldOption.ALL);
- if (fields.contains(FieldNames.INDEX) || indexReader.numDocs() == 0) {
- return IndexFormatVersion.V4;
- } else if (fields.contains(FieldNames.LOCAL_NAME)) {
+ if (fields.contains(FieldNames.LOCAL_NAME) || indexReader.numDocs() == 0) {
return IndexFormatVersion.V3;
} else if (fields.contains(FieldNames.PROPERTIES_SET)) {
return IndexFormatVersion.V2;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-08-30 13:45:20 UTC (rev 4813)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2011-08-30 14:36:07 UTC (rev 4814)
@@ -217,12 +217,6 @@
// unknown uri<->prefix mappings
}
- if (indexFormatVersion.getVersion() >= IndexFormatVersion.V4.getVersion())
- {
- doc.add(new Field(FieldNames.INDEX, Integer.toString(node.getQPath().getIndex()), Field.Store.YES,
- Field.Index.NOT_ANALYZED_NO_NORMS));
- }
-
Collection<PropertyData> props = node.getChildPropertiesData();
if (props == null)
{
@@ -340,7 +334,7 @@
if (encProp == null)
{
encProp =
- (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
+ (PropertyData)stateProvider.getItemData(node, new QPathEntry(Constants.JCR_ENCODING, 0),
ItemType.PROPERTY);
}
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryIndexReordering.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryIndexReordering.java 2011-08-30 13:45:20 UTC (rev 4813)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/TestQueryIndexReordering.java 2011-08-30 14:36:07 UTC (rev 4814)
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2003-2011 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.api.core.query;
-
-import org.exoplatform.services.jcr.usecases.BaseUsecasesTest;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryManager;
-import javax.jcr.query.QueryResult;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date:
- *
- * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
- * @version $Id: TestIndexReordering.java 111 2008-11-11 11:11:11Z serg $
- */
-public class TestQueryIndexReordering extends BaseUsecasesTest
-{
-
- public void testReordering() throws Exception
- {
- Node testRoot = this.root.addNode("testSameNameSiblingDelete");
-
- Node subNode_1 = testRoot.addNode("node", "nt:unstructured"); // 1
- subNode_1.addMixin("mix:referenceable");
- subNode_1.setProperty("prop", "data 1");
- Node subNode_2 = testRoot.addNode("node", "nt:unstructured"); // 2
- subNode_2.addMixin("mix:referenceable");
- subNode_2.setProperty("prop", "data 2");
- Node subNode_3 = testRoot.addNode("node", "nt:unstructured"); // 3
- subNode_3.addMixin("mix:referenceable");
- subNode_3.setProperty("prop", "data 3");
- session.save();
-
- //check the index
- String sqlQuery;
- Query query;
- QueryResult queryResult;
- NodeIterator iterator;
- Node node;
- QueryManager qm = session.getWorkspace().getQueryManager();
-
- sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[1]'";
- query = qm.createQuery(sqlQuery, Query.SQL);
- queryResult = query.execute();
- iterator = queryResult.getNodes();
- assertTrue("Node expected ", iterator.getSize() == 1);
- node = iterator.nextNode();
- assertEquals("Wrong id ", subNode_1.getUUID(), node.getUUID());
- assertEquals("Wrong path ", subNode_1.getPath(), node.getPath());
-
- sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[2]'";
- query = qm.createQuery(sqlQuery, Query.SQL);
- queryResult = query.execute();
- iterator = queryResult.getNodes();
- assertTrue("Node expected ", iterator.getSize() == 1);
- node = iterator.nextNode();
- assertEquals("Wrong id ", subNode_2.getUUID(), node.getUUID());
- assertEquals("Wrong path ", subNode_2.getPath(), node.getPath());
-
- sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[3]'";
- query = qm.createQuery(sqlQuery, Query.SQL);
- queryResult = query.execute();
- iterator = queryResult.getNodes();
- assertTrue("Node expected ", iterator.getSize() == 1);
- node = iterator.nextNode();
- assertEquals("Wrong id ", subNode_3.getUUID(), node.getUUID());
- assertEquals("Wrong path ", subNode_3.getPath(), node.getPath());
-
- // usecase - order to the end,
- // i.e. /testSameNameSiblingDelete/node[2] will be UPDATED to
- // /testSameNameSiblingDelete/node[1]
- // i.e. /testSameNameSiblingDelete/node[3] will be UPDATED to
- // /testSameNameSiblingDelete/node[2]
- subNode_1.getParent().orderBefore("node", null);
- session.save();
-
- sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[1]'";
- query = qm.createQuery(sqlQuery, Query.SQL);
- queryResult = query.execute();
- iterator = queryResult.getNodes();
- assertTrue("Node expected ", iterator.getSize() == 1);
- node = iterator.nextNode();
- assertEquals("Wrong id ", subNode_2.getUUID(), node.getUUID());
- assertEquals("Wrong path ", subNode_2.getPath(), node.getPath());
-
- sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[2]'";
- query = qm.createQuery(sqlQuery, Query.SQL);
- queryResult = query.execute();
- iterator = queryResult.getNodes();
- assertTrue("Node expected ", iterator.getSize() == 1);
- node = iterator.nextNode();
- assertEquals("Wrong id ", subNode_3.getUUID(), node.getUUID());
- assertEquals("Wrong path ", subNode_3.getPath(), node.getPath());
-
- sqlQuery = "SELECT * FROM nt:unstructured WHERE jcr:path = '/testSameNameSiblingDelete/node[3]'";
- query = qm.createQuery(sqlQuery, Query.SQL);
- queryResult = query.execute();
- iterator = queryResult.getNodes();
- assertTrue("Node expected ", iterator.getSize() == 1);
- node = iterator.nextNode();
- assertEquals("Wrong id ", subNode_1.getUUID(), node.getUUID());
- assertEquals("Wrong path ", subNode_1.getPath(), node.getPath());
- }
-
-}
12 years, 7 months
exo-jcr SVN: r4813 - in kernel/trunk: exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl and 2 other directories.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-08-30 09:45:20 -0400 (Tue, 30 Aug 2011)
New Revision: 4813
Added:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/DynamicLocationAwareLogger.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LogMessageFormatter.java
kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestLogMessageFormatter.java
Modified:
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/Log.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SimpleExoLog.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/log/TestLoggers.java
Log:
EXOJCR-1479: added support for both slfj 1.5.x and 1.6.x LocationAwareLog.log methods via reflection, also added some new methods to org.exoplatform.services.log.Log interface and their implementations correspondingly
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/Log.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/Log.java 2011-08-30 13:21:51 UTC (rev 4812)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/Log.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -227,4 +227,88 @@
*/
void fatal(Object message, Throwable t);
+ /**
+ * <p>
+ * Log an error with <i>trace</i> log level.
+ * </p>
+ *
+ * @param format <br> {@link String} format to represent log message.
+ * Sequence of '{}' is used to represent an anchor which will be replaced by
+ * string representation of objects in argArray
+ * @param argArray <br> array of arguments to add to log message
+ * including {@link Throwable}, {@link String}
+ * or any other {@link Object} for which string representation will be used
+ */
+ void trace(String format, Object... argArray);
+
+ /**
+ * <p>
+ * Log an error with <i>debug</i> log level.
+ * </p>
+ *
+ * @param format <br> {@link String} format to represent log message.
+ * Sequence of '{}' is used to represent an anchor which will be replaced by
+ * string representation of objects in argArray
+ * @param argArray <br> array of arguments to add to log message
+ * including {@link Throwable}, {@link String}
+ * or any other {@link Object} for which string representation will be used
+ */
+ void debug(String format, Object... argArray);
+
+ /**
+ * <p>
+ * Log an error with <i>info</i> log level.
+ * </p>
+ *
+ * @param format <br> {@link String} format to represent log message.
+ * Sequence of '{}' is used to represent an anchor which will be replaced by
+ * string representation of objects in argArray
+ * @param argArray <br> array of arguments to add to log message
+ * including {@link Throwable}, {@link String}
+ * or any other {@link Object} for which string representation will be used
+ */
+ void info(String format, Object... argArray);
+
+ /**
+ * <p>
+ * Log a message with <i>warn</i> log level.
+ * </p>
+ *
+ * @param format <br> {@link String} format to represent log message.
+ * Sequence of '{}' is used to represent an anchor which will be replaced by
+ * string representation of objects in argArray
+ * @param argArray <br> array of arguments to add to log message
+ * including {@link Throwable}, {@link String}
+ * or any other {@link Object} for which string representation will be used
+ */
+ void warn(String format, Object... argArray);
+
+ /**
+ * <p>
+ * Log a message with <i>error</i> log level.
+ * </p>
+ *
+ * @param format <br> {@link String} format to represent log message.
+ * Sequence of '{}' is used to represent an anchor which will be replaced by
+ * string representation of objects in argArray
+ * @param argArray <br> array of arguments to add to log message
+ * including {@link Throwable}, {@link String}
+ * or any other {@link Object} for which string representation will be used
+ */
+ void error(String format, Object... argArray);
+
+ /**
+ * <p>
+ * Log a message with <i>fatal</i> log level.
+ * </p>
+ *
+ * @param format <br> {@link String} format to represent log message.
+ * Sequence of '{}' is used to represent an anchor which will be replaced by
+ * string representation of objects in argArray
+ * @param argArray <br> array of arguments to add to log message
+ * including {@link Throwable}, {@link String}
+ * or any other {@link Object} for which string representation will be used
+ */
+ void fatal(String format, Object... argArray);
+
}
Added: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/DynamicLocationAwareLogger.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/DynamicLocationAwareLogger.java (rev 0)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/DynamicLocationAwareLogger.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.log.impl;
+
+import org.slf4j.Marker;
+import org.slf4j.spi.LocationAwareLogger;
+
+import java.lang.reflect.Method;
+
+/**
+ * This is an utility class allowing to use in runtime either 1.5.x or
+ * 1.6.x slf4j libraries. As their log method signature differs,
+ * we use reflection library to invoke it.
+ *
+ * @author <a href="mailto:dkuleshov@exoplatform.com">Dmitry Kuleshov</a>
+ */
+public class DynamicLocationAwareLogger
+{
+ /**
+ * To keep log method instance
+ */
+ private Method log;
+
+ /**
+ * Message to show if log method invocation has failed for some reasons.
+ */
+ private final static String LOG_METHOD_INVOKE_ERROR_MSG =
+ "LocationAwareLogger had some issues on method 'log' invocation. Using location unaware methods.\n";
+
+ /**
+ * To trace if new parameter is supported
+ * 1.5.x slf4j lib does not support
+ * 1.6.x slf4j lib supports
+ */
+ private boolean parameterSupported = false;
+
+ /**
+ * Logger
+ */
+ private LocationAwareLogger logger;
+
+ /**
+ * Simple constructor with one parameter is used to pull out log {@link Method}
+ * an determine which version of slf4j library is currently used.
+ *
+ * @param logger location aware logger to be wrapped
+ */
+ public DynamicLocationAwareLogger(LocationAwareLogger logger)
+ {
+ this.logger = logger;
+
+ // here we're going to retrieve 'log' method instance from logger's class
+ // using java reflection library
+ // also we're determining number of parameters of 'log' method to know
+ // what slf4j library version we're dealing with
+ for (Method m : logger.getClass().getDeclaredMethods())
+ {
+ if ("log".equals(m.getName()))
+ {
+ log = m;
+ if (log.getParameterTypes().length == 6)
+ {
+ parameterSupported = true;
+ }
+ break;
+ }
+ }
+
+ // if no method named 'log' is determined for currently used logger class
+ // we throw an exception to warn that something is definitely going wrong
+ if (log == null)
+ {
+ throw new UnsupportedOperationException("Currently used logger does not have log method.");
+ }
+ }
+
+ /**
+ * Printing method with support for location information.
+ * Encapsulates slf4j lib log {@link Method} invocation and passing it the correct parameters.
+ */
+ public void log(Marker marker, String fqcn, int level, String message, Throwable t)
+ {
+ try
+ {
+ if (!parameterSupported)
+ {
+ log.invoke(logger, marker, fqcn, level, message, t);
+ }
+ else
+ {
+ log.invoke(logger, marker, fqcn, level, message, null, t);
+ }
+ }
+ catch (Exception e)
+ {
+ switch( level)
+ {
+ case LocationAwareLogger.TRACE_INT :
+ logger.trace(LOG_METHOD_INVOKE_ERROR_MSG + message, t);
+ break;
+ case LocationAwareLogger.DEBUG_INT :
+ logger.debug(LOG_METHOD_INVOKE_ERROR_MSG + message, t);
+ break;
+ case LocationAwareLogger.INFO_INT :
+ logger.info(LOG_METHOD_INVOKE_ERROR_MSG + message, t);
+ break;
+ case LocationAwareLogger.WARN_INT :
+ logger.warn(LOG_METHOD_INVOKE_ERROR_MSG + message, t);
+ break;
+ case LocationAwareLogger.ERROR_INT :
+ logger.error(LOG_METHOD_INVOKE_ERROR_MSG + message, t);
+ break;
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isDebugEnabled()
+ {
+ return logger.isDebugEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isErrorEnabled()
+ {
+ return logger.isErrorEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isFatalEnabled()
+ {
+ return logger.isErrorEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isInfoEnabled()
+ {
+ return logger.isInfoEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isTraceEnabled()
+ {
+ return logger.isTraceEnabled();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isWarnEnabled()
+ {
+ return logger.isWarnEnabled();
+ }
+}
\ No newline at end of file
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java 2011-08-30 13:21:51 UTC (rev 4812)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LocationAwareSLF4JExoLog.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -30,12 +30,11 @@
*/
public class LocationAwareSLF4JExoLog implements Log
{
-
/** . */
private static final String FQCN = LocationAwareSLF4JExoLog.class.getName();
/** . */
- private final LocationAwareLogger logger;
+ private final DynamicLocationAwareLogger logger;
/**
* Create a new instance.
@@ -49,96 +48,204 @@
{
throw new NullPointerException();
}
- this.logger = logger;
+ this.logger = new DynamicLocationAwareLogger(logger);
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isDebugEnabled()
{
return logger.isDebugEnabled();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isErrorEnabled()
{
return logger.isErrorEnabled();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isFatalEnabled()
{
return logger.isErrorEnabled();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isInfoEnabled()
{
return logger.isInfoEnabled();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isTraceEnabled()
{
return logger.isTraceEnabled();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isWarnEnabled()
{
return logger.isWarnEnabled();
}
+ /**
+ * {@inheritDoc}
+ */
public void trace(Object o)
{
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(o), null);
}
+ /**
+ * {@inheritDoc}
+ */
public void trace(Object o, Throwable throwable)
{
logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, String.valueOf(o), throwable);
}
+ /**
+ * {@inheritDoc}
+ */
public void debug(Object o)
{
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(o), null);
}
+ /**
+ * {@inheritDoc}
+ */
public void debug(Object o, Throwable throwable)
{
logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, String.valueOf(o), throwable);
}
+ /**
+ * {@inheritDoc}
+ */
public void info(Object o)
{
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(o), null);
}
+ /**
+ * {@inheritDoc}
+ */
public void info(Object o, Throwable throwable)
{
logger.log(null, FQCN, LocationAwareLogger.INFO_INT, String.valueOf(o), throwable);
}
+ /**
+ * {@inheritDoc}
+ */
public void warn(Object o)
{
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(o), null);
}
+ /**
+ * {@inheritDoc}
+ */
public void warn(Object o, Throwable throwable)
{
logger.log(null, FQCN, LocationAwareLogger.WARN_INT, String.valueOf(o), throwable);
}
+ /**
+ * {@inheritDoc}
+ */
public void error(Object o)
{
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(o), null);
}
+ /**
+ * {@inheritDoc}
+ */
public void error(Object o, Throwable throwable)
{
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(o), throwable);
}
+ /**
+ * {@inheritDoc}
+ */
public void fatal(Object o)
{
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(o), null);
}
+ /**
+ * {@inheritDoc}
+ */
public void fatal(Object o, Throwable throwable)
{
logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, String.valueOf(o), throwable);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void trace(String format, Object... argsArray)
+ {
+ logger.log(null, FQCN, LocationAwareLogger.TRACE_INT, LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void debug(String format, Object... argsArray)
+ {
+ logger.log(null, FQCN, LocationAwareLogger.DEBUG_INT, LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void info(String format, Object... argsArray)
+ {
+ logger.log(null, FQCN, LocationAwareLogger.INFO_INT, LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void warn(String format, Object... argsArray)
+ {
+ logger.log(null, FQCN, LocationAwareLogger.WARN_INT, LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void error(String format, Object... argsArray)
+ {
+ logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void fatal(String format, Object... argsArray)
+ {
+ logger.log(null, FQCN, LocationAwareLogger.ERROR_INT, LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
}
Added: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LogMessageFormatter.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LogMessageFormatter.java (rev 0)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/LogMessageFormatter.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.log.impl;
+
+import java.util.regex.Pattern;
+
+/**
+ * Simple class to provide format parsing of log messages similar to what slf4j library does.
+ * @author <a href="mailto:dkuleshov@exoplatform.com">Dmitry Kuleshov</a>
+ */
+public class LogMessageFormatter
+{
+ /**
+ * '{}' - anchor which will be replaced by corresponding
+ * object's string representation
+ */
+ private static final Pattern REPLACE_PATTERN = Pattern.compile("\\{\\}");
+
+ public static String getMessage(String str, Object... argsArray)
+ {
+
+ if (argsArray != null && argsArray.length > 0)
+ {
+ for (int i = 0; i < argsArray.length; i++)
+ {
+ if (i != argsArray.length - 1 || !(argsArray[i] instanceof Throwable))
+ {
+ str = REPLACE_PATTERN.matcher(str).replaceFirst(String.valueOf(argsArray[i]));
+ }
+ }
+ }
+ return str;
+
+
+ }
+
+ public static Throwable getThrowable(Object... argsArray)
+ {
+ if (argsArray != null && argsArray.length > 0)
+ {
+ // we assume that last element in argsArray may be a Throwable
+ if (argsArray[argsArray.length - 1] instanceof Throwable)
+ {
+ return (Throwable)argsArray[argsArray.length - 1];
+ }
+ }
+ return null;
+ }
+}
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java 2011-08-30 13:21:51 UTC (rev 4812)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SLF4JExoLog.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -187,4 +187,52 @@
{
logger.error(String.valueOf(o), throwable);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void trace(String format, Object... argsArray)
+ {
+ logger.trace(format, argsArray);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void debug(String format, Object... argsArray)
+ {
+ logger.debug(format, argsArray);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void info(String format, Object... argsArray)
+ {
+ logger.info(format, argsArray);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void warn(String format, Object... argsArray)
+ {
+ logger.warn(format, argsArray);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void error(String format, Object... argsArray)
+ {
+ logger.error(format, argsArray);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void fatal(String format, Object... argsArray)
+ {
+ logger.error(format, argsArray);
+ }
}
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SimpleExoLog.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SimpleExoLog.java 2011-08-30 13:21:51 UTC (rev 4812)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/services/log/impl/SimpleExoLog.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -139,4 +139,40 @@
{
this.delegate = new SimpleLog(name);
}
+
+ public void trace(String format, Object... argsArray)
+ {
+ this.delegate.trace(LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ public void debug(String format, Object... argsArray)
+ {
+ this.delegate.debug(LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ public void info(String format, Object... argsArray)
+ {
+ this.delegate
+ .info(LogMessageFormatter.getMessage(format, argsArray), LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ public void warn(String format, Object... argsArray)
+ {
+ this.delegate
+ .warn(LogMessageFormatter.getMessage(format, argsArray), LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ public void error(String format, Object... argsArray)
+ {
+ this.delegate.error(LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
+
+ public void fatal(String format, Object... argsArray)
+ {
+ this.delegate.fatal(LogMessageFormatter.getMessage(format, argsArray),
+ LogMessageFormatter.getThrowable(argsArray));
+ }
}
Added: kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestLogMessageFormatter.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestLogMessageFormatter.java (rev 0)
+++ kernel/trunk/exo.kernel.commons/src/test/java/org/exoplatform/commons/utils/TestLogMessageFormatter.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.commons.utils;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.services.log.impl.LogMessageFormatter;
+
+/**
+ * @author <a href="mailto:dkuleshov@exoplatform.com">Dmitry Kuleshov</a>
+ * @version $Revision$
+ */
+public class TestLogMessageFormatter extends TestCase
+{
+ public void testMessageParsing() throws Exception
+ {
+ assertEquals("Sometimes even the wisest of man or machine can make an error.",
+ LogMessageFormatter.getMessage("Sometimes even the wisest of man or machine can make an {}.", "error"));
+
+ assertEquals("Time makes all things possible. I can wait.",
+ LogMessageFormatter.getMessage("Time makes all {} possible. I can wait{}", "things", "."));
+
+ assertEquals("Give it up, Megatron!", LogMessageFormatter.getMessage("Give it up, Megatron!", new Throwable()));
+
+ assertEquals("Just remember, there's a thin line between being a hero and being a memory.",
+ LogMessageFormatter.getMessage("Just remember, there's a thin line between being a hero and being a {}.",
+ "memory", new Throwable()));
+
+ assertEquals("We can't stand by and watch the destruction of this beautiful planet.",
+ LogMessageFormatter.getMessage("{}", "We can't stand by and watch the destruction of this beautiful planet.",
+ new Throwable()));
+ }
+
+ public void testGetThrowable() throws Exception
+ {
+ Throwable t = new Throwable();
+
+ assertNull(LogMessageFormatter.getThrowable());
+ assertNull(LogMessageFormatter.getThrowable(new Object()));
+ assertNull(LogMessageFormatter.getThrowable(new Object(), t, new String()));
+ assertEquals(t, LogMessageFormatter.getThrowable(new Object(), t));
+ assertEquals(t, LogMessageFormatter.getThrowable("Just testing{}", new Object(), t));
+ }
+}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/log/TestLoggers.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/log/TestLoggers.java 2011-08-30 13:21:51 UTC (rev 4812)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/log/TestLoggers.java 2011-08-30 13:45:20 UTC (rev 4813)
@@ -120,6 +120,9 @@
Log log = ExoLogger.getLogger(TestLoggers.class);
log.info("Log4j Container Tests");
+ log.info("Log4j Container {}", "Tests");
+ log.info("Log4j Conta{} Te{}", "iner", "sts");
+ log.info("Log4j Container Tests", 1, 2, 3);
logOut(log);
}
12 years, 7 months
exo-jcr SVN: r4812 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query: lucene/spell and 1 other directory.
by do-not-reply@jboss.org
Author: dkuleshov
Date: 2011-08-30 09:21:51 -0400 (Tue, 30 Aug 2011)
New Revision: 4812
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
Log:
EXOJCR-1445: removed unnecessary privileged wrappings, possible cause of regression
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java 2011-08-30 13:12:37 UTC (rev 4811)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java 2011-08-30 13:21:51 UTC (rev 4812)
@@ -18,6 +18,7 @@
package org.exoplatform.services.jcr.impl.core.query;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -29,6 +30,7 @@
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -97,22 +99,28 @@
*/
private void openFile(final File log) throws IOException
{
- // set file size;
- if (!PrivilegedFileHelper.exists(log))
+ SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
- PrivilegedFileHelper.mkdirs(log.getParentFile());
- PrivilegedFileHelper.createNewFile(log);
-
- out = PrivilegedFileHelper.fileOutputStream(log).getChannel();
- out.position(1024 * fileSize - 1);
- out.write(ByteBuffer.wrap(new byte[]{0}));
- out.position(0);
- out.force(false);
- }
- else
- {
- out = PrivilegedFileHelper.fileOutputStream(log, true).getChannel();
- }
+ public Void run() throws Exception
+ {
+ // set file size;
+ if (!log.exists())
+ {
+ log.getParentFile().mkdirs();
+ log.createNewFile();
+ out = new FileOutputStream(log).getChannel();
+ out.position(1024 * fileSize - 1);
+ out.write(ByteBuffer.wrap(new byte[]{0}));
+ out.position(0);
+ out.force(false);
+ }
+ else
+ {
+ out = new FileOutputStream(log, true).getChannel();
+ }
+ return null;
+ }
+ });
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java 2011-08-30 13:12:37 UTC (rev 4811)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java 2011-08-30 13:21:51 UTC (rev 4812)
@@ -507,16 +507,9 @@
try
{
long time = System.currentTimeMillis();
- final Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
+ Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
log.debug("Starting spell checker index refresh");
- SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
- {
- public Void run() throws IOException
- {
- spellChecker.indexDictionary(dict);
- return null;
- }
- });
+ spellChecker.indexDictionary(dict);
time = System.currentTimeMillis() - time;
time = time / 1000;
log.info("Spell checker index refreshed in: " + new Long(time) + " s.");
12 years, 7 months