You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by je...@apache.org on 2010/05/02 19:03:00 UTC
svn commit: r940263 [10/16] - in /ode/trunk: ./ axis2-war/
axis2-war/src/main/assembly/
axis2-war/src/main/webapp/WEB-INF/conf.hib-derby/
axis2-war/src/main/webapp/WEB-INF/conf.jpa-derby/
axis2-war/src/main/webapp/WEB-INF/conf/ axis2-war/src/test/java/...
Modified: ode/trunk/dao-jpa-db/src/main/descriptors/persistence.postgres.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/descriptors/persistence.postgres.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/descriptors/persistence.postgres.xml (original)
+++ ode/trunk/dao-jpa-db/src/main/descriptors/persistence.postgres.xml Sun May 2 17:02:51 2010
@@ -1,57 +1,63 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ 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.
- -->
-<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-embedded">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
- <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
- <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
-
- <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
- <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
- <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
- <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
-
- <properties>
- <!-- Properties for an embedded Derby connection -->
- <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
- <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.PostgresDictionary"/>
- <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
-
- <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>
- </persistence-unit>
-</persistence>
-
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+-->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.bpel.EventDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.FaultDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageExchangeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MexProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ContextValueDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrSetProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessInstanceDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.PartnerLinkDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageDAOImpl</class>
+
+ <class>org.apache.ode.dao.jpa.store.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.VersionTrackerDAOImpl</class>
+
+ <class>org.apache.ode.dao.jpa.scheduler.JobDAOImpl</class>
+
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.PostgresDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <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>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-hibernate/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/pom.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/pom.xml (added)
+++ ode/trunk/dao-jpa-hibernate/pom.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,73 @@
+<?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 xmlns:pom="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-hibernate</artifactId>
+ <name>ODE :: JPA Hibernate DAO Impl</name>
+
+ <parent>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-schemas</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-il-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <!-- <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-store</artifactId>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
+
Added: ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.derby.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.derby.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.derby.xml (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.derby.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <properties>
+ <property name="hibernate.show_sql" value="false" />
+ <property name="hibernate.dialect" value="org.hibernate.dialect.DerbyDialect" />
+ <property name="hibernate.connection.datasource" value="java:BPELDB" />
+ <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ <property name="jta.UserTransaction" value="jta.UserTransaction" />
+ </properties>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.mysql.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.mysql.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.mysql.xml (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.mysql.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <property name="hibernate.show_sql" value="false" />
+ <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect" />
+ <property name="hibernate.connection.datasource" value="java:BPELDB" />
+ <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ <property name="jta.UserTransaction" value="jta.UserTransaction" />
+ </properties>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.oracle.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.oracle.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.oracle.xml (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.oracle.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <property name="hibernate.show_sql" value="false" />
+ <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
+ <property name="hibernate.connection.datasource" value="java:BPELDB" />
+ <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ <property name="jta.UserTransaction" value="jta.UserTransaction" />
+ </properties>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.postgres.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.postgres.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.postgres.xml (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/descriptors/persistence.postgres.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <property name="hibernate.show_sql" value="false" />
+ <property name="hibernate.dialect" value="org.hibernate.dialect.PostgresDialect" />
+ <property name="hibernate.connection.datasource" value="java:BPELDB" />
+ <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory" />
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
+ <property name="jta.UserTransaction" value="jta.UserTransaction" />
+ </properties>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/hsql.properties
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/hsql.properties?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/hsql.properties (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/hsql.properties Sun May 2 17:02:51 2010
@@ -0,0 +1 @@
+dialect=org.hibernate.dialect.HSQLDialect
\ No newline at end of file
Added: ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/mysql.properties
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/mysql.properties?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/mysql.properties (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/files/hibernate.cfg/mysql.properties Sun May 2 17:02:51 2010
@@ -0,0 +1 @@
+dialect=org.hibernate.dialect.MySQLInnoDBDialect
\ No newline at end of file
Added: ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/BpelDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/BpelDAOConnectionFactoryImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/BpelDAOConnectionFactoryImpl.java (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/BpelDAOConnectionFactoryImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,189 @@
+/*
+ * 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.hibernate;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.jpa.JpaConnection;
+import org.apache.ode.dao.jpa.bpel.BpelDAOConnectionImpl;
+import org.apache.ode.dao.jpa.JpaOperator;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.utils.GUID;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.resolver.DialectFactory;
+import org.hibernate.ejb.EntityManagerImpl;
+
+/**
+
+ */
+public class BpelDAOConnectionFactoryImpl implements BpelDAOConnectionFactory {
+
+ static final Log __log = LogFactory.getLog(BpelDAOConnectionFactoryImpl.class);
+ static Map _defaultProperties = new HashMap();
+ static JpaOperator _operator = new JpaOperatorImpl();
+ EntityManagerFactory _emf;
+ TransactionManager _txm;
+ DataSource _ds;
+
+ static {
+ _defaultProperties.put("javax.persistence.provider", "org.hibernate.ejb.HibernatePersistence");
+ }
+
+ public void init(Properties odeConfig, TransactionManager txm, Object env) {
+ this._txm = txm;
+ this._ds = (DataSource) env;
+ Map emfProperties = buildConfig(OdeConfigProperties.PROP_DAOCF + ".", odeConfig, _txm, _ds);
+ _emf = Persistence.createEntityManagerFactory("ode-bpel", emfProperties);
+
+ }
+
+ public BpelDAOConnection getConnection() {
+ final ThreadLocal<BpelDAOConnectionImpl> currentConnection = BpelDAOConnectionImpl.getThreadLocal();
+
+ BpelDAOConnectionImpl conn = (BpelDAOConnectionImpl) currentConnection.get();
+ if (conn != null && isOpen(conn)) {
+ return conn;
+ } else {
+ EntityManager em = _emf.createEntityManager();
+ conn = new BpelDAOConnectionImpl(em, _txm, _operator);
+ currentConnection.set(conn);
+ return conn;
+ }
+ }
+
+ public void shutdown() {
+ _emf.close();
+ }
+
+ static Map buildConfig(String prefix, Properties odeConfig, TransactionManager txm, DataSource ds) {
+ Map props = new HashMap(_defaultProperties);
+
+ String guid = new GUID().toString();
+ if (ds != null) {
+ props.put(Environment.CONNECTION_PROVIDER, DataSourceConnectionProvider.class.getName());
+ HibernateUtil.registerDatasource(guid, ds);
+ props.put(Environment.DIALECT, guessDialect(ds));
+ }
+ if (txm != null) {
+ props.put(Environment.CURRENT_SESSION_CONTEXT_CLASS, "jta");
+ props.put(Environment.TRANSACTION_MANAGER_STRATEGY, HibernateTransactionManagerLookup.class.getName());
+ HibernateUtil.registerTransactionManager(guid, txm);
+ props.put("javax.persistence.transactionType", "JTA");
+ } else {
+ props.put("javax.persistence.transactionType", "RESOURCE_LOCAL");
+ }
+
+
+ if (ds != null || txm != null) {
+ props.put(HibernateUtil.PROP_GUID, guid);
+ }
+
+ if (Boolean.valueOf(odeConfig.getProperty(OdeConfigProperties.PROP_DB_EMBEDDED_CREATE, "true"))) {
+ props.put(Environment.HBM2DDL_AUTO, "create-drop");
+ }
+
+ // Isolation levels override; when you use a ConnectionProvider, this has no effect
+ //String level = System.getProperty("ode.connection.isolation", "2");
+ //props.put(Environment.ISOLATION, level);
+
+ addEntries(prefix, odeConfig, props);
+
+ return props;
+ }
+
+ public static void addEntries(String prefix, Properties odeConfig, Map props) {
+ if (odeConfig != null) {
+ for (Map.Entry me : odeConfig.entrySet()) {
+ String key = (String) me.getKey();
+ if (key.startsWith(prefix)) {
+ String jpaKey = key.substring(prefix.length() - 1);
+ String val = (String) me.getValue();
+ if (val == null || val.trim().length() == 0) {
+ props.remove(jpaKey);
+ } else {
+ props.put(jpaKey, me.getValue());
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * For some reason Hibernate does not mark an EntityManager as being closed when
+ * the EntityManagerFactory that created it is closed. This method performs a
+ * deep introspection to determine if the EntityManager is still viable.
+ */
+ public static boolean isOpen(JpaConnection conn) {
+ EntityManager mgr = conn.getEntityManager();
+ if (mgr == null) {
+ return false;
+ } else if (mgr instanceof EntityManagerImpl) {
+ EntityManagerImpl mgrImpl = (EntityManagerImpl) mgr;
+ return !mgrImpl.getSession().getSessionFactory().isClosed();
+ } else {
+ return !conn.isClosed();
+ }
+ }
+ private static final String DEFAULT_HIBERNATE_DIALECT = "org.hibernate.dialect.DerbyDialect";
+
+ public static String guessDialect(DataSource dataSource) {
+
+ String dialect = null;
+ // Open a connection and use that connection to figure out database
+ // product name/version number in order to decide which Hibernate
+ // dialect to use.
+ Connection conn = null;
+ try {
+ conn = dataSource.getConnection();
+ Dialect d = DialectFactory.buildDialect(new Properties(), conn);
+ dialect = d.getClass().getName();
+ } catch (SQLException se) {
+ __log.error(se);
+ } finally {
+ try {
+ conn.close();
+ } catch (SQLException ex) {
+ __log.error(ex);
+ }
+ }
+
+ if (dialect == null) {
+ __log.info("Cannot determine hibernate dialect for this database: using the default one.");
+ dialect = DEFAULT_HIBERNATE_DIALECT;
+ }
+
+ return dialect;
+
+ }
+
+}
+
Added: ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/ConfStoreDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/ConfStoreDAOConnectionFactoryImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/ConfStoreDAOConnectionFactoryImpl.java (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/ConfStoreDAOConnectionFactoryImpl.java Sun May 2 17:02:51 2010
@@ -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.hibernate;
+
+import java.util.Map;
+import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.jpa.store.ConfStoreDAOConnectionImpl;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.dao.store.ConfStoreDAOConnection;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
+import static org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl.isOpen;
+import static org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl._operator;
+import static org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl.buildConfig;
+/**
+
+ */
+public class ConfStoreDAOConnectionFactoryImpl implements ConfStoreDAOConnectionFactory {
+
+ static final Log __log = LogFactory.getLog(ConfStoreDAOConnectionFactoryImpl.class);
+ EntityManagerFactory _emf;
+ TransactionManager _txm;
+ DataSource _ds;
+
+
+ public void init(Properties odeConfig,TransactionManager txm, Object env) {
+ this._txm = txm;
+ this._ds = (DataSource) env;
+ Map emfProperties = buildConfig(OdeConfigProperties.PROP_DAOCF + ".", odeConfig, _txm, _ds);
+ _emf = Persistence.createEntityManagerFactory("ode-store", emfProperties);
+
+ }
+
+ public ConfStoreDAOConnection getConnection() {
+ final ThreadLocal<ConfStoreDAOConnectionImpl> currentConnection = ConfStoreDAOConnectionImpl.getThreadLocal();
+
+ ConfStoreDAOConnectionImpl conn = (ConfStoreDAOConnectionImpl)currentConnection.get();
+ if (conn != null && isOpen(conn)) {
+ return conn;
+ } else {
+ EntityManager em = _emf.createEntityManager();
+ conn = new ConfStoreDAOConnectionImpl(em, _txm, _operator);
+ currentConnection.set(conn);
+ return conn;
+ }
+ }
+
+ public void shutdown() {
+ _emf.close();
+ }
+}
Added: ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/DataSourceConnectionProvider.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/DataSourceConnectionProvider.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/DataSourceConnectionProvider.java (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/DataSourceConnectionProvider.java Sun May 2 17:02:51 2010
@@ -0,0 +1,61 @@
+/*
+ * 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.hibernate;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import org.apache.ode.utils.DbIsolation;
+
+import org.hibernate.HibernateException;
+import org.hibernate.connection.ConnectionProvider;
+
+
+public class DataSourceConnectionProvider implements ConnectionProvider {
+
+ private Properties _props;
+
+ public DataSourceConnectionProvider() {
+ }
+
+ public void configure(Properties props) throws HibernateException {
+ _props = props;
+ }
+
+ public Connection getConnection() throws SQLException {
+ Connection c = HibernateUtil.getConnection(_props);
+ DbIsolation.setIsolationLevel(c);
+ return c;
+ }
+
+ public void closeConnection(Connection con) throws SQLException {
+ con.close();
+ }
+
+ public void close() throws HibernateException {
+
+ }
+
+ public boolean supportsAggressiveRelease() {
+ return true;
+ }
+
+}
Added: ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateTransactionManagerLookup.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateTransactionManagerLookup.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateTransactionManagerLookup.java (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateTransactionManagerLookup.java Sun May 2 17:02:51 2010
@@ -0,0 +1,52 @@
+/*
+ * 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.hibernate;
+
+import java.util.Properties;
+
+import javax.transaction.TransactionManager;
+import javax.transaction.Transaction;
+
+import org.hibernate.HibernateException;
+import org.hibernate.transaction.TransactionManagerLookup;
+
+/**
+ * Implementation of the {@link org.hibernate.transaction.TransactionManagerLookup} interface that
+ * uses {@link HibernateUtil} to obtain the JTA {@link TransactionManager} object.
+ */
+public class HibernateTransactionManagerLookup implements TransactionManagerLookup {
+
+ /** Constructor. */
+ public HibernateTransactionManagerLookup() {
+ super();
+ }
+
+ public TransactionManager getTransactionManager(Properties props)
+ throws HibernateException {
+ return HibernateUtil.getTransactionManager(props);
+ }
+
+ public String getUserTransactionName() {
+ return null;
+ }
+
+ public Object getTransactionIdentifier(Transaction transaction) {
+ return transaction;
+ }
+}
Added: ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateUtil.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateUtil.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateUtil.java (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/HibernateUtil.java Sun May 2 17:02:51 2010
@@ -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.hibernate;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+
+/**
+ * Manages datasource and transaction, for hibernate usage.
+ *
+ */
+public class HibernateUtil {
+
+
+ public static final String PROP_GUID = "ode.hibernate.guid";
+
+ private static final Map<String, TransactionManager> _txManagers =
+ Collections.synchronizedMap(new HashMap<String, TransactionManager>());
+ private static final Map<String, DataSource> _dataSources =
+ Collections.synchronizedMap(new HashMap<String,DataSource>());
+
+ private static final String[] CANNOT_JOIN_FOR_UPDATE_DIALECTS =
+ {"org.hibernate.dialect.IngresDialect"};
+
+ private final TransactionManager _txManager = null;
+
+
+ TransactionManager getTransactionManager() {
+ return _txManager;
+ }
+
+ public static void registerTransactionManager(String uuid, TransactionManager txm) {
+ _txManagers.put(uuid, txm);
+ }
+
+ public static void registerDatasource(String uuid, DataSource ds){
+ _dataSources.put(uuid, ds);
+ }
+
+
+ public static TransactionManager getTransactionManager(Properties props) {
+ String guid = props.getProperty(PROP_GUID);
+ return _txManagers.get(guid);
+ }
+
+ public static Connection getConnection(Properties props) throws SQLException {
+ String guid = props.getProperty(PROP_GUID);
+ return _dataSources.get(guid).getConnection();
+ }
+}
Added: ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/JpaOperatorImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/JpaOperatorImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/JpaOperatorImpl.java (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/JpaOperatorImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,47 @@
+/*
+ * 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.hibernate;
+
+import java.util.Iterator;
+
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.jpa.JpaOperator;
+
+/**
+ *
+ * @author Jeff Yu
+ */
+public class JpaOperatorImpl implements JpaOperator {
+
+ private static final Log __log = LogFactory.getLog(JpaOperatorImpl.class);
+
+ public <T> void batchUpdateByIds(Iterator<T> ids, Query query, String parameterName) {
+ while (ids.hasNext()) {
+ query.setParameter(parameterName, ids.next());
+ query.executeUpdate();
+ }
+ }
+
+ public void setBatchSize(Query query, int limit) {
+ //TODO
+ }
+}
Added: ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/SchedulerDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/SchedulerDAOConnectionFactoryImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/SchedulerDAOConnectionFactoryImpl.java (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/java/org/apache/ode/dao/jpa/hibernate/SchedulerDAOConnectionFactoryImpl.java Sun May 2 17:02:51 2010
@@ -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.hibernate;
+
+import java.util.Map;
+import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.jpa.scheduler.SchedulerDAOConnectionImpl;
+import org.apache.ode.dao.scheduler.SchedulerDAOConnection;
+import org.apache.ode.dao.scheduler.SchedulerDAOConnectionFactory;
+import org.apache.ode.il.config.OdeConfigProperties;
+import static org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl.buildConfig;
+import static org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl.isOpen;
+import static org.apache.ode.dao.jpa.hibernate.BpelDAOConnectionFactoryImpl._operator;
+
+/**
+
+ */
+public class SchedulerDAOConnectionFactoryImpl implements SchedulerDAOConnectionFactory {
+
+ static final Log __log = LogFactory.getLog(SchedulerDAOConnectionFactoryImpl.class);
+ EntityManagerFactory _emf;
+ TransactionManager _txm;
+ DataSource _ds;
+
+ public void init(Properties odeConfig, TransactionManager txm, Object env) {
+ this._txm = txm;
+ this._ds = (DataSource) env;
+ Map emfProperties = buildConfig(OdeConfigProperties.PROP_DAOCF + ".", odeConfig, _txm, _ds);
+ _emf = Persistence.createEntityManagerFactory("ode-scheduler", emfProperties);
+
+ }
+
+ public SchedulerDAOConnection getConnection() {
+ final ThreadLocal<SchedulerDAOConnectionImpl> currentConnection = SchedulerDAOConnectionImpl.getThreadLocal();
+
+ SchedulerDAOConnectionImpl conn = (SchedulerDAOConnectionImpl) currentConnection.get();
+ if (conn != null && isOpen(conn)) {
+ return conn;
+ } else {
+ EntityManager em = _emf.createEntityManager();
+ conn = new SchedulerDAOConnectionImpl(em, _txm, _operator);
+ currentConnection.set(conn);
+ return conn;
+ }
+ }
+
+ public void shutdown() {
+ _emf.close();
+ }
+}
Added: ode/trunk/dao-jpa-hibernate/src/main/scripts/license-header.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/scripts/license-header.sql?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/scripts/license-header.sql (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/scripts/license-header.sql Sun May 2 17:02:51 2010
@@ -0,0 +1,19 @@
+--
+-- 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.
+--
+
Added: ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-derby.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-derby.sql?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-derby.sql (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-derby.sql Sun May 2 17:02:51 2010
@@ -0,0 +1,30 @@
+-- Apache ODE - SimpleScheduler Database Schema
+--
+-- Apache Derby scripts by Maciej Szefler.
+--
+--
+
+CREATE TABLE ode_job (
+ jobid CHAR(64) NOT NULL DEFAULT '',
+ ts BIGINT NOT NULL DEFAULT 0,
+ nodeid char(64),
+ scheduled int NOT NULL DEFAULT 0,
+ transacted int NOT NULL DEFAULT 0,
+
+ instanceId BIGINT,
+ mexId varchar(255),
+ processId varchar(255),
+ type varchar(255),
+ channel varchar(255),
+ correlatorId varchar(255),
+ correlationKey varchar(255),
+ retryCount int,
+ inMem int,
+ detailsExt blob(4096),
+
+ PRIMARY KEY(jobid));
+
+CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);
+CREATE INDEX IDX_ODE_JOB_NODEID ON ode_job(nodeid);
+
+
Added: ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-mysql.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-mysql.sql?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-mysql.sql (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-mysql.sql Sun May 2 17:02:51 2010
@@ -0,0 +1,33 @@
+-- Apache ODE - SimpleScheduler Database Schema
+--
+-- MySQL scripts by Maciej Szefler.
+--
+--
+DROP TABLE IF EXISTS ODE_JOB;
+
+CREATE TABLE ODE_JOB (
+ jobid CHAR(64) NOT NULL DEFAULT '',
+ ts BIGINT NOT NULL DEFAULT 0,
+ nodeid char(64) NULL,
+ scheduled int NOT NULL DEFAULT 0,
+ transacted int NOT NULL DEFAULT 0,
+
+ instanceId BIGINT,
+ mexId varchar(255),
+ processId varchar(255),
+ type varchar(255),
+ channel varchar(255),
+ correlatorId varchar(255),
+ correlationKey varchar(255),
+ retryCount int,
+ inMem int,
+ detailsExt blob(4096),
+
+ PRIMARY KEY(jobid),
+ INDEX IDX_ODE_JOB_TS(ts),
+ INDEX IDX_ODE_JOB_NODEID(nodeid)
+)
+TYPE=InnoDB;
+
+COMMIT;
+
Added: ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-oracle.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-oracle.sql?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-oracle.sql (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-oracle.sql Sun May 2 17:02:51 2010
@@ -0,0 +1,32 @@
+-- Apache ODE - SimpleScheduler Database Schema
+--
+-- Apache Derby scripts by Maciej Szefler.
+--
+--
+
+DROP TABLE ode_job;
+
+CREATE TABLE ode_job (
+ jobid VARCHAR(64) NOT NULL,
+ ts number(37) NOT NULL,
+ nodeid varchar(64),
+ scheduled int NOT NULL,
+ transacted int NOT NULL,
+
+ instanceId number(37),
+ mexId varchar(255),
+ processId varchar(255),
+ type varchar(255),
+ channel varchar(255),
+ correlatorId varchar(255),
+ correlationKey varchar(255),
+ retryCount int,
+ inMem int,
+ detailsExt blob,
+
+ PRIMARY KEY(jobid));
+
+CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);
+CREATE INDEX IDX_ODE_JOB_NODEID ON ode_job(nodeid);
+
+
Added: ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-postgres.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-postgres.sql?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-postgres.sql (added)
+++ ode/trunk/dao-jpa-hibernate/src/main/scripts/simplesched-postgres.sql Sun May 2 17:02:51 2010
@@ -0,0 +1,30 @@
+-- Apache ODE - SimpleScheduler Database Schema
+--
+-- Apache Derby scripts by Maciej Szefler.
+--
+--
+
+CREATE TABLE ode_job (
+ jobid CHAR(64) NOT NULL DEFAULT '',
+ ts BIGINT NOT NULL DEFAULT 0,
+ nodeid char(64),
+ scheduled int NOT NULL DEFAULT 0,
+ transacted int NOT NULL DEFAULT 0,
+
+ instanceId BIGINT,
+ mexId varchar(255),
+ processId varchar(255),
+ type varchar(255),
+ channel varchar(255),
+ correlatorId varchar(255),
+ correlationKey varchar(255),
+ retryCount int,
+ inMem int,
+ detailsExt bytea,
+
+ PRIMARY KEY(jobid));
+
+CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);
+CREATE INDEX IDX_ODE_JOB_NODEID ON ode_job(nodeid);
+
+
Added: ode/trunk/dao-jpa-ojpa/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/pom.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/pom.xml (added)
+++ ode/trunk/dao-jpa-ojpa/pom.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,82 @@
+<?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 xmlns:pom="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa-ojpa</artifactId>
+ <name>ODE :: JPA OpenJPA DAO Impl</name>
+
+ <parent>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-schemas</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-il-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa</artifactId>
+ <classifier>openjpa</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.serp</groupId>
+ <artifactId>serp</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
+
Added: ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.derby.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.derby.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.derby.xml (added)
+++ ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.derby.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.DerbyDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <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>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.mysql.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.mysql.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.mysql.xml (added)
+++ ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.mysql.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.MySQLDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <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>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.oracle.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.oracle.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.oracle.xml (added)
+++ ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.oracle.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.OracleDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <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>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.postgres.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.postgres.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.postgres.xml (added)
+++ ode/trunk/dao-jpa-ojpa/src/main/descriptors/persistence.postgres.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+<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-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.EventDAOImpl</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.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
+
+ <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.PostgresDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <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>
+ </persistence-unit>
+</persistence>
+
Added: ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/BpelDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/BpelDAOConnectionFactoryImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/BpelDAOConnectionFactoryImpl.java (added)
+++ ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/BpelDAOConnectionFactoryImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,133 @@
+/*
+ * 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.openjpa;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.bpel.BpelDAOConnection;
+import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
+import org.apache.ode.dao.jpa.JpaOperator;
+import org.apache.ode.dao.jpa.bpel.BpelDAOConnectionImpl;
+import org.apache.ode.il.config.OdeConfigProperties;
+
+/**
+
+ */
+public class BpelDAOConnectionFactoryImpl implements BpelDAOConnectionFactory {
+
+ static final Log __log = LogFactory.getLog(BpelDAOConnectionFactoryImpl.class);
+ static Map _defaultProperties = new HashMap();
+ static JpaOperator _operator = new JpaOperatorImpl();
+ protected EntityManagerFactory _emf;
+ protected DataSource _ds;
+ protected TransactionManager _txm;
+
+ static {
+ _defaultProperties.put("javax.persistence.provider", "org.apache.openjpa.persistence.PersistenceProviderImpl");
+ _defaultProperties.put("openjpa.Log", "log4j");
+ //This was previously set to fault but caused some issues with in memory CorrelatorDAO rout finds.
+ _defaultProperties.put("openjpa.FlushBeforeQueries", "true");
+ _defaultProperties.put("openjpa.FetchBatchSize", 1000);
+
+ // _defaultProperties.put("openjpa.Log", "DefaultLevel=TRACE");
+ }
+
+ public void init(Properties odeConfig, TransactionManager mgr, Object env) {
+ _txm = mgr;
+ _ds = (DataSource) env;
+ Map emfProperties = buildConfig(OdeConfigProperties.PROP_DAOCF + ".", odeConfig, _txm, _ds);
+ _emf = Persistence.createEntityManagerFactory("ode-bpel", emfProperties);
+ }
+
+ public BpelDAOConnection getConnection() {
+ final ThreadLocal<BpelDAOConnectionImpl> currentConnection = BpelDAOConnectionImpl.getThreadLocal();
+ BpelDAOConnectionImpl conn = (BpelDAOConnectionImpl) currentConnection.get();
+ if (conn != null && !conn.isClosed()) {
+ return conn;
+ } else {
+ EntityManager em = _emf.createEntityManager();
+ conn = createBPELDAOConnection(em, _txm, _operator);
+ currentConnection.set(conn);
+ return conn;
+ }
+ }
+
+ protected BpelDAOConnectionImpl createBPELDAOConnection(EntityManager em, TransactionManager mgr, JpaOperator operator) {
+ return new BpelDAOConnectionImpl(em, mgr, operator);
+ }
+
+ public void shutdown() {
+ _emf.close();
+ }
+
+ static Map buildConfig(String prefix, Properties odeConfig, TransactionManager mgr, DataSource ds) {
+ Map props = new HashMap(_defaultProperties);
+ if (mgr != null) {
+ props.put("openjpa.TransactionMode","managed");
+ /* The following was originally set to managed but rollback tests failed.
+ * There is no code in ODE to automatically enlist DataSource s in
+ * global transactions
+ */
+ props.put("openjpa.ConnectionFactoryMode", "local");
+ props.put("openjpa.jdbc.TransactionIsolation", "read-committed");
+ props.put("openjpa.ManagedRuntime", new JpaTxMgrProvider(mgr));
+ props.put("javax.persistence.transactionType", "JTA");
+ } else {
+ props.put("javax.persistence.transactionType", "RESOURCE_LOCAL");
+ }
+ if (ds != null) {
+ props.put("openjpa.ConnectionFactory", ds);
+ }
+
+ //props.put("openjpa.jdbc.DBDictionary", dictionary);
+
+ if (Boolean.valueOf(odeConfig.getProperty(OdeConfigProperties.PROP_DB_EMBEDDED_CREATE, "true"))) {
+ props.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(SchemaAction=drop,SchemaAction=add,ForeignKeys=true)");
+ }
+
+ addEntries(prefix, odeConfig, props);
+
+ return props;
+ }
+
+ public static void addEntries(String prefix, Properties odeConfig, Map props) {
+ if (odeConfig != null) {
+ for (Map.Entry me : odeConfig.entrySet()) {
+ String key = (String) me.getKey();
+ if (key.startsWith(prefix)) {
+ String jpaKey = key.substring(prefix.length() - 1);
+ String val = (String) me.getValue();
+ if (val == null || val.trim().length() == 0) {
+ props.remove(jpaKey);
+ } else {
+ props.put(jpaKey, me.getValue());
+ }
+ }
+ }
+ }
+ }
+}
Added: ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/ConfStoreDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/ConfStoreDAOConnectionFactoryImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/ConfStoreDAOConnectionFactoryImpl.java (added)
+++ ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/ConfStoreDAOConnectionFactoryImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,65 @@
+/*
+ * 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.openjpa;
+
+import java.util.Map;
+import java.util.Properties;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import org.apache.ode.dao.jpa.store.ConfStoreDAOConnectionImpl;
+import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.dao.store.ConfStoreDAOConnection;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
+import static org.apache.ode.dao.jpa.openjpa.BpelDAOConnectionFactoryImpl._operator;
+import static org.apache.ode.dao.jpa.openjpa.BpelDAOConnectionFactoryImpl.buildConfig;
+
+public class ConfStoreDAOConnectionFactoryImpl implements ConfStoreDAOConnectionFactory {
+
+ EntityManagerFactory _emf;
+ TransactionManager _txm;
+ DataSource _ds;
+
+ public void init(Properties odeConfig, TransactionManager txm, Object env) {
+ _txm=txm;
+ _ds = (DataSource) env;
+ Map emfProperties = buildConfig(OdeConfigProperties.PROP_DAOCF_STORE + ".", odeConfig, _txm, _ds);
+ _emf = Persistence.createEntityManagerFactory("ode-store", emfProperties);
+
+ }
+
+ public ConfStoreDAOConnection getConnection() {
+ final ThreadLocal<ConfStoreDAOConnectionImpl> currentConnection = ConfStoreDAOConnectionImpl.getThreadLocal();
+ ConfStoreDAOConnectionImpl conn = (ConfStoreDAOConnectionImpl) currentConnection.get();
+ if (conn != null && !conn.isClosed()) {
+ return conn;
+ } else {
+ EntityManager em = _emf.createEntityManager();
+ conn = new ConfStoreDAOConnectionImpl(em, _txm, _operator);
+ currentConnection.set(conn);
+ return conn;
+ }
+ }
+
+ public void shutdown() {
+ _emf.close();
+ }
+}
Added: ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/JpaOperatorImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/JpaOperatorImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/JpaOperatorImpl.java (added)
+++ ode/trunk/dao-jpa-ojpa/src/main/java/org/apache/ode/dao/jpa/openjpa/JpaOperatorImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,64 @@
+/*
+ * 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.openjpa;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.persistence.Query;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.jpa.JpaOperator;
+import org.apache.openjpa.persistence.OpenJPAPersistence;
+import org.apache.openjpa.persistence.OpenJPAQuery;
+
+/**
+ *
+ *
+ * @author Matthieu Riou <mriou at apache dot org>
+ * @author Jeff Yu
+ */
+public class JpaOperatorImpl implements JpaOperator {
+ private static final Log __log = LogFactory.getLog(JpaOperatorImpl.class);
+
+ public <T> void batchUpdateByIds(Iterator<T> ids, Query query, String parameterName) {
+ if( query instanceof OpenJPAQuery ) {
+ OpenJPAQuery openJpaQuery = (OpenJPAQuery)query;
+ int batchSize = openJpaQuery.getFetchPlan().getFetchBatchSize();
+ if( __log.isTraceEnabled() ) __log.trace("BATCH fetchBatchSize = " + batchSize);
+ List<T> batch = new ArrayList<T>();
+ while( ids.hasNext() ) {
+ for( int i = 0; i < batchSize && ids.hasNext(); i++ ) {
+ batch.add(ids.next());
+ }
+ if( __log.isTraceEnabled() ) __log.trace("BATCH updating " + batch.size() + " objects.");
+ query.setParameter(parameterName, batch);
+ query.executeUpdate();
+ batch.clear();
+ }
+ }
+ }
+
+ public void setBatchSize(Query query, int limit) {
+ OpenJPAQuery kq = OpenJPAPersistence.cast(query);
+ kq.getFetchPlan().setFetchBatchSize(limit);
+ }
+}
\ No newline at end of file