Author: andreas
Date: Fri Feb 6 18:49:16 2009
New Revision: 741672
URL: http://svn.apache.org/viewvc?rev=741672&view=rev
Log:
Added text generator declaration, fixed access control component configurations.
Modified:
lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java
lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java
lenya/trunk/org.apache.lenya.core.ac/src/main/resources/META-INF/cocoon/spring/lenya-core-ac-components.xml
lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/CacheMap.java
lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/avalon/lenya-core-sitemap.xconf
Modified: lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java?rev=741672&r1=741671&r2=741672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java (original)
+++ lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/ac/impl/AbstractAccessControllerResolver.java Fri Feb 6 18:49:16 2009
@@ -116,7 +116,7 @@
this.sourceResolver = sourceResolver;
}
- public SourceResolver getSourceResolver() {
+ protected SourceResolver getSourceResolver() {
return sourceResolver;
}
Modified: lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java?rev=741672&r1=741671&r2=741672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java (original)
+++ lenya/trunk/org.apache.lenya.core.ac/src/main/java/org/apache/lenya/cms/cocoon/acting/AccessControlAction.java Fri Feb 6 18:49:16 2009
@@ -22,12 +22,12 @@
import java.util.Map;
import org.apache.avalon.framework.parameters.Parameters;
-import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.cocoon.acting.ConfigurableServiceableAction;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Redirector;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.spring.configurator.WebAppContextUtils;
import org.apache.lenya.ac.AccessController;
import org.apache.lenya.ac.AccessControllerResolver;
import org.apache.lenya.util.ServletHelper;
@@ -43,87 +43,63 @@
/**
* <p>
- * Invokes the access control functionality.
- * If no access controller was found for the requested URL, an empty map is returned.
+ * Invokes the access control functionality. If no access controller was found for the requested
+ * URL, an empty map is returned.
* </p>
* <p>
* This is a template method. Implement doAct() to add your functionality.
* </p>
- * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
+ * @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector,
+ * org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String,
+ * org.apache.avalon.framework.parameters.Parameters)
*/
- public Map act(
- Redirector redirector,
- SourceResolver sourceResolver,
- Map objectModel,
- String source,
- Parameters parameters)
- throws Exception {
+ public Map act(Redirector redirector, SourceResolver sourceResolver, Map objectModel,
+ String source, Parameters parameters) throws Exception {
- ServiceSelector selector = null;
- AccessControllerResolver resolver = null;
this.accessController = null;
Request request = ObjectModelHelper.getRequest(objectModel);
Map result = null;
- try {
- selector =
- (ServiceSelector) this.manager.lookup(AccessControllerResolver.ROLE + "Selector");
-
- getLogger().debug("Resolving AC resolver for type [" + AccessControllerResolver.DEFAULT_RESOLVER + "]");
- resolver =
- (AccessControllerResolver) selector.select(
- AccessControllerResolver.DEFAULT_RESOLVER);
- getLogger().debug("Resolved AC resolver [" + resolver + "]");
-
- String webappUrl = ServletHelper.getWebappURI(request);
- this.accessController = resolver.resolveAccessController(webappUrl);
-
- if (this.accessController == null) {
- result = Collections.EMPTY_MAP;
- } else {
- this.accessController.setupIdentity(request);
- result = doAct(redirector, sourceResolver, objectModel, source, parameters);
- }
-
- } finally {
- if (selector != null) {
- if (resolver != null) {
- selector.release(resolver);
- }
- this.manager.release(selector);
- }
+ getLogger().debug(
+ "Resolving AC resolver for type [" + AccessControllerResolver.DEFAULT_RESOLVER
+ + "]");
+ AccessControllerResolver resolver = (AccessControllerResolver) WebAppContextUtils
+ .getCurrentWebApplicationContext().getBean(
+ AccessControllerResolver.ROLE + "/"
+ + AccessControllerResolver.DEFAULT_RESOLVER);
+ getLogger().debug("Resolved AC resolver [" + resolver + "]");
+
+ String webappUrl = ServletHelper.getWebappURI(request);
+ this.accessController = resolver.resolveAccessController(webappUrl);
+
+ if (this.accessController == null) {
+ result = Collections.EMPTY_MAP;
+ } else {
+ this.accessController.setupIdentity(request);
+ result = doAct(redirector, sourceResolver, objectModel, source, parameters);
}
+
return result;
}
/**
* The actual act method.
- * @param redirector The <code>Redirector</code> in charge
- * @param resolver The <code>SourceResolver</code> in charge
- * @param objectModel The <code>Map</code> with object of the
- * calling environment which can be used
- * to select values this controller may need
- * (ie Request, Response).
- * @param source A source <code>String</code> to the Action
- * @param parameters The <code>Parameters</code> for this invocation
- * @return Map The returned <code>Map</code> object with
- * sitemap substitution values which can be used
- * in subsequent elements attributes like src=
- * using a xpath like expression: src="mydir/{myval}/foo"
- * If the return value is null the processing inside
- * the <map:act> element of the sitemap will
- * be skipped.
+ * @param redirector The <code>Redirector</code> in charge
+ * @param resolver The <code>SourceResolver</code> in charge
+ * @param objectModel The <code>Map</code> with object of the calling environment which can be
+ * used to select values this controller may need (ie Request, Response).
+ * @param source A source <code>String</code> to the Action
+ * @param parameters The <code>Parameters</code> for this invocation
+ * @return Map The returned <code>Map</code> object with sitemap substitution values which can
+ * be used in subsequent elements attributes like src= using a xpath like expression:
+ * src="mydir/{myval}/foo" If the return value is null the processing inside the
+ * <map:act> element of the sitemap will be skipped.
* @exception Exception Indicates something is totally wrong
*/
- protected abstract Map doAct(
- Redirector redirector,
- SourceResolver resolver,
- Map objectModel,
- String source,
- Parameters parameters)
- throws Exception;
+ protected abstract Map doAct(Redirector redirector, SourceResolver resolver, Map objectModel,
+ String source, Parameters parameters) throws Exception;
/**
* Returns the access controller.
Modified: lenya/trunk/org.apache.lenya.core.ac/src/main/resources/META-INF/cocoon/spring/lenya-core-ac-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.ac/src/main/resources/META-INF/cocoon/spring/lenya-core-ac-components.xml?rev=741672&r1=741671&r2=741672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.ac/src/main/resources/META-INF/cocoon/spring/lenya-core-ac-components.xml (original)
+++ lenya/trunk/org.apache.lenya.core.ac/src/main/resources/META-INF/cocoon/spring/lenya-core-ac-components.xml Fri Feb 6 18:49:16 2009
@@ -21,17 +21,21 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- Resolvers -->
- <bean name="org.apache.lenya.cms.ac.AccessControllerResolver/publication"
- class="org.apache.lenya.cms.ac.PublicationAccessControllerResolver"/>
+ <bean name="org.apache.lenya.ac.AccessControllerResolver/publication"
+ class="org.apache.lenya.cms.ac.PublicationAccessControllerResolver">
+ <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
+ </bean>
<bean name="org.apache.lenya.cms.ac.AccessControllerResolver/global"
class="org.apache.lenya.ac.impl.ConfigurableAccessControllerResolver">
+ <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
<property name="accessControllerType" value="global"/>
</bean>
- <bean name="org.apache.lenya.cms.ac.AccessControllerResolver/composable"
+ <bean name="org.apache.lenya.ac.AccessControllerResolver/composable"
class="org.apache.lenya.ac.impl.ComposableAccessControllerResolver">
+ <property name="sourceResolver" ref="org.apache.excalibur.source.SourceResolver"/>
<property name="resolvers">
<list>
- <ref bean="org.apache.lenya.cms.ac.AccessControllerResolver/publication"/>
+ <ref bean="org.apache.lenya.ac.AccessControllerResolver/publication"/>
</list>
</property>
</bean>
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/CacheMap.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/CacheMap.java?rev=741672&r1=741671&r2=741672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/CacheMap.java (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/java/org/apache/lenya/util/CacheMap.java Fri Feb 6 18:49:16 2009
@@ -31,31 +31,32 @@
* A map with a maximum capacity. When the map is full, the oldest entry is removed.
*/
public class CacheMap extends HashMap {
-
+
/**
- *
- */
- private static final long serialVersionUID = 1L;
-
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
/**
* Ctor.
* @param _capacity The maximum number of entries.
* @param logger The logger.
*/
public CacheMap(int _capacity, Log logger) {
+ this.logger = logger;
assert _capacity > -1;
this.capacity = _capacity;
}
-
+
private int capacity;
private SortedMap timeToKey = new TreeMap();
private Log logger;
-
+
/**
* @see java.util.Map#put(Object, Object)
*/
public Object put(Object key, Object value) {
-
+
if (size() == this.capacity) {
Object timeKey = this.timeToKey.firstKey();
Object oldestKey = this.timeToKey.get(timeKey);
@@ -68,7 +69,7 @@
this.timeToKey.put(new Date(), key);
return super.put(key, value);
}
-
+
/**
* @see java.util.Map#get(java.lang.Object)
*/
@@ -77,12 +78,11 @@
if (logger.isDebugEnabled()) {
if (result != null) {
logger.debug("Using cached object for key [" + key + "]");
- }
- else {
+ } else {
logger.debug("No cached object for key [" + key + "]");
}
}
return result;
}
-
+
}
Modified: lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/avalon/lenya-core-sitemap.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/avalon/lenya-core-sitemap.xconf?rev=741672&r1=741671&r2=741672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/avalon/lenya-core-sitemap.xconf (original)
+++ lenya/trunk/org.apache.lenya.core.api/src/main/resources/META-INF/cocoon/avalon/lenya-core-sitemap.xconf Fri Feb 6 18:49:16 2009
@@ -22,6 +22,9 @@
<map:generators>
<map:generator label="content" logger="sitemap.generator.sessionattr" name="session-attr"
pool-max="16" src="org.apache.cocoon.generation.SessionAttributeGenerator"/>
+ <map:generator name="text" src="org.apache.cocoon.generation.TextGenerator">
+ <parameter name="localizable" value="true"/>
+ </map:generator>
</map:generators>
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.