You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by lw...@apache.org on 2006/11/16 18:26:06 UTC
svn commit: r475825 - in /incubator/ode/trunk: dao-jpa-ojpa-derby/
dao-jpa-ojpa-derby/src/ dao-jpa-ojpa-derby/src/test/
dao-jpa-ojpa-derby/src/test/java/ dao-jpa-ojpa-derby/src/test/java/org/
dao-jpa-ojpa-derby/src/test/java/org/apache/ dao-jpa-ojpa-de...
Author: lwaterman
Date: Thu Nov 16 09:25:59 2006
New Revision: 475825
URL: http://svn.apache.org/viewvc?view=rev&rev=475825
Log:
Add untested OpenJPA persistence
Added:
incubator/ode/trunk/dao-jpa/
incubator/ode/trunk/dao-jpa-ojpa/
incubator/ode/trunk/dao-jpa-ojpa-derby/
incubator/ode/trunk/dao-jpa-ojpa-derby/pom.xml
incubator/ode/trunk/dao-jpa-ojpa-derby/src/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/resources/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/resources/META-INF/
incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/resources/META-INF/persistence.xml
incubator/ode/trunk/dao-jpa-ojpa/pom.xml
incubator/ode/trunk/dao-jpa-ojpa/src/
incubator/ode/trunk/dao-jpa-ojpa/src/main/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/ojpa/
incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/ojpa/BPELDAOConnectionFactoryImpl.java
incubator/ode/trunk/dao-jpa-ojpa/src/main/resources/
incubator/ode/trunk/dao-jpa-ojpa/src/main/resources/META-INF/
incubator/ode/trunk/dao-jpa-ojpa/src/main/resources/META-INF/persistence.xml
incubator/ode/trunk/dao-jpa/pom.xml
incubator/ode/trunk/dao-jpa/src/
incubator/ode/trunk/dao-jpa/src/main/
incubator/ode/trunk/dao-jpa/src/main/java/
incubator/ode/trunk/dao-jpa/src/main/java/org/
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ActivityRecoveryDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelationSetDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultTest.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageTest.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/PartnerLinkDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java
Added: incubator/ode/trunk/dao-jpa-ojpa-derby/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa-ojpa-derby/pom.xml?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa-ojpa-derby/pom.xml (added)
+++ incubator/ode/trunk/dao-jpa-ojpa-derby/pom.xml Thu Nov 16 09:25:59 2006
@@ -0,0 +1,80 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<project>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
+ <name>ODE :: OpenJPA DAO Impl Using Derby</name>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+ <version>2.0-SNAPSHOT</version>
+
+
+
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+-->
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>ode-dao-jpa</artifactId>
+ <groupId>org.apache.ode</groupId>
+ </exclusion>
+ </exclusions>
+
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </dependency>
+
+
+
+ </dependencies>
+
+
+
+
+</project>
Added: incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java (added)
+++ incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/java/org/apache/ode/dao/jpa/test/InsertObjectTest.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,74 @@
+package org.apache.ode.dao.jpa.test;
+
+import java.util.Collection;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import org.apache.ode.bpel.dao.BpelDAOConnection;
+import org.apache.ode.dao.jpa.ojpa.*;
+import org.apache.openjpa.persistence.ArgumentException;
+
+import junit.framework.TestCase;
+
+public class InsertObjectTest extends TestCase {
+
+ private EntityManager em;
+
+ @Override
+ protected void setUp() throws Exception {
+
+ try {
+
+
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory("ode-unit-test");
+ em = emf.createEntityManager();
+
+ if ( em.isOpen() ) {
+ System.out.println("connection open");
+ }
+
+
+
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+
+
+ }
+
+ public void testStart() throws Exception {
+ System.out.println("start test");
+ String tmp = new String("some data");
+
+ BPELDAOConnectionFactoryImpl factory = new BPELDAOConnectionFactoryImpl();
+ BpelDAOConnection conn = factory.getConnection();
+
+
+// Collection<MessageTest> tmp2 = ft.getFaultMessages();
+// ft.addMessage("Test Message");
+// ft.addProp("test1", "test prop 1");
+
+
+ //Collection<TestMessage> tmp = ft.g
+ try {
+ em.getTransaction().begin();
+ em.persist(conn);
+
+ em.flush();
+ em.getTransaction().commit();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ em.close();
+ }
+
+
+}
Added: incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/resources/META-INF/persistence.xml?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/resources/META-INF/persistence.xml (added)
+++ incubator/ode/trunk/dao-jpa-ojpa-derby/src/test/resources/META-INF/persistence.xml Thu Nov 16 09:25:59 2006
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.0">
+ <persistence-unit name="ode-unit-test">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.BPELDAOConnectionImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.FaultDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageExchangeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.PartnerLinkDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ProcessDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ProcessInstanceDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <properties>
+ <!-- Properties for an embedded Derby connection
+ <property name="openjpa.ConnectionDriverName"
+ value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.ConnectionProperties"
+ value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
+ -->
+
+ <!-- Properties for a networked Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.derby.jdbc.ClientDriver"/>
+ <property name="openjpa.ConnectionURL" value="jdbc:derby://localhost:1527/sample"/>
+ <property name="openjpa.ConnectionUserName" value="APP"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.DerbyDictionary"/>
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ </properties>
+ </persistence-unit>
+</persistence>
\ No newline at end of file
Added: incubator/ode/trunk/dao-jpa-ojpa/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa-ojpa/pom.xml?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa-ojpa/pom.xml (added)
+++ incubator/ode/trunk/dao-jpa-ojpa/pom.xml Thu Nov 16 09:25:59 2006
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<project>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa</artifactId>
+ <name>ODE :: OpenJPA DAO Impl</name>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+ <version>2.0-SNAPSHOT</version>
+
+
+
+ <dependencies>
+<!--
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+-->
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa-all</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-dao</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.0</version>
+
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <id>OpenJPA Enhancer</id>
+ <configuration>
+ <tasks>
+ <java classname="org.apache.openjpa.enhance.PCEnhancer">
+ <arg line="-p ./src/main/resources/META-INF/persistence.xml"/>
+ <arg line="-d ./target/classes"/>
+ <classpath>
+ <path refid="maven.dependency.classpath"/>
+ </classpath>
+ </java>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+
+ </plugin>
+
+ </plugins>
+ </build>
+
+
+</project>
Added: incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/ojpa/BPELDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/ojpa/BPELDAOConnectionFactoryImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/ojpa/BPELDAOConnectionFactoryImpl.java (added)
+++ incubator/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/ojpa/BPELDAOConnectionFactoryImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,19 @@
+package org.apache.ode.dao.jpa.ojpa;
+
+
+import java.util.Properties;
+
+import org.apache.ode.bpel.dao.BpelDAOConnection;
+import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
+import org.apache.ode.dao.jpa.BPELDAOConnectionImpl;
+
+public class BPELDAOConnectionFactoryImpl implements BpelDAOConnectionFactory {
+
+ public BpelDAOConnection getConnection() {
+ return new BPELDAOConnectionImpl();
+ }
+
+ public void init(Properties properties) {
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa-ojpa/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa-ojpa/src/main/resources/META-INF/persistence.xml?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa-ojpa/src/main/resources/META-INF/persistence.xml (added)
+++ incubator/ode/trunk/dao-jpa-ojpa/src/main/resources/META-INF/persistence.xml Thu Nov 16 09:25:59 2006
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.0">
+ <persistence-unit name="ode-dao">
+ <!--
+ This properties file is used specifically by the
+ OpenJPA Enhancer.
+ -->
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.BPELDAOConnectionImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.FaultDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageExchangeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.MessageRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.PartnerLinkDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ProcessDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ProcessInstanceDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ </persistence-unit>
+</persistence>
\ No newline at end of file
Added: incubator/ode/trunk/dao-jpa/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/pom.xml?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/pom.xml (added)
+++ incubator/ode/trunk/dao-jpa/pom.xml Thu Nov 16 09:25:59 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<project>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa</artifactId>
+ <name>ODE :: JPA DAO Impl</name>
+ <description>A JPA Implementation of the ODE DAO</description>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+ <version>2.0-SNAPSHOT</version>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-dao</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ </dependencies>
+
+
+</project>
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ActivityRecoveryDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ActivityRecoveryDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ActivityRecoveryDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ActivityRecoveryDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+
+import java.util.Date;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+
+@Entity
+@Table(name="ODE_ACTIVITY_RECOVERY")
+public class ActivityRecoveryDAOImpl implements ActivityRecoveryDAO {
+
+ @Id @Column(name="ACTIVITY_ID") private long _activityId;
+ @Basic @Column(name="CHANNEL") private String _channel;
+ @Basic @Column(name="REASON") private String _reason;
+ @Basic @Column(name="DATE_TIME") private Date _dateTime;
+ @Lob @Column(name="DETAILS") private String _details;
+ @Basic @Column(name="ACTIONS") private String _actions;
+ @Basic @Column(name="RETRIES") private int _retries;
+ @Version @Column(name="VERSION") private long _version;
+
+ public ActivityRecoveryDAOImpl() {}
+ public ActivityRecoveryDAOImpl(String channel, long activityId,
+ String reason, Date dateTime, Element data, String[] actions,
+ int retries) {
+ _channel = channel;
+ _activityId = activityId;
+ _reason = reason;
+ _dateTime = dateTime;
+
+ // TODO: implement
+ //_details = data;
+ //_actions = action;
+
+ _retries = retries;
+
+ }
+
+ public String getActions() {
+ return _actions;
+ }
+
+ public String[] getActionsList() {
+ return getActions().split(" ");
+ }
+
+ public long getActivityId() {
+ return _activityId;
+ }
+
+ public String getChannel() {
+ return _channel;
+ }
+
+ public Date getDateTime() {
+ return _dateTime;
+ }
+
+ public Element getDetails() {
+ Element ret = null;
+ try {
+ ret = DOMUtils.stringToDOM(_details);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return ret;
+ }
+
+ public String getReason() {
+ return _reason;
+ }
+
+ public int getRetries() {
+ return _retries;
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/BPELDAOConnectionImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,135 @@
+package org.apache.ode.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.common.BpelEventFilter;
+import org.apache.ode.bpel.common.InstanceFilter;
+import org.apache.ode.bpel.common.ProcessFilter;
+import org.apache.ode.bpel.dao.BpelDAOConnection;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.evt.BpelEvent;
+
+@Entity
+@Table(name="ODE_ROOT")
+public class BPELDAOConnectionImpl implements BpelDAOConnection {
+
+ @Id @Column(name="ROOT_ID")
+ private Long _id;
+
+ @OneToMany(fetch=FetchType.LAZY,mappedBy="_connection",cascade={CascadeType.ALL})
+ private Collection<ProcessDAOImpl> _processes = new ArrayList<ProcessDAOImpl>();
+
+ @OneToMany(fetch=FetchType.LAZY,mappedBy="_connection",cascade={CascadeType.ALL})
+ private Collection<ProcessInstanceDAOImpl> _instances = new ArrayList<ProcessInstanceDAOImpl>();
+
+ @OneToMany(fetch=FetchType.LAZY,mappedBy="_connection",cascade={CascadeType.ALL})
+ private Collection<MessageExchangeDAOImpl> _messageEx = new ArrayList<MessageExchangeDAOImpl>();
+
+ @OneToMany(fetch=FetchType.LAZY,mappedBy="_connection",cascade={CascadeType.ALL})
+ private Collection<ScopeDAOImpl> _scopes = new ArrayList<ScopeDAOImpl>();
+
+ public List<BpelEvent> bpelEventQuery(InstanceFilter ifilter,
+ BpelEventFilter efilter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Date> bpelEventTimelineQuery(InstanceFilter ifilter,
+ BpelEventFilter efilter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void close() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public MessageExchangeDAO createMessageExchange(char dir) {
+ MessageExchangeDAOImpl ret = new MessageExchangeDAOImpl(dir,this);
+ _messageEx.add(ret);
+ return ret;
+ }
+
+ public ProcessDAO createProcess(QName pid, QName type) {
+ ProcessDAOImpl ret = new ProcessDAOImpl(pid,type,this);
+ _processes.add(ret);
+ return ret;
+ }
+
+ void addInstance(ProcessInstanceDAOImpl inst) {
+ _instances.add(inst);
+ }
+ void addScope(ScopeDAOImpl scope) {
+ _scopes.add(scope);
+ }
+
+ public ProcessInstanceDAO getInstance(Long iid) {
+ // TODO: may need a map or DB lookup here for performance
+ for (ProcessInstanceDAOImpl inst : _instances) {
+ if (inst.getInstanceId() == iid ) return inst;
+ }
+ return null;
+ }
+
+ public MessageExchangeDAO getMessageExchange(String mexid) {
+ // TODO: may need a map or DB lookup here for performance
+ for ( MessageExchangeDAOImpl mex : _messageEx ) {
+ if ( mex.getMessageExchangeId().equals(mexid)) return mex;
+ }
+ return null;
+ }
+
+ public ProcessDAO getProcess(QName processId) {
+ for ( ProcessDAOImpl p : _processes){
+ if ( p.getProcessId().equals(processId)) return p;
+ }
+ return null;
+ }
+
+ public ScopeDAO getScope(Long siidl) {
+ // TODO: May need a map or DB lookup here for performance
+ for ( ScopeDAOImpl s : _scopes ) {
+ if ( s.getScopeInstanceId() == siidl ) return s;
+ }
+ return null;
+ }
+
+ public void insertBpelEvent(BpelEvent event, ProcessDAO process,
+ ProcessInstanceDAO instance) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Collection<ProcessInstanceDAO> instanceQuery(InstanceFilter criteria) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Collection<ProcessInstanceDAO> instanceQuery(String expression) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Collection<ProcessDAO> processQuery(ProcessFilter criteria) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelationSetDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelationSetDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelationSetDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelationSetDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+
+@Entity
+@Table(name="ODE_CORRELATION_SET")
+public class CorrelationSetDAOImpl implements CorrelationSetDAO {
+
+ @Id @Column(name="CORRELATION_SET_ID") private Long _correlationSetId;
+ @Basic @Column(name="NAME") private String _name;
+ @Basic @Column(name="PROPERTIES") private HashMap<QName,String> _props = new HashMap<QName,String>();
+ @Basic @Column(name="CORRELATION_KEY") private CorrelationKey _correlationKey;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="SCOPE_ID")
+ private ScopeDAOImpl _scope;
+ @Version @Column(name="VERSION") private long _version;
+
+ public CorrelationSetDAOImpl() {}
+ public CorrelationSetDAOImpl(ScopeDAOImpl scope, String name) {
+ _name = name;
+ _scope = scope;
+ }
+
+ public Long getCorrelationSetId() {
+ return _correlationSetId;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public Map<QName, String> getProperties() {
+ return _props;
+ }
+
+ public ScopeDAO getScope() {
+ return _scope;
+ }
+
+ public CorrelationKey getValue() {
+ return _correlationKey;
+ }
+
+ public void setValue(QName[] names, CorrelationKey values) {
+ _correlationKey = values;
+ for (int m = 0; m < names.length; m++) {
+ _props.put(names[m], values.getValues()[m]);
+ }
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/CorrelatorDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.dao.CorrelatorDAO;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.bpel.dao.MessageRouteDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+
+@Entity
+@Table(name="ODE_CORRELATOR")
+public class CorrelatorDAOImpl implements CorrelatorDAO {
+
+ @Id @Column(name="CORRELATOR_ID") private Long _correlatorId;
+ @Basic @Column(name="CORRELATOR_KEY") private String _correlatorKey;
+ @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<MessageRouteDAOImpl> _routes = new ArrayList<MessageRouteDAOImpl>();
+ @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<MessageExchangeDAOImpl> _exchanges = new ArrayList<MessageExchangeDAOImpl>();
+
+ @Version @Column(name="VERSION") private long _version;
+
+ public CorrelatorDAOImpl(){}
+ public CorrelatorDAOImpl(String correlatorKey) {
+ _correlatorKey = correlatorKey;
+ }
+
+ public void addRoute(String routeGroupId, ProcessInstanceDAO target,
+ int index, CorrelationKey correlationKey) {
+ _routes.add(new MessageRouteDAOImpl(correlationKey,routeGroupId,index,(ProcessInstanceDAOImpl)target));
+ }
+
+ public MessageExchangeDAO dequeueMessage(CorrelationKey correlationKey) {
+ for (Iterator itr=_exchanges.iterator(); itr.hasNext();){
+ MessageExchangeDAOImpl mex = (MessageExchangeDAOImpl)itr.next();
+ if (mex.getCorrelationKeys().contains(correlationKey)) {
+ itr.remove();
+ return mex;
+ }
+ }
+ return null;
+ }
+
+ public void enqueueMessage(MessageExchangeDAO mex,
+ CorrelationKey[] correlationKeys) {
+ for (CorrelationKey key : correlationKeys ) {
+ ((MessageExchangeDAOImpl)mex).addCorrelationKey(key);
+ }
+ _exchanges.add((MessageExchangeDAOImpl)mex);
+
+ }
+
+ public MessageRouteDAO findRoute(CorrelationKey correlationKey) {
+ for (MessageRouteDAOImpl mr : _routes ) {
+ if ( mr.getCorrelationKey().equals(correlationKey)) return mr;
+ }
+ return null;
+ }
+
+ public String getCorrelatorId() {
+ return _correlatorKey;
+ }
+
+ public void removeRoutes(String routeGroupId, ProcessInstanceDAO target) {
+ for (Iterator itr=_routes.iterator(); itr.hasNext(); ) {
+ MessageRouteDAOImpl mr = (MessageRouteDAOImpl)itr.next();
+ if ( mr.getGroupId().equals(routeGroupId) &&
+ mr.getTargetInstance().equals(target))
+ itr.remove();
+ }
+ }
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.dao.FaultDAO;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+
+@Entity
+@Table(name="ODE_FAULT")
+public class FaultDAOImpl implements FaultDAO {
+
+ @Id @Column(name="FAULT_ID") private Long _id;
+ @Basic @Column(name="NAME") private QName _name;
+ @Basic @Column(name="MESSAGE") private String _explanation;
+ @Lob @Column(name="DATA") private String _data;
+ @Basic @Column(name="LINE_NUMBER") private int _lineNo;
+ @Basic @Column(name="ACTIVITY_ID") private int _activityId;
+ @Version @Column(name="VERSION") private long _version;
+
+ public FaultDAOImpl() {}
+ public FaultDAOImpl(QName faultName, String explanation, int faultLineNo,
+ int activityId, Element faultMessage) {
+ _name = faultName;
+ _explanation = explanation;
+ _lineNo = faultLineNo;
+ _activityId = activityId;
+ // TODO setFaultMessage(faultMessage);
+ }
+
+ public int getActivityId() {
+ return _activityId;
+ }
+
+ public Element getData() {
+ Element ret = null;
+
+ try {
+ ret = DOMUtils.stringToDOM(_data);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ return ret;
+ }
+
+ public String getExplanation() {
+ return _explanation;
+ }
+
+ public int getLineNo() {
+ return _lineNo;
+ }
+
+ public QName getName() {
+ return _name;
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultTest.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultTest.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/FaultTest.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,52 @@
+package org.apache.ode.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Lob;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+@Entity
+@Table(name="TEST_FAULT")
+public class FaultTest {
+
+ @Lob @Column(name="NAME") private String name;
+ @Basic @Column(name="PROPERTIES") private Properties props;
+ @OneToMany(fetch=FetchType.LAZY,mappedBy="faultTest",cascade={CascadeType.ALL})
+ private Collection<MessageTest> faultMessages = new ArrayList<MessageTest>();
+
+
+ public String getName() {
+ return name;
+ }
+
+ public Collection<MessageTest> getFaultMessages() {
+ return faultMessages;
+ }
+
+ public void setName(String value) {
+ name = value;
+ }
+
+ public void addProp(String key, String value) {
+ if ( props == null ) props = new Properties();
+ props.put(key, value);
+ }
+
+ public void addMessage (String msg) {
+ //if ( faultMessages == null ) faultMessages = new ArrayList<MessageTest>();
+ faultMessages.add(new MessageTest(this,"Test DATA"));
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.dao.MessageDAO;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+
+@Entity
+@Table(name="ODE_MESSAGE")
+public class MessageDAOImpl implements MessageDAO {
+
+ @Id @Column(name="MESSAGE_ID") private Long _id;
+ @Basic @Column(name="TYPE") private QName _type;
+ @Lob @Column(name="DATA") private String _data;
+ @Transient private Element _element;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="MESSAGE_EXCHANGE_ID")
+ private MessageExchangeDAOImpl _messageExchange;
+ @Version @Column(name="VERSION") private long _version;
+
+ public MessageDAOImpl() {
+
+ }
+ public MessageDAOImpl(QName type, MessageExchangeDAOImpl me) {
+ _type = type;
+ _messageExchange = me;
+ }
+
+ public Element getData() {
+ if ( _element == null && _data != null ) {
+ try {
+ _element = DOMUtils.stringToDOM(_data);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return _element;
+ }
+
+ public MessageExchangeDAO getMessageExchange() {
+ return _messageExchange;
+ }
+
+ public QName getType() {
+ return _type;
+ }
+
+ public void setData(Element value) {
+ _data = DOMUtils.domToString(value);
+ _element = value;
+ }
+
+ public void setType(QName type) {
+ _type = type;
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageExchangeDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,294 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.dao.MessageDAO;
+import org.apache.ode.bpel.dao.MessageExchangeDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+
+@Entity
+@Table(name="ODE_MESSAGE_EXCHANGE")
+public class MessageExchangeDAOImpl implements MessageExchangeDAO {
+
+ @Id @Column(name="MESSAGE_EXCHANGE_ID") private Long _id;
+ @Basic @Column(name="CALLEE") private QName _callee;
+ @Basic @Column(name="CHANNEL") private String _channel;
+ @Basic @Column(name="CORRELATION_ID") private String _correlationId;
+ @Basic @Column(name="CORRELATION_STATUS") private String _correlationStatus;
+ @Basic @Column(name="CREATE_TIME") private Date _createTime;
+ @Basic @Column(name="DIRECTION") private char _direction;
+ @Lob @Column(name="EPR") private String _epr;
+ @Transient private Element _eprElement;
+ @Basic @Column(name="FAULT") private String _fault;
+ @Basic @Column(name="FAULT_EXPLANATION") private String _faultExplanation;
+ @Basic @Column(name="MESSAGE_EXCHANGE_KEY") private String _messageExchangeId;
+ @Basic @Column(name="OPERATION") private String _operation;
+ @Basic @Column(name="PARTNER_LINK_MODEL_ID") private int _partnerLinkModelId;
+ @Basic @Column(name="PATTERN") private String _pattern;
+ @Basic @Column(name="PORT_TYPE") private QName _portType;
+ @Basic @Column(name="PROPAGATE_TRANS") private boolean _propagateTransactionFlag;
+ @Basic @Column(name="STATUS") private String _status;
+ @Basic @Column(name="PROPERTIES") private HashMap<String,String> _props = new HashMap<String,String>();
+ @Basic @Column(name="CORRELATION_KEYS")
+ private ArrayList<CorrelationKey> _correlationKeys = new ArrayList<CorrelationKey>();
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PROCESS_INSTANCE_ID")
+ private ProcessInstanceDAOImpl _processInst;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PARTNER_LINK_ID")
+ private PartnerLinkDAOImpl _partnerLink;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PROCESS_ID")
+ private ProcessDAOImpl _process;
+ @OneToOne(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ @Column(name="REQUEST_MESSAGE_ID")
+ private MessageDAOImpl _request;
+ @OneToOne(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ @Column(name="RESPONSE_MESSAGE_ID")
+ private MessageDAOImpl _response;
+ @Version @Column(name="VERSION") private long _version;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="CONNECTION_ID")
+ private BPELDAOConnectionImpl _connection;
+
+ public MessageExchangeDAOImpl() {}
+ public MessageExchangeDAOImpl(char direction, BPELDAOConnectionImpl connection){
+ _direction = direction;
+ _connection = connection;
+ }
+
+ public MessageDAO createMessage(QName type) {
+ return new MessageDAOImpl(type,this);
+ }
+
+ public QName getCallee() {
+ return _callee;
+ }
+
+ public String getChannel() {
+ return _channel;
+ }
+
+ public String getCorrelationId() {
+ return _correlationId;
+ }
+
+ public String getCorrelationStatus() {
+ return _correlationStatus;
+ }
+
+ public Date getCreateTime() {
+ return _createTime;
+ }
+
+ public char getDirection() {
+ return _direction;
+ }
+
+ public Element getEPR() {
+ if ( _eprElement == null && _epr != null ) {
+ try {
+ _eprElement = DOMUtils.stringToDOM(_epr);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return _eprElement;
+ }
+
+ public String getFault() {
+ return _fault;
+ }
+
+ public String getFaultExplanation() {
+ return _faultExplanation;
+ }
+
+ public ProcessInstanceDAO getInstance() {
+ return _processInst;
+ }
+
+ public String getMessageExchangeId() {
+ return _messageExchangeId;
+ }
+
+ public String getOperation() {
+ return _operation;
+ }
+
+ public PartnerLinkDAO getPartnerLink() {
+ return _partnerLink;
+ }
+
+ public int getPartnerLinkModelId() {
+ return _partnerLinkModelId;
+ }
+
+ public String getPattern() {
+ return _pattern;
+ }
+
+ public QName getPortType() {
+ return _portType;
+ }
+
+ public ProcessDAO getProcess() {
+ return _process;
+ }
+
+ public boolean getPropagateTransactionFlag() {
+ return _propagateTransactionFlag;
+ }
+
+ public String getProperty(String key) {
+ return _props.get(key);
+ }
+
+ public Set<String> getPropertyNames() {
+ return _props.keySet();
+ }
+
+ public MessageDAO getRequest() {
+ return _request;
+ }
+
+ public MessageDAO getResponse() {
+ return _response;
+ }
+
+ public String getStatus() {
+ return _status;
+ }
+
+ public void setCallee(QName callee) {
+ _callee = callee;
+ }
+
+ public void setChannel(String channel) {
+ _channel = channel;
+ }
+
+ public void setCorrelationId(String correlationId) {
+ _correlationId = correlationId;
+ }
+
+ public void setCorrelationStatus(String cstatus) {
+ _correlationStatus = cstatus;
+ }
+
+ public void setEPR(Element epr) {
+ _eprElement = epr;
+ _epr = DOMUtils.domToString(epr);
+ }
+
+ public void setFault(String faultType) {
+ _fault = faultType;
+ }
+
+ public void setFaultExplanation(String explanation) {
+ _faultExplanation = explanation;
+ }
+
+ public void setInstance(ProcessInstanceDAO dao) {
+ _processInst = (ProcessInstanceDAOImpl)dao;
+
+ }
+
+ public void setOperation(String opname) {
+ _operation = opname;
+ }
+
+ public void setPartnerLink(PartnerLinkDAO plinkDAO) {
+ _partnerLink = (PartnerLinkDAOImpl)plinkDAO;
+
+ }
+
+ public void setPartnerLinkModelId(int modelId) {
+ _partnerLinkModelId = modelId;
+ }
+
+ public void setPattern(String pattern) {
+ _pattern = pattern;
+ }
+
+ public void setPortType(QName porttype) {
+ _portType = porttype;
+ }
+
+ public void setProcess(ProcessDAO process) {
+ _process = (ProcessDAOImpl)process;
+
+ }
+
+ public void setProperty(String key, String value) {
+ _props.put(key, value);
+
+ }
+
+ public void setRequest(MessageDAO msg) {
+ _request = (MessageDAOImpl)msg;
+
+ }
+
+ public void setResponse(MessageDAO msg) {
+ _response = (MessageDAOImpl)msg;
+
+ }
+
+ public void setStatus(String status) {
+ _status = status;
+ }
+
+ public void addCorrelationKey(CorrelationKey correlationKey) {
+ _correlationKeys.add(correlationKey);
+ }
+
+ public Collection<CorrelationKey> getCorrelationKeys() {
+ return _correlationKeys;
+ }
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageRouteDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.dao.MessageRouteDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+
+@Entity
+@Table(name="ODE_MESSAGE_ROUTE")
+public class MessageRouteDAOImpl implements MessageRouteDAO {
+
+ @Id @Column(name="MESSAGE_ROUTE_ID") private Long _id;
+ @Basic @Column(name="GROUP_ID") private String _groupId;
+ @Basic @Column(name="INDEX") private int _index;
+ @Basic @Column(name="CORRELATION_KEY") private CorrelationKey _correlationKey;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PROCESS_INSTANCE_ID")
+ private ProcessInstanceDAOImpl _processInst;
+ @Version @Column(name="VERSION") private long _version;
+
+ public MessageRouteDAOImpl() {}
+ public MessageRouteDAOImpl(CorrelationKey key, String groupId, int index, ProcessInstanceDAOImpl processInst) {
+ _correlationKey = key;
+ _groupId = groupId;
+ _index = index;
+ _processInst = processInst;
+ }
+
+ public CorrelationKey getCorrelationKey() {
+ return _correlationKey;
+ }
+
+ public String getGroupId() {
+ return _groupId;
+ }
+
+ public int getIndex() {
+ return _index;
+ }
+
+ public ProcessInstanceDAO getTargetInstance() {
+ return _processInst;
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageTest.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageTest.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageTest.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/MessageTest.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,28 @@
+package org.apache.ode.dao.jpa;
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="TEST_MESSAAGE")
+public class MessageTest {
+
+ @Basic @Column(name="MESSAGE") private String message;
+ @ManyToOne @Column(name="FAULT_TEST_ID")
+ private FaultTest faultTest;
+
+ public MessageTest() {}
+
+
+ public MessageTest(FaultTest input,String msg) {
+ message = msg;
+ faultTest = input;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/PartnerLinkDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/PartnerLinkDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/PartnerLinkDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/PartnerLinkDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Element;
+
+@Entity
+@Table(name="ODE_PARTNER_LINK")
+public class PartnerLinkDAOImpl implements PartnerLinkDAO {
+
+ @Id @Column(name="PARTNER_LINK_ID") private Long _id;
+ @Lob @Column(name="MY_EPR") private String _myEPR;
+ @Transient private Element _myEPRElement;
+ @Basic @Column(name="MY_ROLE_NAME") private String _myRoleName;
+ @Basic @Column(name="MY_ROLE_SERVICE_NAME") private QName _myRoleServiceName;
+ @Basic @Column(name="MY_SESSION_ID") private String _mySessionId;
+ @Lob @Column(name="PARTNER_EPR") private String _partnerEPR;
+ @Transient private Element _partnerEPRElement;
+ @Basic @Column(name="PARTNER_LINK_MODEL_ID") private int _partnerLinkModelId;
+ @Basic @Column(name="PARTNER_LINK_NAME") private String _partnerLinkName;
+ @Basic @Column(name="PARTNER_ROLE_NAME") private String _partnerRoleName;
+ @Basic @Column(name="PARTNER_SESSION_ID") private String _partnerSessionId;
+ @Version @Column(name="VERSION") private long _version;
+
+ public PartnerLinkDAOImpl() {}
+ public PartnerLinkDAOImpl(int modelId, String name, String myRole, String partnerRole) {
+ _partnerLinkModelId = modelId;
+ _partnerLinkName = name;
+ _myRoleName = myRole;
+ _partnerRoleName = partnerRole;
+ }
+
+ public Element getMyEPR() {
+ if ( _myEPRElement == null && _myEPR != null ) {
+ try {
+ _myEPRElement = DOMUtils.stringToDOM(_myEPR);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ return _myEPRElement;
+ }
+
+ public String getMyRoleName() {
+ return _myRoleName;
+ }
+
+ public QName getMyRoleServiceName() {
+ return _myRoleServiceName;
+ }
+
+ public String getMySessionId() {
+ return _mySessionId;
+ }
+
+ public Element getPartnerEPR() {
+ if ( _partnerEPRElement == null && _partnerEPR != null ) {
+ try {
+ _partnerEPRElement = DOMUtils.stringToDOM(_partnerEPR);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return _partnerEPRElement;
+ }
+
+ public int getPartnerLinkModelId() {
+ return _partnerLinkModelId;
+ }
+
+ public String getPartnerLinkName() {
+ return _partnerLinkName;
+ }
+
+ public String getPartnerRoleName() {
+ return _partnerRoleName;
+ }
+
+ public String getPartnerSessionId() {
+ return _partnerSessionId;
+ }
+
+ public void setMyEPR(Element val) {
+ _myEPRElement = val;
+ _myEPR = DOMUtils.domToString(val);
+
+ }
+
+ public void setMyRoleServiceName(QName svcName) {
+ _myRoleServiceName = svcName;
+
+ }
+
+ public void setMySessionId(String sessionId) {
+ _mySessionId = sessionId;
+
+ }
+
+ public void setPartnerEPR(Element val) {
+ _partnerEPRElement = val;
+ _partnerEPR = DOMUtils.domToString(val);
+
+ }
+
+ public void setPartnerSessionId(String session) {
+ _partnerSessionId = session;
+
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,123 @@
+package org.apache.ode.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Version;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.dao.CorrelatorDAO;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+
+@Entity
+@Table(name="ODE_PROCESS")
+public class ProcessDAOImpl implements ProcessDAO {
+
+ @Id @Column(name="PROCESS_ID") private Long _id;
+ @Basic @Column(name="NUMBER_OF_INSTANCES") private int _numInstances;
+ @Basic @Column(name="PROCESS_KEY") private QName _processKey;
+ @Basic @Column(name="PROCESS_TYPE") private QName _processType;
+ @Version @Column(name="VERSION") private int _version;
+
+ @OneToMany(targetEntity=ProcessInstanceDAOImpl.class,mappedBy="_process",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<ProcessInstanceDAO> _instances = new ArrayList<ProcessInstanceDAO>();
+ @OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<CorrelatorDAOImpl> _correlators = new ArrayList<CorrelatorDAOImpl>();
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="CONNECTION_ID")
+ private BPELDAOConnectionImpl _connection;
+
+ public ProcessDAOImpl() {}
+ public ProcessDAOImpl(QName key, QName type, BPELDAOConnectionImpl connection) {
+ _processKey = key;
+ _processType = type;
+ _connection = connection;
+ }
+
+ public void addCorrelator(String correlator) {
+ _correlators.add(new CorrelatorDAOImpl(correlator));
+ }
+
+ public ProcessInstanceDAO createInstance(
+ CorrelatorDAO instantiatingCorrelator) {
+ ProcessInstanceDAOImpl inst = new ProcessInstanceDAOImpl((CorrelatorDAOImpl)instantiatingCorrelator,_connection);
+ _instances.add(inst);
+
+ return inst;
+ }
+
+ public void delete() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Collection<ProcessInstanceDAO> findInstance(CorrelationKey cckey) {
+ Collection<ProcessInstanceDAO> ret = new ArrayList<ProcessInstanceDAO>();
+
+ for (ProcessInstanceDAO pi : _instances) {
+ scope_block:for (ScopeDAO s : pi.getScopes()) {
+ for (CorrelationSetDAO c : s.getCorrelationSets()) {
+ if (c.getValue().equals(cckey)) ret.add(pi);
+ break scope_block;
+ }
+ }
+ }
+ return ret;
+ }
+
+ public CorrelatorDAO getCorrelator(String correlatorId) {
+ for ( CorrelatorDAO c : _correlators ) {
+ if ( c.getCorrelatorId().equals(correlatorId) ) return c;
+ }
+ return null;
+ }
+
+ public ProcessInstanceDAO getInstance(Long iid) {
+ for (ProcessInstanceDAO pi : _instances) {
+ if ( pi.getInstanceId() == iid ) return pi;
+ }
+ return null;
+ }
+
+ public int getNumInstances() {
+ return _numInstances;
+ }
+
+ public QName getProcessId() {
+ return _processKey;
+ }
+
+ public QName getType() {
+ return _processType;
+ }
+
+ public int getVersion() {
+ return _version;
+ }
+
+ public void instanceCompleted(ProcessInstanceDAO instance) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void removeRoutes(String routeId, ProcessInstanceDAO target) {
+ for (CorrelatorDAO c : _correlators) {
+ c.removeRoutes(routeId, target);
+ }
+
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ProcessInstanceDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,264 @@
+package org.apache.ode.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.common.ProcessState;
+import org.apache.ode.bpel.dao.ActivityRecoveryDAO;
+import org.apache.ode.bpel.dao.BpelDAOConnection;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.CorrelatorDAO;
+import org.apache.ode.bpel.dao.FaultDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.bpel.evt.ProcessInstanceEvent;
+import org.w3c.dom.Element;
+
+@Entity
+@Table(name="ODE_PROCESS_INSTANCE")
+public class ProcessInstanceDAOImpl implements ProcessInstanceDAO {
+
+ @Id @Column(name="PROCESS_INSTANCE_ID") private Long _instanceId;
+ @Basic @Column(name="LAST_RECOVERY_DATE") private Date _lastRecovery;
+ @Basic @Column(name="LAST_ACTIVE_TIME") private Date _lastActive;
+ @Basic @Column(name="INSTANCE_STATE") private short _state;
+ @Basic @Column(name="PREVIOUS_STATE") private short _previousState;
+ @Lob @Column(name="EXECUTION_STATE") private byte[] _executionState;
+ @Basic @Column(name="SEQUENCE") private Long _sequence;
+ @Basic @Column(name="DATE_CREATED") private Date _dateCreated = new Date();
+ @Transient private ScopeDAO _rootScope;
+
+ @OneToMany(targetEntity=ScopeDAOImpl.class,mappedBy="_processInstance",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<ScopeDAO> _scopes = new ArrayList<ScopeDAO>();
+ @OneToMany(targetEntity=ActivityRecoveryDAOImpl.class,fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<ActivityRecoveryDAO> _recoveries = new ArrayList<ActivityRecoveryDAO>();
+ @OneToOne(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ @Column(name="FAULT_ID")
+ private FaultDAOImpl _fault;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PROCESS_ID")
+ private ProcessDAOImpl _process;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="CONNECTION_ID")
+ private BPELDAOConnectionImpl _connection;
+ @OneToOne(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ @Column(name="INSTANTIATING_CORRELATOR_ID")
+ private CorrelatorDAOImpl _instantiatingCorrelator;
+
+ public ProcessInstanceDAOImpl() {}
+ public ProcessInstanceDAOImpl(CorrelatorDAOImpl correlator, BPELDAOConnectionImpl connection) {
+ _instantiatingCorrelator = correlator;
+ _connection = connection;
+ _connection.addInstance(this);
+ }
+
+ public void createActivityRecovery(String channel, long activityId,
+ String reason, Date dateTime, Element data, String[] actions,
+ int retries) {
+ ActivityRecoveryDAO ar = new ActivityRecoveryDAOImpl(channel, activityId, reason, dateTime, data, actions, retries);
+ _recoveries.add(ar);
+ _lastRecovery = dateTime;
+ }
+
+ public ScopeDAO createScope(ScopeDAO parentScope, String name,
+ int scopeModelId) {
+ ScopeDAOImpl ret = new ScopeDAOImpl((ScopeDAOImpl)parentScope,name,scopeModelId,_connection);
+ _scopes.add(ret);
+
+ _rootScope = (parentScope == null)?ret:_rootScope;
+
+ return ret;
+ }
+
+ public void delete() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void deleteActivityRecovery(String channel) {
+
+ for (Iterator itr=_recoveries.iterator(); itr.hasNext(); ) {
+ ActivityRecoveryDAO arElement = (ActivityRecoveryDAO)itr.next();
+ if ( arElement.getChannel().equals(channel)) {
+ itr.remove();
+ return;
+ }
+ }
+ }
+
+ public void finishCompletion() {
+ // make sure we have completed.
+ assert (ProcessState.isFinished(this.getState()));
+ // let our process know that we've done our work.
+ this.getProcess().instanceCompleted(this);
+ }
+
+ public long genMonotonic() {
+ return _sequence++;
+ }
+
+ public int getActivityFailureCount() {
+ return _recoveries.size();
+ }
+
+ public Date getActivityFailureDateTime() {
+ return _lastRecovery;
+ }
+
+ public Collection<ActivityRecoveryDAO> getActivityRecoveries() {
+ return _recoveries;
+ }
+
+ public BpelDAOConnection getConnection() {
+ return _connection;
+ }
+
+ public CorrelationSetDAO getCorrelationSet(String name) {
+ // TODO: should this method be deprecated?
+
+ // Its not clear where the correlation set for the process is used
+ // or populated.
+
+ return null;
+ }
+
+ public Set<CorrelationSetDAO> getCorrelationSets() {
+ // TODO: should this method be deprecated?
+
+ // Its not clear where the correlation set for the process is used
+ // or populated.
+ return new HashSet<CorrelationSetDAO>();
+ }
+
+ public Date getCreateTime() {
+ return _dateCreated;
+ }
+
+ public EventsFirstLastCountTuple getEventsFirstLastCount() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public byte[] getExecutionState() {
+ return _executionState;
+ }
+
+ public FaultDAO getFault() {
+ return _fault;
+ }
+
+ public Long getInstanceId() {
+ return _instanceId;
+ }
+
+ public CorrelatorDAO getInstantiatingCorrelator() {
+ return _instantiatingCorrelator;
+ }
+
+ public Date getLastActiveTime() {
+ return _lastActive;
+ }
+
+ public short getPreviousState() {
+ return _previousState;
+ }
+
+ public ProcessDAO getProcess() {
+ return _process;
+ }
+
+ public ScopeDAO getRootScope() {
+ return _rootScope;
+ }
+
+ public ScopeDAO getScope(Long scopeInstanceId) {
+ for (ScopeDAO sElement : _scopes) {
+ if ( sElement.getScopeInstanceId() == scopeInstanceId) return sElement;
+ }
+ return null;
+ }
+
+ public Collection<ScopeDAO> getScopes(String scopeName) {
+ Collection<ScopeDAO> ret = new ArrayList<ScopeDAO>();
+
+ for (ScopeDAO sElement : _scopes) {
+ if ( sElement.getName().equals(scopeName)) ret.add(sElement);
+ }
+ return ret;
+ }
+
+ public Collection<ScopeDAO> getScopes() {
+ return _scopes;
+ }
+
+ public short getState() {
+ return _state;
+ }
+
+ public XmlDataDAO[] getVariables(String variableName, int scopeModelId) {
+
+ //TODO: This method is not used and should be considered a deprecation candidate.
+
+ List<XmlDataDAO> results = new ArrayList<XmlDataDAO>();
+
+ for (ScopeDAO sElement : _scopes) {
+ if ( sElement.getModelId() == scopeModelId) {
+ XmlDataDAO var = sElement.getVariable(variableName);
+ if ( var != null ) results.add(var);
+ }
+ }
+ return results.toArray(new XmlDataDAO[results.size()]);
+ }
+
+ public void insertBpelEvent(ProcessInstanceEvent event) {
+ _connection.insertBpelEvent(event, getProcess(), this);
+ }
+
+ public void setExecutionState(byte[] execState) {
+ _executionState = execState;
+ }
+
+ public void setFault(FaultDAO fault) {
+ _fault = (FaultDAOImpl)fault;
+
+ }
+
+ public void setFault(QName faultName, String explanation, int faultLineNo,
+ int activityId, Element faultMessage) {
+ _fault = new FaultDAOImpl(faultName,explanation,faultLineNo,activityId,faultMessage);
+ }
+
+ public void setLastActiveTime(Date dt) {
+ _lastActive = dt;
+
+ }
+
+ public void setState(short state) {
+ _previousState = _state;
+ _state = state;
+
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.apache.ode.bpel.common.BpelEventFilter;
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.ScopeStateEnum;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.bpel.evt.BpelEvent;
+
+@Entity
+@Table(name="ODE_SCOPE")
+public class ScopeDAOImpl implements ScopeDAO {
+
+ @Id @Column(name="SCOPE_ID") private Long _scopeInstanceId;
+ @Basic @Column(name="MODEL_ID") private int _modelId;
+ @Basic @Column(name="SCOPE_NAME") private String _name;
+ @Basic @Column(name="SCOPE_STATE") private String _scopeState;
+ @Version @Column(name="VERSION") private long _version;
+
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PARENT_SCOPE_ID")
+ private ScopeDAOImpl _parentScope;
+
+ @OneToMany(targetEntity=ScopeDAOImpl.class,mappedBy="_parentScope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<ScopeDAO> _childScopes = new ArrayList<ScopeDAO>();
+ @OneToMany(targetEntity=CorrelationSetDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<CorrelationSetDAO> _correlationSets = new ArrayList<CorrelationSetDAO>();
+ @OneToMany(targetEntity=PartnerLinkDAOImpl.class,fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<PartnerLinkDAO> _partnerLinks = new ArrayList<PartnerLinkDAO>();
+ @OneToMany(targetEntity=XmlDataDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<XmlDataDAO> _variables = new ArrayList<XmlDataDAO>();
+
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PROCESS_INSTANCE_ID")
+ private ProcessInstanceDAOImpl _processInstance;
+
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="CONNECTION_ID")
+ private BPELDAOConnectionImpl _connection;
+
+ public ScopeDAOImpl() {}
+ public ScopeDAOImpl(ScopeDAOImpl parentScope, String name, int scopeModelId, BPELDAOConnectionImpl connection) {
+ _parentScope = parentScope;
+ _name = name;
+ _modelId = scopeModelId;
+ _connection = connection;
+ _connection.addScope(this);
+ }
+
+ public PartnerLinkDAO createPartnerLink(int plinkModelId, String pLinkName,
+ String myRole, String partnerRole) {
+ PartnerLinkDAO pl = new PartnerLinkDAOImpl(plinkModelId, pLinkName, myRole, partnerRole);
+
+ _partnerLinks.add(pl);
+ return pl;
+ }
+
+ public Collection<ScopeDAO> getChildScopes() {
+ return _childScopes;
+ }
+
+ public CorrelationSetDAO getCorrelationSet(String corrSetName) {
+ CorrelationSetDAO ret = null;
+ for (CorrelationSetDAO csElement : _correlationSets) {
+ if ( csElement.getName().equals(corrSetName)) ret = csElement;
+ }
+
+ if ( ret == null ) {
+ // Apparently the caller knows there should be a correlation set
+ // in here. Create a new set if one does not exist.
+ // Not sure I understand this implied object creation and why
+ // an explicit create pattern isn't used ( i.e. similar to
+ // PartnerLink creation )
+ ret = new CorrelationSetDAOImpl(this,corrSetName);
+ _correlationSets.add(ret);
+ }
+
+ return ret;
+ }
+
+ public Collection<CorrelationSetDAO> getCorrelationSets() {
+ return _correlationSets;
+ }
+
+ public int getModelId() {
+ return _modelId;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public ScopeDAO getParentScope() {
+ return _parentScope;
+ }
+
+ public PartnerLinkDAO getPartnerLink(int plinkModelId) {
+ for (PartnerLinkDAO plElement : _partnerLinks) {
+ if ( plElement.getPartnerLinkModelId() == plinkModelId) return plElement;
+ }
+ return null;
+ }
+
+ public Collection<PartnerLinkDAO> getPartnerLinks() {
+ return _partnerLinks;
+ }
+
+ public ProcessInstanceDAO getProcessInstance() {
+ return _processInstance;
+ }
+
+ public Long getScopeInstanceId() {
+ return _scopeInstanceId;
+ }
+
+ public ScopeStateEnum getState() {
+ return new ScopeStateEnum(_scopeState);
+ }
+
+ public XmlDataDAO getVariable(String varName) {
+ for (XmlDataDAO xmlElement : _variables) {
+ if ( xmlElement.getName().equals(varName)) return xmlElement;
+ }
+ return null;
+ }
+
+ public Collection<XmlDataDAO> getVariables() {
+ return _variables;
+ }
+
+ public List<BpelEvent> listEvents(BpelEventFilter efilter) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setState(ScopeStateEnum state) {
+ _scopeState = state.toString();
+ }
+
+}
Added: incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java?view=auto&rev=475825
==============================================================================
--- incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java (added)
+++ incubator/ode/trunk/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java Thu Nov 16 09:25:59 2006
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.ode.dao.jpa;
+
+import java.util.Properties;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.Version;
+
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+@Entity
+@Table(name="ODE_XML_DATA")
+public class XmlDataDAOImpl implements XmlDataDAO {
+
+ @Id @Column(name="XML_DATA_ID") private Long _id;
+ @Lob @Column(name="DATA") private String _data;
+ @Transient private Node _node;
+ @Basic @Column(name="IS_SIMPLE_TYPE") private boolean _isSimpleType;
+ @Basic @Column(name="IS_NULL") private boolean _isNull;
+ @Basic @Column(name="NAME") private String _name;
+ @Basic @Column(name="PROPERTIES") private Properties _props;
+ @Version @Column(name="VERSION") private long _version;
+
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="SCOPE_ID")
+ private ScopeDAOImpl _scope;
+
+ public Node get() {
+ if ( _node == null && _data != null ) {
+ if(_isSimpleType){
+ Document d = DOMUtils.newDocument();
+ // we create a dummy wrapper element
+ // prevents some apps from complaining
+ // when text node is not actual child of document
+ Element e = d.createElement("text-node-wrapper");
+ Text tnode = d.createTextNode(_data);
+ d.appendChild(e);
+ e.appendChild(tnode);
+ _node = tnode;
+ }else{
+ try{
+ _node = DOMUtils.stringToDOM(_data);
+ }catch(Exception e){
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return _node;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public String getProperty(String propertyName) {
+ return _props.getProperty(propertyName);
+ }
+
+ public ScopeDAO getScopeDAO() {
+ return _scope;
+ }
+
+ public boolean isNull() {
+ return _isNull;
+ }
+
+ public void remove() {
+
+ }
+
+ public void set(Node val) {
+ _node = val;
+ if ( val instanceof Element ) {
+ _isSimpleType = false;
+ _data = DOMUtils.domToString(val);
+ } else {
+ _isSimpleType = true;
+ _data = _node.getNodeValue();
+ }
+ }
+
+ public void setProperty(String pname, String pvalue) {
+ _props.setProperty(pname, pvalue);
+ }
+
+}