james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1142600 - in /james/server/trunk: jdbc/ jdbc/src/main/resources/OSGI-INF/ jdbc/src/main/resources/OSGI-INF/blueprint/ jpa/ jpa/src/main/resources/ jpa/src/main/resources/META-INF/
Date Mon, 04 Jul 2011 09:52:42 GMT
Author: norman
Date: Mon Jul  4 09:52:41 2011
New Revision: 1142600

URL: http://svn.apache.org/viewvc?rev=1142600&view=rev
Log:
Add osgi meta-data for jdbc and jpa bundle. This use the aries jpa container which is shipped
with karaf. See JAMES-835

Added:
    james/server/trunk/jdbc/src/main/resources/OSGI-INF/
    james/server/trunk/jdbc/src/main/resources/OSGI-INF/blueprint/
    james/server/trunk/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc.xml
    james/server/trunk/jpa/src/main/resources/
    james/server/trunk/jpa/src/main/resources/META-INF/
    james/server/trunk/jpa/src/main/resources/META-INF/persistence.xml
Modified:
    james/server/trunk/jdbc/pom.xml
    james/server/trunk/jpa/pom.xml

Modified: james/server/trunk/jdbc/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/jdbc/pom.xml?rev=1142600&r1=1142599&r2=1142600&view=diff
==============================================================================
--- james/server/trunk/jdbc/pom.xml (original)
+++ james/server/trunk/jdbc/pom.xml Mon Jul  4 09:52:41 2011
@@ -27,6 +27,16 @@
   <groupId>org.apache.james</groupId>
   <artifactId>james-server-jdbc</artifactId>
   <name>Apache James Server JDBC Data Persistence</name>
+  <properties>
+      <!-- OSGI stuff -->
+    <james.osgi.export>
+      org.apache.james.*,
+    </james.osgi.export>
+    <james.osgi.import>
+      *,
+      org.apache.commons.dbcp.*
+    </james.osgi.import>
+  </properties> 
   
   <dependencies>
     <dependency>

Added: james/server/trunk/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc.xml?rev=1142600&view=auto
==============================================================================
--- james/server/trunk/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc.xml (added)
+++ james/server/trunk/jdbc/src/main/resources/OSGI-INF/blueprint/jdbc.xml Mon Jul  4 09:52:41
2011
@@ -0,0 +1,45 @@
+<?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. !
+    -->
+
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+            default-activation="lazy">
+         
+    <!-- Configuration Admin entries so the user can overwrite them if needed -->
+  <cm:property-placeholder persistent-id="org.apache.james.jdbc">
+    <cm:default-properties>
+      <cm:property name="jdbc.driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"
/>
+      <cm:property name="jdbc.url" value="jdbc:derby:/tmp/james;create=true" />
+      <cm:property name="jdbc.username" value="" />
+      <cm:property name="jdbc.password" value="" />          
+    </cm:default-properties>
+  </cm:property-placeholder>
+
+  <!-- DataSource Derby -->
+  <bean id="dataSourceJames" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
+    <property name="driverClassName" value="${jdbc.driverClassName}" />
+    <property name="url" value="${jdbc.url}" />
+    <property name="username" value="${jdbc.username}" />
+    <property name="password" value="${jdbc.password}" />
+  </bean>
+  <service id="datasource" ref="dataSourceJames" interface="javax.sql.DataSource">
+    <service-properties>
+      <entry key="osgi.jndi.service.name" value="jdbc/james"/>
+    </service-properties>
+  </service>
+</blueprint>

Modified: james/server/trunk/jpa/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/jpa/pom.xml?rev=1142600&r1=1142599&r2=1142600&view=diff
==============================================================================
--- james/server/trunk/jpa/pom.xml (original)
+++ james/server/trunk/jpa/pom.xml Mon Jul  4 09:52:41 2011
@@ -27,6 +27,15 @@
   <groupId>org.apache.james</groupId>
   <artifactId>james-server-jpa</artifactId>
   <name>Apache James Server JPA Data Persistence</name>
+  <properties>
+      <!-- OSGI stuff -->
+    <james.osgi.export>
+      org.apache.james.*,
+    </james.osgi.export>
+    <james.osgi.import>
+      *
+    </james.osgi.import>
+  </properties> 
   
   <build>
     <plugins>
@@ -80,6 +89,33 @@ Parent pom build failure prevents inheri
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <executions>
+          <execution>
+            <id>bundle-manifest</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>manifest</goal>
+            </goals>
+          </execution>
+        </executions>
+
+        <configuration>
+          <excludeDependencies>${james.osgi.exclude.dependencies}</excludeDependencies>
+          <instructions>
+            <Bundle-Name>${project.artifactId}</Bundle-Name>
+            <Export-Package>${james.osgi.export}</Export-Package>
+            <Import-Package>${james.osgi.import}</Import-Package>
+            <DynamicImport-Package>${james.osgi.dynamic}</DynamicImport-Package>
+            <Implementation-Title>Apache James Server</Implementation-Title>
+            <Implementation-Version>${project.version}</Implementation-Version>
+            <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
+          </instructions>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   

Added: james/server/trunk/jpa/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/jpa/src/main/resources/META-INF/persistence.xml?rev=1142600&view=auto
==============================================================================
--- james/server/trunk/jpa/src/main/resources/META-INF/persistence.xml (added)
+++ james/server/trunk/jpa/src/main/resources/META-INF/persistence.xml Mon Jul  4 09:52:41
2011
@@ -0,0 +1,42 @@
+<?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"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+    version="2.0">
+
+    <persistence-unit name="James" transaction-type="JTA">
+       <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/james)</jta-data-source>
+        <class>org.apache.james.domainlist.jpa.model.JPADomain</class>
+        <class>org.apache.james.user.jpa.model.JPAUser</class>
+        <class>org.apache.james.rrt.jpa.model.JPARecipientRewrite</class>
+        <exclude-unlisted-classes>true</exclude-unlisted-classes>
+        <properties>
+            <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+            <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=cascade,
JoinForeignKeyDeleteAction=cascade"/>
+            <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
+            <property name="openjpa.jdbc.QuerySQLCache" value="false"/>
+        </properties>
+
+    </persistence-unit>
+
+</persistence>



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message