Author: dabbous
Date: 2006-06-30 05:49:42-0700
New Revision: 10193
Modified:
branches/release/b21/src/java/org/apache/fulcrum/localization/Localization.java
branches/release/b21/src/java/org/tigris/scarab/om/ParentChildAttributeOption.java
branches/release/b21/src/java/org/tigris/scarab/om/ROptionOption.java
branches/release/b21/src/java/org/tigris/scarab/services/cache/ScarabCache.java
branches/release/b21/src/java/org/tigris/scarab/util/ComponentLocator.java
branches/release/b21/src/java/org/tigris/scarab/util/word/LuceneSearchIndex.java
branches/release/b21/src/java/org/tigris/scarab/util/word/SearchFactory.java
Log:
fixed a bug due to parallel threading: yaafi was sometimes
initialized twices causing al sorts of unexpected behaviour
during runtime.
Modified: branches/release/b21/src/java/org/apache/fulcrum/localization/Localization.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/apache/fulcrum/localization/Localization.java?view=diff&rev=10193&p1=branches/release/b21/src/java/org/apache/fulcrum/localization/Localization.java&p2=branches/release/b21/src/java/org/apache/fulcrum/localization/Localization.java&r1=10192&r2=10193
==============================================================================
--- branches/release/b21/src/java/org/apache/fulcrum/localization/Localization.java (original)
+++ branches/release/b21/src/java/org/apache/fulcrum/localization/Localization.java 2006-06-30 05:49:42-0700
@@ -58,9 +58,7 @@
import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
-
-import org.apache.fulcrum.TurbineServices;
-import org.apache.turbine.services.yaaficomponent.YaafiComponentService;
+import org.tigris.scarab.services.ServiceManager;
/**
* <p>Wrapper around the TurbineLocalization Service that makes it easy
@@ -284,15 +282,8 @@
{
if (localizationService==null)
{
- try{
- YaafiComponentService yaafi = (YaafiComponentService) TurbineServices.getInstance().getService(
- YaafiComponentService.SERVICE_NAME);
- localizationService = (LocalizationService) yaafi.lookup(LocalizationService.class.getName());
- }
- catch (Exception e)
- {
- throw new RuntimeException("Problem looking up localization service: " + e.getMessage());
- }
+ ServiceManager sm = ServiceManager.getInstance();
+ localizationService = (LocalizationService) sm.lookup(LocalizationService.class);
}
return localizationService;
}
Modified: branches/release/b21/src/java/org/tigris/scarab/om/ParentChildAttributeOption.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/om/ParentChildAttributeOption.java?view=diff&rev=10193&p1=branches/release/b21/src/java/org/tigris/scarab/om/ParentChildAttributeOption.java&p2=branches/release/b21/src/java/org/tigris/scarab/om/ParentChildAttributeOption.java&r1=10192&r2=10193
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/om/ParentChildAttributeOption.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/om/ParentChildAttributeOption.java 2006-06-30 05:49:42-0700
@@ -49,14 +49,12 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.fulcrum.TurbineServices;
import org.apache.fulcrum.cache.CachedObject;
import org.apache.fulcrum.cache.GlobalCacheService;
import org.apache.fulcrum.cache.ObjectExpiredException;
import org.apache.fulcrum.intake.Retrievable;
-import org.apache.fulcrum.localization.Localization;
import org.apache.torque.TorqueException;
-import org.apache.turbine.services.yaaficomponent.YaafiComponentService;
+import org.tigris.scarab.services.ServiceManager;
import org.tigris.scarab.tools.localization.L10NKey;
import org.tigris.scarab.tools.localization.L10NKeySet;
import org.tigris.scarab.util.ScarabException;
@@ -391,9 +389,8 @@
protected static final GlobalCacheService getGlobalCacheService()
{
try{
- YaafiComponentService yaafi = (YaafiComponentService) TurbineServices.getInstance().getService(
- YaafiComponentService.SERVICE_NAME);
- return (GlobalCacheService) yaafi.lookup(GlobalCacheService.class.getName());
+ ServiceManager sm = ServiceManager.getInstance();
+ return (GlobalCacheService) sm.lookup(GlobalCacheService.class);
}
catch (Exception e) {
throw new ScarabRuntimeException(L10NKeySet.ExceptionLookupGlobalCache, e);
Modified: branches/release/b21/src/java/org/tigris/scarab/om/ROptionOption.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/om/ROptionOption.java?view=diff&rev=10193&p1=branches/release/b21/src/java/org/tigris/scarab/om/ROptionOption.java&p2=branches/release/b21/src/java/org/tigris/scarab/om/ROptionOption.java&r1=10192&r2=10193
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/om/ROptionOption.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/om/ROptionOption.java 2006-06-30 05:49:42-0700
@@ -47,14 +47,13 @@
*/
// Turbine classes
-import org.apache.fulcrum.TurbineServices;
import org.apache.fulcrum.cache.CachedObject;
import org.apache.fulcrum.cache.GlobalCacheService;
import org.apache.fulcrum.cache.ObjectExpiredException;
import org.apache.torque.TorqueException;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
-import org.apache.turbine.services.yaaficomponent.YaafiComponentService;
+import org.tigris.scarab.services.ServiceManager;
import org.tigris.scarab.tools.localization.L10NKeySet;
import org.tigris.scarab.util.ScarabException;
import org.tigris.scarab.util.ScarabRuntimeException;
@@ -245,9 +244,8 @@
protected static final GlobalCacheService getGlobalCacheService()
{
try{
- YaafiComponentService yaafi = (YaafiComponentService) TurbineServices.getInstance().getService(
- YaafiComponentService.SERVICE_NAME);
- return (GlobalCacheService) yaafi.lookup(GlobalCacheService.class.getName());
+ ServiceManager sm = ServiceManager.getInstance();
+ return (GlobalCacheService) sm.lookup(GlobalCacheService.class);
}
catch (Exception e) {
throw new ScarabRuntimeException(L10NKeySet.ExceptionLookupGlobalCache, e);
Modified: branches/release/b21/src/java/org/tigris/scarab/services/cache/ScarabCache.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/services/cache/ScarabCache.java?view=diff&rev=10193&p1=branches/release/b21/src/java/org/tigris/scarab/services/cache/ScarabCache.java&p2=branches/release/b21/src/java/org/tigris/scarab/services/cache/ScarabCache.java&r1=10192&r2=10193
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/services/cache/ScarabCache.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/services/cache/ScarabCache.java 2006-06-30 05:49:42-0700
@@ -49,8 +49,7 @@
import java.io.Serializable;
import java.util.Map;
-import org.apache.fulcrum.TurbineServices;
-import org.apache.turbine.services.yaaficomponent.YaafiComponentService;
+import org.tigris.scarab.services.ServiceManager;
import org.tigris.scarab.tools.localization.L10NKeySet;
import org.tigris.scarab.util.ScarabRuntimeException;
@@ -126,9 +125,8 @@
public static final ScarabCacheService getService() {
if (scarabCacheService == null) {
try {
- YaafiComponentService yaafi = (YaafiComponentService) TurbineServices.getInstance().getService(
- YaafiComponentService.SERVICE_NAME);
- scarabCacheService = (ScarabCacheService) yaafi.lookup(ScarabCacheService.class.getName());
+ ServiceManager sm = ServiceManager.getInstance();
+ scarabCacheService = (ScarabCacheService) sm.lookup(ScarabCacheService.class);
} catch (Exception e) {
throw new ScarabRuntimeException(
L10NKeySet.ExceptionScarabCacheService, e);
Modified: branches/release/b21/src/java/org/tigris/scarab/util/ComponentLocator.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/util/ComponentLocator.java?view=diff&rev=10193&p1=branches/release/b21/src/java/org/tigris/scarab/util/ComponentLocator.java&p2=branches/release/b21/src/java/org/tigris/scarab/util/ComponentLocator.java&r1=10192&r2=10193
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/util/ComponentLocator.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/util/ComponentLocator.java 2006-06-30 05:49:42-0700
@@ -6,9 +6,8 @@
*/
package org.tigris.scarab.util;
-import org.apache.fulcrum.TurbineServices;
import org.apache.fulcrum.mimetype.MimeTypeService;
-import org.apache.turbine.services.yaaficomponent.YaafiComponentService;
+import org.tigris.scarab.services.ServiceManager;
import org.tigris.scarab.tools.localization.L10NKeySet;
/**
@@ -42,12 +41,14 @@
* @param class1
* @return
*/
- private static Object lookup(Class clazz) {
- YaafiComponentService yaafi = (YaafiComponentService) TurbineServices
- .getInstance().getService(YaafiComponentService.SERVICE_NAME);
- try {
- return yaafi.lookup(clazz.getName());
- } catch (Exception e) {
+ private static Object lookup(Class clazz)
+ {
+ try
+ {
+ ServiceManager sm = ServiceManager.getInstance();
+ return sm.lookup(clazz);
+ } catch (Exception e)
+ {
throw new ScarabRuntimeException(
L10NKeySet.ExceptionComponentLocator,
clazz.getName(),
Modified: branches/release/b21/src/java/org/tigris/scarab/util/word/LuceneSearchIndex.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/util/word/LuceneSearchIndex.java?view=diff&rev=10193&p1=branches/release/b21/src/java/org/tigris/scarab/util/word/LuceneSearchIndex.java&p2=branches/release/b21/src/java/org/tigris/scarab/util/word/LuceneSearchIndex.java&r1=10192&r2=10193
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/util/word/LuceneSearchIndex.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/util/word/LuceneSearchIndex.java 2006-06-30 05:49:42-0700
@@ -527,7 +527,7 @@
public void updateIndex()
throws Exception
{
- // find estimate of max id
+ Log.get().info("find estimate of max id...");
Criteria crit = new Criteria();
crit.addSelectColumn("max(" + AttributeValuePeer.VALUE_ID + ")");
List records = AttributeValuePeer.doSelectVillageRecords(crit);
@@ -535,6 +535,8 @@
long i = 0L;
List avs = null;
+
+ Log.get().info("index attribute values in database ...");
do
{
crit = new Criteria();
@@ -569,7 +571,7 @@
}
while (i<max || !avs.isEmpty());
- // Attachments
+ Log.get().info("Index attachments ...");// Attachments
crit = new Criteria();
crit.addSelectColumn("max(" + AttachmentPeer.ATTACHMENT_ID + ")");
@@ -616,7 +618,7 @@
}
while (i<max || !atts.isEmpty());
- // finish off with an optimized index
+ Log.get().info("Finish off with an optimized index...");
synchronized (getClass())
{
IndexWriter indexer = null;
@@ -633,7 +635,8 @@
indexer.close();
}
}
- }
+ }
+ Log.get().info("Indexing terminated.");
}
// ---------------- Avalon Lifecycle Methods ---------------------
Modified: branches/release/b21/src/java/org/tigris/scarab/util/word/SearchFactory.java
Url: http://scarab.tigris.org/source/browse/scarab/branches/release/b21/src/java/org/tigris/scarab/util/word/SearchFactory.java?view=diff&rev=10193&p1=branches/release/b21/src/java/org/tigris/scarab/util/word/SearchFactory.java&p2=branches/release/b21/src/java/org/tigris/scarab/util/word/SearchFactory.java&r1=10192&r2=10193
==============================================================================
--- branches/release/b21/src/java/org/tigris/scarab/util/word/SearchFactory.java (original)
+++ branches/release/b21/src/java/org/tigris/scarab/util/word/SearchFactory.java 2006-06-30 05:49:42-0700
@@ -46,9 +46,11 @@
* individuals on behalf of Collab.Net.
*/
-import org.apache.fulcrum.TurbineServices;
+import org.apache.fulcrum.cache.GlobalCacheService;
import org.apache.turbine.services.yaaficomponent.YaafiComponentService;
-import org.tigris.scarab.util.Log;
+import org.tigris.scarab.services.ServiceManager;
+import org.tigris.scarab.tools.localization.L10NKeySet;
+import org.tigris.scarab.util.ScarabRuntimeException;
/**
* Returns an instance of the SearchIndex specified in Scarab.properties
@@ -65,17 +67,13 @@
if (result == null)
{
- try {
- YaafiComponentService yaafi = (YaafiComponentService) TurbineServices.getInstance().getService(
- YaafiComponentService.SERVICE_NAME);
- result = (SearchIndex) yaafi.lookup(SearchIndex.class.getName());
- } catch (Exception e) {
- String str = "Could not create new instance of SearchIndex. "
- + "Could be a result of insufficient permission "
- + "to write the Index to the disk. The default is to "
- + "write the Index into the WEB-INF/index directory.";
- Log.get().error(str, e);
- throw new InstantiationException(str); //EXCEPTION
+
+ try{
+ ServiceManager sm = ServiceManager.getInstance();
+ return (SearchIndex) sm.lookup(SearchIndex.class);
+ }
+ catch (Exception e) {
+ throw new ScarabRuntimeException(L10NKeySet.ExceptionLucene, e);
}
}
return result;
@@ -87,8 +85,7 @@
*/
public static void releaseInstance(SearchIndex searchIndex)
{
- YaafiComponentService yaafi = (YaafiComponentService) TurbineServices.getInstance().getService(
- YaafiComponentService.SERVICE_NAME);
+ YaafiComponentService yaafi = ServiceManager.getService();
searchIndex.clear();
yaafi.release(searchIndex);
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.