Author: julien_viet
Date: 2010-05-22 04:10:53 -0400 (Sat, 22 May 2010)
New Revision: 3169
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
Log:
GTNPORTAL-1238 : Encapsulate how repository name is obtained
Modified:
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
===================================================================
---
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2010-05-21
15:05:21 UTC (rev 3168)
+++
portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2010-05-22
08:10:53 UTC (rev 3169)
@@ -236,8 +236,9 @@
{
LocalGadgetData localData = (LocalGadgetData)data;
url =
- "jcr/repository/" + chromatticLifeCycle.getWorkspaceName() +
"/production/app:gadgets/app:" + def.getName()
- + "/app:data/app:resources/" + localData.getFileName();
+ "jcr/" + chromatticLifeCycle.getRepositoryName() + "/" +
+ chromatticLifeCycle.getWorkspaceName() +
"/production/app:gadgets/app:" + def.getName() +
+ "/app:data/app:resources/" + localData.getFileName();
}
else
{
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java 2010-05-21
15:05:21 UTC (rev 3168)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/chromattic/ChromatticLifeCycle.java 2010-05-22
08:10:53 UTC (rev 3169)
@@ -20,6 +20,7 @@
import org.chromattic.api.Chromattic;
import org.chromattic.api.ChromatticBuilder;
+import org.chromattic.api.UndeclaredRepositoryException;
import org.exoplatform.container.component.BaseComponentPlugin;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
@@ -123,6 +124,18 @@
return domainName;
}
+ public final String getRepositoryName()
+ {
+ try
+ {
+ return
manager.repositoryService.getCurrentRepository().getConfiguration().getName();
+ }
+ catch (RepositoryException e)
+ {
+ throw new UndeclaredRepositoryException("JCR exceptions are really
bad", e);
+ }
+ }
+
public final String getWorkspaceName()
{
return workspaceName;
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java 2010-05-21
15:05:21 UTC (rev 3168)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/GlobalKey.java 2010-05-22
08:10:53 UTC (rev 3169)
@@ -19,12 +19,7 @@
package org.exoplatform.portal.pom.config;
-import org.exoplatform.services.jcr.RepositoryService;
-import org.exoplatform.services.jcr.core.ManageableRepository;
-
-import javax.jcr.RepositoryException;
import java.io.Serializable;
-import java.lang.reflect.UndeclaredThrowableException;
/**
* A global key wrapping a local key including the current repository id.
@@ -35,17 +30,9 @@
public class GlobalKey implements Serializable
{
- public static GlobalKey wrap(RepositoryService repoService, Serializable localKey)
+ public static GlobalKey wrap(String repositoryName, Serializable localKey)
{
- try
- {
- ManageableRepository repo = repoService.getCurrentRepository();
- return new GlobalKey(repo.getConfiguration().getName(), localKey);
- }
- catch (RepositoryException e)
- {
- throw new UndeclaredThrowableException(e);
- }
+ return new GlobalKey(repositoryName, localKey);
}
/** . */
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2010-05-21
15:05:21 UTC (rev 3168)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2010-05-22
08:10:53 UTC (rev 3169)
@@ -74,7 +74,7 @@
public void cachePut(Serializable key, Object value)
{
- GlobalKey globalKey = GlobalKey.wrap(repositoryService, key);
+ GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
//
if (log.isTraceEnabled())
@@ -88,7 +88,7 @@
public Object cacheGet(Serializable key)
{
- GlobalKey globalKey = GlobalKey.wrap(repositoryService, key);
+ GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
//
Object value = cache.get(globalKey);
@@ -105,7 +105,7 @@
public void cacheRemove(Serializable key)
{
- GlobalKey globalKey = GlobalKey.wrap(repositoryService, key);
+ GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
//
if (log.isTraceEnabled())
Show replies by date