You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/03/07 10:18:06 UTC

[incubator-servicecomb-saga] branch master updated: SCB-346 Add saga-persistence back

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git


The following commit(s) were added to refs/heads/master by this push:
     new 107c385  SCB-346 Add saga-persistence back
107c385 is described below

commit 107c385999afd2342cf7135ff08c5380ec06648a
Author: Yang Bo <ya...@huawei.com>
AuthorDate: Wed Mar 7 14:36:39 2018 +0800

    SCB-346 Add saga-persistence back
    
    The saga-persistence module is needed for connecting to databases.
---
 pom.xml                                            |  1 +
 saga-persistence/pom.xml                           | 36 +++++++++
 saga-persistence/saga-persistence-jpa/pom.xml      | 89 ++++++++++++++++++++++
 .../jpa/EclipseLinkJpaConfiguration.java           | 50 ++++++++++++
 .../src/main/resources/META-INF/spring.factories   | 18 +++++
 5 files changed, 194 insertions(+)

diff --git a/pom.xml b/pom.xml
index 3c980f0..438ad33 100755
--- a/pom.xml
+++ b/pom.xml
@@ -37,6 +37,7 @@
     <module>pack-contracts</module>
     <module>pack-common</module>
     <module>integration-tests</module>
+    <module>saga-persistence</module>
   </modules>
 
   <properties>
diff --git a/saga-persistence/pom.xml b/saga-persistence/pom.xml
new file mode 100644
index 0000000..5f7bc20
--- /dev/null
+++ b/saga-persistence/pom.xml
@@ -0,0 +1,36 @@
+<?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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>saga</artifactId>
+    <groupId>org.apache.servicecomb.saga</groupId>
+    <version>0.0.3-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>saga-persistence</artifactId>
+  <packaging>pom</packaging>
+  <modules>
+    <module>saga-persistence-jpa</module>
+  </modules>
+
+
+</project>
diff --git a/saga-persistence/saga-persistence-jpa/pom.xml b/saga-persistence/saga-persistence-jpa/pom.xml
new file mode 100644
index 0000000..372b383
--- /dev/null
+++ b/saga-persistence/saga-persistence-jpa/pom.xml
@@ -0,0 +1,89 @@
+<?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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>saga-persistence</artifactId>
+    <groupId>org.apache.servicecomb.saga</groupId>
+    <version>0.0.3-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>saga-persistence-jpa</artifactId>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring.boot.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-aop</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter-jdbc</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.transaction</groupId>
+      <artifactId>javax.transaction-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework.data</groupId>
+      <artifactId>spring-data-jpa</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.aspectj</groupId>
+          <artifactId>aspectjrt</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-aspects</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.persistence</groupId>
+      <artifactId>org.eclipse.persistence.jpa</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>com.ethlo.persistence.tools</groupId>
+        <artifactId>eclipselink-maven-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/saga-persistence/saga-persistence-jpa/src/main/java/org/apache/servicecomb/saga/persistence/jpa/EclipseLinkJpaConfiguration.java b/saga-persistence/saga-persistence-jpa/src/main/java/org/apache/servicecomb/saga/persistence/jpa/EclipseLinkJpaConfiguration.java
new file mode 100644
index 0000000..1ad7879
--- /dev/null
+++ b/saga-persistence/saga-persistence-jpa/src/main/java/org/apache/servicecomb/saga/persistence/jpa/EclipseLinkJpaConfiguration.java
@@ -0,0 +1,50 @@
+/*
+ * 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.servicecomb.saga.persistence.jpa;
+
+import java.util.Collections;
+import java.util.Map;
+
+import javax.sql.DataSource;
+
+import org.springframework.beans.factory.ObjectProvider;
+import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
+import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
+import org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter;
+import org.springframework.transaction.jta.JtaTransactionManager;
+
+@Configuration
+public class EclipseLinkJpaConfiguration extends JpaBaseConfiguration {
+  EclipseLinkJpaConfiguration(DataSource dataSource,
+      JpaProperties properties,
+      ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
+    super(dataSource, properties, jtaTransactionManagerProvider);
+  }
+
+  @Override
+  protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
+    return new EclipseLinkJpaVendorAdapter();
+  }
+
+  @Override
+  protected Map<String, Object> getVendorProperties() {
+    return Collections.singletonMap("eclipselink.weaving", "false");
+  }
+}
diff --git a/saga-persistence/saga-persistence-jpa/src/main/resources/META-INF/spring.factories b/saga-persistence/saga-persistence-jpa/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..1d6b850
--- /dev/null
+++ b/saga-persistence/saga-persistence-jpa/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,18 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+  org.apache.servicecomb.saga.persistence.jpa.EclipseLinkJpaConfiguration

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.