Author: julien(a)jboss.com
Date: 2007-01-18 10:56:25 -0500 (Thu, 18 Jan 2007)
New Revision: 6031
Modified:
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java
Log:
- improved the impl of JBossInterceptorStackFactory
- corrected issue in cms service wiring with the integration of identity interceptor in
the server stack
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-01-18
13:05:47 UTC (rev 6030)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-01-18
15:56:25 UTC (rev 6031)
@@ -620,7 +620,7 @@
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends
-
optional-attribute-name="InterceptorName">portal:service=PortalAuthorizationManagerFactory</depends>
+
optional-attribute-name="InterceptorName">portal:service=Interceptor,type=Server,name=CMSIdentityBinding</depends>
<depends
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Server</depends>
</mbean>
Modified:
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java
===================================================================
---
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java 2007-01-18
13:05:47 UTC (rev 6030)
+++
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStack.java 2007-01-18
15:56:25 UTC (rev 6031)
@@ -33,8 +33,11 @@
{
/** . */
- protected Interceptor[] interceptors;
+ public static final InterceptorStack EMPTY_STACK = new JBossInterceptorStack(new
Interceptor[0]);
+ /** . */
+ private final Interceptor[] interceptors;
+
public JBossInterceptorStack(Interceptor[] interceptors)
{
if (interceptors == null)
Modified:
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java
===================================================================
---
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java 2007-01-18
13:05:47 UTC (rev 6030)
+++
trunk/server/src/main/org/jboss/portal/server/impl/invocation/JBossInterceptorStackFactory.java 2007-01-18
15:56:25 UTC (rev 6031)
@@ -29,6 +29,8 @@
import javax.management.ObjectName;
import java.util.List;
+import java.util.ArrayList;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -40,8 +42,20 @@
/** . */
protected List interceptorNames;
+ /** . */
+ protected List dynamicInterceptorNames;
+
+ /** . */
protected InterceptorStack stack;
+
+ public JBossInterceptorStackFactory()
+ {
+ interceptorNames = null;
+ dynamicInterceptorNames = new ArrayList();
+ stack = JBossInterceptorStack.EMPTY_STACK;
+ }
+
public List getInterceptorNames()
{
return interceptorNames;
@@ -52,6 +66,11 @@
this.interceptorNames = interceptorNames;
}
+ public List getDynamicInterceptorNames()
+ {
+ return Collections.unmodifiableList(dynamicInterceptorNames);
+ }
+
public InterceptorStack getInterceptorStack()
{
return stack;
@@ -65,7 +84,7 @@
*/
public void addInterceptor(ObjectName name) throws Exception
{
- interceptorNames.add(name);
+ dynamicInterceptorNames.add(name);
}
/**
@@ -87,20 +106,33 @@
/** Rebuild the interceptor stack. */
public void rebuild() throws Exception
{
+ List names = new ArrayList();
+
+ //
if (interceptorNames != null)
{
- Interceptor[] interceptors = new Interceptor[interceptorNames.size()];
- for (int i = 0; i < interceptorNames.size(); i++)
- {
- ObjectName name = (ObjectName)interceptorNames.get(i);
- interceptors[i] = (Interceptor)server.getAttribute(name,
"Interceptor");
- }
- stack = new JBossInterceptorStack(interceptors);
+ names.addAll(interceptorNames);
}
+
+ //
+ names.addAll(dynamicInterceptorNames);
+
+ //
+ log.debug("Building interceptor stack " + getName());
+ Interceptor[] interceptors = new Interceptor[names.size()];
+ for (int i = 0; i < names.size(); i++)
+ {
+ ObjectName name = (ObjectName)names.get(i);
+ log.debug("Adding interceptor " + name + " to the stack");
+ interceptors[i] = (Interceptor)server.getAttribute(name,
"Interceptor");
+ }
+
+ //
+ stack = new JBossInterceptorStack(interceptors);
}
public void stopService()
{
- this.stack = null;
+ this.stack = JBossInterceptorStack.EMPTY_STACK;
}
}
Show replies by date