You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2011/05/21 22:27:32 UTC

svn commit: r1125800 [1/3] - in /openejb/trunk/sandbox/arquillian-tomee: ./ arquillian-tomee-container/ arquillian-tomee-container/src/ arquillian-tomee-container/src/main/ arquillian-tomee-container/src/main/java/ arquillian-tomee-container/src/main/j...

Author: jgallimore
Date: Sat May 21 20:27:31 2011
New Revision: 1125800

URL: http://svn.apache.org/viewvc?rev=1125800&view=rev
Log:
OPENEJB-1556 Basic Arquillian Adapter for TomEE

Added:
    openejb/trunk/sandbox/arquillian-tomee/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/pom.xml
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppLookupException.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatus.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatusRemote.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEArchiveAppender.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEConfiguration.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEContainer.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/org.apache.openejb.tomcat/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/org.apache.openejb.tomcat/service-jar.xml
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.container.DeployableContainer
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.deployment.AuxiliaryArchiveAppender
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/catalina.policy
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/catalina.properties
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/context.xml
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/logging.properties
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/openejb.xml
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/server.xml
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/tomcat-users.xml
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/web.xml
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TestEjb.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TestServlet.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/java/org/apache/openejb/arquillian/TomEEContainerTest.java
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/resources/
    openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/test/resources/arquillian.xml
    openejb/trunk/sandbox/arquillian-tomee/openejb-webapp-wrapper/
    openejb/trunk/sandbox/arquillian-tomee/openejb-webapp-wrapper/pom.xml
    openejb/trunk/sandbox/arquillian-tomee/pom.xml

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/pom.xml?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/pom.xml (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/pom.xml Sat May 21 20:27:31 2011
@@ -0,0 +1,172 @@
+<?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="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>
+    <artifactId>arquillian-tomee</artifactId>
+    <groupId>org.apache.openejb</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.openejb</groupId>
+  <artifactId>arquillian-tomee-container</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>arquillian-tomee</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+      <version.org.apache.tomcat>7.0.12</version.org.apache.tomcat>
+      <version.cdi-api>1.0</version.cdi-api>
+      <version.arquillian>1.0.0-SNAPSHOT</version.arquillian>
+      <version.shrinkwrap>SW140-SNAPSHOT</version.shrinkwrap>
+   </properties>
+
+   <dependencies>
+
+      <dependency>
+         <groupId>org.jboss.arquillian</groupId>
+         <artifactId>arquillian-spi</artifactId>
+         <version>${version.arquillian}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.shrinkwrap</groupId>
+         <artifactId>shrinkwrap-extension-tomcat-6</artifactId>
+         <version>${version.shrinkwrap}</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.jboss.arquillian.protocol</groupId>
+        <artifactId>arquillian-protocol-servlet</artifactId>
+        <version>${version.arquillian}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.arquillian.testenricher</groupId>
+         <artifactId>arquillian-testenricher-cdi</artifactId>
+         <version>${version.arquillian}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.arquillian.testenricher</groupId>
+         <artifactId>arquillian-testenricher-resource</artifactId>
+         <version>${version.arquillian}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.jboss.arquillian.testenricher</groupId>
+         <artifactId>arquillian-testenricher-ejb</artifactId>
+         <version>${version.arquillian}</version>
+      </dependency>
+    
+      <dependency>
+         <groupId>org.apache.tomcat</groupId>
+         <artifactId>tomcat-catalina</artifactId>
+         <version>${version.org.apache.tomcat}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.apache.tomcat</groupId>
+         <artifactId>tomcat-coyote</artifactId>
+         <version>${version.org.apache.tomcat}</version>
+      </dependency>
+
+      <dependency>
+         <groupId>org.apache.tomcat</groupId>
+         <artifactId>tomcat-jasper</artifactId>
+         <version>${version.org.apache.tomcat}</version>
+         <exclusions>
+         	<exclusion>
+         		<groupId>org.eclipse.jdt.core.compiler</groupId>
+         		<artifactId>ecj</artifactId>
+         	</exclusion>
+         </exclusions>
+      </dependency>
+
+      <dependency>
+        <groupId>org.jboss.arquillian</groupId>
+        <artifactId>arquillian-junit</artifactId>
+        <version>${version.arquillian}</version>
+        <scope>test</scope>
+      </dependency>
+
+      <dependency>
+      	<groupId>javax.enterprise</groupId>
+      	<artifactId>cdi-api</artifactId>
+      	<version>${version.cdi-api}</version>
+      	<scope>test</scope>
+      </dependency>
+      
+      <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <version>4.8.1</version>
+         <scope>test</scope>
+      </dependency>
+      
+      <dependency>
+        <groupId>org.jboss.shrinkwrap.resolver</groupId>
+        <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
+        <version>${version.shrinkwrap}</version>
+      </dependency>
+
+      <dependency>
+      	<groupId>org.apache.openejb</groupId>
+      	<artifactId>openejb-webapp-wrapper</artifactId>
+      	<version>1.0-SNAPSHOT</version>
+      	<type>jar</type>
+      </dependency>
+      <dependency>
+      	<groupId>org.eclipse.jdt.core.compiler</groupId>
+      	<artifactId>ecj</artifactId>
+      	<version>3.5.1</version>
+      	<type>jar</type>
+      	<scope>compile</scope>
+      </dependency>
+      <dependency>
+      	<groupId>org.apache.openejb</groupId>
+      	<artifactId>javaee-api</artifactId>
+      	<version>6.0-SNAPSHOT</version>
+      	<type>jar</type>
+      </dependency>
+      <dependency>
+      	<groupId>org.apache.velocity</groupId>
+      	<artifactId>velocity</artifactId>
+      	<version>1.6.4</version>
+      	<type>jar</type>
+      	<scope>compile</scope>
+      </dependency>
+      <dependency>
+      	<groupId>org.apache.geronimo.specs</groupId>
+      	<artifactId>geronimo-j2ee-deployment_1.1_spec</artifactId>
+      	<version>1.1</version>
+      	<type>jar</type>
+      	<scope>compile</scope>
+      </dependency>
+      <dependency>
+      	<groupId>org.apache.openejb</groupId>
+      	<artifactId>openejb-client</artifactId>
+      	<version>4.0.0-SNAPSHOT</version>
+      	<type>jar</type>
+      	<scope>test</scope>
+      </dependency>
+   </dependencies>
+</project>

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppLookupException.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppLookupException.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppLookupException.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppLookupException.java Sat May 21 20:27:31 2011
@@ -0,0 +1,38 @@
+/**
+ * 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.openejb.arquillian;
+
+public class AppLookupException extends Exception {
+
+	private static final long serialVersionUID = 5131748818917110220L;
+
+	public AppLookupException() {
+	}
+
+	public AppLookupException(String message) {
+		super(message);
+	}
+
+	public AppLookupException(Throwable throwable) {
+		super(throwable);
+	}
+
+	public AppLookupException(String message, Throwable throwable) {
+		super(message, throwable);
+	}
+
+}

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatus.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatus.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatus.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatus.java Sat May 21 20:27:31 2011
@@ -0,0 +1,68 @@
+/**
+ * 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.openejb.arquillian;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class AppStatus implements AppStatusRemote {
+
+	public String[] getDeployedApps() throws AppLookupException {
+		// Basically the reflection equivalent of:
+		//
+		//		Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+		//		Collection<AppInfo> deployedApplications = assembler.getDeployedApplications();
+		//		for (AppInfo appInfo : deployedApplications) {
+		//			result.add(appInfo.path);
+		//		}
+		
+		List<String> result;
+		try {
+			result = new ArrayList<String>();
+			
+			Class<?> systemInstanceCls = Class.forName("org.apache.openejb.loader.SystemInstance");
+			Method getMethod = systemInstanceCls.getMethod("get");
+			Object systemInstanceObj = getMethod.invoke(null);
+			
+			Class<?> assemblerCls = Class.forName("org.apache.openejb.assembler.classic.Assembler");
+			Method getComponentMethod = systemInstanceCls.getMethod("getComponent", Class.class);
+			Object assemblerObj = getComponentMethod.invoke(systemInstanceObj, assemblerCls);
+			
+			Class<?> appInfoCls = Class.forName("org.apache.openejb.assembler.classic.AppInfo");
+			
+			Method getDeployedApplicationsMethod = assemblerCls.getMethod("getDeployedApplications");
+			Collection<?> deployedApplications = (Collection<?>) getDeployedApplicationsMethod.invoke(assemblerObj);
+			for (Object deployedApplication : deployedApplications) {
+				String path = (String) appInfoCls.getDeclaredField("path").get(deployedApplication);
+				result.add(path);
+			}
+			
+			return result.toArray(new String[result.size()]);
+		} catch (Exception e) {
+			throw new AppLookupException("Unable to lookup deployed apps in TomEE. Is this EJB running in TomEE?", e);
+		}
+		
+		
+		
+	}
+
+}

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatusRemote.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatusRemote.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatusRemote.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/AppStatusRemote.java Sat May 21 20:27:31 2011
@@ -0,0 +1,24 @@
+/**
+ * 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.openejb.arquillian;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface AppStatusRemote {
+	public String[] getDeployedApps() throws AppLookupException;
+}

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEArchiveAppender.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEArchiveAppender.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEArchiveAppender.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEArchiveAppender.java Sat May 21 20:27:31 2011
@@ -0,0 +1,42 @@
+/**
+ * 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.openejb.arquillian;
+
+import org.jboss.arquillian.spi.TestEnricher;
+import org.jboss.arquillian.spi.client.deployment.AuxiliaryArchiveAppender;
+import org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher;
+import org.jboss.arquillian.testenricher.ejb.EJBInjectionEnricher;
+import org.jboss.arquillian.testenricher.resource.ResourceInjectionEnricher;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+public class TomEEArchiveAppender implements AuxiliaryArchiveAppender {
+
+	public Archive<?> createAuxiliaryArchive() {
+		JavaArchive archive = ShrinkWrap
+				.create(JavaArchive.class, "arquillian-jboss-testenrichers.jar")
+				.addPackages(true, EJBInjectionEnricher.class.getPackage(),
+						ResourceInjectionEnricher.class.getPackage(),
+						CDIInjectionEnricher.class.getPackage())
+				.addAsServiceProvider(TestEnricher.class,
+						CDIInjectionEnricher.class, EJBInjectionEnricher.class,
+						ResourceInjectionEnricher.class);
+		return archive;
+	}
+
+}

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEConfiguration.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEConfiguration.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEConfiguration.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEConfiguration.java Sat May 21 20:27:31 2011
@@ -0,0 +1,85 @@
+/**
+ * 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.openejb.arquillian;
+
+import org.jboss.arquillian.spi.ConfigurationException;
+import org.jboss.arquillian.spi.client.container.ContainerConfiguration;
+
+public class TomEEConfiguration implements ContainerConfiguration {
+
+	private int httpPort = 8080;
+	private int stopPort = 8005;
+	private String stopCommand = "SHUTDOWN";
+	private String dir = System.getProperty("java.io.tmpdir") + "/arquillian-apache-tomee";
+	private String openejbPath = "classpath:/openejb-tomcat-webapp-4.0.0-SNAPSHOT.war";
+	private int timeout = 30;
+	
+	public int getHttpPort() {
+		return httpPort;
+	}
+
+	public void setHttpPort(int httpPort) {
+		this.httpPort = httpPort;
+	}
+
+	public int getStopPort() {
+		return stopPort;
+	}
+
+	public void setStopPort(int stopPort) {
+		this.stopPort = stopPort;
+	}
+
+	public String getStopCommand() {
+		return stopCommand;
+	}
+
+	public void setStopCommand(String stopCommand) {
+		this.stopCommand = stopCommand;
+	}
+
+	public String getDir() {
+		return dir;
+	}
+
+	public void setDir(String dir) {
+		this.dir = dir;
+	}
+
+	public String getOpenejbPath() {
+		return openejbPath;
+	}
+
+	public void setOpenejbPath(String openejbPath) {
+		this.openejbPath = openejbPath;
+	}
+
+	public void validate() throws ConfigurationException {
+	}
+
+	public int getTimeOut() {
+		return timeout;
+	}
+
+	public int getTimeout() {
+		return timeout;
+	}
+
+	public void setTimeout(int timeout) {
+		this.timeout = timeout;
+	}
+}

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEContainer.java?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEContainer.java (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/java/org/apache/openejb/arquillian/TomEEContainer.java Sat May 21 20:27:31 2011
@@ -0,0 +1,321 @@
+/**
+ * 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.openejb.arquillian;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.lang.management.ManagementFactory;
+import java.net.URL;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectInstance;
+import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.catalina.startup.Bootstrap;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+import org.apache.velocity.runtime.log.Log4JLogChute;
+import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+import org.jboss.arquillian.spi.client.container.DeployableContainer;
+import org.jboss.arquillian.spi.client.container.DeploymentException;
+import org.jboss.arquillian.spi.client.container.LifecycleException;
+import org.jboss.arquillian.spi.client.protocol.ProtocolDescription;
+import org.jboss.arquillian.spi.client.protocol.metadata.HTTPContext;
+import org.jboss.arquillian.spi.client.protocol.metadata.ProtocolMetaData;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
+import org.jboss.shrinkwrap.api.exporter.ZipExporter;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.descriptor.api.Descriptor;
+
+public class TomEEContainer implements DeployableContainer<TomEEConfiguration> {
+
+	private Bootstrap bootstrap;
+	private TomEEConfiguration configuration;
+	private File catalinaDirectory;
+	private boolean usingOpenEJB;
+
+	public Class<TomEEConfiguration> getConfigurationClass() {
+		return TomEEConfiguration.class;
+	}
+
+	public void setup(TomEEConfiguration configuration) {
+		this.configuration = configuration;
+	}
+
+	public void start() throws LifecycleException {
+		try {
+			System.setProperty("openejb.deployments.classpath.exclude", ".*");
+			System.setProperty("openejb.deployments.classpath.include", "");
+			
+			catalinaDirectory = new File(configuration.getDir());
+			if (catalinaDirectory.exists()) {
+				catalinaDirectory.delete();
+			}
+			
+			catalinaDirectory.mkdirs();
+			catalinaDirectory.deleteOnExit();
+
+			createTomcatDirectories(catalinaDirectory);
+
+			// copy configs
+			copyConfigs(catalinaDirectory);
+			
+			// deploy status helper app
+			copyArchive(getStatusApp());
+			
+			// call Bootstrap();
+			System.out.println("Starting TomEE from: " + catalinaDirectory.getAbsolutePath());
+			
+			String catalinaBase = catalinaDirectory.getAbsolutePath();
+
+			System.setProperty("catalina.home", catalinaBase);
+			System.setProperty("catalina.base", catalinaBase);
+			
+			bootstrap = new Bootstrap();
+			bootstrap.start();
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new LifecycleException("Summat went wrong", e);
+		}		
+	}
+
+	private Archive<?> getStatusApp() {
+		return ShrinkWrap.create(JavaArchive.class, "status.jar")
+		.addClass(AppStatus.class)
+		.addClass(AppStatusRemote.class)
+		.addClass(AppLookupException.class)
+		.addAsResource(new StringAsset("<ejb-jar/>"), "META-INF/ejb-jar.xml");
+	}
+
+	public void stop() throws LifecycleException {
+		try {
+ 			bootstrap.stopServer();
+			deleteTree(catalinaDirectory);
+		} catch (Exception e) {
+			throw new LifecycleException("Unable to stop server", e);
+		}
+	}
+
+	public ProtocolDescription getDefaultProtocol() {
+		return new ProtocolDescription("Servlet 3.0");
+	}
+
+	public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
+		try {
+			copyArchive(archive);
+			
+			boolean deployed = false;
+			int attempts = 0;
+			while (attempts < configuration.getTimeout() && deployed == false) {
+				// need to poll for the app being deployed
+				attempts++;
+				Thread.sleep(1000);
+				
+				deployed = checkDeploymentStatus(archive);
+			}
+			
+			HTTPContext httpContext = new HTTPContext("0.0.0.0", configuration.getHttpPort());
+			return new ProtocolMetaData().addContext(httpContext);
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new DeploymentException("Unable to deploy", e);
+		}
+	}
+
+	private void copyArchive(Archive<?> archive) throws IOException, FileNotFoundException {
+		InputStream is = archive.as(ZipExporter.class).exportAsInputStream();
+		copyStream(is, new FileOutputStream(new File(catalinaDirectory, "webapps/" + archive.getName())));
+	}
+
+	private boolean checkDeploymentStatus(Archive<?> archive) throws Exception {
+		if (usingOpenEJB) {
+			try {
+				String dir = getDir(catalinaDirectory.getAbsolutePath() + "/webapps/" + archive.getName());
+				
+				Properties properties = new Properties();
+				properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+				properties.setProperty(Context.PROVIDER_URL, "http://localhost:" + configuration.getHttpPort() + "/openejb/ejb");
+				
+				InitialContext context = new InitialContext(properties);
+				AppStatusRemote appStatus = (AppStatusRemote) context.lookup("AppStatusRemote");
+				String[] deployedApps = appStatus.getDeployedApps();
+				for (String deployedApp : deployedApps) {
+					if (deployedApp.equals(dir)) {
+						return true;
+					}
+				}
+			} catch (Exception e) {
+			}
+			
+		    return false;
+		} else {
+			String context = getDir(archive.getName());
+			
+			MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
+			Set<ObjectInstance> mbeans = platformMBeanServer.queryMBeans(new ObjectName("Catalina:type=Manager,context=/" + context + ",*"), null);
+			for (ObjectInstance objectInstance : mbeans) {
+				String status = (String) platformMBeanServer.getAttribute(objectInstance.getObjectName(), "stateName");
+				if ("STARTED".equals(status)) {
+					return true;
+				}
+			}
+			return false;
+		}
+	}
+
+	public void undeploy(Archive<?> archive) throws DeploymentException {
+		// remove the archive file
+		new File(catalinaDirectory,"webapps/" + archive.getName()).delete();
+		
+		// remove the directory
+		deleteTree(new File(catalinaDirectory, "/webapps/" + getDir(archive.getName())));
+	}
+
+	private String getDir(String filename) {
+		int lastDot = filename.lastIndexOf(".");
+		if (lastDot == -1) {
+			return filename;
+		}
+		
+		return filename.substring(0, lastDot);
+	}
+
+	private void deleteTree(File file) {
+		if (file == null) return;
+		if (! file.exists()) return;
+		
+		if (file.isFile()) {
+			file.delete();
+			return;
+		}
+		
+		if (file.isDirectory()) {
+			if (".".equals(file.getName())) return;
+			if ("..".equals(file.getName())) return;
+			
+			File[] children = file.listFiles();
+			
+			for (File child : children) {
+				deleteTree(child);
+			}
+			
+			file.delete();
+		}
+	}
+
+	public void deploy(Descriptor descriptor) throws DeploymentException {
+		throw new UnsupportedOperationException("Not implemented");
+	}
+
+	public void undeploy(Descriptor descriptor) throws DeploymentException {
+		throw new UnsupportedOperationException("Not implemented");
+	}
+
+	private void copyConfigs(File directory) throws Exception {
+		File confDir = new File(directory, "conf");
+		copyFileTo(confDir, "catalina.policy");
+		copyTemplateTo(confDir, "catalina.properties");
+		copyFileTo(confDir, "context.xml");
+		copyFileTo(confDir, "logging.properties");
+		copyFileTo(confDir, "openejb.xml");
+		copyFileTo(confDir, "server.xml");
+		copyFileTo(confDir, "tomcat-users.xml");
+		copyFileTo(confDir, "web.xml");
+		
+		String openejbPath = configuration.getOpenejbPath();
+		
+		
+		if (openejbPath != null && openejbPath.length() > 0) {
+			usingOpenEJB = true;
+			try {
+				if (openejbPath.startsWith("classpath:/")) {
+					URL resource = TomEEContainerTest.class.getResource(openejbPath.substring(10));
+					copyStream(resource.openStream(), new FileOutputStream(new File(directory, "webapps/openejb.war")));
+				} else {
+					FileInputStream is = new FileInputStream(new File(openejbPath));
+					copyStream(is, new FileOutputStream(new File(directory, "webapps/openejb.war")));
+				}
+			} catch (Exception e) {
+				usingOpenEJB = false;
+			}
+		}
+	}
+
+	private void copyTemplateTo(File targetDir, String filename) throws Exception {
+        Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, new Log4JLogChute());
+        Velocity.setProperty(Velocity.RESOURCE_LOADER, "class");
+        Velocity.setProperty("class.resource.loader.description", "Velocity Classpath Resource Loader");
+        Velocity.setProperty("class.resource.loader.class", ClasspathResourceLoader.class.getName());
+        Velocity.init();
+        Template template = Velocity.getTemplate("/org/apache/openejb/tomee/configs/" + filename);
+        VelocityContext context = new VelocityContext();
+        context.put("tomcatHttpPort", Integer.toString(configuration.getHttpPort()));
+        context.put("tomcatShutdownPort", Integer.toString(configuration.getStopPort()));
+        context.put("tomcatShutdownCommand", configuration.getStopCommand());
+        Writer writer = new FileWriter(new File(targetDir, filename));
+        template.merge(context, writer);
+        writer.flush();
+        writer.close();		
+	}
+
+	private void copyFileTo(File targetDir, String filename) throws IOException {
+		InputStream is = getClass().getResourceAsStream("/org/apache/openejb/tomee/configs/" + filename);
+		FileOutputStream os = new FileOutputStream(new File(targetDir, filename));
+		
+		copyStream(is, os);
+	}
+
+	private void copyStream(InputStream is, FileOutputStream os)
+			throws IOException {
+		byte[] buffer = new byte[8192];
+		int bytesRead = -1;
+		
+		while ((bytesRead = is.read(buffer)) > -1) {
+			os.write(buffer, 0, bytesRead);
+		}
+		
+		is.close();
+		os.close();
+	}
+
+	private void createTomcatDirectories(File directory) {
+		createDirectory(directory, "apps");
+		createDirectory(directory, "conf");
+		createDirectory(directory, "lib");
+		createDirectory(directory, "logs");
+		createDirectory(directory, "webapps");
+		createDirectory(directory, "temp");
+		createDirectory(directory, "work");
+	}
+
+	private void createDirectory(File parent, String directory) {
+		new File(parent, directory).mkdirs();
+	}
+}

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/org.apache.openejb.tomcat/service-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/org.apache.openejb.tomcat/service-jar.xml?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/org.apache.openejb.tomcat/service-jar.xml (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/org.apache.openejb.tomcat/service-jar.xml Sat May 21 20:27:31 2011
@@ -0,0 +1,1007 @@
+<?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.
+-->
+<ServiceJar>
+
+  <!--
+  #===================================================================#
+  #       D E F A U L T    O P E N E J B    S E R V I C E S           #
+  #===================================================================#
+  #
+  #
+  #  This file defines all the default configurations of containers,
+  #  factories, managers and services that come with OpenEJB.
+  #
+  #  Can contain numerous configurations of the standard services
+  #  making it easy for users to simply name the one they want in
+  #  their configuration files.
+  #
+  #  Over time this will be become a library of default
+  #  configurations
+  #
+  #
+  #  The Configuraitions in this file reference the following other
+  #  files:
+  #
+  #  conf/default.cmp_global_tx_database.xml
+  #  conf/default.cmp_local_tx_database.xml
+  #  conf/default.idb_database.conf
+  -->
+
+  <!--
+  # ==========================================================
+  # Default Container-Managed Persistence EntityBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider id="Default CMP Container"
+                   service="Container"
+                   types="CMP_ENTITY"
+                   constructor="id, transactionManager, securityService, CmpEngineFactory"
+                   class-name="org.apache.openejb.core.cmp.CmpContainer">
+
+    CmpEngineFactory org.apache.openejb.core.cmp.jpa.JpaCmpEngineFactory
+  </ServiceProvider>
+
+  <!--
+  # ==========================================================
+  # Default Bean-Managed Persistence EntityBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default BMP Container"
+          service="Container"
+          types="BMP_ENTITY"
+          constructor="id, securityService, PoolSize"
+          class-name="org.apache.openejb.core.entity.EntityContainer">
+
+    # Specifies the size of the bean pools for this
+    # bmp entity container.
+
+    PoolSize 10
+
+</ServiceProvider>
+
+
+
+  <!--
+  # ==========================================================
+  # Default Stateless SessionBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default Stateless Container"
+          service="Container"
+          types="STATELESS"
+          factory-name="create"
+          class-name="org.apache.openejb.core.stateless.StatelessContainerFactory">
+
+    # Specifies the time an invokation should wait for an instance
+    # of the pool to become available.
+    #
+    # After the timeout is reached, if an instance in the pool cannot
+    # be obtained, the method invocation will fail.
+    #
+    # Usable time units: nanoseconds, microsecons, milliseconds,
+    # seconds, minutes, hours, days.  Or any combination such as
+    # "1 hour and 27 minutes and 10 seconds"
+
+    AccessTimeout = 30 seconds
+
+    # Specifies the size of the bean pools for this stateless
+    # SessionBean container.  If StrictPooling is not used, instances
+    # will still be created beyond this number if there is demand, but
+    # they will not be returned to the pool and instead will be
+    # immediately destroyed.
+
+    MaxSize = 10
+
+    # Specifies the minimum number of bean instances that should be in
+    # the pool for each bean.  Pools are prefilled to the minimum on
+    # startup.  Note this will create start order dependencies between
+    # other beans that also eagerly start, such as other @Stateless
+    # beans with a minimum or @Singleton beans using @Startup.  The
+    # @DependsOn annotation can be used to appropriately influence
+    # start order.
+    #
+    # The minimum pool size is rigidly maintained.  Instances in the
+    # minimum side of the pool are not eligible for IdleTimeout or
+    # GarbageCollection, but are subject to MaxAge and flushing.
+    #
+    # If the pool is flushed it is immediately refilled to the minimum
+    # size with MaxAgeOffset applied.  If an instance from the minimum
+    # side of the pool reaches its MaxAge, it is also immediately
+    # replaced.  Replacement is done in a background queue using the
+    # number of threads specified by CallbackThreads.
+
+    MinSize = 0
+
+    # StrictPooling tells the container what to do when the pool
+    # reaches it's maximum size and there are incoming requests that
+    # need instances.
+    #
+    # With strict pooling, requests will have to wait for instances to
+    # become available. The pool size will never grow beyond the the
+    # set PoolSize value.  The maximum amount of time a request should
+    # wait is specified via the AccessTimeout setting.
+    #
+    # Without strict pooling, the container will create temporary
+    # instances to meet demand. The instances will last for just one
+    # method invocation and then are removed.
+    #
+    # Setting StrictPooling to false and PoolSize to 0 will result in
+    # no pooling. Instead instances will be created on demand and live
+    # for exactly one method call before being removed.
+
+    StrictPooling = true
+
+    # Specifies the maximum time that an instance should live before
+    # it should be retired and removed from use.  This will happen
+    # gracefully.  Useful for situations where bean instances are
+    # designed to hold potentially expensive resources such as memory
+    # or file handles and need to be periodically cleared out.
+    #
+    # Usable time units: nanoseconds, microsecons, milliseconds,
+    # seconds, minutes, hours, days.  Or any combination such as
+    # "1 hour and 27 minutes and 10 seconds"
+
+    MaxAge = 0 hours
+
+    # When ReplaceAged is enabled, any instances in the pool that
+    # expire due to reaching their MaxAge will be replaced immediately
+    # so that the pool will remain at its current size.  Replacement
+    # is done in a background queue so that incoming threads will not
+    # have to wait for instance creation.
+    #
+    # The aim of his option is to prevent user requests from paying
+    # the instance creation cost as MaxAge is enforced, potentially
+    # while under heavy load at peak hours.
+    #
+    # Instances from the minimum side of the pool are always replaced
+    # when they reach their MaxAge, this setting dictates the
+    # treatment of non-minimum instances.
+
+    ReplaceAged = true
+
+    # When ReplaceFlushed is enabled, any instances in the pool that
+    # are flushed will be replaced immediately so that the pool will
+    # remain at its current size.  Replacement is done in a background
+    # queue so that incoming threads will not have to wait for
+    # instance creation.
+    #
+    # The aim of his option is to prevent user requests from paying
+    # the instance creation cost if a flush performed while under
+    # heavy load at peak hours.
+    #
+    # Instances from the minimum side of the pool are always replaced
+    # when they are flushed, this setting dictates the treatment of
+    # non-minimum instances.
+    #
+    # A bean may flush its pool by casting the SessionContext to
+    # Flushable and calling flush().  See SweepInterval for details on
+    # how flush is performed.
+    #
+    #   import javax.annotation.Resource;
+    #   import javax.ejb.SessionContext;
+    #   import javax.ejb.Stateless;
+    #   import java.io.Flushable;
+    #   import java.io.IOException;
+    #
+    #   @Stateless
+    #   public class MyBean {
+    #
+    #       @Resource
+    #       private SessionContext sessionContext;
+    #
+    #       public void flush() throws IOException {
+    #
+    #           ((Flushable) sessionContext).flush();
+    #       }
+    #   }
+
+    ReplaceFlushed = false
+
+    # Applies to MaxAge usage and would rarely be changed, but is a
+    # nice feature to understand.
+    #
+    # When the container first starts and the pool is filled to the
+    # minimum size, all those "minimum" instances will have the same
+    # creation time and therefore all expire at the same time dictated
+    # by the MaxAge setting.  To protect against this sudden drop
+    # scenario and provide a more gradual expiration from the start
+    # the container will spread out the age of the instances that fill
+    # the pool to the minimum using an offset.
+    #
+    # The MaxAgeOffset is not the final value of the offset, but
+    # rather it is used in creating the offset and allows the
+    # spreading to push the initial ages into the future or into the
+    # past.  The pool is filled at startup as follows:
+    #
+    #  for (int i = 0; i &lt; poolMin; i++) {
+    #    long ageOffset = (maxAge / poolMin * i * maxAgeOffset) % maxAge;
+    #    pool.add(new Bean(), ageOffset));
+    #  }
+    #
+    # The default MaxAgeOffset is -1 which causes the initial
+    # instances in the pool to live a bit longer before expiring.  As
+    # a concrete example, let's say the MinSize is 4 and the MaxAge is
+    # 100 years.  The generated offsets for the four instances created
+    # at startup would be 0, -25, -50, -75.  So the first instance
+    # would be "born" at age 0, die at 100, living 100 years.  The
+    # second instance would be born at -25, die at 100, living a total
+    # of 125 years.  The third would live 150 years.  The fourth 175
+    # years.
+    #
+    # A MaxAgeOffset of 1 would cause instances to be "born" older
+    # and therefore die sooner.  Using the same example MinSize of 4
+    # and MaxAge of 100 years, the life spans of these initial four
+    # instances would be 100, 75, 50, and 25 years respectively.
+    #
+    # A MaxAgeOffset of 0 will cause no "spreading" of the age of the
+    # first instances used to fill the pool to the minimum and these
+    # instances will of course reach their MaxAge at the same time.
+    # It is possible to set to decimal values such as -0.5, 0.5, -1.2,
+    # or 1.2.
+
+    MaxAgeOffset = -1
+
+    # Specifies the maximum time that an instance should be allowed to
+    # sit idly in the pool without use before it should be retired and
+    # removed.
+    #
+    # Usable time units: nanoseconds, microsecons, milliseconds,
+    # seconds, minutes, hours, days.  Or any combination such as
+    # "1 hour and 27 minutes and 10 seconds"
+
+    IdleTimeout = 0 minutes
+
+    # Allows Garbage Collection to be used as a mechanism for shrinking
+    # the pool.  When set to true all instances in the pool, excluding
+    # the minimum, are eligible for garbage collection by the virtual
+    # machine as per the rules of java.lang.ref.SoftReference and can be
+    # claimed by the JVM to free memory.  Instances garbage collected
+    # will have their @PreDestroy methods called during finalization.
+    #
+    # In the OpenJDK VM the -XX:SoftRefLRUPolicyMSPerMB flag can adjust
+    # how aggressively SoftReferences are collected.  The default
+    # OpenJDK setting is 1000, resulting in inactive pooled instances
+    # living one second of lifetime per free megabyte in the heap, which
+    # is very aggressive.  The setting should be increased to get the
+    # most out of the GarbageCollection feature of the pool.  Much
+    # higher settings are safe.  Even a setting as high as 3600000 (1
+    # hour per free MB in the heap) does not affect the ability for the
+    # VM to garbage collect SoftReferences in the event that memory is
+    # needed to avoid an OutOfMemoryException.
+
+    GarbageCollection = false
+
+    # The frequency in which the container will sweep the pool and
+    # evict expired instances.  Eviction is how the IdleTimeout,
+    # MaxAge, and pool "flush" functionality is enforced.  Higher
+    # intervals are better.
+    #
+    # Instances in use are excluded from sweeping.  Should an instance
+    # expire while in use it will be evicted immediately upon return
+    # to the pool.  Effectively MaxAge and flushes will be enforced as
+    # a part of normal activity or sweeping, while IdleTimeout is only
+    # enforcable via sweeping.  This makes aggressive sweeping less
+    # important for a pool under moderate load.
+    #
+    # Usable time units: nanoseconds, microsecons, milliseconds,
+    # seconds, minutes, hours, days.  Or any combination such as
+    # "1 hour and 27 minutes and 10 seconds"
+
+    SweepInterval = 5 minutes
+
+    # When sweeping the pool for expired instances a thread pool is
+    # used to process calling @PreDestroy on expired instances as well
+    # as creating new instances as might be required to fill the pool
+    # to the minimum after a Flush or MaxAge expiration.  The
+    # CallbackThreads setting dictates the size of the thread pool and
+    # is shared by all beans deployed in the container.
+
+    CallbackThreads = 5
+
+    # PostConstruct methods are invoked on all instances in the pool
+    # when the bean is undeployed and its pool is closed.  The
+    # CloseTimeout specifies the maximum time to wait for the pool to
+    # close and PostConstruct methods to be invoked.
+    #
+    # Usable time units: nanoseconds, microsecons, milliseconds,
+    # seconds, minutes, hours, days.  Or any combination such as
+    # "1 hour and 27 minutes and 10 seconds"
+
+    CloseTimeout = 5 minutes
+
+  </ServiceProvider>
+
+
+  <!--
+  # ==========================================================
+  # Default Singleton SessionBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default Singleton Container"
+          service="Container"
+          types="SINGLETON"
+          constructor="id, securityService"
+          class-name="org.apache.openejb.core.singleton.SingletonContainer">
+
+    AccessTimeout = 30 seconds
+
+  </ServiceProvider>
+
+
+  <!--
+  # ==========================================================
+  # Default Stateful SessionBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default Stateful Container"
+          service="Container"
+          types="STATEFUL"
+          factory-name="create"
+          class-name="org.apache.openejb.core.stateful.StatefulContainerFactory">
+
+    # Specifies the maximum time an invocation could wait for the
+    # stateful bean instance to become available before giving up.
+    #
+    # After the timeout is reached a javax.ejb.ConcurrentAccessTimeoutException
+    # will be thrown.
+    #
+    # Usable time units: nanoseconds, microsecons, milliseconds,
+    # seconds, minutes, hours, days.  Or any combination such as
+    # "1 hour and 27 minutes and 10 seconds"
+
+    AccessTimeout = 30 seconds
+
+    # The cache is responsible for managing stateful bean
+    # instances.  The cache can page instances to disk as memory
+    # is filled and can destroy abandoned instances.  A different
+    # cache implementation can be used by setting this property
+    # to the fully qualified class name of the Cache implementation.
+
+    Cache org.apache.openejb.core.stateful.SimpleCache
+
+    # The passivator is responsible for writing beans to disk
+    # at passivation time. Different passivators can be used
+    # by setting this property to the fully qualified class name
+    # of the PassivationStrategy implementation. The passivator
+    # is not responsible for invoking any callbacks or other
+    # processing, its only responsibly is to write the bean state
+    # to disk.
+    #
+    # Known implementations:
+    # org.apache.openejb.core.stateful.RAFPassivater
+    # org.apache.openejb.core.stateful.SimplePassivater
+
+    Passivator org.apache.openejb.core.stateful.SimplePassivater
+
+    # Specifies the time to wait between invocations. This
+    # value is measured in minutes. A value of 5 would
+    # result in a time-out of 5 minutes between invocations.
+
+    TimeOut 20
+
+    # Specifies the size of the bean pools for this
+    # stateful SessionBean container.
+
+    Capacity 1000
+
+    # Property name that specifies the number of instances
+    # to passivate at one time when doing bulk passivation.
+
+    BulkPassivate 100
+
+  </ServiceProvider>
+
+  <!--
+  # ==========================================================
+  # Default Managed SessionBean Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default Managed Container"
+          service="Container"
+          types="MANAGED"
+          constructor="id, securityService"
+          class-name="org.apache.openejb.core.managed.ManagedContainer">
+
+  </ServiceProvider>
+
+  <!--
+  # ==========================================================
+  # Default Message Driven Container
+  # ==========================================================
+  -->
+  <ServiceProvider
+          id="Default MDB Container"
+          service="Container"
+          types="MESSAGE"
+          constructor="id, securityService, ResourceAdapter, MessageListenerInterface, ActivationSpecClass, InstanceLimit"
+          class-name="org.apache.openejb.core.mdb.MdbContainer">
+
+    # The resource adapter delivers messages to the container
+
+    ResourceAdapter Default JMS Resource Adapter
+
+    # Specifies the message listener interface handled by this container
+
+    MessageListenerInterface javax.jms.MessageListener
+
+    # Specifies the activation spec class
+
+    ActivationSpecClass org.apache.activemq.ra.ActiveMQActivationSpec
+
+    # Specifies the maximum number of bean instances that are
+    # allowed to exist for each MDB deployment.
+
+    InstanceLimit 10
+
+  </ServiceProvider>
+
+  <!--
+  # ================================================
+  # Default Proxy Factory implementation for JDK 1.3
+  # ================================================
+  -->
+  <ServiceProvider
+          id="Default JDK 1.3 ProxyFactory"
+          service="ProxyFactory"
+          types="ProxyFactory"
+          class-name="org.apache.openejb.util.proxy.Jdk13ProxyFactory"/>
+
+  <!--
+  # ================================================
+  # Default Security Service implementation
+  # ================================================
+  -->
+  <ServiceProvider
+          id="Tomcat Security Service"
+          service="SecurityService"
+          types="SecurityService"
+          class-name="org.apache.openejb.tomcat.catalina.TomcatSecurityService"/>
+
+  <ServiceProvider
+          id="PseudoSecurityService"
+          service="SecurityService"
+          types="SecurityService"
+          class-name="org.apache.openejb.ri.sp.PseudoSecurityService"/>
+
+  <ServiceProvider
+          id="Default Security Service"
+          service="SecurityService"
+          types="SecurityService"
+          class-name="org.apache.openejb.core.security.SecurityServiceImpl"/>
+
+
+  <!--
+  # ================================================
+  # Default Transaction Manager implementation
+  # ================================================
+  -->
+    <ServiceProvider
+            id="Default Transaction Manager"
+            service="TransactionManager"
+            types="TransactionManager"
+            factory-name="create"
+            constructor="defaultTransactionTimeoutSeconds, TxRecovery, tmId, bufferClassName, bufferSizeKb, checksumEnabled, adler32Checksum, flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile, maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold"
+            class-name="org.apache.openejb.resource.GeronimoTransactionManagerFactory">
+           defaultTransactionTimeoutSeconds 600
+           TxRecovery false
+           bufferSizeKb 32
+           checksumEnabled true
+           adler32Checksum true
+           flushSleepTimeMilliseconds 50
+           logFileDir txlog
+           logFileExt log
+           logFileName howl
+           maxBlocksPerFile -1
+           maxBuffers 0
+           maxLogFiles 2
+           minBuffers 4
+           threadsWaitingForceThreshold -1
+    </ServiceProvider>
+
+  <!--
+  # ================================================
+  # Default JCA ManagedConnectionFactory for JDBC
+  # ================================================
+  -->
+  <ServiceProvider
+          id="Default JDBC Database"
+          service="Resource"
+          types="javax.sql.DataSource, DataSource"
+          factory-name="create"
+          constructor="JtaManaged"
+          class-name="org.apache.openejb.resource.jdbc.DataSourceFactory">
+
+    # Determines wether or not this data source should be JTA managed
+    # or user managed.  If set to 'true' it will automatically be enrolled
+    # in any ongoing transactions.  Calling begin/commit/rollback or setAutoCommit
+    # on the datasource or connection will not be allowed.  If you need to perform
+    # these functions yourself, set JtaManaged to 'false'
+    #
+    # In terms of JPA persistence.xml:
+    # "JtaManaged=true" can be used as a 'jta-data-source'
+    # "JtaManaged=false" can be used as a 'non-jta-data-source'
+
+    JtaManaged = true
+
+    # Driver class name
+
+    JdbcDriver org.hsqldb.jdbcDriver
+
+    # Url for creating connections
+
+    JdbcUrl jdbc:hsqldb:file:data/hsqldb/hsqldb
+
+    # Default user name
+
+    UserName sa
+
+    # Default password
+
+    Password
+
+    PasswordCipher  PlainText
+
+    # The connection properties that will be sent to the JDBC
+    # driver when establishing new connections
+    #
+    # Format of the string must be [propertyName=property;]*
+    #
+    # NOTE - The "user" and "password" properties will be passed
+    # explicitly, so they do not need to be included here.
+
+    ConnectionProperties
+
+    # The default auto-commit state of new connections
+
+    DefaultAutoCommit true
+
+    # The default read-only state of new connections
+    # If not set then the setReadOnly method will not be called.
+    # (Some drivers don't support read only mode, ex: Informix)
+
+    # DefaultReadOnly
+
+
+    # The default TransactionIsolation state of new connections
+    # If not set then the setTransactionIsolation method will not
+    # be called. The allowed values for this property are:
+    #     NONE
+    #     READ_COMMITTED
+    #     READ_UNCOMMITTED
+    #     REPEATABLE_READ
+    #     SERIALIZABLE
+    #
+    # Note: Most JDBC drivers do not support all isolation levels
+
+    # DefaultTransactionIsolation
+
+
+    # The initial number of connections that are created when the
+    # pool is started
+
+    InitialSize	0
+
+    # The maximum number of active connections that can be
+    # allocated from this pool at the same time, or a negative
+    # number for no limit.
+
+    MaxActive	20
+
+    # The maximum number of connections that can remain idle in
+    # the pool, without extra ones being released, or a negative
+    # number for no limit.
+
+    MaxIdle	20
+
+    # The minimum number of connections that can remain idle in
+    # the pool, without extra ones being created, or zero to
+    # create none.
+
+    MinIdle	0
+
+    # The maximum number of milliseconds that the pool will wait
+    # (when there are no available connections) for a connection
+    # to be returned before throwing an exception, or -1 to wait
+    # indefinitely.
+
+    MaxWait	-1
+
+    # The SQL query that will be used to validate connections from
+    # this pool before returning them to the caller. If specified,
+    # this query MUST be an SQL SELECT statement that returns at
+    # least one row.
+
+    # ValidationQuery
+
+    # If true connections will be validated before being returned
+    # from the pool. If the validation fails, the connection is
+    # destroyed, and a new conection will be retrieved from the
+    # pool (and validated).
+    #
+    # NOTE - for a true value to have any effect, the
+    # ValidationQuery parameter must be set.
+
+    TestOnBorrow	true
+
+    # If true connections will be validated before being returned
+    # to the pool.  If the validation fails, the connection is
+    # destroyed instead of being returned to the pool.
+    #
+    # NOTE - for a true value to have any effect, the
+    # ValidationQuery parameter must be set.
+
+    TestOnReturn	false
+
+    # If true connections will be validated by the idle connection
+    # evictor (if any). If the validation fails, the connection is
+    # destroyed and removed from the pool
+    #
+    # NOTE - for a true value to have any effect, the
+    # timeBetweenEvictionRunsMillis property must be a positive
+    # number and the ValidationQuery parameter must be set.
+
+    TestWhileIdle	false
+
+    # The number of milliseconds to sleep between runs of the idle
+    # connection evictor thread. When set to a negative number, no
+    # idle connection evictor thread will be run.
+
+    TimeBetweenEvictionRunsMillis	-1
+
+    # The number of connectionss to examine during each run of the
+    # idle connection evictor thread (if any).
+
+    NumTestsPerEvictionRun	3
+
+    # The minimum amount of time a connection may sit idle in the
+    # pool before it is eligable for eviction by the idle
+    # connection evictor (if any).
+
+    MinEvictableIdleTimeMillis	1800000
+
+    # If true, a statement pool is created for each Connection and
+    # PreparedStatements created by one of the following methods are
+    # pooled:
+    #    public PreparedStatement prepareStatement(String sql);
+    #    public PreparedStatement prepareStatement(String sql,
+    #            int resultSetType,
+    #            int resultSetConcurrency)
+
+    PoolPreparedStatements false
+
+    # The maximum number of open statements that can be allocated
+    # from the statement pool at the same time, or zero for no
+    # limit.
+    #
+    # NOTE - Some drivers have limits on the number of open
+    # statements, so make sure there are some resources left
+    # for the other (non-prepared) statements.
+
+    MaxOpenPreparedStatements 0
+
+    # If true the raw physical connection to the database can be
+    # accessed using the following construct:
+    #     Connection conn = ds.getConnection();
+    #     Connection rawConn = ((DelegatingConnection) conn).getInnermostDelegate();
+    #     ...
+    #     conn.close()
+    #
+    # Default is false, because misbehaving programs can do harmfull
+    # things to the raw connection shuch as closing the raw
+    # connection or continuing to use the raw connection after it
+    # has been assigned to another logical connection.  Be carefull
+    # and only use when you need direct access to driver specific
+    # extentions.
+    #
+    # NOTE: Do NOT close the underlying connection, only the
+    # original logical connection wrapper.
+
+    AccessToUnderlyingConnectionAllowed	false
+  </ServiceProvider>
+
+  <ServiceProvider
+          id="Default Unmanaged JDBC Database"
+          service="Resource"
+          types="javax.sql.DataSource, DataSource"
+          factory-name="create"
+          constructor="JtaManaged"
+          class-name="org.apache.openejb.resource.jdbc.DataSourceFactory">
+
+    JtaManaged = false
+
+    # Driver class name
+
+    #JdbcDriver org.apache.derby.jdbc.EmbeddedDriver
+    JdbcDriver org.hsqldb.jdbcDriver
+
+    # Url for creating connections
+
+    #JdbcUrl jdbc:derby:derbyDB;create=true
+    JdbcUrl jdbc:hsqldb:file:data/hsqldb/hsqldb
+
+    # Default user name
+
+    #UserName admin
+    UserName sa
+
+    # Default password
+
+    #Password pass
+    Password
+
+    PasswordCipher  PlainText
+
+    # The connection properties that will be sent to the JDBC
+    # driver when establishing new connections
+    #
+    # Format of the string must be [propertyName=property;]*
+    #
+    # NOTE - The "user" and "password" properties will be passed
+    # explicitly, so they do not need to be included here.
+
+    ConnectionProperties
+
+    # The default auto-commit state of new connections
+
+    DefaultAutoCommit true
+
+    # The default read-only state of new connections
+    # If not set then the setReadOnly method will not be called.
+    # (Some drivers don't support read only mode, ex: Informix)
+
+    # DefaultReadOnly
+
+
+    # The default TransactionIsolation state of new connections
+    # If not set then the setTransactionIsolation method will not
+    # be called. The allowed values for this property are:
+    #     NONE
+    #     READ_COMMITTED
+    #     READ_UNCOMMITTED
+    #     REPEATABLE_READ
+    #     SERIALIZABLE
+    #
+    # Note: Most JDBC drivers do not support all isolation levels
+
+    # DefaultTransactionIsolation
+
+
+    # The initial number of connections that are created when the
+    # pool is started
+
+    InitialSize	0
+
+    # The maximum number of active connections that can be
+    # allocated from this pool at the same time, or a negative
+    # number for no limit.
+
+    MaxActive	10
+
+    # The maximum number of connections that can remain idle in
+    # the pool, without extra ones being released, or a negative
+    # number for no limit.
+
+    MaxIdle	10
+
+    # The minimum number of connections that can remain idle in
+    # the pool, without extra ones being created, or zero to
+    # create none.
+
+    MinIdle	0
+
+    # The maximum number of milliseconds that the pool will wait
+    # (when there are no available connections) for a connection
+    # to be returned before throwing an exception, or -1 to wait
+    # indefinitely.
+
+    MaxWait	-1
+
+    # The SQL query that will be used to validate connections from
+    # this pool before returning them to the caller. If specified,
+    # this query MUST be an SQL SELECT statement that returns at
+    # least one row.
+
+    # ValidationQuery
+
+    # If true connections will be validated before being returned
+    # from the pool. If the validation fails, the connection is
+    # destroyed, and a new conection will be retrieved from the
+    # pool (and validated).
+    #
+    # NOTE - for a true value to have any effect, the
+    # ValidationQuery parameter must be set.
+
+    TestOnBorrow	true
+
+    # If true connections will be validated before being returned
+    # to the pool.  If the validation fails, the connection is
+    # destroyed instead of being returned to the pool.
+    #
+    # NOTE - for a true value to have any effect, the
+    # ValidationQuery parameter must be set.
+
+    TestOnReturn	false
+
+    # If true connections will be validated by the idle connection
+    # evictor (if any). If the validation fails, the connection is
+    # destroyed and removed from the pool
+    #
+    # NOTE - for a true value to have any effect, the
+    # timeBetweenEvictionRunsMillis property must be a positive
+    # number and the ValidationQuery parameter must be set.
+
+    TestWhileIdle	false
+
+    # The number of milliseconds to sleep between runs of the idle
+    # connection evictor thread. When set to a negative number, no
+    # idle connection evictor thread will be run.
+
+    TimeBetweenEvictionRunsMillis	-1
+
+    # The number of connectionss to examine during each run of the
+    # idle connection evictor thread (if any).
+
+    NumTestsPerEvictionRun	3
+
+    # The minimum amount of time a connection may sit idle in the
+    # pool before it is eligable for eviction by the idle
+    # connection evictor (if any).
+
+    MinEvictableIdleTimeMillis	1800000
+
+    # If true, a statement pool is created for each Connection and
+    # PreparedStatements created by one of the following methods are
+    # pooled:
+    #    public PreparedStatement prepareStatement(String sql);
+    #    public PreparedStatement prepareStatement(String sql,
+    #            int resultSetType,
+    #            int resultSetConcurrency)
+
+    PoolPreparedStatements false
+
+    # The maximum number of open statements that can be allocated
+    # from the statement pool at the same time, or zero for no
+    # limit.
+    #
+    # NOTE - Some drivers have limits on the number of open
+    # statements, so make sure there are some resources left
+    # for the other (non-prepared) statements.
+
+    MaxOpenPreparedStatements 0
+
+    # If true the raw physical connection to the database can be
+    # accessed using the following construct:
+    #     Connection conn = ds.getConnection();
+    #     Connection rawConn = ((DelegatingConnection) conn).getInnermostDelegate();
+    #     ...
+    #     conn.close()
+    #
+    # Default is false, because misbehaving programs can do harmfull
+    # things to the raw connection shuch as closing the raw
+    # connection or continuing to use the raw connection after it
+    # has been assigned to another logical connection.  Be carefull
+    # and only use when you need direct access to driver specific
+    # extentions.
+    #
+    # NOTE: Do NOT close the underlying connection, only the
+    # original logical connection wrapper.
+
+    AccessToUnderlyingConnectionAllowed	false
+  </ServiceProvider>
+
+  <!--
+  # ================================================
+  # Default JMS
+  # ================================================
+  -->
+  <ServiceProvider
+          id="Default JMS Resource Adapter"
+          service="Resource"
+          types="ActiveMQResourceAdapter"
+          class-name="org.apache.openejb.resource.activemq.ActiveMQResourceAdapter">
+
+    # Broker configuration
+    BrokerXmlConfig broker:(tcp://localhost:61616)?useJmx=false
+
+    # Broker address
+    ServerUrl vm://localhost?async=true
+
+    # DataSource for persistence messages
+    DataSource Default Unmanaged JDBC Database
+
+  </ServiceProvider>
+
+  <ServiceProvider
+          id="Default JMS Connection Factory"
+          service="Resource"
+          types="javax.jms.ConnectionFactory, javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory, QueueConnectionFactory, TopicConnectionFactory"
+          class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">
+
+    ResourceAdapter Default JMS Resource Adapter
+
+    # Specifies if the connection is enrolled in global transaction
+    # allowed values: xa, local or none
+    TransactionSupport xa
+
+    # Maximum number of physical connection to the ActiveMQ broker
+    PoolMaxSize 10
+
+    # Minimum number of physical connection to the ActiveMQ broker
+    PoolMinSize 0
+
+    # Maximum amount of time to wait for a connection
+    ConnectionMaxWaitMilliseconds 5000
+
+    # Maximum amount of time a connection can be idle before being reclaimed
+    ConnectionMaxIdleMinutes 15
+  </ServiceProvider>
+
+  <ServiceProvider
+          id="Default Queue"
+          service="Resource"
+          types="javax.jms.Queue, Queue"
+          constructor="destination"
+          class-name="org.apache.activemq.command.ActiveMQQueue">
+
+  </ServiceProvider>
+
+  <ServiceProvider
+          id="Default Topic"
+          service="Resource"
+          types="javax.jms.Topic, Topic"
+          constructor="destination"
+          class-name="org.apache.activemq.command.ActiveMQTopic">
+
+  </ServiceProvider>
+
+  <!--
+  # ================================================
+  # Default ORB
+  # ================================================
+  -->
+  <ServiceProvider
+          id="Default ORB"
+          service="Resource"
+          types="org.omg.CORBA.ORB, ORB"
+          factory-name="create"
+          class-name="org.apache.openejb.core.OrbFactory">
+
+  </ServiceProvider>
+
+  <!--
+  # ================================================
+  # Default ORB
+  # ================================================
+  -->
+  <ServiceProvider
+          id="Default Mail Session"
+          service="Resource"
+          types="javax.mail.Session"
+          factory-name="create"
+          class-name="org.apache.openejb.core.MailSessionFactory">
+
+  </ServiceProvider>
+
+
+</ServiceJar>

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.container.DeployableContainer
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.container.DeployableContainer?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.container.DeployableContainer (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.container.DeployableContainer Sat May 21 20:27:31 2011
@@ -0,0 +1 @@
+org.apache.openejb.arquillian.TomEEContainer
\ No newline at end of file

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.deployment.AuxiliaryArchiveAppender
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.deployment.AuxiliaryArchiveAppender?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.deployment.AuxiliaryArchiveAppender (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/META-INF/services/org.jboss.arquillian.spi.client.deployment.AuxiliaryArchiveAppender Sat May 21 20:27:31 2011
@@ -0,0 +1 @@
+org.apache.openejb.arquillian.TomEEArchiveAppender
\ No newline at end of file

Added: openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/catalina.policy
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/catalina.policy?rev=1125800&view=auto
==============================================================================
--- openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/catalina.policy (added)
+++ openejb/trunk/sandbox/arquillian-tomee/arquillian-tomee-container/src/main/resources/org/apache/openejb/tomee/configs/catalina.policy Sat May 21 20:27:31 2011
@@ -0,0 +1,241 @@
+// 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.
+
+// ============================================================================
+// catalina.policy - Security Policy Permissions for Tomcat 7
+//
+// This file contains a default set of security policies to be enforced (by the
+// JVM) when Catalina is executed with the "-security" option.  In addition
+// to the permissions granted here, the following additional permissions are
+// granted specific to each web application:
+//
+// * Read access to its document root directory
+// * Read, write and delete access to its working directory
+//
+// $Id: catalina.policy 1079755 2011-03-09 11:38:38Z markt $
+// ============================================================================
+
+
+// ========== SYSTEM CODE PERMISSIONS =========================================
+
+
+// These permissions apply to javac
+grant codeBase "file:${java.home}/lib/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions
+grant codeBase "file:${java.home}/jre/lib/ext/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to javac when ${java.home] points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/../lib/-" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to all shared system extensions when
+// ${java.home} points at $JAVA_HOME/jre
+grant codeBase "file:${java.home}/lib/ext/-" {
+        permission java.security.AllPermission;
+};
+
+
+// ========== CATALINA CODE PERMISSIONS =======================================
+
+
+// These permissions apply to the daemon code
+grant codeBase "file:${catalina.home}/bin/commons-daemon.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the logging API
+// Note: If tomcat-juli.jar is in ${catalina.base} and not in ${catalina.home},
+// update this section accordingly.
+//  grant codeBase "file:${catalina.base}/bin/tomcat-juli.jar" {..}
+grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" {
+        permission java.io.FilePermission
+         "${java.home}${file.separator}lib${file.separator}logging.properties", "read"; 
+
+        permission java.io.FilePermission
+         "${catalina.base}${file.separator}conf${file.separator}logging.properties", "read";
+        permission java.io.FilePermission
+         "${catalina.base}${file.separator}logs", "read, write";
+        permission java.io.FilePermission
+         "${catalina.base}${file.separator}logs${file.separator}*", "read, write";
+
+        permission java.lang.RuntimePermission "shutdownHooks";
+        permission java.lang.RuntimePermission "getClassLoader";
+        permission java.lang.RuntimePermission "setContextClassLoader";
+
+        permission java.util.logging.LoggingPermission "control";
+
+        permission java.util.PropertyPermission "java.util.logging.config.class", "read";
+        permission java.util.PropertyPermission "java.util.logging.config.file", "read";
+        permission java.util.PropertyPermission "catalina.base", "read";
+
+        // Note: To enable per context logging configuration, permit read access to
+        // the appropriate file. Be sure that the logging configuration is
+        // secure before enabling such access.
+        // E.g. for the examples web application:
+        // permission java.io.FilePermission "${catalina.base}${file.separator}
+        //  webapps${file.separator}examples${file.separator}WEB-INF
+        //  ${file.separator}classes${file.separator}logging.properties", "read";
+};
+
+// These permissions apply to the server startup code
+grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
+        permission java.security.AllPermission;
+};
+
+// These permissions apply to the servlet API classes
+// and those that are shared across all class loaders
+// located in the "lib" directory
+grant codeBase "file:${catalina.home}/lib/-" {
+        permission java.security.AllPermission;
+};
+
+
+// If using a per instance lib directory, i.e. ${catalina.base}/lib,
+// then the following permission will need to be uncommented
+// grant codeBase "file:${catalina.base}/lib/-" {
+//         permission java.security.AllPermission;
+// };
+
+
+// ========== WEB APPLICATION PERMISSIONS =====================================
+
+
+// These permissions are granted by default to all web applications
+// In addition, a web application will be given a read FilePermission
+// and JndiPermission for all files and directories in its document root.
+grant {
+    // Required for JNDI lookup of named JDBC DataSource's and
+    // javamail named MimePart DataSource used to send mail
+    permission java.util.PropertyPermission "java.home", "read";
+    permission java.util.PropertyPermission "java.naming.*", "read";
+    permission java.util.PropertyPermission "javax.sql.*", "read";
+
+    // OS Specific properties to allow read access
+    permission java.util.PropertyPermission "os.name", "read";
+    permission java.util.PropertyPermission "os.version", "read";
+    permission java.util.PropertyPermission "os.arch", "read";
+    permission java.util.PropertyPermission "file.separator", "read";
+    permission java.util.PropertyPermission "path.separator", "read";
+    permission java.util.PropertyPermission "line.separator", "read";
+
+    // JVM properties to allow read access
+    permission java.util.PropertyPermission "java.version", "read";
+    permission java.util.PropertyPermission "java.vendor", "read";
+    permission java.util.PropertyPermission "java.vendor.url", "read";
+    permission java.util.PropertyPermission "java.class.version", "read";
+    permission java.util.PropertyPermission "java.specification.version", "read";
+    permission java.util.PropertyPermission "java.specification.vendor", "read";
+    permission java.util.PropertyPermission "java.specification.name", "read";
+
+    permission java.util.PropertyPermission "java.vm.specification.version", "read";
+    permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
+    permission java.util.PropertyPermission "java.vm.specification.name", "read";
+    permission java.util.PropertyPermission "java.vm.version", "read";
+    permission java.util.PropertyPermission "java.vm.vendor", "read";
+    permission java.util.PropertyPermission "java.vm.name", "read";
+
+    // Required for OpenJMX
+    permission java.lang.RuntimePermission "getAttribute";
+
+    // Allow read of JAXP compliant XML parser debug
+    permission java.util.PropertyPermission "jaxp.debug", "read";
+
+    // All JSPs need to be able to read this package
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat";
+
+    // Precompiled JSPs need access to these packages.
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.el";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.jasper.runtime";
+    permission java.lang.RuntimePermission
+     "accessClassInPackage.org.apache.jasper.runtime.*";
+
+    // Precompiled JSPs need access to these system properties.
+    permission java.util.PropertyPermission
+     "org.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER", "read";
+    permission java.util.PropertyPermission
+     "org.apache.el.parser.COERCE_TO_ZERO", "read";
+
+    // The cookie code needs these.
+    permission java.util.PropertyPermission
+     "org.apache.catalina.STRICT_SERVLET_COMPLIANCE", "read";
+    permission java.util.PropertyPermission
+     "org.apache.tomcat.util.http.ServerCookie.STRICT_NAMING", "read";
+    permission java.util.PropertyPermission
+     "org.apache.tomcat.util.http.ServerCookie.FWD_SLASH_IS_SEPARATOR", "read";
+
+    // Applications using Comet need to be able to access this package
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.comet";
+};
+
+
+// The Manager application needs access to the following packages to support the
+// session display functionality. These settings support the following
+// configurations:
+// - default CATALINA_HOME == CATALINA_BASE
+// - CATALINA_HOME != CATALINA_BASE, per instance Manager in CATALINA_BASE
+// - CATALINA_HOME != CATALINA_BASE, shared Manager in CATALINA_HOME
+grant codeBase "file:${catalina.base}/webapps/manager/-" {
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
+};
+grant codeBase "file:${catalina.home}/webapps/manager/-" {
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.ha.session";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.manager.util";
+    permission java.lang.RuntimePermission "accessClassInPackage.org.apache.catalina.util";
+};
+
+// You can assign additional permissions to particular web applications by
+// adding additional "grant" entries here, based on the code base for that
+// application, /WEB-INF/classes/, or /WEB-INF/lib/ jar files.
+//
+// Different permissions can be granted to JSP pages, classes loaded from
+// the /WEB-INF/classes/ directory, all jar files in the /WEB-INF/lib/
+// directory, or even to individual jar files in the /WEB-INF/lib/ directory.
+//
+// For instance, assume that the standard "examples" application
+// included a JDBC driver that needed to establish a network connection to the
+// corresponding database and used the scrape taglib to get the weather from
+// the NOAA web server.  You might create a "grant" entries like this:
+//
+// The permissions granted to the context root directory apply to JSP pages.
+// grant codeBase "file:${catalina.base}/webapps/examples/-" {
+//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+//
+// The permissions granted to the context WEB-INF/classes directory
+// grant codeBase "file:${catalina.base}/webapps/examples/WEB-INF/classes/-" {
+// };
+//
+// The permission granted to your JDBC driver
+// grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/driver.jar!/-" {
+//      permission java.net.SocketPermission "dbhost.mycompany.com:5432", "connect";
+// };
+// The permission granted to the scrape taglib
+// grant codeBase "jar:file:${catalina.base}/webapps/examples/WEB-INF/lib/scrape.jar!/-" {
+//      permission java.net.SocketPermission "*.noaa.gov:80", "connect";
+// };
+