exo-jcr SVN: r4627 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query: lucene and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-07-13 10:57:01 -0400 (Wed, 13 Jul 2011)
New Revision: 4627
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryHits.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
Log:
EXOJCR-1436: IndexReader release added to LuceneQueryHits
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-07-13 14:54:22 UTC (rev 4626)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-07-13 14:57:01 UTC (rev 4627)
@@ -971,17 +971,17 @@
private Set<String> getNodes(final org.apache.lucene.search.Query query) throws RepositoryException
{
Set<String> result = new HashSet<String>();
+ QueryHits hits = null;
try
{
- QueryHits hits = handler.executeQuery(query);
+ hits = handler.executeQuery(query);
ScoreNode sn;
-
while ((sn = hits.nextScoreNode()) != null)
{
- // Node node = session.getNodeById(sn.getNodeId());
result.add(sn.getNodeId());
}
+ return result;
}
catch (IndexOfflineIOException e)
{
@@ -991,7 +991,20 @@
{
throw new RepositoryException(e.getLocalizedMessage(), e);
}
- return result;
+ finally
+ {
+ if (hits != null)
+ {
+ try
+ {
+ hits.close();
+ }
+ catch (IOException e)
+ {
+ log.error("Can not close QueryHits.", e);
+ }
+ }
+ }
}
private boolean isPrefixMatch(final InternalQName value, final String prefix) throws RepositoryException
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryHits.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryHits.java 2011-07-13 14:54:22 UTC (rev 4626)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LuceneQueryHits.java 2011-07-13 14:57:01 UTC (rev 4627)
@@ -41,10 +41,31 @@
*/
private final Scorer scorer;
+ /**
+ * Release IndexReader on LuceneQueryHits.close().
+ */
+ private final boolean releaseReaderOnClose;
+
public LuceneQueryHits(IndexReader reader, IndexSearcher searcher, Query query) throws IOException
{
+ this(reader, searcher, query, false);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param reader IndexReader
+ * @param searcher IndexSearcher
+ * @param query Query
+ * @param releaseReaderOnClose - release IndexReader on LuceneQueryHits.close().
+ * @throws IOException
+ */
+ public LuceneQueryHits(IndexReader reader, IndexSearcher searcher, Query query, boolean releaseReaderOnClose)
+ throws IOException
+ {
this.reader = reader;
this.scorer = query.weight(searcher).scorer(reader, true, false);
+ this.releaseReaderOnClose = releaseReaderOnClose;
}
/**
@@ -66,8 +87,16 @@
*/
public void close() throws IOException
{
- // make sure scorer frees resources
- scorer.skipTo(Integer.MAX_VALUE);
+ if (scorer != null)
+ {
+ // make sure scorer frees resources
+ scorer.advance(Integer.MAX_VALUE);
+ }
+
+ if (releaseReaderOnClose && reader != null && reader instanceof ReleaseableIndexReader)
+ {
+ ((ReleaseableIndexReader)reader).release();
+ }
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-07-13 14:54:22 UTC (rev 4626)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2011-07-13 14:57:01 UTC (rev 4627)
@@ -3054,7 +3054,7 @@
IndexSearcher searcher = new IndexSearcher(reader);
searcher.setSimilarity(getSimilarity());
- return new LuceneQueryHits(reader, searcher, query);
+ return new LuceneQueryHits(reader, searcher, query, true);
}
/**
12 years, 10 months
exo-jcr SVN: r4626 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-07-13 10:54:22 -0400 (Wed, 13 Jul 2011)
New Revision: 4626
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-1436: doUpdateRO and doUpdateRW redundant IndexReader get and release replaced with releaseMultiReader
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-07-13 14:15:42 UTC (rev 4625)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2011-07-13 14:54:22 UTC (rev 4626)
@@ -634,7 +634,7 @@
{
try
{
- getIndexReader().release();
+ releaseMultiReader();
}
catch (IOException e)
{
@@ -768,7 +768,7 @@
{
try
{
- getIndexReader().release();
+ releaseMultiReader();
}
catch (IOException e)
{
12 years, 10 months
exo-jcr SVN: r4625 - jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-07-13 10:15:42 -0400 (Wed, 13 Jul 2011)
New Revision: 4625
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
Log:
EXOJCR-1435 : Unit test was fixed (for working on OS Windows)
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java 2011-07-13 13:25:27 UTC (rev 4624)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java 2011-07-13 14:15:42 UTC (rev 4625)
@@ -1221,9 +1221,15 @@
String backupDitEnv = backDir.getCanonicalPath();
- String newBackupDir =
- "\\${java.io.tmpdir}" + bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "");
+ String relativePath = bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "");
+ String relativePathForWrite = relativePath;
+ if (File.separator.equals("\\"))
+ {
+ relativePathForWrite = relativePath.replaceAll("\\\\", "\\\\\\\\");
+ }
+ String newBackupDir = "\\${java.io.tmpdir}" + relativePathForWrite;
+
File dest = new File(repositoryBackupChainLogPath + ".xml");
dest.createNewFile();
@@ -1231,10 +1237,9 @@
try
{
String sConfig =
- setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDir);
+ setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDir);
- assertTrue(sConfig.contains("${java.io.tmpdir}"
- + bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "")));
+ assertTrue(sConfig.contains("${java.io.tmpdir}" + relativePath));
// check
newRepositoryBackupChainLog = new RepositoryBackupChainLog(dest);
@@ -1277,6 +1282,11 @@
String newBackupDir =
bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(relativePrefixBackupDir, "");
+ String newBackupDirForWrite = newBackupDir;
+ if (File.separator.equals("\\"))
+ {
+ newBackupDirForWrite = newBackupDir.replaceAll("\\\\", "\\\\\\\\");
+ }
File dest = new File(repositoryBackupChainLogPath + ".xml");
dest.createNewFile();
@@ -1284,7 +1294,7 @@
RepositoryBackupChainLog newRepositoryBackupChainLog = null;
String sConfig =
- setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDir);
+ setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDirForWrite);
assertTrue(sConfig.contains(newBackupDir));
12 years, 10 months
exo-jcr SVN: r4624 - kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-13 09:25:27 -0400 (Wed, 13 Jul 2011)
New Revision: 4624
Modified:
kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java
Log:
EXOJCR-1425: Close all database connections, Fix tests
Modified: kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java
===================================================================
--- kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java 2011-07-13 11:48:29 UTC (rev 4623)
+++ kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java 2011-07-13 13:25:27 UTC (rev 4624)
@@ -85,7 +85,7 @@
|| fileName.equals("Probe.java") || fileName.equals("ExportBase.java")
|| fileName.equals("AbstractTestContainer.java") || fileName.equals("ContainerBuilder.java")
|| fileName.equals("WorkspaceStorageCacheBaseCase.java")
- || fileName.equals("ExoRepositoryStub.java"))
+ || fileName.equals("ExoRepositoryStub.java") || fileName.equals("CloseableDataSource.java"))
{
testCode = true;
}
@@ -114,11 +114,8 @@
}
// Only for debug purpose
- // if (!se
- // .getMessage()
- // .equals(
- // "access denied (java.lang.RuntimePermission
- // accessClassInPackage.com.sun.xml.internal.bind.v2.runtime.reflect)"))
+ // if (!se.getMessage().equals(
+ // "access denied (java.lang.RuntimePermission.com.sun.xml.internal.bind.v2.runtime.reflect)"))
// {
// se.printStackTrace();
// }
12 years, 10 months
exo-jcr SVN: r4623 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-13 07:48:29 -0400 (Wed, 13 Jul 2011)
New Revision: 4623
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java
Log:
EXOJCR-1425: Close all database connections
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java 2011-07-13 11:47:50 UTC (rev 4622)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/repository/creation/RepositoryCreationServiceImpl.java 2011-07-13 11:48:29 UTC (rev 4623)
@@ -38,6 +38,7 @@
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.util.IdGenerator;
+import org.exoplatform.services.jdbc.impl.CloseableDataSource;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
@@ -94,12 +95,12 @@
/**
* The default factory class name.
*/
- private static final String BASIC_DATA_SOURCE_FACTORY = "org.apache.commons.dbcp.BasicDataSourceFactory";
+ private static final String DEFAULT_DATA_SOURCE_FACTORY = "org.apache.commons.dbcp.BasicDataSourceFactory";
/**
* The factory class name to create object.
*/
- private String factoryClassName = BASIC_DATA_SOURCE_FACTORY;
+ private String factoryClassName = DEFAULT_DATA_SOURCE_FACTORY;
/**
* The Repository service.
@@ -861,8 +862,7 @@
* the repository name
* @throws RepositoryCreationException
*/
- protected void removeRepositoryLocally(String repositoryName)
- throws RepositoryCreationException
+ protected void removeRepositoryLocally(String repositoryName) throws RepositoryCreationException
{
try
{
@@ -886,7 +886,30 @@
// unbind datasource and close connections
for (String dsName : datasources)
{
- initialContextInitializer.getInitialContextBinder().unbind(dsName);
+ try
+ {
+ // we suppose that lookup() method returns the same instance of datasource by the same name
+ DataSource ds = (DataSource)initialContextInitializer.getInitialContext().lookup(dsName);
+ initialContextInitializer.getInitialContextBinder().unbind(dsName);
+
+ // close datasource
+ if (ds instanceof CloseableDataSource)
+ {
+ ((CloseableDataSource)ds).close();
+ }
+ }
+ catch (NamingException e)
+ {
+ LOG.error("Can't unbind datasource " + dsName, e);
+ }
+ catch (FileNotFoundException e)
+ {
+ LOG.error("Can't unbind datasource " + dsName, e);
+ }
+ catch (XMLStreamException e)
+ {
+ LOG.error("Can't unbind datasource " + dsName, e);
+ }
}
}
catch (RepositoryException e)
@@ -897,18 +920,6 @@
{
throw new RepositoryCreationException("Can't remove repository", e);
}
- catch (FileNotFoundException e)
- {
- throw new RepositoryCreationException("Can't remove repository", e);
- }
- catch (NamingException e)
- {
- throw new RepositoryCreationException("Can't remove repository", e);
- }
- catch (XMLStreamException e)
- {
- throw new RepositoryCreationException("Can't remove repository", e);
- }
}
private DBCreator getDBCreator(DBCreationProperties creationProps) throws ConfigurationException
12 years, 10 months
exo-jcr SVN: r4622 - in kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services: naming and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-13 07:47:50 -0400 (Wed, 13 Jul 2011)
New Revision: 4622
Added:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/CloseableDataSource.java
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/SimpleContext.java
Log:
EXOJCR-1425: Close all database connections
Added: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/CloseableDataSource.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/CloseableDataSource.java (rev 0)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/CloseableDataSource.java 2011-07-13 11:47:50 UTC (rev 4622)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2011 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.jdbc.impl;
+
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+/**
+ * This class is used to wrap the original {@link DataSource}
+ * in order to be able to support close operation.
+ *
+ * @author <a href="abazko(a)exoplatform.com">Anatoliy Bazko</a>
+ * @version $Id$
+ */
+public class CloseableDataSource implements DataSource
+{
+ /**
+ * The wrapped {@link DataSource}
+ */
+ private DataSource ds;
+
+ /**
+ * Constructor CloseableDataSource.
+ */
+ public CloseableDataSource(DataSource ds)
+ {
+ this.ds = ds;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public PrintWriter getLogWriter() throws SQLException
+ {
+ checkValid();
+ return ds.getLogWriter();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getLoginTimeout() throws SQLException
+ {
+ checkValid();
+ return ds.getLoginTimeout();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setLogWriter(PrintWriter out) throws SQLException
+ {
+ checkValid();
+ ds.setLogWriter(out);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setLoginTimeout(int seconds) throws SQLException
+ {
+ checkValid();
+ ds.setLoginTimeout(seconds);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isWrapperFor(Class<?> iface) throws SQLException
+ {
+ checkValid();
+ return ds.isWrapperFor(iface);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public <T> T unwrap(Class<T> iface) throws SQLException
+ {
+ checkValid();
+ return ds.unwrap(iface);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Connection getConnection() throws SQLException
+ {
+ checkValid();
+ return ds.getConnection();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Connection getConnection(String username, String password) throws SQLException
+ {
+ checkValid();
+ return ds.getConnection(username, password);
+ }
+
+ /**
+ * Closes datasource to release all idle connections.
+ */
+ public void close()
+ {
+ ds = null;
+ }
+
+ /**
+ * Check if datasouce already closed.
+ *
+ * @throws SQLException
+ * if datasource is closed
+ */
+ private void checkValid() throws SQLException
+ {
+ if (ds == null)
+ {
+ throw new SQLException("The datasource is closed");
+ }
+ }
+}
Property changes on: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/jdbc/impl/CloseableDataSource.java
___________________________________________________________________
Added: svn:keywords
+ Id
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/SimpleContext.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/SimpleContext.java 2011-07-13 06:10:10 UTC (rev 4621)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/SimpleContext.java 2011-07-13 11:47:50 UTC (rev 4622)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.naming;
+import org.exoplatform.services.jdbc.impl.CloseableDataSource;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -41,6 +42,7 @@
import javax.naming.Reference;
import javax.naming.Referenceable;
import javax.naming.spi.NamingManager;
+import javax.sql.DataSource;
/**
* Created by The eXo Platform SAS.
@@ -112,6 +114,12 @@
try
{
obj = NamingManager.getObjectInstance(obj, NAME_PARSER.parse(name), this, getInternalEnv());
+
+ if (obj instanceof DataSource)
+ {
+ obj = new CloseableDataSource((DataSource)obj);
+ }
+
// Re-bind with the object with its new value to be able to return the same ins
bind(name, obj, false);
}
12 years, 10 months
exo-jcr SVN: r4621 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-13 02:10:10 -0400 (Wed, 13 Jul 2011)
New Revision: 4621
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
Log:
EXOJCR-1439: Add getCurrentRepositoryName method to RepositoryServiceImpl
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2011-07-13 06:05:27 UTC (rev 4620)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2011-07-13 06:10:10 UTC (rev 4621)
@@ -191,6 +191,14 @@
return config;
}
+ /**
+ * @return Name of current repository if exists or null in other case
+ */
+ public String getCurrentRepositoryName()
+ {
+ return currentRepositoryName.get();
+ }
+
public ManageableRepository getCurrentRepository() throws RepositoryException
{
if (currentRepositoryName.get() == null)
12 years, 10 months
exo-jcr SVN: r4620 - kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-13 02:05:27 -0400 (Wed, 13 Jul 2011)
New Revision: 4620
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java
Log:
EXOJCR-1416: Get rid of any call to InitialContextInitializer.recall()
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java 2011-07-12 15:16:01 UTC (rev 4619)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/naming/InitialContextInitializer.java 2011-07-13 06:05:27 UTC (rev 4620)
@@ -169,7 +169,7 @@
* of app using different copy of Context, for example per web app
* InitialContext in Tomcat
*/
- @deprecated
+ @Deprecated
public void recall()
{
for (BindReferencePlugin plugin : bindReferencesPlugins)
12 years, 10 months
exo-jcr SVN: r4619 - jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-12 11:16:01 -0400 (Tue, 12 Jul 2011)
New Revision: 4619
Modified:
jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
Log:
EXOJCR-1435: fix tests
Modified: jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java 2011-07-12 14:49:45 UTC (rev 4618)
+++ jcr/trunk/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupUseCasesTest.java 2011-07-12 15:16:01 UTC (rev 4619)
@@ -1222,9 +1222,7 @@
String backupDitEnv = backDir.getCanonicalPath();
String newBackupDir =
- "\\${java.io.tmpdir}"
- + bch.getBackupConfig().getBackupDir().getCanonicalPath()
- .replace(backupDitEnv, "");
+ "\\${java.io.tmpdir}" + bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "");
File dest = new File(repositoryBackupChainLogPath + ".xml");
dest.createNewFile();
@@ -1235,7 +1233,8 @@
String sConfig =
setNewBackupDirInRepositoryBackupChainLog(new File(repositoryBackupChainLogPath), dest, newBackupDir);
- assertTrue(sConfig.contains(newBackupDir.subSequence(1, newBackupDir.length())));
+ assertTrue(sConfig.contains("${java.io.tmpdir}"
+ + bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(backupDitEnv, "")));
// check
newRepositoryBackupChainLog = new RepositoryBackupChainLog(dest);
@@ -1277,7 +1276,7 @@
String relativePrefixBackupDir = backDir.getCanonicalFile().getParent() + File.separator;
String newBackupDir =
- bch.getBackupConfig().getBackupDir().getCanonicalPath().replaceAll(relativePrefixBackupDir, "");
+ bch.getBackupConfig().getBackupDir().getCanonicalPath().replace(relativePrefixBackupDir, "");
File dest = new File(repositoryBackupChainLogPath + ".xml");
dest.createNewFile();
12 years, 10 months
exo-jcr SVN: r4618 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache and 4 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-07-12 10:49:45 -0400 (Tue, 12 Jul 2011)
New Revision: 4618
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/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
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/jndi-naming.xml
Log:
EXOJCR-1416: Get rid of any call to InitialContextInitializer.recall()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2011-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2011-07-12 14:49:45 UTC (rev 4618)
@@ -117,9 +117,6 @@
configureJDBCCacheLoader(config.getLockManager());
cache = factory.createCache("L" + config.getUniqueName().replace("_", ""), config.getLockManager());
-
- // Context recall is a workaround of JDBCCacheLoader starting.
- context.recall();
}
else
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2011-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2011-07-12 14:49:45 UTC (rev 4618)
@@ -212,9 +212,6 @@
}
createStructuredNode(lockRoot);
-
- // Context recall is a workaround of JDBCCacheLoader starting.
- context.recall();
}
else
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-07-12 14:49:45 UTC (rev 4618)
@@ -63,6 +63,7 @@
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
import org.exoplatform.services.jdbc.DataSourceProvider;
+import org.exoplatform.services.jdbc.impl.ManagedDataSource;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
@@ -255,11 +256,6 @@
FileCleanerHolder fileCleanerHolder, DataSourceProvider dsProvider) throws RepositoryConfigurationException, NamingException,
RepositoryException, IOException
{
-
- // This recall is workaround for tenants creation. There is a trouble in visibility datasource
- // binded in one tomcat context from another tomcat context.
- contextInit.recall();
-
checkIntegrity(wsConfig, repConfig);
this.wsConfig = wsConfig;
this.containerName = wsConfig.getName();
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-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration-jbc.xml 2011-07-12 14:49:45 UTC (rev 4618)
@@ -379,6 +379,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtest"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="100" />
</properties-param>
</init-params>
</component-plugin>
@@ -622,6 +623,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
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-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2011-07-12 14:49:45 UTC (rev 4618)
@@ -379,6 +379,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtest"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="100" />
</properties-param>
</init-params>
</component-plugin>
@@ -622,6 +623,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
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-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-jbc.xml 2011-07-12 14:49:45 UTC (rev 4618)
@@ -360,7 +360,8 @@
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtest"/>
<property name="username" value="sa"/>
- <property name="password" value=""/>
+ <property name="password" value=""/>
+ <property name="maxActive" value="100" />
</properties-param>
</init-params>
</component-plugin>
@@ -604,6 +605,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
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-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc-jbc.xml 2011-07-12 14:49:45 UTC (rev 4618)
@@ -280,6 +280,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtest"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="100" />
</properties-param>
</init-params>
</component-plugin>
@@ -442,6 +443,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
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-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2011-07-12 14:49:45 UTC (rev 4618)
@@ -280,6 +280,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtest"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="100" />
</properties-param>
</init-params>
</component-plugin>
@@ -442,6 +443,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
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-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2011-07-12 14:49:45 UTC (rev 4618)
@@ -361,6 +361,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrtest"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="100" />
</properties-param>
</init-params>
</component-plugin>
@@ -604,6 +605,7 @@
<property name="url" value="jdbc:hsqldb:file:target/temp/data/testdbcleaner"/>
<property name="username" value="sa"/>
<property name="password" value=""/>
+ <property name="maxActive" value="20" />
</properties-param>
</init-params>
</component-plugin>
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/jndi-naming.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/jndi-naming.xml 2011-07-12 14:45:41 UTC (rev 4617)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/jndi-naming.xml 2011-07-12 14:49:45 UTC (rev 4618)
@@ -121,6 +121,14 @@
<programlisting language="xml"> <component>
<type>org.exoplatform.services.naming.InitialContextInitializer</type>
<init-params>
+ <value-param>.
+ <name>bindings-store-path</name>.
+ <value>bind-references.xml</value>.
+ </value-param>.
+ <value-param>
+ <name>overload-context-factory</name>
+ <value>true</value>
+ </value-param>
<properties-param>
<name>default-properties</name>
<description>Default initial context properties</description>
@@ -131,10 +139,6 @@
<description>Mandatory initial context properties</description>
<property name="java.naming.provider.url" value="rmi://localhost:9999"/>
</properties-param>
- <value-param>.
- <name>bindings-store-path</name>.
- <value>bind-references.xml</value>.
- </value-param>.
</init-params>
</component></programlisting>
@@ -143,6 +147,13 @@
<para><emphasis role="bold">binding-store-path</emphasis> is file path
which stores binded datasources in runtime</para>
+ <para><emphasis role="bold">overload-context-factory</emphasis> allows to
+ overload the default initial context factory by a context factory that is
+ ExoContainer aware and that is able to delegate to the original initial
+ context factory if it detects that it is not in the eXo scope. By default
+ the feature is disabled since it is only required on AS that don't share
+ the objects by default like tomcat but unlike JBoss AS</para>
+
<para>The <envar>BindReferencePlugin</envar> component plugin
configuration example (for JDBC datasource):</para>
12 years, 10 months