[jboss-cvs] JBossAS SVN: r70419 - in projects/security/security-negotiation/trunk: SimpleWebApplication and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 5 07:52:41 EST 2008


Author: darran.lofthouse at jboss.com
Date: 2008-03-05 07:52:41 -0500 (Wed, 05 Mar 2008)
New Revision: 70419

Added:
   projects/security/security-negotiation/trunk/SimpleWebApplication/
   projects/security/security-negotiation/trunk/SimpleWebApplication/.classpath
   projects/security/security-negotiation/trunk/SimpleWebApplication/.project
   projects/security/security-negotiation/trunk/SimpleWebApplication/build.xml
   projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/
   projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/application.xml
   projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/context.xml
   projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/ejb-jar.xml
   projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-app.xml
   projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-web.xml
   projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/web.xml
   projects/security/security-negotiation/trunk/SimpleWebApplication/pages/
   projects/security/security-negotiation/trunk/SimpleWebApplication/pages/index.html
   projects/security/security-negotiation/trunk/SimpleWebApplication/pages/lookup.jsp
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/CalculatorServlet.java
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorBean.java
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorHome.java
   projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorRemote.java
Log:
A simple web/ejb application for testing the SPNEGO authentication.

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/.classpath
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/.classpath	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/.classpath	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="/home/darranl/src/links/JBoss_Current/client/servlet-api.jar"/>
+	<classpathentry kind="lib" path="/home/darranl/src/links/JBoss_Current/client/jbossall-client.jar"/>
+	<classpathentry kind="lib" path="/home/darranl/src/links/JBoss_Current/client/log4j.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/.project
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/.project	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/.project	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>SimpleWebApplication</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/build.xml
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/build.xml	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/build.xml	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,83 @@
+<project name="Calculator" default="deploy" basedir=".">
+
+  <property file="${basedir}/../local.properties" />
+
+  <property name="src.dir" location="${basedir}/src" />
+  <property name="descriptors.dir" location="${basedir}/descriptors" />
+  <property name="lib.dir" location="${basedir}/lib" />
+  <property name="pages.dir" location="${basedir}/pages" />
+
+  <property name="build.dir" location="${basedir}/build" />
+  <property name="build.classes.dir" location="${build.dir}/classes" />
+  <property name="build.deliverables.dir" location="${build.dir}/deliverables" />
+  <property name="build.descriptors.dir" location="${build.dir}/descriptors" />
+
+  <property name="jboss.home" location="/home/darranl/src/links/JBoss_Current" />
+  <property name="jboss.server.dir" location="${jboss.home}/server/default" />
+
+  <path id="project.classpath">
+    <fileset dir="${jboss.home}">
+      <include name="client/jbossall-client.jar" />
+      <include name="client/log4j.jar" />
+      <include name="client/servlet-api.jar" />
+      <include name="server/all/lib/jboss-cache.jar" />
+    </fileset>
+  </path>
+
+  <target name="prepare">
+    <mkdir dir="${build.dir}" />
+    <mkdir dir="${build.classes.dir}" />
+    <mkdir dir="${build.deliverables.dir}" />
+    <mkdir dir="${build.descriptors.dir}" />
+  </target>
+
+  <target name="compile" depends="prepare">
+    <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on" deprecation="on" optimize="off">
+      <classpath refid="project.classpath" />
+    </javac>
+  </target>
+
+  <target name="package" depends="compile">
+
+    <jar destfile="${build.deliverables.dir}/${ant.project.name}.jar">
+      <metainf dir="${descriptors.dir}">
+        <include name="ejb-jar.xml" />
+      </metainf>
+      <fileset dir="${build.classes.dir}">
+        <include name="**/ejb/*" />
+      </fileset>
+    </jar>
+
+    <war destfile="${build.deliverables.dir}/${ant.project.name}.war" webxml="${descriptors.dir}/web.xml">
+      <webinf dir="${descriptors.dir}">
+        <include name="jboss-web.xml" />
+        <!--include name="context.xml" /-->
+      </webinf>
+      <!--lib dir="${build.deliverables.dir}">
+        <include name="${ant.project.name}.jar" />
+      </lib-->
+      <classes dir="${build.classes.dir}">
+        <include name="**/*.class" />
+        <exclude name="**/ejb/*" />
+      </classes>
+      <fileset dir="${pages.dir}">
+        <include name="**" />
+      </fileset>
+    </war>
+
+    <ear destfile="${build.deliverables.dir}/${ant.project.name}.ear" appxml="${descriptors.dir}/application.xml">
+      <metainf dir="${descriptors.dir}">
+        <include name="jboss-app.xml" />
+      </metainf>
+      <fileset dir="${build.deliverables.dir}">
+        <include name="${ant.project.name}.jar" />
+        <include name="${ant.project.name}.war" />
+      </fileset>
+    </ear>
+
+  </target>
+
+  <target name="deploy" depends="package">
+    <copy file="${build.deliverables.dir}/${ant.project.name}.ear" todir="${jboss.server.dir}/deploy" />
+  </target>
+</project>
\ No newline at end of file


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/build.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/application.xml
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/application.xml	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/application.xml	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application xmlns="http://java.sun.com/xml/ns/j2ee"
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+		http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
+	      version="1.4">
+
+  <module>
+    <ejb>Calculator.jar</ejb>
+  </module>
+  
+  <module>
+    <web>
+      <web-uri>Calculator.war</web-uri>
+      <context-root>/Calculator</context-root>
+    </web>
+  </module>
+  
+</application>
\ No newline at end of file


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/application.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/context.xml
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/context.xml	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/context.xml	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,9 @@
+
+<Context>
+
+   <Valve className="com.darranl.tomcat.gss.SimpleValve"/>
+   
+   <!-- Valve	className="com.darranl.tomcat.gss.SPNEGOValve">
+   </Valve-->
+
+</Context>
\ No newline at end of file


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/context.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/ejb-jar.xml
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/ejb-jar.xml	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/ejb-jar.xml	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,28 @@
+<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+		  http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
+	version="2.1">
+	<enterprise-beans>
+	
+	  <session>
+	    <ejb-name>CalculatorBean</ejb-name>	    
+	    <remote>org.jboss.support.simpleapp.ejb.CalculatorRemote</remote>
+	    <home>org.jboss.support.simpleapp.ejb.CalculatorHome</home>
+	    <ejb-class>org.jboss.support.simpleapp.ejb.CalculatorBean</ejb-class>
+	    <session-type>Stateless</session-type>
+	    <transaction-type>Container</transaction-type>	    	    
+	  </session>
+	
+	</enterprise-beans>
+	
+	<assembly-descriptor>
+	  <method-permission>
+	    <unchecked/>
+	    <method>
+	      <ejb-name>CalculatorBean</ejb-name>
+	      <method-name>*</method-name>
+	    </method>
+	  </method-permission>
+	</assembly-descriptor>
+</ejb-jar>
\ No newline at end of file


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/ejb-jar.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-app.xml
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-app.xml	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-app.xml	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,11 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+
+<!DOCTYPE jboss-app
+    PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
+    
+<jboss-app>
+
+  <security-domain>java:/jaas/SPNEGO</security-domain>
+  
+</jboss-app>
\ No newline at end of file


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-app.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-web.xml
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-web.xml	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-web.xml	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,7 @@
+<!DOCTYPE jboss-web PUBLIC
+  "-//JBoss//DTD Web Application 2.4//EN"
+  "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
+
+<jboss-web>
+
+</jboss-web>


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/jboss-web.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/web.xml
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/web.xml	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/web.xml	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,40 @@
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+	version="2.4">
+
+	<servlet>
+		<servlet-name>Calculator</servlet-name>
+		<servlet-class>
+			org.jboss.support.simpleapp.CalculatorServlet
+		</servlet-class>
+	</servlet>
+
+	<servlet-mapping>
+		<servlet-name>Calculator</servlet-name>
+		<url-pattern>/Calculator</url-pattern>
+	</servlet-mapping>
+
+    <security-constraint>
+      <web-resource-collection>
+        <web-resource-name>Restricted</web-resource-name>
+        <url-pattern>/Calculator/*</url-pattern>
+      </web-resource-collection>
+      <auth-constraint>
+        <role-name>Mathematician</role-name>
+      </auth-constraint>
+      <user-data-constraint>
+        <transport-guarantee>NONE</transport-guarantee>
+      </user-data-constraint>
+    </security-constraint>
+    
+   <login-config>
+    <auth-method>SPNEGO</auth-method>
+    <realm-name>SPNEGO</realm-name>    
+   </login-config>
+          
+    <security-role>
+      <role-name>Mathematician</role-name>
+    </security-role>
+
+</web-app>
\ No newline at end of file


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/descriptors/web.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/pages/index.html
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/pages/index.html	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/pages/index.html	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,9 @@
+<html>
+  <head>
+    <title>Calculator Application</title>
+  </head>
+  <body>
+    <h1>Welcome</h1>
+    <a href="Calculator">Use Calculator</a>    
+  </body>
+</html>
\ No newline at end of file

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/pages/lookup.jsp
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/pages/lookup.jsp	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/pages/lookup.jsp	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,17 @@
+<html>
+  <head></head>
+  <body>
+    <%
+      String name = request.getParameter("name");
+      try {
+      javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
+      java.lang.Object o =
+      initialContext.lookup(name);
+      out.print(o);
+      }
+      catch (Exception e) {
+      e.printStackTrace(System.out);
+      }
+    %>
+  </body>
+</html>
\ No newline at end of file

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/CalculatorServlet.java
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/CalculatorServlet.java	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/CalculatorServlet.java	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,130 @@
+package org.jboss.support.simpleapp;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.security.Principal;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jboss.support.simpleapp.ejb.CalculatorHome;
+import org.jboss.support.simpleapp.ejb.CalculatorRemote;
+
+public class CalculatorServlet extends HttpServlet
+{
+
+   /**
+    * 
+    */
+   private static final long serialVersionUID = -2859406369812457187L;
+
+   private static final Logger log = Logger.getLogger(CalculatorServlet.class);
+
+   @Override
+   protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException,
+         IOException
+   {
+      String a = request.getParameter("a");
+      String b = request.getParameter("b");
+
+      String remoteUser = request.getRemoteUser();
+      log.info("Remote User - '" + remoteUser + "'");
+      Principal userPrincipal = request.getUserPrincipal();
+      log.info("User Principal - '" + userPrincipal + "' " + userPrincipal.getClass().getName());
+
+      log.info("a='" + a + "'");
+      log.info("b='" + b + "'");
+
+      PrintWriter writer = response.getWriter();
+
+      if (a == null || b == null)
+      {
+         displayForm(writer);
+      }
+      else
+      {
+         try
+         {
+            displayResult(writer, a, b);
+         }
+         catch (Exception e)
+         {
+            throw new ServletException("Unable to calculate result", e);
+         }
+      }
+
+   }
+
+   private void displayForm(final PrintWriter writer)
+   {
+
+      writer.println("<html>");
+      writer.println("  <head>");
+      writer.println("    <title>Calculator</title>");
+      writer.println("  </head>");
+      writer.println("  <body>");
+      writer.println("    <h1>Calculator</h1>");
+      writer.println("    <p>Please enter two numbers you would like to add together.</p>");
+      writer.println("    <p>");
+      writer.println("      <form method='get'>");
+      writer.println("        A <input type='text' name='a' value='0'><br>");
+      writer.println("        B <input type='text' name='b' value='0'><br>");
+      writer.println("        <br><input type='submit' value='Add'>");
+      writer.println("      </form>");
+      writer.println("    </p>");
+      writer.println("  </body>");
+      writer.println("</html>");
+      writer.flush();
+   }
+
+   private void displayResult(final PrintWriter writer, final String a, final String b) throws Exception
+   {
+      Context ctx = new InitialContext();
+      Object homeObj = ctx.lookup("CalculatorBean");
+
+      log.info("CH " + CalculatorHome.class.getName());
+      log.info("CH " + CalculatorHome.class.getClassLoader());
+
+      for (Class clazz : homeObj.getClass().getInterfaces())
+      {
+         log.info(clazz.getName());
+         log.info(clazz.getClassLoader());
+      }
+      //CalculatorHome home = (CalculatorHome) PortableRemoteObject.narrow(homeObj, CalculatorHome.class);
+      CalculatorHome home = (CalculatorHome) homeObj;
+
+      int result = -1;
+      CalculatorRemote remote = null;
+      try
+      {
+         remote = home.create();
+         int aint = Integer.valueOf(a).intValue();
+         int bint = Integer.valueOf(b).intValue();
+
+         result = remote.add(aint, bint);
+
+      }
+      finally
+      {
+         if (remote != null)
+            remote.remove();
+      }
+
+      writer.println("<html>");
+      writer.println("  <head>");
+      writer.println("    <title>Calculator</title>");
+      writer.println("  </head>");
+      writer.println("  <body>");
+      writer.println("    <h1>Calculator</h1>");
+      writer.println("    <p>" + a + " + " + b + " = " + result + "</p>");
+      writer.println("  </body>");
+      writer.println("</html>");
+      writer.flush();
+   }
+
+}


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/CalculatorServlet.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorBean.java
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorBean.java	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorBean.java	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.support.simpleapp.ejb;
+
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The Calculator EJB implementation.
+ * 
+ * @author darran.lofthouse at jboss.com
+ * @version $Revision$
+ */
+public class CalculatorBean implements SessionBean
+{
+
+   private static final long serialVersionUID = -4924100303363049831L;
+
+   private static final Logger log = Logger.getLogger(CalculatorBean.class);
+
+   private SessionContext sessionContext;
+
+   public void ejbCreate()
+   {
+   }
+
+   public int add(final int a, final int b)
+   {      
+      log.info("Caller Principal " + sessionContext.getCallerPrincipal());
+
+      return a + b;
+   }
+
+   public void ejbActivate()
+   {
+   }
+
+   public void ejbPassivate()
+   {
+   }
+
+   public void ejbRemove()
+   {
+   }
+
+   public void setSessionContext(final SessionContext sessionContext)
+   {
+      this.sessionContext = sessionContext;
+   }
+
+}


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorHome.java
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorHome.java	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorHome.java	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.support.simpleapp.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * The home interface to the Calculator EJB.
+ * 
+ * @author darran.lofthouse at jboss.com
+ * @version $Revision$
+ */
+public interface CalculatorHome extends EJBHome
+{
+
+   public CalculatorRemote create() throws CreateException, RemoteException;
+
+}


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorHome.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorRemote.java
===================================================================
--- projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorRemote.java	                        (rev 0)
+++ projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorRemote.java	2008-03-05 12:52:41 UTC (rev 70419)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.support.simpleapp.ejb;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * Remote interface to the secured Calculator EJB
+ * 
+ * @author darran.lofthouse at jboss.com
+ * @version $Revision$
+ */
+public interface CalculatorRemote extends EJBObject
+{
+
+   /**
+    * Add a and b together and return the result.
+    * 
+    * @param a
+    * @param b
+    * @return
+    * @throws RemoteException
+    */
+   public int add(final int a, final int b) throws RemoteException;
+   
+}


Property changes on: projects/security/security-negotiation/trunk/SimpleWebApplication/src/main/org/jboss/support/simpleapp/ejb/CalculatorRemote.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-cvs-commits mailing list