[seam-commits] Seam SVN: r10639 - in modules/trunk/bpm: src/main/java/org/jboss/seam/bpm and 1 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Sat Apr 25 02:28:36 EDT 2009
Author: shane.bryzak at jboss.com
Date: 2009-04-25 02:28:36 -0400 (Sat, 25 Apr 2009)
New Revision: 10639
Added:
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/CreateProcessEvent.java
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndProcessEvent.java
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndTaskEvent.java
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitProcessEvent.java
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitTaskEvent.java
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/StartTaskEvent.java
Modified:
modules/trunk/bpm/pom.xml
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/BusinessProcess.java
modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/ManagedJbpmContext.java
Log:
added dependencies, bpm event types
Modified: modules/trunk/bpm/pom.xml
===================================================================
--- modules/trunk/bpm/pom.xml 2009-04-25 00:08:12 UTC (rev 10638)
+++ modules/trunk/bpm/pom.xml 2009-04-25 06:28:36 UTC (rev 10639)
@@ -26,7 +26,15 @@
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-jpdl</artifactId>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ </dependency>
</dependencies>
</project>
Modified: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/BusinessProcess.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/BusinessProcess.java 2009-04-25 00:08:12 UTC (rev 10638)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/BusinessProcess.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -4,7 +4,15 @@
import javax.annotation.Named;
import javax.context.ConversationScoped;
+import javax.inject.Current;
+import javax.inject.manager.Manager;
+import org.jboss.seam.bpm.events.CreateProcessEvent;
+import org.jboss.seam.bpm.events.EndProcessEvent;
+import org.jboss.seam.bpm.events.EndTaskEvent;
+import org.jboss.seam.bpm.events.InitProcessEvent;
+import org.jboss.seam.bpm.events.InitTaskEvent;
+import org.jboss.seam.bpm.events.StartTaskEvent;
import org.jboss.seam.international.StatusMessage;
import org.jboss.seam.international.StatusMessages;
import org.jbpm.graph.def.ProcessDefinition;
@@ -16,7 +24,7 @@
* and provides programmatic control over the business process.
*
* @author Gavin King
- *
+ * @author Shane Bryzak
*/
@Named
@ConversationScoped
@@ -24,18 +32,11 @@
{
private static final long serialVersionUID = 4722350870845851070L;
+ @Current Manager manager;
+
private Long processId;
private Long taskId;
- public static BusinessProcess instance()
- {
- if ( !Contexts.isConversationContextActive() )
- {
- throw new IllegalStateException("No active conversation context");
- }
- return (BusinessProcess) Component.getInstance(BusinessProcess.class, ScopeType.CONVERSATION);
- }
-
/**
* Is there a process instance associated with
* the current conversation?
@@ -151,7 +152,7 @@
process.signal();
}
- Events.instance().raiseEvent("org.jboss.seam.createProcess." + processDefinitionName);
+ manager.fireEvent(new CreateProcessEvent(processDefinitionName));
}
/**
@@ -172,7 +173,7 @@
task.start();
}
- Events.instance().raiseEvent("org.jboss.seam.startTask." + task.getTask().getName());
+ manager.fireEvent(new StartTaskEvent(task.getTask().getName()));
}
/**
@@ -206,11 +207,12 @@
setTaskId(null); //TODO: do I really need this???!
- Events.instance().raiseEvent("org.jboss.seam.endTask." + task.getTask().getName());
+ manager.fireEvent(new EndTaskEvent(task.getTask().getName()));
+
ProcessInstance process = org.jboss.seam.bpm.ProcessInstance.instance();
if ( process.hasEnded() )
{
- Events.instance().raiseEvent("org.jboss.seam.endProcess." + process.getProcessDefinition().getName());
+ manager.fireEvent(new EndProcessEvent(process.getProcessDefinition().getName()));
}
}
@@ -225,7 +227,7 @@
process.signal(transitionName);
if ( process.hasEnded() )
{
- Events.instance().raiseEvent("org.jboss.seam.endProcess." + process.getProcessDefinition().getName());
+ manager.fireEvent(new EndProcessEvent(process.getProcessDefinition().getName()));
}
}
@@ -253,7 +255,7 @@
else
{
setProcessId( task.getTaskMgmtInstance().getProcessInstance().getId() );
- Events.instance().raiseEvent("org.jboss.seam.initTask." + task.getTask().getName());
+ manager.fireEvent(new InitTaskEvent(task.getTask().getName()));
return true;
}
}
@@ -303,7 +305,7 @@
}
else
{
- Events.instance().raiseEvent("org.jboss.seam.initProcess." + process.getProcessDefinition().getName());
+ manager.fireEvent(new InitProcessEvent(process.getProcessDefinition().getName()));
return true;
}
}
@@ -322,7 +324,7 @@
}
else
{
- Events.instance().raiseEvent("org.jboss.seam.initProcess." + process.getProcessDefinition().getName());
+ manager.fireEvent(new InitProcessEvent(process.getProcessDefinition().getName()));
return true;
}
}
@@ -411,7 +413,6 @@
);
}
-
@Override
public String toString()
{
Modified: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/ManagedJbpmContext.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/ManagedJbpmContext.java 2009-04-25 00:08:12 UTC (rev 10638)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/ManagedJbpmContext.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -6,26 +6,19 @@
*/
package org.jboss.seam.bpm;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
+import javax.annotation.PreDestroy;
+import javax.context.RequestScoped;
+import javax.inject.Initializer;
+import javax.inject.Produces;
import javax.naming.NamingException;
import javax.transaction.RollbackException;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
-import org.jboss.seam.Component;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Unwrap;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.contexts.Lifecycle;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
import org.jboss.seam.transaction.Transaction;
import org.jboss.seam.transaction.UserTransaction;
import org.jbpm.JbpmContext;
@@ -38,10 +31,7 @@
* @author <a href="mailto:steve at hibernate.org">Steve Ebersole</a>
* @author Gavin King
*/
- at Scope(ScopeType.EVENT)
- at Name("org.jboss.seam.bpm.jbpmContext")
- at BypassInterceptors
- at Install(precedence=BUILT_IN, dependencies="org.jboss.seam.bpm.jbpm")
+ at RequestScoped
public class ManagedJbpmContext implements Synchronization
{
private static final LogProvider log = Logging.getLogProvider(ManagedJbpmContext.class);
@@ -49,7 +39,7 @@
private JbpmContext jbpmContext;
private boolean synchronizationRegistered;
- @Create
+ @Initializer
public void create() throws NamingException, RollbackException, SystemException
{
jbpmContext = Jbpm.instance().getJbpmConfiguration().createJbpmContext();
@@ -67,7 +57,7 @@
}
}
- @Unwrap
+ @Produces
public JbpmContext getJbpmContext() throws NamingException, RollbackException, SystemException
{
joinTransaction();
@@ -132,7 +122,7 @@
}
}
- @Destroy
+ @PreDestroy
public void destroy()
{
if ( !synchronizationRegistered )
Added: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/CreateProcessEvent.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/CreateProcessEvent.java (rev 0)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/CreateProcessEvent.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -0,0 +1,21 @@
+package org.jboss.seam.bpm.events;
+
+/**
+ * This event is raised when a bpm process is created
+ *
+ * @author Shane Bryzak
+ */
+public class CreateProcessEvent
+{
+ private String processName;
+
+ public CreateProcessEvent(String processName)
+ {
+ this.processName = processName;
+ }
+
+ public String getProcessName()
+ {
+ return processName;
+ }
+}
Added: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndProcessEvent.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndProcessEvent.java (rev 0)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndProcessEvent.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -0,0 +1,22 @@
+package org.jboss.seam.bpm.events;
+
+/**
+ * This event is raised when a bpm process is ended
+ *
+ * @author Shane Bryzak
+ *
+ */
+public class EndProcessEvent
+{
+ private String processName;
+
+ public EndProcessEvent(String processName)
+ {
+ this.processName = processName;
+ }
+
+ public String getProcessName()
+ {
+ return processName;
+ }
+}
Added: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndTaskEvent.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndTaskEvent.java (rev 0)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/EndTaskEvent.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -0,0 +1,21 @@
+package org.jboss.seam.bpm.events;
+
+/**
+ * This event is raise when a bpm task ends
+ *
+ * @author Shane Bryzak
+ */
+public class EndTaskEvent
+{
+ private String taskName;
+
+ public EndTaskEvent(String taskName)
+ {
+ this.taskName = taskName;
+ }
+
+ public String getTaskName()
+ {
+ return taskName;
+ }
+}
Added: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitProcessEvent.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitProcessEvent.java (rev 0)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitProcessEvent.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -0,0 +1,21 @@
+package org.jboss.seam.bpm.events;
+
+/**
+ * This event is raised when a bpm process is initialized
+ *
+ * @author Shane Bryzak
+ */
+public class InitProcessEvent
+{
+ private String processName;
+
+ public InitProcessEvent(String processName)
+ {
+ this.processName = processName;
+ }
+
+ public String getProcessName()
+ {
+ return processName;
+ }
+}
Added: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitTaskEvent.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitTaskEvent.java (rev 0)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/InitTaskEvent.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -0,0 +1,21 @@
+package org.jboss.seam.bpm.events;
+
+/**
+ * This event is raised when a bpm task is initialized
+ *
+ * @author Shane Bryzak
+ */
+public class InitTaskEvent
+{
+ private String taskName;
+
+ public InitTaskEvent(String taskName)
+ {
+ this.taskName = taskName;
+ }
+
+ public String getTaskName()
+ {
+ return taskName;
+ }
+}
Added: modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/StartTaskEvent.java
===================================================================
--- modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/StartTaskEvent.java (rev 0)
+++ modules/trunk/bpm/src/main/java/org/jboss/seam/bpm/events/StartTaskEvent.java 2009-04-25 06:28:36 UTC (rev 10639)
@@ -0,0 +1,21 @@
+package org.jboss.seam.bpm.events;
+
+/**
+ * This event is raised when a bpm task is started
+ *
+ * @author Shane Bryzak
+ */
+public class StartTaskEvent
+{
+ private String taskName;
+
+ public StartTaskEvent(String taskName)
+ {
+ this.taskName = taskName;
+ }
+
+ public String getTaskName()
+ {
+ return taskName;
+ }
+}
More information about the seam-commits
mailing list