Author: rmannibucau
Date: Mon May 14 22:22:05 2012
New Revision: 1338458

URL: http://svn.apache.org/viewvc?rev=1338458&view=rev
Log:
TOMEE-191 adding a sample using a tomee.xml datasource for tomcat 
datasourcerealm

Added:
    openejb/trunk/openejb/examples/realm-in-tomee/
    openejb/trunk/openejb/examples/realm-in-tomee/pom.xml
    openejb/trunk/openejb/examples/realm-in-tomee/src/
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/server.xml
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/tomee.xml
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/lib/
    
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/lib/import-myDataSource.sql
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/WEB-INF/
    
openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/WEB-INF/web.xml
    openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/index.jsp
Modified:
    openejb/trunk/openejb/examples/pom.xml

Modified: openejb/trunk/openejb/examples/pom.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/pom.xml?rev=1338458&r1=1338457&r2=1338458&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/pom.xml (original)
+++ openejb/trunk/openejb/examples/pom.xml Mon May 14 22:22:05 2012
@@ -108,6 +108,7 @@
     <module>webservice-handlerchain</module>
     <module>webservice-holder</module>
     <module>multiple-tomee-arquillian</module>
+    <module>realm-in-tomee</module>
   </modules>
   <profiles>
     <profile>

Added: openejb/trunk/openejb/examples/realm-in-tomee/pom.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/realm-in-tomee/pom.xml?rev=1338458&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/realm-in-tomee/pom.xml (added)
+++ openejb/trunk/openejb/examples/realm-in-tomee/pom.xml Mon May 14 22:22:05 
2012
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.superbiz</groupId>
+  <artifactId>realm-in-tomee</artifactId>
+  <packaging>war</packaging>
+  <version>1.1-SNAPSHOT</version>
+  <name>OpenEJB :: Examples :: DataSource Realm</name>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <build>
+    <defaultGoal>install</defaultGoal>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.4</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <version>2.2</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.openejb.maven</groupId>
+        <artifactId>tomee-maven-plugin</artifactId>
+        <version>1.0-alpha-1</version>
+      </plugin>
+    </plugins>
+  </build>
+  <repositories>
+    <repository>
+      <id>apache-m2-snapshot</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://repository.apache.org/snapshots</url>
+    </repository>
+  </repositories>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.openejb</groupId>
+      <artifactId>javaee-api</artifactId>
+      <version>6.0-3</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <!--
+  This section allows you to configure where to publish libraries for sharing.
+  It is not required and may be deleted.  For more information see:
+  http://maven.apache.org/plugins/maven-deploy-plugin/
+  -->
+  <distributionManagement>
+    <repository>
+      <id>localhost</id>
+      <url>file://${basedir}/target/repo/</url>
+    </repository>
+    <snapshotRepository>
+      <id>localhost</id>
+      <url>file://${basedir}/target/snapshot-repo/</url>
+    </snapshotRepository>
+  </distributionManagement>
+</project>
\ No newline at end of file

Added: 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/server.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/server.xml?rev=1338458&view=auto
==============================================================================
--- 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/server.xml 
(added)
+++ 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/server.xml 
Mon May 14 22:22:05 2012
@@ -0,0 +1,46 @@
+<?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.
+-->
+<Server port="8005" shutdown="SHUTDOWN">
+  <Listener className="org.apache.tomee.catalina.ServerListener" />
+  <Listener className="org.apache.catalina.core.AprLifecycleListener" 
SSLEngine="on" />
+  <Listener className="org.apache.catalina.core.JasperListener" />
+  <Listener 
className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+  <Listener 
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+  <Service name="Catalina">
+    <Connector port="8080" protocol="HTTP/1.1"
+               connectionTimeout="20000" />
+
+    <Engine name="Catalina" defaultHost="localhost">
+      <Realm className="org.apache.catalina.realm.LockOutRealm">
+        <Realm
+            className="org.apache.catalina.realm.DataSourceRealm"
+            dataSourceName="myDataSource"
+            userTable="users"
+            userNameCol="user_name"
+            userCredCol="user_pass"
+            userRoleTable="user_roles"
+            roleNameCol="role_name"/>
+      </Realm>
+
+      <Host name="localhost"  appBase="webapps"
+            unpackWARs="true" autoDeploy="true" />
+    </Engine>
+  </Service>
+</Server>

Added: 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/tomee.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/tomee.xml?rev=1338458&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/tomee.xml 
(added)
+++ openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/conf/tomee.xml 
Mon May 14 22:22:05 2012
@@ -0,0 +1,3 @@
+<tomee>
+  <Resource id="myDataSource" type="DataSource" /> <!-- configure it -->
+</tomee>
\ No newline at end of file

Added: 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/lib/import-myDataSource.sql
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/lib/import-myDataSource.sql?rev=1338458&view=auto
==============================================================================
--- 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/lib/import-myDataSource.sql
 (added)
+++ 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/tomee/lib/import-myDataSource.sql
 Mon May 14 22:22:05 2012
@@ -0,0 +1,4 @@
+create table users (user_name varchar(15) not null primary key, user_pass 
varchar(15) not null);
+create table user_roles (user_name varchar(15) not null, role_name varchar(15) 
not null, primary key (user_name, role_name));
+insert into users(user_name, user_pass) values('tomee', 'tomee');
+insert into user_roles(user_name, role_name) values('tomee', 'admin');

Added: 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/WEB-INF/web.xml?rev=1338458&view=auto
==============================================================================
--- 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/WEB-INF/web.xml 
(added)
+++ 
openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/WEB-INF/web.xml 
Mon May 14 22:22:05 2012
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd";
+         version="3.0">
+  <security-constraint>
+    <display-name>Realm In TomEE</display-name>
+    <web-resource-collection>
+      <web-resource-name>Secured</web-resource-name>
+      <url-pattern>/index.jsp</url-pattern>
+    </web-resource-collection>
+    <auth-constraint>
+      <role-name>admin</role-name>
+    </auth-constraint>
+  </security-constraint>
+  <login-config>
+    <auth-method>BASIC</auth-method>
+    <realm-name>Admin space</realm-name>
+  </login-config>
+  <security-role>
+    <description>Admin</description>
+    <role-name>admin</role-name>
+  </security-role>
+</web-app>

Added: openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/index.jsp
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/index.jsp?rev=1338458&view=auto
==============================================================================
--- openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/index.jsp 
(added)
+++ openejb/trunk/openejb/examples/realm-in-tomee/src/main/webapp/index.jsp Mon 
May 14 22:22:05 2012
@@ -0,0 +1,8 @@
+<html>
+    <head>
+        <title>Realm In TomEE</title>
+    </head>
+    <body>
+        <h1>Home</h1>
+    </body>
+</html>


Reply via email to