Author: shuber
Date: Thu Oct 18 16:56:43 2007
New Revision: 18938
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D18938&repname=
=3Djahia
Log:
Synchronization optimizations. ServicesRegistry now uses an internal cache =
that is not synchronized, because when calling the getBean method on a Spri=
ng ApplicationContext we were accessing a synchronized map. Also removed sy=
nchronized getInstance() call on JahiaACLManagerService. Refactored some cl=
asses to store locally references to the services they need.
Modified:
trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.java
trunk/core/src/java/org/jahia/registries/ServicesRegistry.java
trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java
trunk/core/src/java/org/jahia/services/containers/ContainerFactory.java
trunk/core/src/java/org/jahia/services/fields/ContentField.java
Modified: trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.j=
ava
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/data/containers/JahiaContainerSet.java&rev=3D18938&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.java (o=
riginal)
+++ trunk/core/src/java/org/jahia/data/containers/JahiaContainerSet.java Th=
u Oct 18 16:56:43 2007
@@ -111,6 +111,8 @@
*/
private Map cachedContainerListsFromContainers;
=
+ private JahiaContainersService jahiaContainersService;
+
//--------------------------------------------------------------------=
-----
/***
* constructor
@@ -127,6 +129,7 @@
this.declaredFieldDefProps =3D new Hashtable();
this.cachedFieldsFromContainers =3D new Hashtable();
this.cachedContainersFromContainerLists =3D new Hashtable();
+ this.jahiaContainersService =3D ServicesRegistry.getInstance().get=
JahiaContainersService();
ApplicationContext context =3D SpringContextSingleton.getInstance(=
).getContext();
this.containerManager =3D (JahiaContainerManager) context.getBean(=
JahiaContainerManager.class.getName());
this.containerListManager =3D (JahiaContainerListManager) context.=
getBean(JahiaContainerListManager.class.getName());
@@ -807,8 +810,7 @@
declaredContainers.add(containerName);
=
// last, we create a new fake container list if the contai=
ner list is empty
- int clistID =3D ServicesRegistry.getInstance()
- .getJahiaContainersService().getContainerListID(
+ int clistID =3D jahiaContainersService.getContainerListID(
containerName,
jData.getProcessingContext().getPage().get=
ID());
if (clistID =3D=3D -1) {
@@ -1137,8 +1139,7 @@
containerName);
EntryLoadRequest usedLoadRequest =3D jData.getProcessingConte=
xt().getEntryLoadRequest();
if (theContainerList =3D=3D null) {
- int clistID =3D ServicesRegistry.getInstance().
- getJahiaContainersService().
+ int clistID =3D jahiaContainersService.
getContainerListID(containerName,
jData.getProcessingContex=
t().getPage().getID());
if (clistID !=3D -1) {
@@ -1148,15 +1149,13 @@
usedLoadRequest =3D ctnLoadRequest;
if (ctnLoadRequest.isVersioned()) {
// does the container exists at this archive date
- theContainerList =3D ServicesRegistry.getInstance(=
).
- getJahiaContainersService()
+ theContainerList =3D jahiaContainersService
.loadContainerListInfo(clistID,
ctnLoadRequest);
}
if (ctnLoadRequest.isVersioned() && theContainerList =
=3D=3D null) {
// return the active version of the container list=
but without any containers !
- theContainerList =3D ServicesRegistry.getInstance(=
).
- getJahiaContainersService()
+ theContainerList =3D jahiaContainersService
.loadContainerListInfo(clistID);
// to avoid reloading the container
theContainerList.setIsContainersLoaded(true);
@@ -1198,7 +1197,7 @@
if ( theContainerList !=3D null && theContainerList.getID() !=
=3D 0
&& !theContainerList.getContentContainerList().hasActi=
veOrStagingEntries() ){
// create staged entries
- ServicesRegistry.getInstance().getJahiaContainersService()=
.saveContainerListInfo(
+ jahiaContainersService.saveContainerListInfo(
theContainerList,theContainerList.getACL().getPare=
ntID(),
jData.getProcessingContext());
}
@@ -1328,8 +1327,7 @@
getInstance().
getDefinition(jData.getProce=
ssingContext().
getSiteID(), containerName);
- SortedSet parentSubContainerDefinitions =3D ServicesRegistry.
- getInstance().getJah=
iaContainersService().
+ SortedSet parentSubContainerDefinitions =3D jahiaContainersSer=
vice.
getContainerDefiniti=
onParents(theDef.getID());
/**
* todo possible bug here, should we check the parent sub
@@ -1347,8 +1345,7 @@
}
}
=
- int containerListID =3D ServicesRegistry.getInstance().
- getJahiaContainersService().
+ int containerListID =3D jahiaContainersService.
getContainerListID(containerName, pageID);
if (containerListID !=3D -1) {
// let's update cross reference list
@@ -1370,15 +1367,13 @@
getEntryLoadRequest();
if (ctnLoadRequest.isVersioned()) {
// does the container exists at this archive date
- theContainerList =3D ServicesRegistry.getInstance().
- getJahiaContainersService()
+ theContainerList =3D jahiaContainersService
.loadContainerListInfo(containerLis=
tID,
ctnLoadRequest);
}
if (ctnLoadRequest.isVersioned() && theContainerList =3D=
=3D null) {
// return the active version of the container list but=
without any containers !
- theContainerList =3D ServicesRegistry.getInstance().
- getJahiaContainersService()
+ theContainerList =3D jahiaContainersService
.loadContainerListInfo(containerLis=
tID);
// to avoid reload of containers
theContainerList.setIsContainersLoaded(true);
@@ -1442,7 +1437,7 @@
0,
pageID, theDef.getID(), 0);
=
- ServicesRegistry.getInstance().getJahiaContainersService().
+ jahiaContainersService.
saveContainerListInfo(fakeContainerList, pageACLID, th=
is.jData.getProcessingContext());
addContainerList(fakeContainerList);
=
@@ -1570,8 +1565,6 @@
=
public JahiaContainerList ensureContainerList(JahiaContainerDefinition=
def, int page, int parent) throws JahiaException {
synchronized(JahiaContainerSet.CLASS_NAME){
- JahiaContainersService jahiaContainersService =3D ServicesRegi=
stry.getInstance().
- getJahiaContainersService();
int id =3D -1;
if (parent =3D=3D 0) {
id =3D jahiaContainersService.getContainerListID(def.getNa=
me(), page);
@@ -1597,7 +1590,7 @@
this.addContainerList(list);
=
int containerType =3D def.getContainerListType();
- if ( ServicesRegistry.getInstance().getJahiaContainersServ=
ice()
+ if ( jahiaContainersService
.getctnidsInList(list.getID()).size() =3D=3D 0
&& ((containerType & JahiaContainerDefinition.MANDATOR=
Y_TYPE) !=3D 0)){
=
@@ -1609,11 +1602,11 @@
list.getAclID(),
list.getctndefid(),
0, 2);
- ServicesRegistry.getInstance().getJahiaContainersServi=
ce().
+ jahiaContainersService.
saveContainer(container, list.getID(), jData.getPr=
ocessingContext());
container.setLanguageCode(jData.getProcessingContext()=
.getLocale().toString());
container.fieldsStructureCheck(jData.getProcessingCont=
ext());
- ServicesRegistry.getInstance().getJahiaContainersServi=
ce().
+ jahiaContainersService.
saveContainer(container, list.getID(), jData.getPr=
ocessingContext());
list.addContainer(container);
}
Modified: trunk/core/src/java/org/jahia/registries/ServicesRegistry.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/registries/ServicesRegistry.java&rev=3D18938&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/registries/ServicesRegistry.java (origina=
l)
+++ trunk/core/src/java/org/jahia/registries/ServicesRegistry.java Thu Oct =
18 16:56:43 2007
@@ -73,9 +73,7 @@
import org.jahia.settings.SettingsBean;
import org.springframework.beans.BeansException;
=
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Set;
+import java.util.*;
=
/**
* The ServicesRegistry class that give a unique access point to Jahia Ser=
vices.
@@ -223,6 +221,9 @@
"JahiaStatisticsManagerService";
// Nicol=C3=83=C2=A1s Charczewski - Neoris Argentina - added 07/04/200=
6 - End
=
+ // This map is an optimization to avoid synchronization issues.
+ private Map servicesCache =3D new HashMap();
+
/** Return the unique instance of this class.
*
* @return the unique instance of this class
@@ -272,7 +273,13 @@
* @return the service instance
*/
public JahiaService getService (String serviceName) {
- return (JahiaService) SpringContextSingleton.getInstance().getCont=
ext().getBean(serviceName);
+ JahiaService jahiaService =3D (JahiaService) servicesCache.get(ser=
viceName);
+ if (jahiaService !=3D null) {
+ return jahiaService;
+ }
+ jahiaService =3D (JahiaService) SpringContextSingleton.getInstance=
().getContext().getBean(serviceName);
+ servicesCache.put(serviceName, jahiaService);
+ return jahiaService;
} // end getService
=
=
@@ -568,6 +575,7 @@
JahiaService service =3D null;
try {
service =3D (JahiaService) SpringContextSingleton.getInstance(=
).getContext().getBean(serviceName,JahiaService.class);
+ servicesCache.put(serviceName, service);
=
service.start();
=
Modified: trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService=
.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/acl/JahiaACLManagerService.java&rev=3D18938&repname=3Djah=
ia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java =
(original)
+++ trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java =
Thu Oct 18 16:56:43 2007
@@ -58,7 +58,7 @@
private static final org.apache.log4j.Logger logger =3D
org.apache.log4j.Logger.getLogger(JahiaACLManagerService.class=
);
=
- private static JahiaACLManagerService mACLService;
+ private static JahiaACLManagerService mACLService =3D new JahiaACLMana=
gerService();
=
// the preloaded container acls by page.
public static final String PRELOADED_CTNR_ACL_BY_PAGE_CACHE =3D "Prelo=
adedCtnrACLByPageCache";
@@ -98,9 +98,7 @@
*
* @throws JahiaException
*/
- protected JahiaACLManagerService()
- throws JahiaException {
-
+ protected JahiaACLManagerService() {
}
=
=
@@ -140,16 +138,7 @@
*
* @return Return the reterence on the ACL Manager Service.
*/
- public static synchronized JahiaACLManagerService getInstance() {
- if (mACLService =3D=3D null) {
- try {
- mACLService =3D new JahiaACLManagerService();
-
- } catch (JahiaException ex) {
- logger.fatal("Could not instanciate the ACL Manager Servic=
e!!");
- return null;
- }
- }
+ public static JahiaACLManagerService getInstance() {
return mACLService;
}
=
Modified: trunk/core/src/java/org/jahia/services/containers/ContainerFactor=
y.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/containers/ContainerFactory.java&rev=3D18938&repname=3Dja=
hia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/services/containers/ContainerFactory.java=
(original)
+++ trunk/core/src/java/org/jahia/services/containers/ContainerFactory.java=
Thu Oct 18 16:56:43 2007
@@ -61,6 +61,7 @@
private JahiaContainerManager containerManager;
private JahiaContainerListManager containerListManager;
private JahiaObjectManager jahiaObjectManager;
+ private JahiaContainersService jahiaContainersService;
//--------------------------------------------------------------------=
------
=
/**
@@ -71,6 +72,7 @@
containerManager =3D (JahiaContainerManager) context.getBean(Jahia=
ContainerManager.class.getName());
containerListManager =3D (JahiaContainerListManager) context.getBe=
an(JahiaContainerListManager.class.getName());
jahiaObjectManager =3D (JahiaObjectManager) context.getBean(JahiaO=
bjectManager.class.getName());
+ jahiaContainersService =3D ServicesRegistry.getInstance().getJahia=
ContainersService();
}
=
public static synchronized ContainerFactory getInstance() {
@@ -109,8 +111,7 @@
container.clearFields();
container.setFieldsLoaded(true);
// not already in fullyLoadedList -> load it
- final List fieldIDs =3D ServicesRegistry.getInstance()
- .getJahiaContainersService().getFieldIDsInContaine=
r(
+ final List fieldIDs =3D jahiaContainersService.getFieldIDs=
InContainer(
container.getID(), loadRequest);
for (int i =3D 0; i < fieldIDs.size(); i++) {
final int fieldID =3D ((Integer) fieldIDs.get(i)).intV=
alue();
@@ -128,8 +129,6 @@
synchronized (container) {
container.clearContainerLists();
container.setContainerListsLoaded(true);
- final JahiaContainersService ctnServ =3D ServicesRegistry
- .getInstance().getJahiaContainersService();
=
// load container lists
// load the the containers for this one
@@ -140,7 +139,7 @@
final int size =3D listIDs.size();
for (int i =3D 0; i < size; i++) {
final Integer listID =3D (Integer) listIDs.get(i);
- final JahiaContainerList cList =3D ctnServ.loadContain=
erList(
+ final JahiaContainerList cList =3D jahiaContainersServ=
ice.loadContainerList(
listID.intValue(), loadFlag, jParams, loadRequ=
est,
cachedFieldsFromContainers,
cachedContainersFromContainerLists,
@@ -227,7 +226,7 @@
cachedContainersFromContainerLists);
=
if (ctnids =3D=3D null) {
- ctnids =3D ServicesRegistry.getInstance().getJahiaContainersSe=
rvice().
+ ctnids =3D jahiaContainersService.
getctnidsInList(cList.getID(), loadRequest);
}
if (ctnids =3D=3D null) {
@@ -256,7 +255,7 @@
final Map cachedConta=
inersFromContainerLists,
final Map cachedConta=
inerListsFromContainers)
throws JahiaException {
- JahiaContainerList cList =3D ServicesRegistry.getInstance().getJah=
iaContainersService().
+ JahiaContainerList cList =3D jahiaContainersService.
loadContainerListInfo(ctnListID, loadRequest);
/*
* We bybass lazy load here! =
@@ -384,17 +383,16 @@
=
// get all container ids
/*
- ctnIds =3D ServicesRegistry.getInstance ()
- .getJahiaContainersService ().getctnidsInList =
(clistID, loadVersion);
+ ctnIds =3D jahiaContainersService.getctnidsInList (cli=
stID, loadVersion);
*/
=
if (resultBitSet =3D=3D null) {
- ctnIds =3D ServicesRegistry.getInstance().getJahia=
ContainersService().
+ ctnIds =3D jahiaContainersService.
getctnidsInList(clist.getID(), loadVersion=
);
=
return ctnIds;
} else {
- ctnIds =3D ServicesRegistry.getInstance().getJahia=
ContainersService().getCtnIds();
+ ctnIds =3D jahiaContainersService.getCtnIds();
=
final Vector v =3D new Vector();
int size =3D ctnIds.size();
@@ -852,7 +850,6 @@
}
}
=
- final JahiaContainersService jahiaContainersService =3D ServicesRe=
gistry.getInstance().getJahiaContainersService();
final Vector v =3D new Vector();
final Map loadedContainers =3D new HashMap();
for (int i =3D 0; i < ctnids.size(); i++) {
Modified: trunk/core/src/java/org/jahia/services/fields/ContentField.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/fields/ContentField.java&rev=3D18938&repname=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/services/fields/ContentField.java (origin=
al)
+++ trunk/core/src/java/org/jahia/services/fields/ContentField.java Thu Oct=
18 16:56:43 2007
@@ -37,12 +37,15 @@
import org.jahia.services.acl.JahiaBaseACL;
import org.jahia.services.containers.ContentContainer;
import org.jahia.services.containers.FieldsChangeEventListener;
+import org.jahia.services.containers.JahiaContainersService;
import org.jahia.services.pages.ContentPage;
import org.jahia.services.sites.JahiaSite;
import org.jahia.services.sites.SiteLanguageSettings;
import org.jahia.services.usermanager.JahiaUser;
import org.jahia.services.version.*;
import org.jahia.services.workflow.WorkflowEvent;
+import org.jahia.services.search.JahiaSearchService;
+import org.jahia.services.events.JahiaEventGeneratorService;
import org.jahia.utils.xml.XMLSerializationOptions;
import org.jahia.utils.xml.XmlWriter;
=
@@ -89,6 +92,12 @@
private transient JahiaFieldsDataManager fieldsDataManager;
private ContentObject parent;
=
+ private static transient JahiaVersionService jahiaVersionService;
+ private static transient JahiaSearchService jahiaSearchService;
+ private static transient JahiaEventGeneratorService jahiaEventService;
+ private static transient JahiaFieldService jahiaFieldService;
+ private static transient JahiaContainersService jahiaContainersService;
+
protected ObjectKey metadataOwnerObjectKey;
=
static {
@@ -219,6 +228,7 @@
this.loadedDBValues =3D new Hashtable(activeAndStagedDBValues);
=
fieldsDataManager =3D (JahiaFieldsDataManager) SpringContextSingle=
ton.getInstance().getContext().getBean(JahiaFieldsDataManager.class.getName=
());
+
}
=
/**
@@ -251,7 +261,7 @@
entryStateables.addAll (versioningEntryStates);
}
// faire le resolving STAGING/ACTIVE/MULTILANGUE a partir de loade=
dDBValues
- return (ContentObjectEntryState) ServicesRegistry.getInstance ().g=
etJahiaVersionService ().resolveEntry (
+ return (ContentObjectEntryState) getJahiaVersionService ().resolve=
Entry (
entryStateables, loadRequest);
}
=
@@ -360,7 +370,7 @@
=
// update the search index
/*
- ServicesRegistry.getInstance ().getJahiaSearchService ()
+ getJahiaSearchService ()
.removeFieldFromSearchEngine (this.getSiteID (), this.=
getID (),
ContentObjectEntryState.WORKFLOW_STATE_START_S=
TAGING, languageCode);
*/
@@ -369,9 +379,9 @@
=
if (!isMetadata()) {
WorkflowEvent theEvent =3D new WorkflowEvent (this, this, =
user, languageCode, true);
- ServicesRegistry.getInstance ().getJahiaEventService ().fi=
reObjectChanged(theEvent);
+ getJahiaEventService ().fireObjectChanged(theEvent);
} else {
- ServicesRegistry.getInstance ().getJahiaSearchService ()
+ getJahiaSearchService ()
.indexContentObject(this, user);
}
=
@@ -412,7 +422,7 @@
}
} else {
JahiaEvent theEvent =3D new JahiaEvent(this, null, this);
- ServicesRegistry.getInstance ().getJahiaEventService ().fi=
reBeforeStagingContentIsDeleted(theEvent);
+ getJahiaEventService ().fireBeforeStagingContentIsDeleted(=
theEvent);
=
Set tempLanguageCodes =3D new HashSet ();
tempLanguageCodes.add (saveRequest.getLanguageCode ());
@@ -421,9 +431,9 @@
=
if (!isMetadata()) {
WorkflowEvent theEvent =3D new WorkflowEvent (this, this, =
user, curLanguageCode, true);
- ServicesRegistry.getInstance ().getJahiaEventService ().fi=
reObjectChanged(theEvent);
+ getJahiaEventService ().fireObjectChanged(theEvent);
} else {
- ServicesRegistry.getInstance ().getJahiaSearchService ()
+ getJahiaSearchService ()
.indexContentObject(this, user);
}
}
@@ -435,7 +445,7 @@
notifyFieldUpdate();
=
// handled by previous objectChanged event
- //ServicesRegistry.getInstance ().getJahiaSearchService ().indexCo=
ntentObject(this, user);
+ // getJahiaSearchService ().indexContentObject(this, user);
=
}
=
@@ -489,7 +499,7 @@
}
=
=
- boolean versioningEnabled =3D ServicesRegistry.getInstance ().getJ=
ahiaVersionService ().isVersioningEnabled (jahiaID);
+ boolean versioningEnabled =3D getJahiaVersionService ().isVersioni=
ngEnabled (jahiaID);
Vector stagedEntries =3D new Vector ();
=
boolean stateModified =3D false;
@@ -676,12 +686,10 @@
=
/** Remove field from search engine */
/*
- ServicesRegistry.getInstance ()
- .getJahiaSearchService ().removeFieldFromSearchEngine (thi=
s);
+ getJahiaSearchService ().removeFieldFromSearchEngine (this);
=
if (!this.willBeCompletelyDeleted (null, null)) {
- ServicesRegistry.getInstance ()
- .getJahiaSearchService().indexContainer(this.getContai=
nerID(), false, jParams);
+ getJahiaSearchService().indexContainer(this.getContainerID(), =
false, jParams);
}*/
=
if (stateModified) {
@@ -699,13 +707,11 @@
stateModifContext,
activationResults);
} else {
- ServicesRegistry.getInstance ()
- .getJahiaSearchService().indexContentObject(this, jPar=
ams.getUser());
+ getJahiaSearchService().indexContentObject(this, jParams.getUs=
er());
}
=
// handled by contentActivationEvent
- //ServicesRegistry.getInstance ()
- // .getJahiaSearchService().indexContentObject(this, jParam=
s.getUser());
+ // getJahiaSearchService().indexContentObject(this, jParams=
.getUser());
=
syncClusterOnValidation();
return activationResults;
@@ -897,17 +903,16 @@
=
/** Remove field from search engine */
/*
- ServicesRegistry.getInstance ()
- .getJahiaSearchService().removeContentObject(this);*/
+ getJahiaSearchService().removeContentObject(this);*/
=
}
=
ContentUndoStagingEvent jahiaEvent =3D new ContentUndoStagingEvent=
(this, this.getSiteID(), jParams);
- ServicesRegistry.getInstance().getJahiaEventService()
+ getJahiaEventService()
.fireContentObjectUndoStaging(jahiaEvent);
// handled by previous event
// update the search index
- //ServicesRegistry.getInstance ().getJahiaSearchService()
+ //getJahiaSearchService()
// .indexContentObject(this, jParams.getUser());
=
}
@@ -1342,7 +1347,7 @@
=
if (!isMetadata()) {
WorkflowEvent theEvent =3D new WorkflowEvent(this, this, saveR=
equest.getUser(), saveRequest.getLanguageCode(), false);
- ServicesRegistry.getInstance ().getJahiaEventService ().fireOb=
jectChanged(theEvent);
+ getJahiaEventService ().fireObjectChanged(theEvent);
} else {
JahiaFieldDefinition d =3D (JahiaFieldDefinition) JahiaFieldDe=
finition.getChildInstance(""+ getDefinitionID(null));
if (!systemMetadata.contains(d.getName())) {
@@ -1355,7 +1360,7 @@
if (((Integer)ls.get(language)).intValue() =3D=3D =
EntryLoadRequest.ACTIVE_WORKFLOW_STATE) {
c.createStaging(language);
WorkflowEvent theEvent =3D new WorkflowEvent(t=
his, c, saveRequest.getUser(), saveRequest.getLanguageCode(), false);
- ServicesRegistry.getInstance ().getJahiaEventS=
ervice ().fireObjectChanged(theEvent);
+ getJahiaEventService ().fireObjectChanged(theE=
vent);
}
}
} catch (ClassNotFoundException e) {
@@ -1364,7 +1369,7 @@
=
}
// stopWatch.start("index postSet");
-// ServicesRegistry.getInstance().getJahiaSearchService()
+// getJahiaSearchService()
// .indexContentObject(this,saveRequest.getUser());
// stopWatch.stop();
}
@@ -1642,7 +1647,7 @@
// 3. create a staged entry with the new type.
// 4. return a new Instance of ContentField of new Type from DB.
=
- boolean versioningEnabled =3D ServicesRegistry.getInstance ().getJ=
ahiaVersionService ().isVersioningEnabled (jahiaID);
+ boolean versioningEnabled =3D getJahiaVersionService ().isVersioni=
ngEnabled (jahiaID);
Set languageCodes =3D new HashSet ();
=
// 1. we backup all active entries that will be replaced
@@ -1944,9 +1949,9 @@
if (result.getStatus() !=3D
RestoreVersionTestResults.FAILED_OPERATION_STATUS ){
try {
- //ServicesRegistry.getInstance().getJahiaSearchService()
+ //getJahiaSearchService()
// .removeFieldFromSearchEngine(this);
- ServicesRegistry.getInstance().getJahiaSearchService().ind=
exContentObject(this, user);
+ getJahiaSearchService().indexContentObject(this, user);
} catch ( Throwable t ){
logger.debug("Error re-indexing the field " + this.getID()
+ " after restore version operation.",t);
@@ -1970,7 +1975,7 @@
*/
public JahiaField getJahiaField (EntryLoadRequest entryLoadRequest)
throws JahiaException {
- return ServicesRegistry.getInstance ().getJahiaFieldService ().
+ return getJahiaFieldService ().
contentFieldToJahiaField (this, entryLoadRequest);
}
=
@@ -2028,7 +2033,7 @@
=
public boolean isMetadata() {
try {
- return ServicesRegistry.getInstance().getJahiaFieldService()
+ return getJahiaFieldService()
.loadFieldDefinition(getFieldDefID()).getJahiaID() =3D=
=3D 0;
} catch (Exception e) {
}
@@ -2049,9 +2054,8 @@
try {
ContentContainer container =3D ContentContainer.getContain=
er(containerID);
if (container.getParentContainerListID() > 0) {
- ServicesRegistry instance =3D ServicesRegistry.getInst=
ance();
- Map properties =3D instance.getJahiaContainersService(=
).getContainerListProperties(container.getParentContainerListID());
- String aclID =3D (String) properties.get("view_field_a=
cl_" + instance.getJahiaFieldService().loadFieldDefinition(fieldDefID).getN=
ame());
+ Map properties =3D getJahiaContainersService().getCont=
ainerListProperties(container.getParentContainerListID());
+ String aclID =3D (String) properties.get("view_field_a=
cl_" + getJahiaFieldService().loadFieldDefinition(fieldDefID).getName());
if (aclID !=3D null && !"".equals(aclID)) {
boolean result =3D false;
try {
@@ -2114,4 +2118,38 @@
fieldsDataManager =3D (JahiaFieldsDataManager) SpringContextSingl=
eton.getInstance().getContext().getBean(JahiaFieldsDataManager.class.getNam=
e());
}
=
+ public static JahiaVersionService getJahiaVersionService() {
+ if (jahiaVersionService =3D=3D null) {
+ jahiaVersionService =3D ServicesRegistry.getInstance().getJahi=
aVersionService();
+ }
+ return jahiaVersionService;
+ }
+
+ public static JahiaSearchService getJahiaSearchService() {
+ if (jahiaSearchService =3D=3D null) {
+ jahiaSearchService =3D ServicesRegistry.getInstance().getJahia=
SearchService();
+ }
+ return jahiaSearchService;
+ }
+
+ public static JahiaEventGeneratorService getJahiaEventService() {
+ if (jahiaEventService =3D=3D null) {
+ jahiaEventService =3D ServicesRegistry.getInstance().getJahiaE=
ventService();
+ }
+ return jahiaEventService;
+ }
+
+ public static JahiaFieldService getJahiaFieldService() {
+ if (jahiaFieldService =3D=3D null) {
+ jahiaFieldService =3D ServicesRegistry.getInstance().getJahiaF=
ieldService();
+ }
+ return jahiaFieldService;
+ }
+
+ public static JahiaContainersService getJahiaContainersService() {
+ if (jahiaContainersService =3D=3D null) {
+ jahiaContainersService =3D ServicesRegistry.getInstance().getJ=
ahiaContainersService();
+ }
+ return jahiaContainersService;
+ }
}
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list