[riftsaw-commits] riftsaw SVN: r988 - in trunk: console and 20 other directories.

riftsaw-commits at lists.jboss.org riftsaw-commits at lists.jboss.org
Mon Sep 27 05:03:36 EDT 2010


Author: heiko.braun at jboss.com
Date: 2010-09-27 05:03:31 -0400 (Mon, 27 Sep 2010)
New Revision: 988

Added:
   trunk/console/bpaf/
   trunk/console/bpaf/pom.xml
   trunk/console/bpaf/src/
   trunk/console/bpaf/src/main/
   trunk/console/bpaf/src/main/java/
   trunk/console/bpaf/src/main/java/org/
   trunk/console/bpaf/src/main/java/org/jboss/
   trunk/console/bpaf/src/main/java/org/jboss/soa/
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityEndAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityFailedAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityStartAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/BPAFLogAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/EventAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceEndAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceStartAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceTerminationAdapter.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/JDBCPersistenceStrategy.java
   trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/PersistenceStrategy.java
   trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/DefaultEMLocator.java
   trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/EntityManagerLocator.java
Removed:
   trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/Runner.java
Modified:
   trunk/console/integration/pom.xml
   trunk/console/pom.xml
   trunk/distribution/pom.xml
   trunk/distribution/src/main/assembly/bin.xml
   trunk/distribution/src/main/release/db/bpel.properties
   trunk/distribution/src/main/release/install/build.xml
   trunk/pom.xml
   trunk/runtime/deployer/pom.xml
   trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/service/BPELEngineService.java
   trunk/samples/quickstart/hello_world/bpelContent/deploy.xml
Log:
BPAF history support, first cut (disabled by default)

Added: trunk/console/bpaf/pom.xml
===================================================================
--- trunk/console/bpaf/pom.xml	                        (rev 0)
+++ trunk/console/bpaf/pom.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,171 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.jboss.soa.bpel.console</groupId>
+    <artifactId>bpaf</artifactId>
+    <packaging>jar</packaging>
+    <version>2.2.0-SNAPSHOT</version>
+    <name>RiftSaw::Console::BPAF</name>
+
+    <parent>
+        <groupId>org.jboss.soa.bpel.console</groupId>
+        <artifactId>parent</artifactId>
+        <version>2.2.0-SNAPSHOT</version>
+    </parent>
+
+    <!-- Properties -->
+    <properties>
+        
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.jboss.bpm</groupId>
+            <artifactId>activity-monitor-model</artifactId>            
+        </dependency>
+
+        <!--dependency>
+            <groupId>org.jboss.errai</groupId>
+            <artifactId>errai-bus</artifactId>            
+        </dependency-->
+
+        <dependency>
+            <groupId>org.jboss.soa.bpel.console</groupId>
+            <artifactId>integration</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-core</artifactId>
+            <version>3.3.1.GA</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-annotations</artifactId>
+            <version>3.3.1.GA</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- RiftSaw -->
+
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-bpel-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-bpel-schemas</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.xmlbeans</groupId>
+            <artifactId>xmlbeans</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.soa.bpel.runtime</groupId>
+            <artifactId>riftsaw-engine</artifactId>
+            <version>${riftsaw.engine.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-bpel-store</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-bpel-dao</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-bpel-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-utils</artifactId>
+        </dependency>
+
+        <!--  ODE 2.0 dependencies
+        <dependency>
+          <groupId>org.jboss.soa.bpel</groupId>
+          <artifactId>riftsaw-il-common</artifactId>
+          <version>${riftsaw.engine.version}</version>
+        </dependency>
+        <dependency>
+          <groupId>org.jboss.soa.bpel</groupId>
+          <artifactId>riftsaw-engine</artifactId>
+          <version>${riftsaw.engine.version}</version>
+        </dependency>
+        -->
+
+        <!-- ODE1.3.3 dependencies -->
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-bpel-runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-bpel-epr</artifactId>
+        </dependency>
+        <!-- -->             
+
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+    </dependencies>
+
+
+    <build>
+        <finalName>riftsaw-console-bpaf</finalName>
+
+        <plugins>
+            <!-- Specify the compiler options and settings -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.0.2</version>
+
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                    <showDeprecation>false</showDeprecation>
+                    <showWarnings>false</showWarnings>
+                </configuration>
+            </plugin>
+
+            <!-- Produce source jars during the 'verify' phase -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <includes>
+                        <include>**/*TestCase.java</include>
+                        <include>**/*Test.java</include>
+                    </includes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityEndAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityEndAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityEndAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.ode.bpel.evt.ActivityExecEndEvent;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+import org.jboss.bpm.monitor.model.bpaf.State;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public final class ActivityEndAdapter
+    implements EventAdapter.EventDetailMapping<ActivityExecEndEvent> {
+
+    public Event adoptDetails(Event target, ActivityExecEndEvent source) {
+
+        Event.EventDetails details = target.getEventDetails();
+        details.setCurrentState(State.Closed_Completed);
+
+        ActivityStartAdapter.mapDefault(target, source);
+        
+        return target;
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityFailedAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityFailedAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityFailedAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.ode.bpel.evt.ActivityFailureEvent;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+import org.jboss.bpm.monitor.model.bpaf.State;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public final class ActivityFailedAdapter
+    implements EventAdapter.EventDetailMapping<ActivityFailureEvent> {
+
+    public Event adoptDetails(Event target, ActivityFailureEvent source) {
+
+        Event.EventDetails details = target.getEventDetails();
+        details.setCurrentState(State.Closed_Completed_Failed);
+
+        ActivityStartAdapter.mapDefault(target, source);
+
+        return target;
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityStartAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityStartAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/ActivityStartAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.ode.bpel.evt.ActivityEvent;
+import org.apache.ode.bpel.evt.ActivityExecStartEvent;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+import org.jboss.bpm.monitor.model.bpaf.State;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public final class ActivityStartAdapter
+    implements EventAdapter.EventDetailMapping<ActivityExecStartEvent> {
+
+    public Event adoptDetails(Event target, ActivityExecStartEvent source) {
+
+        Event.EventDetails details = target.getEventDetails();
+        details.setCurrentState(State.Open_Running);
+
+        mapDefault(target, source);
+
+        return target;
+    }
+
+    static void mapDefault(Event target, ActivityEvent source)
+    {
+        InstanceStartAdapter.mapDefault(target, source);
+        
+        target.setActivityDefinitionID(String.valueOf(source.getActivityDeclarationId()));
+        target.setActivityInstanceID(String.valueOf(source.getActivityId()));
+        target.setActivityName( source.getActivityName() );
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/BPAFLogAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/BPAFLogAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/BPAFLogAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.evt.*;
+import org.apache.ode.bpel.iapi.BpelEventListener;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+
+import java.util.Properties;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 20, 2010
+ */
+public class BPAFLogAdapter implements BpelEventListener {
+
+    protected final Log log = LogFactory.getLog(BPAFLogAdapter.class);
+    
+    final static Class[] notableEvents = new Class[] {
+            ActivityExecStartEvent.class,
+            ActivityExecEndEvent.class,
+            ActivityFailureEvent.class,
+            ProcessInstanceStartedEvent.class,
+            ProcessCompletionEvent.class,
+            ProcessTerminationEvent.class
+    };
+    
+    private PersistenceStrategy persistenceStrategy = null;
+
+    public void onEvent(BpelEvent bpelEvent) {
+        if(isNotable(bpelEvent))
+        {
+            Event event = EventAdapter.createBPAFModel(bpelEvent);
+            persistenceStrategy.persist(event);
+        }
+    }
+
+    public void startup(Properties properties) {
+        this.persistenceStrategy = new JDBCPersistenceStrategy();
+        this.persistenceStrategy.start();
+        log.info("Using: " + persistenceStrategy.getClass());
+    }
+
+    public void shutdown() {
+        this.persistenceStrategy.stop();
+        System.out.println("BPAFLogAdapter shutdown");        
+    }
+
+    private static boolean isNotable(BpelEvent event)
+    {
+        boolean notable = false;
+        for(Class c : notableEvents)
+            if(c.equals(event.getClass()))
+            {
+                notable = true;
+                break;
+            }
+        return notable;
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/EventAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/EventAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/EventAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.evt.*;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public class EventAdapter {
+
+    protected final static Log log = LogFactory.getLog(EventAdapter.class);
+    
+    static Map<Class<?>, EventDetailMapping> detailMapping = new HashMap<Class<?>, EventDetailMapping>();
+
+    static
+    {
+        detailMapping.put(ProcessInstanceStartedEvent.class, new InstanceStartAdapter());
+        detailMapping.put(ProcessCompletionEvent.class, new InstanceEndAdapter());
+        detailMapping.put(ProcessTerminationEvent.class, new InstanceTerminationAdapter());
+
+        detailMapping.put(ActivityExecStartEvent.class, new ActivityStartAdapter());
+        detailMapping.put(ActivityExecEndEvent.class, new ActivityEndAdapter());
+        detailMapping.put(ActivityFailureEvent.class, new ActivityFailedAdapter());
+    }
+
+    public static Event createBPAFModel(BpelEvent bpelEvent)
+    {
+        ProcessEvent source = (ProcessEvent)bpelEvent;
+
+        // base event data
+        Event target = new Event(false);
+        target.setTimestamp(bpelEvent.getTimestamp().getTime());
+        target.setProcessDefinitionID(source.getProcessId().toString());
+        target.setProcessName(source.getProcessName().toString());
+
+        EventDetailMapping mapping = detailMapping.get(bpelEvent.getClass());
+        if(mapping!=null)
+            mapping.adoptDetails(target, source);
+        else
+            log.warn("No mapping for "+ bpelEvent.getClass());
+
+        return target;
+    }
+
+    public interface EventDetailMapping<T extends ProcessEvent>
+    {
+        Event adoptDetails(Event target, T source);
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceEndAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceEndAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceEndAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.ode.bpel.evt.ProcessCompletionEvent;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+import org.jboss.bpm.monitor.model.bpaf.State;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public final class InstanceEndAdapter implements EventAdapter.EventDetailMapping<ProcessCompletionEvent> {
+    public Event adoptDetails(Event target, ProcessCompletionEvent source) {
+
+        Event.EventDetails details = target.getEventDetails();
+        details.setCurrentState(State.Closed_Completed);
+
+        InstanceStartAdapter.mapDefault(target, source);
+        
+        return target;
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceStartAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceStartAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceStartAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.apache.ode.bpel.evt.ProcessInstanceStartedEvent;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+import org.jboss.bpm.monitor.model.bpaf.State;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public final class InstanceStartAdapter
+        implements EventAdapter.EventDetailMapping<ProcessInstanceStartedEvent> {
+
+    public Event adoptDetails(Event target, ProcessInstanceStartedEvent source) {
+
+        Event.EventDetails details = target.getEventDetails();
+        details.setCurrentState(State.Open_Running);
+
+        mapDefault(target, source);
+
+        return target;
+    }
+
+    static void mapDefault(Event target, ProcessInstanceEvent source) {
+        target.setProcessInstanceID(source.getProcessInstanceId().toString());
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceTerminationAdapter.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceTerminationAdapter.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/InstanceTerminationAdapter.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.ode.bpel.evt.ProcessTerminationEvent;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+import org.jboss.bpm.monitor.model.bpaf.State;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public final class InstanceTerminationAdapter implements EventAdapter.EventDetailMapping<ProcessTerminationEvent> {
+    public Event adoptDetails(Event target, ProcessTerminationEvent source) {
+
+        Event.EventDetails details = target.getEventDetails();
+        details.setCurrentState(State.Closed_Cancelled);
+
+        InstanceStartAdapter.mapDefault(target, source);
+
+        return target;
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/JDBCPersistenceStrategy.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/JDBCPersistenceStrategy.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/JDBCPersistenceStrategy.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.monitor.model.bpaf.Event;
+import org.jboss.soa.bpel.console.util.DefaultEMLocator;
+import org.jboss.soa.bpel.console.util.EntityManagerLocator;
+
+import javax.persistence.EntityManager;
+
+/**
+ * Plain JDBC batch persistence.
+ *
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public final class JDBCPersistenceStrategy implements PersistenceStrategy {
+
+    protected final Log log = LogFactory.getLog(JDBCPersistenceStrategy.class);
+
+    private EntityManagerLocator defaultLocator = new DefaultEMLocator();
+
+    public void start() {
+
+    }
+
+    public void stop() {
+
+    }
+
+    public void persist(Event event) {
+
+        try {
+
+            // get entity manager
+            EntityManager entityManager = defaultLocator.locate();
+
+            // It's managed by JACORB
+            // Hence we don't deal with the TX here
+            entityManager.persist(event);
+
+        } catch (Exception e) {
+            log.error("Error persisting event", e);
+        }
+
+    }
+}

Added: trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/PersistenceStrategy.java
===================================================================
--- trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/PersistenceStrategy.java	                        (rev 0)
+++ trunk/console/bpaf/src/main/java/org/jboss/soa/bpel/console/bpaf/PersistenceStrategy.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.bpaf;
+
+import org.jboss.bpm.monitor.model.bpaf.Event;
+
+/**
+ * Strategy for persisting {@link org.jboss.bpm.monitor.model.bpaf.Event}'s
+ *  
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 21, 2010
+ */
+public interface PersistenceStrategy {
+    void start();
+    void stop();
+    void persist(Event event);
+}

Modified: trunk/console/integration/pom.xml
===================================================================
--- trunk/console/integration/pom.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/console/integration/pom.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -91,6 +91,22 @@
             <groupId>org.jboss.soa.bpel</groupId>
             <artifactId>riftsaw-bpel-epr</artifactId>
         </dependency>
+
+          <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-dao-jpa</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.openjpa</groupId>
+                    <artifactId>openjpa</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.soa.bpel</groupId>
+            <artifactId>riftsaw-dao-jpa-hibernate</artifactId>
+        </dependency>
+        
         <!-- -->
 
         <!-- Common -->

Added: trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/DefaultEMLocator.java
===================================================================
--- trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/DefaultEMLocator.java	                        (rev 0)
+++ trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/DefaultEMLocator.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.util;
+
+import org.apache.ode.dao.jpa.bpel.BpelDAOConnectionImpl;
+
+import javax.persistence.EntityManager;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 22, 2010
+ */
+public class DefaultEMLocator implements EntityManagerLocator {
+    public EntityManager locate() {
+
+        final ThreadLocal<BpelDAOConnectionImpl> currentConnection = BpelDAOConnectionImpl.getThreadLocal();
+        BpelDAOConnectionImpl bpelDAOConnection = currentConnection.get();
+        if(null==bpelDAOConnection)
+            throw new IllegalStateException("Unabled to locate BpelDAOConnectionImpl from ThreadLocal");
+
+        return bpelDAOConnection.getEntityManager();
+        
+    }
+}

Added: trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/EntityManagerLocator.java
===================================================================
--- trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/EntityManagerLocator.java	                        (rev 0)
+++ trunk/console/integration/src/main/java/org/jboss/soa/bpel/console/util/EntityManagerLocator.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2009 JBoss, a divison Red Hat, Inc
+ *
+ * Licensed 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.
+ */
+package org.jboss.soa.bpel.console.util;
+
+import javax.persistence.EntityManager;
+
+/**
+ * @author: Heiko Braun <hbraun at redhat.com>
+ * @date: Sep 22, 2010
+ */
+public interface EntityManagerLocator {
+    EntityManager locate();
+}

Modified: trunk/console/pom.xml
===================================================================
--- trunk/console/pom.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/console/pom.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -19,6 +19,7 @@
 		<module>integration</module>
 		<module>identity</module>		
 		<module>bpel2svg</module>
+        <module>bpaf</module>
 	</modules>
 
 </project>

Modified: trunk/distribution/pom.xml
===================================================================
--- trunk/distribution/pom.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/distribution/pom.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -179,6 +179,18 @@
 
         <dependency>
             <groupId>org.jboss.soa.bpel.console</groupId>
+            <artifactId>bpaf</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jboss.bpm</groupId>
+            <artifactId>activity-monitor-model</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.jboss.soa.bpel.console</groupId>
             <artifactId>identity</artifactId>
             <version>${version}</version>
         </dependency>

Modified: trunk/distribution/src/main/assembly/bin.xml
===================================================================
--- trunk/distribution/src/main/assembly/bin.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/distribution/src/main/assembly/bin.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -119,6 +119,14 @@
       </includes>
     </fileSet>
 
+      <fileSet>
+          <directory>../console/bpaf/target</directory>
+          <outputDirectory>/modules/bpel-console</outputDirectory>
+          <includes>
+              <include>riftsaw-console-bpaf.jar</include>
+          </includes>
+    </fileSet>
+
     <fileSet>
       <directory>../console/identity/target</directory>
       <outputDirectory>/modules/bpel-console</outputDirectory>
@@ -173,7 +181,7 @@
         <include>org.jboss.bpm:gwt-console-server-integration</include>
         <include>org.jboss.bpm:gwt-console-rpc</include>
         <include>org.codehaus.jettison:jettison</include>  
-        
+        <include>org.jboss.bpm:activity-monitor-model</include>        
       </includes>
     </dependencySet>
     

Modified: trunk/distribution/src/main/release/db/bpel.properties
===================================================================
--- trunk/distribution/src/main/release/db/bpel.properties	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/distribution/src/main/release/db/bpel.properties	2010-09-27 09:03:31 UTC (rev 988)
@@ -128,8 +128,14 @@
 hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup
 hibernate.show_sql=false
 hibernate.connection.isolation=2
+hibernate.jdbc.batch_size=20
 
 
 jta.UserTransaction=UserTransaction
 
 ode.persistence=hibernate
+
+#
+# BPAF History
+#
+#bpel.event.listeners=org.jboss.soa.bpel.console.bpaf.BPAFLogAdapter

Modified: trunk/distribution/src/main/release/install/build.xml
===================================================================
--- trunk/distribution/src/main/release/install/build.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/distribution/src/main/release/install/build.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -102,6 +102,10 @@
     <mkdir dir="${deploy.dir}/bpel-console"/>
     <mkdir dir="${deploy.dir}/bpel-console/bpel-identity.sar"/>
     <mkdir dir="${deploy.dir}/bpel-console/gwt-console-server.war"/>
+
+      <copy file="${modules}/bpel-console/riftsaw-console-bpaf.jar" todir="${deploy.dir}/bpel-console"/>
+      <copy file="${modules}/bpel-console/activity-monitor-model.jar" todir="${deploy.dir}/bpel-console"/>      
+
     <copy file="${modules}/bpel-console/riftsaw-console-integration.jar" todir="${deploy.dir}/bpel-console"/>
     <copy file="${modules}/bpel-console/jettison.jar" todir="${deploy.dir}/bpel-console"/>  
     <unzip src="${modules}/bpel-console/riftsaw-console-identity.jar" dest="${deploy.dir}/bpel-console/bpel-identity.sar"/>

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/pom.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -77,7 +77,7 @@
   <properties>
     <riftsaw.ode.version>2.2.0-SNAPSHOT</riftsaw.ode.version>
     <riftsaw.engine.version>2.2.0-SNAPSHOT</riftsaw.engine.version>
-    <bpel.console.version>2.1.2</bpel.console.version>
+    <bpel.console.version>2.2.0-SNAPSHOT</bpel.console.version>
     <commons.logging.version>1.1.1</commons.logging.version>
     <junit.version>4.8.1</junit.version>
     <jboss.version>5.1.0.GA</jboss.version>
@@ -125,6 +125,12 @@
       <classifier>riftsaw</classifier>
       <type>war</type>
     </dependency>
+       <dependency>
+           <groupId>org.jboss.bpm</groupId>
+           <artifactId>activity-monitor-model</artifactId>
+           <version>1.0.0-SNAPSHOT</version>
+       </dependency>
+      
       <dependency>
         <groupId>wsdl4j</groupId>
         <artifactId>wsdl4j</artifactId>

Modified: trunk/runtime/deployer/pom.xml
===================================================================
--- trunk/runtime/deployer/pom.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/runtime/deployer/pom.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -74,6 +74,12 @@
 			<artifactId>junit</artifactId>			
  			<scope>test</scope>
 		</dependency>
+
+        <dependency>
+            <groupId>apache-xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+            <version>2.9.0</version>
+        </dependency>
 	</dependencies>
 	<build>
 		<finalName>jboss-riftsaw-deployer</finalName>

Modified: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/service/BPELEngineService.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/service/BPELEngineService.java	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/service/BPELEngineService.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -20,9 +20,11 @@
 import org.jboss.logging.Logger;
 import org.jboss.soa.bpel.runtime.engine.BPELEngine;
 import org.jboss.soa.bpel.runtime.engine.BPELEngineFactory;
+import org.jboss.soa.bpel.runtime.engine.ode.BPELEngineImpl;
 import org.jboss.util.naming.NonSerializableFactory;
 
 import javax.naming.*;
+import javax.persistence.EntityManagerFactory;
 
 /**
  * This is the JBoss Service managing the BPEL engine.
@@ -58,6 +60,17 @@
     m_bpelEngine.init();
 
     rebindPMAPI();
+
+    // hack to expose the EntityManagerFactory.
+    // See org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl as well.
+    EntityManagerFactory emf = (EntityManagerFactory)
+            ((BPELEngineImpl)m_bpelEngine).getOdeConfig().getProperties().get("ode.emf");
+
+    if(emf!=null) // can happen when the persistence implementation is changed
+       bindEMF(emf);
+    else
+       log.warn("EntityManagerFactory cannot be exposed through JNDI.");
+
   }
 
   /**
@@ -167,4 +180,11 @@
 	    NonSerializableFactory.rebind(fullName, m_bpelEngine.getManagementInterface(), true);
 	}
   }
+
+   private void bindEMF(EntityManagerFactory emf) throws NamingException {
+       InitialContext rootCtx = new InitialContext();
+       Name fullName = rootCtx.getNameParser("").parse("bpel/EntityManagerFactory");
+       logger.info("EntityManagerFactory fullName="+fullName);
+       NonSerializableFactory.rebind(fullName, emf, true);
+   }
 }

Deleted: trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/Runner.java
===================================================================
--- trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/Runner.java	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/ws/Runner.java	2010-09-27 09:03:31 UTC (rev 988)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.bpel.runtime.ws;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Operation;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-public class Runner
-{
-  static QName service;
-  static String port;
-
-  public static void main(String[] args) throws Exception
-  {
-     // HelloWorldProcessRequest
-
-    WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
-    Definition wsdlDefinition = wsdlReader.readWSDL(
-        "file:///Users/hbraun/dev/env/riftsaw-distro/jbossesb-4.6/samples/quickstarts/webservice_esb_bpel/bpel/wsdl/BPELRetailer.wsdl"
-    );
-
-    service = new QName("http://www.jboss.org/samples/bpel/Retailer.wsdl", "RetailerService");
-    port = "RetailerPort";
-
-    SOAPMessageAdapter soapAdapter =new SOAPMessageAdapter(wsdlDefinition, service, port);
-
-    System.out.println("RPC ? "+soapAdapter.isRPC());
-
-    WSDLParser parser = new WSDLParser(wsdlDefinition);
-    Operation op = parser.getDocLitOperation(
-        service, port, new QName("http://www.jboss.org/samples/bpel/CustomerOrder.xsd", "customerOrder")
-    );
-
-    System.out.println("operation: "+op.getName());
-
-    System.out.println(
-        "URL: " + parser.getServiceLocationURL(service, port)
-    );
-  }
-
-}

Modified: trunk/samples/quickstart/hello_world/bpelContent/deploy.xml
===================================================================
--- trunk/samples/quickstart/hello_world/bpelContent/deploy.xml	2010-09-27 07:21:17 UTC (rev 987)
+++ trunk/samples/quickstart/hello_world/bpelContent/deploy.xml	2010-09-27 09:03:31 UTC (rev 988)
@@ -23,6 +23,7 @@
 
 	<process name="bpl:HelloWorld">
 		<active>true</active>
+        <process-events generate="all"/>
 		<provide partnerLink="helloPartnerLink">
 			<service name="intf:HelloService" port="HelloPort"/>
 		</provide>



More information about the riftsaw-commits mailing list