You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2009/02/06 03:04:28 UTC
svn commit: r741373 - in /lenya/trunk:
org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/
org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/
org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/ o...
Author: andreas
Date: Fri Feb 6 02:04:27 2009
New Revision: 741373
URL: http://svn.apache.org/viewvc?rev=741373&view=rev
Log:
Continue springification of source factories and related classes.
Added:
lenya/trunk/org.apache.lenya.core.observation/src/main/resources/
lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/
lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/cocoon/
lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/cocoon/spring/
lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/cocoon/spring/lenya-core-observation-components.xml
Modified:
lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java
lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java
lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryUtil.java
lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java
lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/ServletHelper.java
lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java
lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java
lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml
lenya/trunk/org.apache.lenya.core.observation/src/main/java/org/apache/lenya/cms/observation/ObservationManager.java
lenya/trunk/org.apache.lenya.parent/pom.xml
lenya/trunk/org.apache.lenya.welcome/pom.xml
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/AggregatingFallbackSourceFactory.java Fri Feb 6 02:04:27 2009
@@ -24,8 +24,10 @@
import java.util.List;
import java.util.Map;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.Request;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.cocoon.processing.ProcessInfoProvider;
+import org.apache.cocoon.spring.configurator.WebAppContextUtils;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.store.impl.MRUMemoryStore;
import org.apache.lenya.cms.publication.DocumentFactory;
@@ -56,7 +58,7 @@
* </p>
*/
public class AggregatingFallbackSourceFactory extends FallbackSourceFactory {
-
+
/**
* @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
*/
@@ -73,7 +75,10 @@
uris = findUris(location, parameters);
store.hold(cacheKey, uris);
if (getLogger().isDebugEnabled()) {
- getLogger().debug("No cached source URI for key " + cacheKey + ", caching resolved URIs.");
+ getLogger()
+ .debug(
+ "No cached source URI for key " + cacheKey
+ + ", caching resolved URIs.");
}
} else {
uris = cachedUris;
@@ -81,8 +86,7 @@
getLogger().debug("Using cached source URIs for key " + cacheKey);
}
}
- }
- else {
+ } else {
uris = findUris(location, parameters);
}
return new AggregatingSource(location, uris, getSourceResolver());
@@ -90,14 +94,16 @@
protected String[] findUris(final String location, Map parameters) throws IOException,
MalformedURLException {
-
+
FallbackUri uri = new FallbackUri(location);
String pubId = uri.getPubId();
String path = uri.getPath();
try {
- Request request = ContextHelper.getRequest(this.context);
+ final ProcessInfoProvider processInfo = (ProcessInfoProvider) WebAppContextUtils
+ .getCurrentWebApplicationContext().getBean(ProcessInfoProvider.ROLE);
+ HttpServletRequest request = processInfo.getRequest();
if (pubId == null) {
String webappUrl = ServletHelper.getWebappURI(request);
@@ -118,24 +124,26 @@
} else {
uris = new String[0];
}
-
+
List allUris = new ArrayList();
allUris.addAll(Arrays.asList(uris));
-
+
String contextSourceUri = null;
if (path.startsWith("lenya/modules/")) {
final String moduleShortcut = path.split("/")[2];
String baseUri = getModuleManager().getBaseURI(moduleShortcut);
- final String modulePath = path.substring(("lenya/modules/" + moduleShortcut).length());
+ final String modulePath = path.substring(("lenya/modules/" + moduleShortcut)
+ .length());
contextSourceUri = baseUri + modulePath;
} else {
contextSourceUri = "context://" + path;
}
- if (org.apache.lenya.cms.cocoon.source.SourceUtil.exists(contextSourceUri, getSourceResolver())) {
+ if (org.apache.lenya.cms.cocoon.source.SourceUtil.exists(contextSourceUri,
+ getSourceResolver())) {
allUris.add(contextSourceUri);
}
- return (String[]) allUris.toArray(new String[allUris.size()]);
+ return (String[]) allUris.toArray(new String[allUris.size()]);
} catch (Exception e) {
throw new RuntimeException("Resolving path [" + location + "] failed: ", e);
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/cocoon/source/FallbackSourceFactory.java Fri Feb 6 02:04:27 2009
@@ -21,10 +21,10 @@
import java.net.MalformedURLException;
import java.util.Map;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.environment.Request;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.cocoon.processing.ProcessInfoProvider;
+import org.apache.cocoon.spring.configurator.WebAppContextUtils;
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceFactory;
@@ -51,14 +51,15 @@
* Source factory following the fallback principle.
* </p>
* <p>
- * The ID of the current publication can be passed in the URL (<code>fallback:pub://path</code),
+ * The ID of the current publication can be passed in the URL (
+ * <code>fallback:pub://path</code),
* this is necessary as a workaround for bug 40564.
* </p>
*
* @version $Id$
*/
public class FallbackSourceFactory extends AbstractLogEnabled implements SourceFactory,
- Contextualizable, URIAbsolutizer {
+ URIAbsolutizer {
protected MRUMemoryStore store;
private SourceResolver resolver;
@@ -66,7 +67,7 @@
private DocumentFactoryBuilder documentFactoryBuilder;
private PublicationTemplateManager templateManager;
private ModuleManager moduleManager;
-
+
/**
* Configure the spring bean accordingly if you want to use a store.
* @param store The store.
@@ -83,43 +84,43 @@
protected MRUMemoryStore getStore() {
return this.store;
}
-
+
public void setSourceResolver(SourceResolver resolver) {
this.resolver = resolver;
}
-
+
protected SourceResolver getSourceResolver() {
return this.resolver;
}
-
+
public void setRepositoryManager(RepositoryManager repoMgr) {
this.repositoryManager = repoMgr;
}
-
+
protected RepositoryManager getRepositoryManager() {
return this.repositoryManager;
}
-
+
public void setDocumentFactoryBuilder(DocumentFactoryBuilder builder) {
this.documentFactoryBuilder = builder;
}
-
+
protected DocumentFactoryBuilder getDocumentFactoryBuilder() {
return this.documentFactoryBuilder;
}
-
+
public void setTemplateManager(PublicationTemplateManager mgr) {
this.templateManager = mgr;
}
-
+
protected PublicationTemplateManager getTemplateManager() {
return this.templateManager;
}
-
+
public void setModuleManager(ModuleManager mgr) {
this.moduleManager = mgr;
}
-
+
protected ModuleManager getModuleManager() {
return this.moduleManager;
}
@@ -173,7 +174,9 @@
}
protected String getPublicationId() {
- Request request = ContextHelper.getRequest(this.context);
+ final ProcessInfoProvider processInfo = (ProcessInfoProvider) WebAppContextUtils
+ .getCurrentWebApplicationContext().getBean(ProcessInfoProvider.ROLE);
+ HttpServletRequest request = processInfo.getRequest();
String webappUri = ServletHelper.getWebappURI(request);
URLInformation info = new URLInformation(webappUri);
String pubId = null;
@@ -189,10 +192,10 @@
}
return pubId;
}
-
+
protected Source findSource(final String location, Map parameters) throws IOException,
MalformedURLException {
-
+
FallbackUri uri = new FallbackUri(location);
String pubId = uri.getPubId();
@@ -200,8 +203,9 @@
Source source = null;
try {
-
- Request request = ContextHelper.getRequest(this.context);
+ final ProcessInfoProvider processInfo = (ProcessInfoProvider) WebAppContextUtils
+ .getCurrentWebApplicationContext().getBean(ProcessInfoProvider.ROLE);
+ HttpServletRequest request = processInfo.getRequest();
if (pubId == null) {
String webappUrl = request.getRequestURI().substring(
@@ -224,8 +228,8 @@
if (path.startsWith("lenya/modules/")) {
final String moduleShortcut = path.split("/")[2];
String baseUri = this.moduleManager.getBaseURI(moduleShortcut);
- final String modulePath = path
- .substring(("lenya/modules/" + moduleShortcut).length());
+ final String modulePath = path.substring(("lenya/modules/" + moduleShortcut)
+ .length());
source = this.resolver.resolveURI(baseUri + modulePath);
} else {
String contextUri = "context://" + path;
@@ -248,16 +252,6 @@
return new ExistingSourceResolver();
}
- protected org.apache.avalon.framework.context.Context context;
-
- /**
- * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(org.apache.avalon.framework.context.Context _context)
- throws ContextException {
- this.context = _context;
- }
-
/**
* @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
*/
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryManagerImpl.java Fri Feb 6 02:04:27 2009
@@ -17,30 +17,50 @@
*/
package org.apache.lenya.cms.repository;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.lenya.ac.Identity;
+import org.apache.lenya.cms.observation.ObservationRegistry;
/**
* Repository manager implementation.
* @version $Id:$
*/
-public class RepositoryManagerImpl extends AbstractLogEnabled implements RepositoryManager,
- Serviceable {
+public class RepositoryManagerImpl extends AbstractLogEnabled implements RepositoryManager {
- protected ServiceManager manager;
+ public Session createSession(Identity identity, boolean modifiable) throws RepositoryException {
+ SessionImpl session = new SessionImpl(identity, modifiable, getLogger());
+ session.setObservationRegistry(getObservationRegistry());
+ session.setUuidGenerator(getUuidGenerator());
+ session.setSharedItemStore(getSharedItemStore());
+ return session;
+ }
+
+ private SharedItemStore sharedItemStore;
+ private UUIDGenerator uuidGenerator;
+ private ObservationRegistry observationRegistry;
- /**
- * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
- */
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
+ protected SharedItemStore getSharedItemStore() {
+ return sharedItemStore;
}
- public Session createSession(Identity identity, boolean modifiable) throws RepositoryException {
- return new SessionImpl(identity, modifiable, this.manager, getLogger());
+ public void setSharedItemStore(SharedItemStore sharedItemStore) {
+ this.sharedItemStore = sharedItemStore;
+ }
+
+ protected UUIDGenerator getUuidGenerator() {
+ return uuidGenerator;
+ }
+
+ public void setUuidGenerator(UUIDGenerator uuidGenerator) {
+ this.uuidGenerator = uuidGenerator;
+ }
+
+ protected ObservationRegistry getObservationRegistry() {
+ return observationRegistry;
+ }
+
+ public void setObservationRegistry(ObservationRegistry observationRegistry) {
+ this.observationRegistry = observationRegistry;
}
}
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryUtil.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryUtil.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryUtil.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/RepositoryUtil.java Fri Feb 6 02:04:27 2009
@@ -17,6 +17,7 @@
*/
package org.apache.lenya.cms.repository;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.avalon.framework.service.ServiceManager;
@@ -35,7 +36,7 @@
* @return A session.
* @throws RepositoryException if an error occurs.
*/
- public static Session getSession(RepositoryManager repoManager, Request request)
+ public static Session getSession(RepositoryManager repoManager, HttpServletRequest request)
throws RepositoryException {
Session session = (Session) request.getAttribute(Session.class.getName());
if (session == null) {
@@ -77,6 +78,11 @@
return session;
}
+ protected static Identity getIdentity(HttpServletRequest request) {
+ HttpSession session = request.getSession();
+ return (Identity) session.getAttribute(Identity.class.getName());
+ }
+
protected static Identity getIdentity(Request request) {
HttpSession cocoonSession = request.getSession();
return (Identity) cocoonSession.getAttribute(Identity.class.getName());
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/cms/repository/SessionImpl.java Fri Feb 6 02:04:27 2009
@@ -23,9 +23,6 @@
import java.util.List;
import java.util.Set;
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.commons.logging.Log;
import org.apache.lenya.ac.Identity;
@@ -50,8 +47,30 @@
public class SessionImpl extends AbstractLogEnabled implements Session {
protected static final String UNMODIFIABLE_SESSION_ID = "unmodifiable";
- private ServiceManager manager;
private Identity identity;
+ private ObservationRegistry observationRegistry;
+ private UUIDGenerator uuidGenerator;
+
+ protected ObservationRegistry getObservationRegistry() {
+ return observationRegistry;
+ }
+
+ protected void setObservationRegistry(ObservationRegistry observationRegistry)
+ throws RepositoryException {
+ if (this.observationRegistry != null) {
+ throw new IllegalStateException("Observation registry already set.");
+ }
+ this.observationRegistry = observationRegistry;
+ addListener(observationRegistry);
+ }
+
+ protected UUIDGenerator getUuidGenerator() {
+ return uuidGenerator;
+ }
+
+ protected void setUuidGenerator(UUIDGenerator uuidGenerator) {
+ this.uuidGenerator = uuidGenerator;
+ }
/**
* Ctor.
@@ -60,47 +79,19 @@
* @param manager The service manager.
* @param logger The logger.
*/
- public SessionImpl(Identity identity, boolean modifiable, ServiceManager manager, Log logger) {
-
- Assert.notNull("service manager", manager);
- this.manager = manager;
+ public SessionImpl(Identity identity, boolean modifiable, Log logger) {
this.identityMap = new IdentityMapImpl(logger);
this.identity = identity;
this.id = modifiable ? createUuid() : UNMODIFIABLE_SESSION_ID;
- ObservationRegistry registry = null;
- try {
- registry = (ObservationRegistry) this.manager.lookup(ObservationRegistry.ROLE);
- addListener(registry);
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (registry != null) {
- this.manager.release(registry);
- }
- }
-
if (modifiable) {
this.unitOfWork = new UnitOfWorkImpl(this.identityMap, this.identity, getLogger());
}
}
protected String createUuid() {
- String id;
- UUIDGenerator generator = null;
- try {
-
- generator = (UUIDGenerator) this.manager.lookup(UUIDGenerator.ROLE);
- id = generator.nextUUID();
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (generator == null) {
- this.manager.release(generator);
- }
- }
- return id;
+ return getUuidGenerator().nextUUID();
}
public Identity getIdentity() {
@@ -126,17 +117,17 @@
* Commits the transaction.
* @throws RepositoryException if an error occurs.
* @throws ConcurrentModificationException if a transactionable has been modified by another
- * session.
+ * session.
*/
public synchronized void commit() throws RepositoryException, ConcurrentModificationException {
savePersistables();
-
+
this.committing = true;
try {
synchronized (TransactionLock.LOCK) {
-
+
getUnitOfWork().commit();
getSharedItemStore().clear();
}
@@ -190,16 +181,13 @@
}
protected SharedItemStore getSharedItemStore() {
- if (this.sharedItemStore == null) {
- try {
- this.sharedItemStore = (SharedItemStore) this.manager.lookup(SharedItemStore.ROLE);
- } catch (ServiceException e) {
- throw new RuntimeException(e);
- }
- }
return this.sharedItemStore;
}
+ protected void setSharedItemStore(SharedItemStore sharedItemStore) {
+ this.sharedItemStore = sharedItemStore;
+ }
+
/**
* @see org.apache.lenya.cms.repository.Session#getRepositoryItem(org.apache.lenya.cms.repository.RepositoryItemFactory,
* java.lang.String)
@@ -284,7 +272,7 @@
public String getId() {
return this.id;
}
-
+
public String toString() {
return "Session " + getId();
}
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/ServletHelper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/ServletHelper.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/ServletHelper.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/ServletHelper.java Fri Feb 6 02:04:27 2009
@@ -25,6 +25,7 @@
import java.util.HashMap;
import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
@@ -56,6 +57,17 @@
* @param request The request.
* @return A string.
*/
+ public static String getWebappURI(HttpServletRequest request) {
+ String context = request.getContextPath();
+ String requestUri = request.getRequestURI();
+ return getWebappURI(context, requestUri);
+ }
+
+ /**
+ * Returns the URL inside the web application (without the context prefix).
+ * @param request The request.
+ * @return A string.
+ */
public static String getWebappURI(Request request) {
String context = request.getContextPath();
String requestUri = request.getRequestURI();
Modified: lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/AxisUUIDGenerator.java Fri Feb 6 02:04:27 2009
@@ -17,7 +17,6 @@
*/
package org.apache.lenya.cms.repository;
-import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.axis.components.uuid.UUIDGen;
import org.apache.axis.components.uuid.UUIDGenFactory;
import org.apache.cocoon.util.AbstractLogEnabled;
@@ -25,7 +24,7 @@
/**
* UUID generator based on Apache Axis.
*/
-public class AxisUUIDGenerator extends AbstractLogEnabled implements UUIDGenerator, ThreadSafe {
+public class AxisUUIDGenerator extends AbstractLogEnabled implements UUIDGenerator {
// FIXME Get rid of this absurd dependency on Axis!! - fr
private UUIDGen delegate;
Modified: lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/main/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java Fri Feb 6 02:04:27 2009
@@ -17,10 +17,6 @@
*/
package org.apache.lenya.cms.repository;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.lenya.ac.Identity;
import org.apache.lenya.cms.observation.RepositoryEvent;
@@ -33,15 +29,23 @@
/**
* Shared item store implementation.
*/
-public class SharedItemStoreImpl extends AbstractLogEnabled implements SharedItemStore, ThreadSafe, Serviceable {
+public class SharedItemStoreImpl extends AbstractLogEnabled implements SharedItemStore {
private Session session;
- private ServiceManager manager;
+ private RepositoryManager repositoryManager;
+
+ public RepositoryManager getRepositoryManager() {
+ return repositoryManager;
+ }
+
+ public void setRepositoryManager(RepositoryManager repositoryManager) {
+ this.repositoryManager = repositoryManager;
+ }
public synchronized Session getSession() {
if (this.session == null) {
try {
- this.session = RepositoryUtil.createSession(this.manager, null, false);
+ this.session = getRepositoryManager().createSession(null, false);
} catch (RepositoryException e) {
throw new RuntimeException(e);
}
@@ -118,8 +122,4 @@
return getClass().getName();
}
- public void service(ServiceManager manager) throws ServiceException {
- this.manager = manager;
- }
-
}
Modified: lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml (original)
+++ lenya/trunk/org.apache.lenya.core.impl/src/main/resources/META-INF/cocoon/spring/lenya-core-impl-components.xml Fri Feb 6 02:04:27 2009
@@ -20,9 +20,19 @@
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
xmlns="http://www.springframework.org/schema/beans">
<bean name="org.apache.lenya.cms.repository.RepositoryManager"
- class="org.apache.lenya.cms.repository.RepositoryManagerImpl"/>
+ class="org.apache.lenya.cms.repository.RepositoryManagerImpl">
+ <property name="observationRegistry" ref="org.apache.lenya.cms.observation.ObservationRegistry"/>
+ <property name="uuidGenerator" ref="org.apache.lenya.cms.repository.UUIDGenerator"/>
+ <property name="sharedItemStore" ref="org.apache.lenya.cms.repository.SharedItemStore"/>
+ </bean>
<bean name="org.apache.lenya.cms.publication.DocumentFactoryBuilder"
class="org.apache.lenya.cms.publication.DocumentFactoryBuilderImpl"/>
<bean name="org.apache.lenya.cms.module.ModuleManager"
class="org.apache.lenya.cms.module.ModuleManagerImpl"/>
+ <bean name="org.apache.lenya.cms.repository.SharedItemStore"
+ class="org.apache.lenya.cms.repository.SharedItemStoreImpl">
+ <property name="repositoryManager" ref="org.apache.lenya.cms.repository.RepositoryManager"/>
+ </bean>
+ <bean name="org.apache.lenya.cms.repository.UUIDGenerator"
+ class="org.apache.lenya.cms.repository.AxisUUIDGenerator"/>
</beans>
Modified: lenya/trunk/org.apache.lenya.core.observation/src/main/java/org/apache/lenya/cms/observation/ObservationManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.observation/src/main/java/org/apache/lenya/cms/observation/ObservationManager.java?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.observation/src/main/java/org/apache/lenya/cms/observation/ObservationManager.java (original)
+++ lenya/trunk/org.apache.lenya.core.observation/src/main/java/org/apache/lenya/cms/observation/ObservationManager.java Fri Feb 6 02:04:27 2009
@@ -23,7 +23,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.lenya.cms.publication.Document;
import org.apache.lenya.cms.publication.DocumentIdentifier;
@@ -32,8 +31,7 @@
/**
* Observation manager. Works as an observation registry and sends the notifications.
*/
-public class ObservationManager extends AbstractLogEnabled implements ObservationRegistry,
- ThreadSafe {
+public class ObservationManager extends AbstractLogEnabled implements ObservationRegistry {
private Map identifier2listeners = new HashMap();
private Set listeners = new HashSet();
Added: lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/cocoon/spring/lenya-core-observation-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/cocoon/spring/lenya-core-observation-components.xml?rev=741373&view=auto
==============================================================================
--- lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/cocoon/spring/lenya-core-observation-components.xml (added)
+++ lenya/trunk/org.apache.lenya.core.observation/src/main/resources/META-INF/cocoon/spring/lenya-core-observation-components.xml Fri Feb 6 02:04:27 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"
+ xmlns="http://www.springframework.org/schema/beans">
+ <bean name="org.apache.lenya.cms.observation.ObservationRegistry"
+ class="org.apache.lenya.cms.observation.ObservationManager"/>
+</beans>
Modified: lenya/trunk/org.apache.lenya.parent/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.parent/pom.xml?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.parent/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.parent/pom.xml Fri Feb 6 02:04:27 2009
@@ -319,6 +319,11 @@
</dependency>
<dependency>
<groupId>org.apache.lenya</groupId>
+ <artifactId>lenya-core-observation</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lenya</groupId>
<artifactId>lenya-core-sitemanagement</artifactId>
<version>${project.version}</version>
</dependency>
Modified: lenya/trunk/org.apache.lenya.welcome/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.welcome/pom.xml?rev=741373&r1=741372&r2=741373&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.welcome/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.welcome/pom.xml Fri Feb 6 02:04:27 2009
@@ -90,6 +90,10 @@
</dependency>
<dependency>
<groupId>org.apache.lenya</groupId>
+ <artifactId>lenya-core-observation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lenya</groupId>
<artifactId>lenya-core-templating</artifactId>
</dependency>
<dependency>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org