You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@provisionr.apache.org by as...@apache.org on 2013/07/01 13:41:49 UTC

git commit: PROVISIONR-9 : Adding support for postgres

Updated Branches:
  refs/heads/master 21d6c3897 -> 416958b5e


PROVISIONR-9 : Adding support for postgres

 -  Added Spring-jdbc for JDBC URL based DB access
 -  Added a new fragment as Postgres is not OSGI friendly
 -  Added JDBC parameters as cfg props
 -  upgraded Spring to 3.1.4 available in karaf


Project: http://git-wip-us.apache.org/repos/asf/incubator-provisionr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-provisionr/commit/416958b5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-provisionr/tree/416958b5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-provisionr/diff/416958b5

Branch: refs/heads/master
Commit: 416958b5e02d5dec0ddb255baf21e81c6827984a
Parents: 21d6c38
Author: Rahul Sharma <rs...@apache.org>
Authored: Sat Jun 29 14:19:31 2013 +0530
Committer: Andrei Savu <as...@apache.org>
Committed: Mon Jul 1 14:33:11 2013 +0300

----------------------------------------------------------------------
 activiti/database/pom.xml                       | 57 ++++++++++++++++++++
 core/pom.xml                                    | 10 ++--
 .../resources/OSGI-INF/blueprint/context.xml    | 10 ++--
 core/src/main/resources/features.xml            |  3 +-
 .../main/resources/org.apache.provisionr.cfg    | 15 ++++--
 parent/pom.xml                                  | 17 +++++-
 pom.xml                                         |  1 +
 7 files changed, 100 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/416958b5/activiti/database/pom.xml
----------------------------------------------------------------------
diff --git a/activiti/database/pom.xml b/activiti/database/pom.xml
new file mode 100644
index 0000000..9e4b7a6
--- /dev/null
+++ b/activiti/database/pom.xml
@@ -0,0 +1,57 @@
+<!-- Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License. -->
+
+<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">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.provisionr</groupId>
+        <artifactId>provisionr-parent</artifactId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../../parent</relativePath>
+    </parent>
+
+    <artifactId>activiti-database</artifactId>
+    <packaging>bundle</packaging>
+
+    <name>Apache Provisionr :: Activiti Database </name>
+    <description>Bundle containing database drives with Spring JDBC</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-jdbc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Fragment-Host>org.springframework.jdbc</Fragment-Host>
+                        <Export-Package>org.postgresql</Export-Package>
+                        <Export-Package>org.postgresql*</Export-Package>
+                        <Private-Package>!*</Private-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/416958b5/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 1b954e5..6798018 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -32,7 +32,7 @@
     <packaging>bundle</packaging>
 
     <properties>
-        <osgi.import>*</osgi.import>
+        <osgi.import>org.postgresql,org.h2,*</osgi.import>
         <osgi.export>org.apache.provisionr.core*</osgi.export>
     </properties>
 
@@ -71,6 +71,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.provisionr</groupId>
+            <artifactId>activiti-database</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.provisionr</groupId>
             <artifactId>provisionr-test-support</artifactId>
             <scope>test</scope>
             <exclusions>
@@ -144,8 +148,8 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Import-Packages>${osgi.import}</Import-Packages>
-                        <Export-Packages>${osgi.export}</Export-Packages>
+                        <Import-Package>${osgi.import}</Import-Package>
+                        <Export-Package>${osgi.export}</Export-Package>
                     </instructions>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/416958b5/core/src/main/resources/OSGI-INF/blueprint/context.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/OSGI-INF/blueprint/context.xml b/core/src/main/resources/OSGI-INF/blueprint/context.xml
index 7090675..5f7cb1e 100644
--- a/core/src/main/resources/OSGI-INF/blueprint/context.xml
+++ b/core/src/main/resources/OSGI-INF/blueprint/context.xml
@@ -23,6 +23,7 @@
                               placeholder-prefix="$(" placeholder-suffix=")" update-strategy="reload">
         <cfg:default-properties>
             <cfg:property name="activiti.db.url" value="jdbc:h2:mem:provisionr;MVCC=TRUE;DB_CLOSE_DELAY=-1"/>
+            <cfg:property name="activiti.db.driver" value="org.h2.Driver"/>
             <cfg:property name="activiti.db.user" value="sa"/>
             <cfg:property name="activiti.db.password" value=""/>
             <cfg:property name="activiti.db.schemaUpdate" value="true"/>
@@ -39,10 +40,11 @@
         </cfg:default-properties>
     </cfg:property-placeholder>
 
-    <bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource" scope="singleton">
-        <property name="URL" value="$(activiti.db.url)"/>
-        <property name="user" value="$(activiti.db.user)"/>
-        <property name="password" value="$(activiti.db.password)"/>
+    <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+        <property name="driverClass" value="${activiti.db.driver}"/>
+        <property name="url" value="${activiti.db.url}"/>
+        <property name="username" value="${activiti.db.user}"/>
+        <property name="password" value="${activiti.db.password}"/>
     </bean>
 
     <bean id="jobExecutor" class="org.activiti.engine.impl.jobexecutor.DefaultJobExecutor">

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/416958b5/core/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/features.xml b/core/src/main/resources/features.xml
index 924a48a..b85c568 100644
--- a/core/src/main/resources/features.xml
+++ b/core/src/main/resources/features.xml
@@ -27,7 +27,8 @@
 
         <bundle dependency="true">mvn:com.h2database/h2/${h2.version}</bundle>
         <bundle dependency="true">mvn:org.mybatis/mybatis/${mybatis.version}</bundle>
-
+        <bundle dependency="true">mvn:org.springframework/spring-jdbc/${spring.version}</bundle>
+        <bundle dependency="true">mvn:org.apache.provisionr/activiti-database/${project.version}</bundle>
         <bundle dependency="true">mvn:org.codehaus.groovy/groovy-all/${groovy.version}</bundle>
 
         <bundle start="true">mvn:org.activiti/activiti-engine/${activiti.version}</bundle>

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/416958b5/core/src/main/resources/org.apache.provisionr.cfg
----------------------------------------------------------------------
diff --git a/core/src/main/resources/org.apache.provisionr.cfg b/core/src/main/resources/org.apache.provisionr.cfg
index df4242d..aef5e24 100644
--- a/core/src/main/resources/org.apache.provisionr.cfg
+++ b/core/src/main/resources/org.apache.provisionr.cfg
@@ -20,11 +20,18 @@
 # Database configuration
 #
 
-# We use MVCC to enable row-level locking on h2. This avoids transaction dead locks.
-activiti.db.url=jdbc:h2:data/state;MVCC=TRUE;DB_CLOSE_DELAY=-1
+# By default Provisionr will use a H2 database stored on the local filesystem
 
+activiti.db.url=jdbc:h2:data/state;MVCC=TRUE;DB_CLOSE_DELAY=-1
+activiti.db.driver=org.h2.Driver
 activiti.db.user=sa
-# activiti.db.password=
+
+# For production deployments we recommend PostgreSQL (http://www.postgresql.org/)
+
+# activiti.db.url=jdbc:postgresql://localhost:5432/provisionr
+# activiti.db.driver=org.postgresql.Driver
+# activiti.db.user=provisionr
+# activiti.db.password=test
 
 activiti.db.schemaUpdate=true
 
@@ -48,7 +55,7 @@ activiti.executor.lockTimeInMillis=600000
 # Job Retries
 #
 
-# Use -1 for infinity
+# Use -1 for infinity (not recommended)
 activiti.job.maxNumberOfRetries=13
 activiti.job.timeBetweenRetriesInSeconds=10
 

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/416958b5/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 5153ffa..8ad08b2 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -144,7 +144,7 @@
         <osgi.framework.version>4.3.0</osgi.framework.version>
         <activiti.version>5.10</activiti.version>
         <h2.version>1.3.168</h2.version>
-        <spring.version>3.0.7.RELEASE</spring.version>
+        <spring.version>3.1.4.RELEASE</spring.version>
         <spring.osgi.version>1.2.1</spring.osgi.version>
         <vaadin.version>6.6.2</vaadin.version>
         <guava.version>13.0</guava.version>
@@ -253,6 +253,21 @@
                 <version>${activiti.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.springframework</groupId>
+                <artifactId>spring-jdbc</artifactId>
+                <version>${spring.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.provisionr</groupId>
+                <artifactId>activiti-database</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>postgresql</groupId>
+                <artifactId>postgresql</artifactId>
+                <version>9.1-901.jdbc4</version>
+            </dependency>
+            <dependency>
                 <groupId>com.google.guava</groupId>
                 <artifactId>guava</artifactId>
                 <version>${guava.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-provisionr/blob/416958b5/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 21d6d3a..f08c0cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,7 @@
         <module>providers/amazon</module>
         <module>providers/cloudstack</module>
         <module>integration/rundeck</module>
+        <module>activiti/database</module>
     </modules>
 
     <profiles>