Seam SVN: r8873 - trunk/src/main/org/jboss/seam/core.
by seam-commits@lists.jboss.org
Author: matt.drees
Date: 2008-09-02 00:53:02 -0400 (Tue, 02 Sep 2008)
New Revision: 8873
Modified:
trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java
Log:
JBSEAM-3362
add context info even if CyclicDependencyException is wrapped by another exception
Modified: trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java 2008-09-01 22:50:56 UTC (rev 8872)
+++ trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java 2008-09-02 04:53:02 UTC (rev 8873)
@@ -8,6 +8,7 @@
import org.jboss.seam.annotations.intercept.Interceptor;
import org.jboss.seam.intercept.AbstractInterceptor;
import org.jboss.seam.intercept.InvocationContext;
+import org.jboss.seam.util.EJB;
/**
* Before invoking the component, inject all dependencies. After
@@ -103,10 +104,19 @@
return result;
}
- catch (CyclicDependencyException cyclicDependencyException)
+ catch (Exception e)
{
- cyclicDependencyException.addInvocation(getComponent().getName(), invocation.getMethod());
- throw cyclicDependencyException;
+ Exception root = e;
+ while (EJB.getCause(root) != null)
+ {
+ root = EJB.getCause(root);
+ }
+ if (root instanceof CyclicDependencyException)
+ {
+ CyclicDependencyException cyclicDependencyException = (CyclicDependencyException) root;
+ cyclicDependencyException.addInvocation(getComponent().getName(), invocation.getMethod());
+ }
+ throw e;
}
finally
{
16 years, 7 months
Seam SVN: r8872 - trunk/src/main/org/jboss/seam/security.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2008-09-01 18:50:56 -0400 (Mon, 01 Sep 2008)
New Revision: 8872
Modified:
trunk/src/main/org/jboss/seam/security/Identity.java
Log:
create systemOp on demand, fix serialization issue
Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java 2008-09-01 21:43:28 UTC (rev 8871)
+++ trunk/src/main/org/jboss/seam/security/Identity.java 2008-09-01 22:50:56 UTC (rev 8872)
@@ -78,7 +78,7 @@
private RememberMe rememberMe;
- private transient ThreadLocal<Boolean> systemOp = new ThreadLocal<Boolean>();
+ private transient ThreadLocal<Boolean> systemOp;
private String jaasConfigName = null;
@@ -412,7 +412,7 @@
public boolean hasRole(String role)
{
if (!securityEnabled) return true;
- if (systemOp.get() == Boolean.TRUE) return true;
+ if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;
isLoggedIn(true);
@@ -524,7 +524,7 @@
*/
public void checkPermission(String name, String action, Object...arg)
{
- if (systemOp.get() == Boolean.TRUE) return;
+ if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return;
isLoggedIn(true);
@@ -546,7 +546,7 @@
public void checkPermission(Object target, String action)
{
- if (systemOp.get() == Boolean.TRUE) return;
+ if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return;
isLoggedIn(true);
@@ -577,7 +577,7 @@
public boolean hasPermission(String name, String action, Object...arg)
{
if (!securityEnabled) return true;
- if (systemOp.get() == Boolean.TRUE) return true;
+ if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;
if (permissionMapper == null) return false;
if (arg != null)
@@ -598,7 +598,7 @@
public boolean hasPermission(Object target, String action)
{
if (!securityEnabled) return true;
- if (systemOp.get() == Boolean.TRUE) return true;
+ if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;
if (permissionMapper == null) return false;
if (target == null) return false;
@@ -706,6 +706,11 @@
principal = operation.getPrincipal();
subject = operation.getSubject();
+ if (systemOp == null)
+ {
+ systemOp = new ThreadLocal<Boolean>();
+ }
+
systemOp.set(operation.isSystemOperation());
operation.execute();
16 years, 7 months
Seam SVN: r8871 - in trunk: doc/Seam_Reference_Guide/en-US and 1 other directories.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-09-01 17:43:28 -0400 (Mon, 01 Sep 2008)
New Revision: 8871
Added:
trunk/src/main/org/jboss/seam/async/AsynchronousExceptionHandler.java
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Jms.xml
trunk/seam21migration.txt
trunk/src/main/org/jboss/seam/async/Asynchronous.java
trunk/src/main/org/jboss/seam/async/AsynchronousEvent.java
trunk/src/main/org/jboss/seam/async/AsynchronousInvocation.java
trunk/src/main/org/jboss/seam/async/QuartzDispatcher.java
trunk/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java
Log:
JBSEAM-2607, JBSEAM-2889, and make Future injectable
Modified: trunk/doc/Seam_Reference_Guide/en-US/Jms.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Jms.xml 2008-09-01 16:16:22 UTC (rev 8870)
+++ trunk/doc/Seam_Reference_Guide/en-US/Jms.xml 2008-09-01 21:43:28 UTC (rev 8871)
@@ -352,7 +352,63 @@
business process context is propagated to the asynchronous thread.
</para>
</sect2>
+
+ <sect2>
+ <title>Handling exceptions from asynchronous calls</title>
+
+ <para>
+ Each asynchronous dispatcher behaves differently when an
+ exception propagates through it. For example, the
+ <literal>java.util.concurrent</literal> dispatcher will suspend
+ further executions of a call which repeats, and the EJB3 timer
+ service will swallow the exception. Seam therefore catches any
+ exception which propagates out of the asynchronous call before
+ it reaches the dispatcher.
+ </para>
+
+ <para>
+ By default, any exception which propagates out from an
+ asynchronous execution will be caught and logged at error level.
+ You can customize this behavior globally by overriding the
+ <literal>org.jboss.seam.async.asynchronousExceptionHandler</literal>
+ component:
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[(a)Scope(ScopeType.STATELESS)
+@Name("org.jboss.seam.async.asynchronousExceptionHandler")
+public class MyAsynchronousExceptionHandler extends AsynchronousExceptionHandler {
+ @Logger Log log;
+
+ @In Future timer;
+
+ @Override
+ public void handleException(Exception exception) {
+ log.debug(exception);
+ timer.cancel(false);
+ }
+
+}]]></programlisting>
+
+ <para>
+ Here, for example, using <literal>java.util.concurrent</literal>
+ dispatcher, we inject it's control object and cancel all future
+ invocations when an exception is encountered
+ </para>
+
+ <para>
+ You can also alter this behavior for an individual component by
+ implementing the method
+ <literal>public void handleAsynchronousException(Exception exception);</literal>
+ on the component. For example:
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[ public void handleAsynchronousException(Exception exception) {
+ log.fatal(exception);
+ }]]></programlisting>
+
+ </sect2>
+
</sect1>
<sect1>
Modified: trunk/seam21migration.txt
===================================================================
--- trunk/seam21migration.txt 2008-09-01 16:16:22 UTC (rev 8870)
+++ trunk/seam21migration.txt 2008-09-01 21:43:28 UTC (rev 8871)
@@ -119,3 +119,11 @@
<value>org.jboss.seam.persistence.ManagedEntityIdentityInterceptor</value>
</core:interceptors>
</core:init>
+
+
+Asynchronous Exception Handling
+----------------------
+
+All asynchronous are now wrapped in exception handling. By default, any
+exceptions which propagate out of the asynchronous call are caught and logged at
+error level. The reference manual describes how to customize this behaviour.
\ No newline at end of file
Modified: trunk/src/main/org/jboss/seam/async/Asynchronous.java
===================================================================
--- trunk/src/main/org/jboss/seam/async/Asynchronous.java 2008-09-01 16:16:22 UTC (rev 8870)
+++ trunk/src/main/org/jboss/seam/async/Asynchronous.java 2008-09-01 21:43:28 UTC (rev 8871)
@@ -19,62 +19,80 @@
*/
public abstract class Asynchronous implements Serializable
{
- private static final LogProvider log = Logging.getLogProvider(Asynchronous.class);
+
static final long serialVersionUID = -551286304424595765L;
+ private static final LogProvider log = Logging.getLogProvider(Asynchronous.class);
+
private Long processId;
private Long taskId;
- protected Asynchronous()
+ public Asynchronous()
{
if ( Init.instance().isJbpmInstalled() )
{
BusinessProcess businessProcess = BusinessProcess.instance();
processId = businessProcess.getProcessId();
taskId = BusinessProcess.instance().getTaskId();
- }
+ }
}
- public void execute(Object timer)
+ protected abstract class ContextualAsynchronousRequest
{
- boolean createContexts = !Contexts.isEventContextActive() && !Contexts.isApplicationContextActive();
- if (createContexts) Lifecycle.beginCall();
- Contexts.getEventContext().set(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL, true);
- try
+
+ private Object timer;
+ private boolean createContexts;
+
+ public ContextualAsynchronousRequest(Object timer)
{
- executeInContexts(timer);
+ this.timer = timer;
+ this.createContexts = !Contexts.isEventContextActive() && !Contexts.isApplicationContextActive();
}
- finally
- {
- Contexts.getEventContext().remove(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL);
- if (createContexts) Lifecycle.endCall();
- }
- }
-
- private void executeInContexts(Object timer)
- {
- if (taskId!=null)
+ private void setup()
{
- BusinessProcess.instance().resumeTask(taskId);
+ if (createContexts) Lifecycle.beginCall();
+ Contexts.getEventContext().set(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL, true);
+ if (taskId!=null)
+ {
+ BusinessProcess.instance().resumeTask(taskId);
+ }
+ else if (processId!=null)
+ {
+ BusinessProcess.instance().resumeProcess(processId);
+ }
+
+ if (timer!=null)
+ {
+ Contexts.getEventContext().set("timer", timer);
+ }
+
+ log.debug("executing: " + this);
}
- else if (processId!=null)
- {
- BusinessProcess.instance().resumeProcess(processId);
- }
- if (timer!=null)
+ protected abstract void process();
+
+ public void run()
{
- Contexts.getEventContext().set("timer", timer);
+ setup();
+ try
+ {
+ process();
+ }
+ finally
+ {
+ cleanup();
+ }
}
- if ( log.isDebugEnabled() )
+ private void cleanup()
{
- log.debug("executing: " + this);
+ Contexts.getEventContext().remove(AbstractDispatcher.EXECUTING_ASYNCHRONOUS_CALL);
+ if (createContexts) Lifecycle.endCall();
}
-
- call();
- }
+ }
- protected abstract void call();
+ public abstract void execute(Object timer);
+
+ protected abstract void handleException(Exception exception, Object timer);
}
\ No newline at end of file
Modified: trunk/src/main/org/jboss/seam/async/AsynchronousEvent.java
===================================================================
--- trunk/src/main/org/jboss/seam/async/AsynchronousEvent.java 2008-09-01 16:16:22 UTC (rev 8870)
+++ trunk/src/main/org/jboss/seam/async/AsynchronousEvent.java 2008-09-01 21:43:28 UTC (rev 8871)
@@ -22,9 +22,18 @@
}
@Override
- public void call()
+ public void execute(Object timer)
{
- Events.instance().raiseEvent(type, parameters);
+ new ContextualAsynchronousRequest(timer)
+ {
+
+ @Override
+ protected void process()
+ {
+ Events.instance().raiseEvent(type, parameters);
+ }
+
+ }.run();
}
@Override
@@ -37,5 +46,19 @@
{
return type;
}
+
+ @Override
+ protected void handleException(final Exception exception, Object timer)
+ {
+ new ContextualAsynchronousRequest(timer)
+ {
+ @Override
+ protected void process()
+ {
+ AsynchronousExceptionHandler.instance().handleException(exception);
+ }
+ }.run();
+
+ }
}
\ No newline at end of file
Added: trunk/src/main/org/jboss/seam/async/AsynchronousExceptionHandler.java
===================================================================
--- trunk/src/main/org/jboss/seam/async/AsynchronousExceptionHandler.java (rev 0)
+++ trunk/src/main/org/jboss/seam/async/AsynchronousExceptionHandler.java 2008-09-01 21:43:28 UTC (rev 8871)
@@ -0,0 +1,33 @@
+package org.jboss.seam.async;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+(a)Scope(ScopeType.STATELESS)
+@Name("org.jboss.seam.async.asynchronousExceptionHandler")
+@Install(precedence=BUILT_IN)
+@BypassInterceptors
+public class AsynchronousExceptionHandler
+{
+
+ private LogProvider log = Logging.getLogProvider(AsynchronousExceptionHandler.class);
+
+ public void handleException(Exception throwable)
+ {
+ log.error("Exeception thrown whilst executing asynchronous call", throwable);
+ }
+
+ public static AsynchronousExceptionHandler instance()
+ {
+ return (AsynchronousExceptionHandler) Component.getInstance(AsynchronousExceptionHandler.class);
+ }
+
+}
Property changes on: trunk/src/main/org/jboss/seam/async/AsynchronousExceptionHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/org/jboss/seam/async/AsynchronousInvocation.java
===================================================================
--- trunk/src/main/org/jboss/seam/async/AsynchronousInvocation.java 2008-09-01 16:16:22 UTC (rev 8870)
+++ trunk/src/main/org/jboss/seam/async/AsynchronousInvocation.java 2008-09-01 21:43:28 UTC (rev 8871)
@@ -4,6 +4,8 @@
import org.jboss.seam.Component;
import org.jboss.seam.intercept.InvocationContext;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
import org.jboss.seam.util.Reflections;
/**
@@ -16,6 +18,8 @@
{
static final long serialVersionUID = 7426196491669891310L;
+ private LogProvider log = Logging.getLogProvider(AsynchronousInvocation.class);
+
private String methodName;
private Class[] argTypes;
private Object[] args;
@@ -35,21 +39,31 @@
}
@Override
- protected void call()
+ public void execute(Object timer)
{
- Object target = Component.getInstance(componentName);
-
- Method method;
- try
+ new ContextualAsynchronousRequest(timer)
{
- method = target.getClass().getMethod(methodName, argTypes);
- }
- catch (NoSuchMethodException nsme)
- {
- throw new IllegalStateException(nsme);
- }
+
+ @Override
+ protected void process()
+ {
+ Object target = Component.getInstance(componentName);
+
+ Method method;
+ try
+ {
+ method = target.getClass().getMethod(methodName, argTypes);
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ throw new IllegalStateException(nsme);
+ }
+
+ Reflections.invokeAndWrap(method, target, args);
+ }
+
+ }.run();
- Reflections.invokeAndWrap(method, target, args);
}
@Override
@@ -57,4 +71,28 @@
{
return "AsynchronousInvocation(" + componentName + '.' + methodName + "())";
}
+
+ @Override
+ protected void handleException(final Exception exception, Object timer)
+ {
+ new ContextualAsynchronousRequest(timer)
+ {
+ @Override
+ protected void process()
+ {
+ Object target = Component.getInstance(componentName);
+ try
+ {
+ Method method = target.getClass().getMethod("handleAsynchronousException", Exception.class);
+ log.trace("Using asynchronous exception handler " + componentName + ".handleAsynchronsException;");
+ method.invoke(target, exception);
+ }
+ catch (Exception e)
+ {
+ log.trace("Using default asynchronous exception handler");
+ AsynchronousExceptionHandler.instance().handleException(exception);
+ }
+ }
+ }.run();
+ }
}
\ No newline at end of file
Modified: trunk/src/main/org/jboss/seam/async/QuartzDispatcher.java
===================================================================
--- trunk/src/main/org/jboss/seam/async/QuartzDispatcher.java 2008-09-01 16:16:22 UTC (rev 8870)
+++ trunk/src/main/org/jboss/seam/async/QuartzDispatcher.java 2008-09-01 21:43:28 UTC (rev 8871)
@@ -237,7 +237,15 @@
{
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
async = (Asynchronous)dataMap.get("async");
- async.execute(new QuartzTriggerHandle(context.getTrigger().getName()));
+ QuartzTriggerHandle handle = new QuartzTriggerHandle(context.getTrigger().getName());
+ try
+ {
+ async.execute(handle);
+ }
+ catch (Exception e)
+ {
+ async.handleException(e, handle);
+ }
}
}
Modified: trunk/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java
===================================================================
--- trunk/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java 2008-09-01 16:16:22 UTC (rev 8870)
+++ trunk/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java 2008-09-01 21:43:28 UTC (rev 8871)
@@ -34,7 +34,10 @@
public Future scheduleAsynchronousEvent(String type, Object... parameters)
{
- return executor.submit( new RunnableAsynchronous( new AsynchronousEvent(type, parameters) ) );
+ RunnableAsynchronous runnableAsynchronous = new RunnableAsynchronous( new AsynchronousEvent(type, parameters) );
+ Future future = executor.submit(runnableAsynchronous);
+ runnableAsynchronous.setFuture(future);
+ return future;
}
public Future scheduleTimedEvent(String type, TimerSchedule schedule, Object... parameters)
@@ -55,47 +58,50 @@
return expiration.getTime() - new Date().getTime();
}
- private Future scheduleWithExecutorService(TimerSchedule schedule, Runnable runnable)
+ private Future scheduleWithExecutorService(TimerSchedule schedule, RunnableAsynchronous runnable)
{
+ Future future = null;
if ( schedule.getIntervalDuration()!=null )
{
if ( schedule.getExpiration()!=null )
{
- return executor.scheduleAtFixedRate( runnable,
+ future = executor.scheduleAtFixedRate( runnable,
toDuration( schedule.getExpiration() ),
schedule.getIntervalDuration(),
TimeUnit.MILLISECONDS );
}
else if ( schedule.getDuration()!=null )
{
- return executor.scheduleAtFixedRate( runnable,
+ future = executor.scheduleAtFixedRate( runnable,
schedule.getDuration(),
schedule.getIntervalDuration(),
TimeUnit.MILLISECONDS );
}
else
{
- return executor.scheduleAtFixedRate( runnable, 0l,
+ future = executor.scheduleAtFixedRate( runnable, 0l,
schedule.getIntervalDuration(),
TimeUnit.MILLISECONDS );
}
}
else if ( schedule.getExpiration()!=null )
{
- return executor.schedule( runnable,
+ future = executor.schedule( runnable,
toDuration( schedule.getExpiration() ),
TimeUnit.MILLISECONDS );
}
else if ( schedule.getDuration()!=null )
{
- return executor.schedule( runnable,
+ future = executor.schedule( runnable,
schedule.getDuration(),
TimeUnit.MILLISECONDS );
}
else
{
- return executor.schedule(runnable, 0l, TimeUnit.MILLISECONDS);
+ future = executor.schedule(runnable, 0l, TimeUnit.MILLISECONDS);
}
+ runnable.setFuture(future);
+ return future;
}
@Destroy
@@ -116,6 +122,8 @@
{
private Asynchronous async;
+ private Future future;
+
RunnableAsynchronous(Asynchronous async)
{
this.async = async;
@@ -123,8 +131,21 @@
public void run()
{
- async.execute(null);
+ try
+ {
+ async.execute(future);
+ }
+ catch (Exception exception)
+ {
+ async.handleException(exception, future);
+ }
}
+
+ public void setFuture(Future future)
+ {
+ this.future = future;
+ }
+
}
public int getThreadPoolSize()
16 years, 7 months
Seam SVN: r8870 - trunk/src/debug/META-INF.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-09-01 12:16:22 -0400 (Mon, 01 Sep 2008)
New Revision: 8870
Modified:
trunk/src/debug/META-INF/debug.xhtml
Log:
JBSEA-3354
Modified: trunk/src/debug/META-INF/debug.xhtml
===================================================================
--- trunk/src/debug/META-INF/debug.xhtml 2008-09-01 15:17:03 UTC (rev 8869)
+++ trunk/src/debug/META-INF/debug.xhtml 2008-09-01 16:16:22 UTC (rev 8870)
@@ -223,7 +223,7 @@
Exception during request processing:
<ui:repeat value="#{org.jboss.seam.debug.contexts.exceptionCauses}" var="exception">
<div>
- Caused by #{exception.class.name} with message: "#{exception.message}"
+ Caused by #{exception.class.name} with message: "#{exception.getMessage()}"
<pre><ui:repeat value="#{exception.stackTrace}" var="stackElement">
#{stackElement}</ui:repeat></pre>
</div>
16 years, 7 months
Seam SVN: r8869 - trunk/src/main/org/jboss/seam/international.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-09-01 11:17:03 -0400 (Mon, 01 Sep 2008)
New Revision: 8869
Modified:
trunk/src/main/org/jboss/seam/international/StatusMessages.java
Log:
JBSEAM-3340
Modified: trunk/src/main/org/jboss/seam/international/StatusMessages.java
===================================================================
--- trunk/src/main/org/jboss/seam/international/StatusMessages.java 2008-09-01 14:46:56 UTC (rev 8868)
+++ trunk/src/main/org/jboss/seam/international/StatusMessages.java 2008-09-01 15:17:03 UTC (rev 8869)
@@ -72,22 +72,19 @@
*/
public void add(Severity severity, String key, String detailKey, String messageTemplate, String messageDetailTemplate, final Object... params)
{
- if (!Strings.isEmpty(key))
+ final StatusMessage message = new StatusMessage(severity, key, detailKey, messageTemplate, messageDetailTemplate);
+ if (!Strings.isEmpty(message.getSummary()))
{
- final StatusMessage message = new StatusMessage(severity, key, detailKey, messageTemplate, messageDetailTemplate);
- if (!Strings.isEmpty(message.getSummary()))
- {
- messages.add(message);
- getTasks().add(
- new Runnable()
+ messages.add(message);
+ getTasks().add(
+ new Runnable()
+ {
+ public void run()
{
- public void run()
- {
- message.interpolate(params);
- }
+ message.interpolate(params);
}
- );
- }
+ }
+ );
}
}
@@ -105,33 +102,30 @@
*/
public void addToControl(String id, Severity severity, String key, String messageTemplate, final Object... params)
{
- if (!Strings.isEmpty(key))
- {
- final StatusMessage message = new StatusMessage(severity, key, null, messageTemplate, null);
- if (!Strings.isEmpty(message.getSummary()))
- {
- if (keyedMessages.containsKey(id))
- {
- keyedMessages.get(id).add(message);
- }
- else
- {
- List<StatusMessage> list = new ArrayList<StatusMessage>();
- list.add(message);
- keyedMessages.put(id, list);
- }
- getTasks().add(
- new Runnable()
+ final StatusMessage message = new StatusMessage(severity, key, null, messageTemplate, null);
+ if (!Strings.isEmpty(message.getSummary()))
+ {
+ if (keyedMessages.containsKey(id))
+ {
+ keyedMessages.get(id).add(message);
+ }
+ else
+ {
+ List<StatusMessage> list = new ArrayList<StatusMessage>();
+ list.add(message);
+ keyedMessages.put(id, list);
+ }
+ getTasks().add(
+ new Runnable()
+ {
+
+ public void run()
{
-
- public void run()
- {
- message.interpolate(params);
- }
-
+ message.interpolate(params);
}
- );
- }
+
+ }
+ );
}
}
16 years, 7 months
Seam SVN: r8868 - in trunk/src/main/org/jboss/seam: init and 1 other directory.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-09-01 10:46:56 -0400 (Mon, 01 Sep 2008)
New Revision: 8868
Modified:
trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
trunk/src/main/org/jboss/seam/init/Initialization.java
Log:
JBSEAM-3323
Modified: trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
===================================================================
--- trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-09-01 14:46:16 UTC (rev 8867)
+++ trunk/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2008-09-01 14:46:56 UTC (rev 8868)
@@ -10,9 +10,11 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
@@ -33,6 +35,9 @@
private List<File> files = new ArrayList<File>();
+ private Set<String> excludes = new HashSet<String>();
+ private Set<String> wildCardExcludes = new HashSet<String>();
+
private Map<String, DeploymentHandler> deploymentHandlers;
/**
@@ -172,6 +177,20 @@
*/
public void handle(String name)
{
+ for (String exclude: excludes)
+ {
+ if (name.equals(exclude))
+ {
+ return;
+ }
+ }
+ for (String exclude: wildCardExcludes)
+ {
+ if (name.startsWith(exclude))
+ {
+ return;
+ }
+ }
for (String key: getDeploymentHandlers().keySet())
{
getDeploymentHandlers().get(key).handle(name, getClassLoader());
@@ -296,4 +315,19 @@
this.files = files;
}
+ public void addExclude(String path)
+ {
+ if (path == null)
+ {
+ throw new NullPointerException("Cannot exclude a null path");
+ }
+ if (path.endsWith("*"))
+ {
+ wildCardExcludes.add(path.substring(0, path.length() - 1));
+ }
+ else
+ {
+ excludes.add(path);
+ }
+ }
}
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-09-01 14:46:16 UTC (rev 8867)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-09-01 14:46:56 UTC (rev 8868)
@@ -42,6 +42,7 @@
import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.core.Expressions;
import org.jboss.seam.core.Init;
+import org.jboss.seam.deployment.DeploymentStrategy;
import org.jboss.seam.deployment.DotPageDotXmlDeploymentHandler;
import org.jboss.seam.deployment.HotDeploymentStrategy;
import org.jboss.seam.deployment.StandardDeploymentStrategy;
@@ -109,7 +110,7 @@
public Initialization create()
{
standardDeploymentStrategy = new StandardDeploymentStrategy(Thread.currentThread().getContextClassLoader());
- standardDeploymentStrategy.getFiles().add(warRootDirectory);
+ addWarRoot(standardDeploymentStrategy);
standardDeploymentStrategy.scan();
addNamespaces();
initComponentsFromXmlDocument("/WEB-INF/components.xml");
@@ -120,6 +121,13 @@
initJndiProperties();
return this;
}
+
+ private void addWarRoot(DeploymentStrategy deploymentStrategy)
+ {
+ deploymentStrategy.getFiles().add(warRootDirectory);
+ deploymentStrategy.addExclude("WEB-INF/classes/*");
+ deploymentStrategy.addExclude("/WEB-INF/classes/*");
+ }
private void initComponentsFromXmlDocuments()
{
@@ -604,7 +612,7 @@
}
ServletLifecycle.beginInitialization();
Contexts.getApplicationContext().set(Component.PROPERTIES, properties);
- createHotDeployment(Thread.currentThread().getContextClassLoader());
+ hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
scanForComponents();
addComponent( new ComponentDescriptor(Init.class), Contexts.getApplicationContext());
Init init = (Init) Component.getInstance(Init.class, ScopeType.APPLICATION);
@@ -624,12 +632,17 @@
// Make the deployment strategies available in the contexts. This gives
// access to custom deployment handlers for processing custom annotations
// etc.
-
Contexts.getEventContext().set(StandardDeploymentStrategy.NAME, standardDeploymentStrategy);
Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
installComponents(init);
+ if (hotDeploymentStrategy != null)
+ {
+ hotDeploymentStrategy.scan();
+ installHotDeployableComponents();
+ }
+
for (String globalImport: globalImports)
{
init.importNamespace(globalImport);
@@ -660,7 +673,10 @@
Contexts.getApplicationContext().remove(name + COMPONENT_SUFFIX);
}
//TODO open the ability to reuse the classloader by looking at the components class classloaders
- createHotDeployment(Thread.currentThread().getContextClassLoader(), warRootDirectory);
+ hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
+ addWarRoot(hotDeploymentStrategy);
+ hotDeploymentStrategy.scan();
+ installHotDeployableComponents();
Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
// Add the WAR root to the hot deploy path to pick up .page.xml
Pages.instance().setHotDotPageDotXmlFileNames(DotPageDotXmlDeploymentHandler.hotInstance().getFiles());
@@ -680,27 +696,25 @@
}
}
- private void createHotDeployment(ClassLoader classLoader, File ... directories)
+ private HotDeploymentStrategy createHotDeployment(ClassLoader classLoader)
{
if ( isDebugEnabled() && hotDeployDirectory != null )
{
if (isGroovyPresent())
{
log.debug("Using Java + Groovy hot deploy");
- hotDeploymentStrategy = HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory);
+ return HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory);
}
else
{
log.debug("Using Java hot deploy");
- hotDeploymentStrategy = new HotDeploymentStrategy(classLoader, hotDeployDirectory);
+ return new HotDeploymentStrategy(classLoader, hotDeployDirectory);
}
- for (File file : directories)
- {
- hotDeploymentStrategy.getFiles().add(file);
- }
- hotDeploymentStrategy.scan();
- installHotDeployableComponents();
}
+ else
+ {
+ return null;
+ }
}
private static File getRealFile(ServletContext servletContext, String path)
16 years, 7 months
Seam SVN: r8867 - trunk/src/main/org/jboss/seam/core.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-09-01 10:46:16 -0400 (Mon, 01 Sep 2008)
New Revision: 8867
Modified:
trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java
Log:
minor
Modified: trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java 2008-09-01 14:45:51 UTC (rev 8866)
+++ trunk/src/main/org/jboss/seam/core/BijectionInterceptor.java 2008-09-01 14:46:16 UTC (rev 8867)
@@ -48,7 +48,7 @@
{
if (!injected)
{
- if (injecting == true)
+ if (injecting)
{
throw new CyclicDependencyException();
}
16 years, 7 months
Seam SVN: r8866 - trunk/doc/Seam_Reference_Guide/en-US.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2008-09-01 10:45:51 -0400 (Mon, 01 Sep 2008)
New Revision: 8866
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
Log:
Add Nik and Daniel to authors list
Modified: trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml 2008-09-01 06:36:25 UTC (rev 8865)
+++ trunk/doc/Seam_Reference_Guide/en-US/Author_Group.xml 2008-09-01 14:45:51 UTC (rev 8866)
@@ -48,6 +48,14 @@
<firstname>Emmanuel</firstname>
<surname>Bernard</surname>
</author>
+ <author>
+ <firstname>Nicklas</firstname>
+ <surname>Karlsson</surname>
+ </author>
+ <author>
+ <firstname>Daniel</firstname>
+ <surname>Roth</surname>
+ </author>
<othercredit>
<firstname>James</firstname>
<surname>Cobb</surname>
16 years, 7 months
Seam SVN: r8865 - trunk/seam-gen/src.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-09-01 02:36:25 -0400 (Mon, 01 Sep 2008)
New Revision: 8865
Modified:
trunk/seam-gen/src/Authenticator.java
Log:
use preferred syntax for positional replacement in message
Modified: trunk/seam-gen/src/Authenticator.java
===================================================================
--- trunk/seam-gen/src/Authenticator.java 2008-09-01 06:36:16 UTC (rev 8864)
+++ trunk/seam-gen/src/Authenticator.java 2008-09-01 06:36:25 UTC (rev 8865)
@@ -16,7 +16,7 @@
public boolean authenticate()
{
- log.info("authenticating #0", identity.getUsername());
+ log.info("authenticating {0}", identity.getUsername());
//write your authentication logic here,
//return true if the authentication was
//successful, false otherwise
16 years, 7 months
Seam SVN: r8864 - branches/Seam_2_0/seam-gen/src.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2008-09-01 02:36:16 -0400 (Mon, 01 Sep 2008)
New Revision: 8864
Modified:
branches/Seam_2_0/seam-gen/src/Authenticator.java
Log:
use preferred syntax for positional replacement in message
Modified: branches/Seam_2_0/seam-gen/src/Authenticator.java
===================================================================
--- branches/Seam_2_0/seam-gen/src/Authenticator.java 2008-09-01 05:09:03 UTC (rev 8863)
+++ branches/Seam_2_0/seam-gen/src/Authenticator.java 2008-09-01 06:36:16 UTC (rev 8864)
@@ -16,7 +16,7 @@
public boolean authenticate()
{
- log.info("authenticating #0", identity.getUsername());
+ log.info("authenticating {0}", identity.getUsername());
//write your authentication logic here,
//return true if the authentication was
//successful, false otherwise
16 years, 7 months