[jboss-cvs] JBossAS SVN: r59389 - in trunk: . embedded embedded/src embedded/src/main embedded/src/main/java embedded/src/main/java/org embedded/src/main/java/org/jboss embedded/src/main/java/org/jboss/embedded embedded/src/main/resources embedded/src/main/resources/javase embedded/src/main/resources/javase/conf embedded/src/main/resources/javase/deploy embedded/src/main/resources/javase/deployers embedded/src/main/resources/stylesheets embedded/src/test embedded/src/test/java embedded/src/test/java/org embedded/src/test/java/org/jboss embedded/src/test/java/org/jboss/embedded embedded/src/test/java/org/jboss/embedded/test embedded/src/test/java/org/jboss/embedded/test/bootstrap embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit embedded/src/test/java/org/jboss/embedded/test/ejb embedded/src/test/java/org/jboss/embedded/test/ejb/unit embedded/src/test/resources embedded/src/test/resources/ejb embedded/src/test/resources/ejb/META-INF
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 5 17:14:24 EST 2007
Author: bill.burke at jboss.com
Date: 2007-01-05 17:14:20 -0500 (Fri, 05 Jan 2007)
New Revision: 59389
Added:
trunk/embedded/
trunk/embedded/build-test.xml
trunk/embedded/build.bat
trunk/embedded/build.sh
trunk/embedded/build.xml
trunk/embedded/src/
trunk/embedded/src/main/
trunk/embedded/src/main/java/
trunk/embedded/src/main/java/org/
trunk/embedded/src/main/java/org/jboss/
trunk/embedded/src/main/java/org/jboss/embedded/
trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java
trunk/embedded/src/main/java/org/jboss/embedded/ClassLoaderDeployer.java
trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java
trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java
trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java
trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java
trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java
trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java
trunk/embedded/src/main/java/org/jboss/embedded/Test.java
trunk/embedded/src/main/resources/
trunk/embedded/src/main/resources/javase/
trunk/embedded/src/main/resources/javase/conf/
trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml
trunk/embedded/src/main/resources/javase/conf/jboss-service.xml
trunk/embedded/src/main/resources/javase/conf/login-config.xml
trunk/embedded/src/main/resources/javase/deploy/
trunk/embedded/src/main/resources/javase/deploy/ejb3-interceptors-aop.xml
trunk/embedded/src/main/resources/javase/deploy/hsqldb-ds.xml
trunk/embedded/src/main/resources/javase/deployers/
trunk/embedded/src/main/resources/javase/deployers/aspect-deployer-beans.xml
trunk/embedded/src/main/resources/javase/deployers/ejb3-deployers-beans.xml
trunk/embedded/src/main/resources/javase/deployers/jca-deployers-beans.xml
trunk/embedded/src/main/resources/javase/jndi.properties
trunk/embedded/src/main/resources/javase/log4j.xml
trunk/embedded/src/main/resources/stylesheets/
trunk/embedded/src/main/resources/stylesheets/NoJRMPConnectionFactoryTemplate.xsl
trunk/embedded/src/test/
trunk/embedded/src/test/java/
trunk/embedded/src/test/java/org/
trunk/embedded/src/test/java/org/jboss/
trunk/embedded/src/test/java/org/jboss/embedded/
trunk/embedded/src/test/java/org/jboss/embedded/test/
trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/
trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/
trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java
trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/
trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/Customer.java
trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAO.java
trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAOBean.java
trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/
trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java
trunk/embedded/src/test/resources/
trunk/embedded/src/test/resources/ejb/
trunk/embedded/src/test/resources/ejb/META-INF/
trunk/embedded/src/test/resources/ejb/META-INF/persistence.xml
Log:
Embedded JBoss initial commit
Added: trunk/embedded/build-test.xml
===================================================================
--- trunk/embedded/build-test.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/build-test.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
+ ]>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: build.xml 57108 2006-09-23 20:55:54Z scott.stark at jboss.org $ -->
+
+<project default="main" name="JBoss/EJB3X">
+ <import file="../tools/etc/buildmagic/build-common.xml"/>
+
+ <target name="init">
+
+
+ <!-- =================== -->
+ <!-- Basic Configuration -->
+ <!-- =================== -->
+
+ <!-- ========= -->
+ <!-- Libraries -->
+ <!-- ========= -->
+
+ &libraries;
+
+
+ <echo message="${junit.junit.lib}"/>
+
+ <!-- The combined library classpath -->
+ <path id="library.classpath">
+ <path refid="junit.junit.classpath"/>
+ </path>
+
+ <!-- ======= -->
+ <!-- Modules -->
+ <!-- ======= -->
+
+ &modules;
+
+ <!-- The combined dependent module classpath -->
+ <path id="dependentmodule.classpath">
+ <fileset dir="output/lib/embedded-jboss/lib">
+ <include name="*.jar"/>
+ </fileset>
+ <pathelement location="output/lib/embedded-jboss/bootstrap"/>
+ </path>
+
+ <!-- ===== -->
+ <!-- Tasks -->
+ <!-- ===== -->
+
+ <!-- Where source files live -->
+ <property name="source.java" value="src/test/java"/>
+ <property name="source.stylesheets" value="../testsuite/src/stylesheets"/>
+ <property name="resources" value="src/test/resources"/>
+
+ <!-- Where build generated files will go -->
+ <property name="build.reports" value="output/reports"/>
+ <property name="build.testlog" value="output/log"/>
+ <property name="build.classes" value="output/test-classes"/>
+ <property name="build.lib" value="output/test-lib"/>
+ <property name="build.stylesheets" value="output/stylesheets"/>
+
+
+ <!-- The combined thirdparty classpath -->
+ <path id="thirdparty.classpath">
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ </path>
+
+ <!-- classpath and local.classpath must have a value using with a path -->
+ <property name="classpath" value=""/>
+ <property name="local.classpath" value=""/>
+
+ <!-- The classpath required to build classes. -->
+ <path id="javac.classpath">
+ <pathelement path="${classpath}"/>
+ <pathelement path="${local.classpath}"/>
+ <path refid="thirdparty.classpath"/>
+ </path>
+
+ <!-- The classpath required to build javadocs. -->
+ <path id="javadoc.classpath">
+ <path refid="javac.classpath"/>
+ </path>
+
+ <!-- Packages to include when generating api documentation -->
+ <property name="javadoc.packages" value="javax.*"/>
+
+ <!-- Override JUnit defaults -->
+ <property name="junit.timeout" value="240000"/>
+ <!-- 4 minutes -->
+ <property name="junit.batchtest.todir" value="${build.reports}"/>
+ <property name="junit.jvm.options" value="-Ddummy"/>
+ <!-- ======================================================== -->
+ <!-- Initialization -->
+ <!-- ======================================================== -->
+ <tstamp>
+ <format property="TIMENOW" pattern="yyyy-MM-dd.HH-mm" timezone="GMT"/>
+ </tstamp>
+ </target>
+
+
+ <!-- ================================================================== -->
+ <!-- Compile -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Compile everything.
+ |
+ | This target should depend on other compile-* targets for each
+ | different type of compile that needs to be performed, short of
+ | documentation compiles.
+ -->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="compile-classes"/>
+
+ <!-- Compile all class files -->
+ <target name="compile-classes" depends="init">
+ <mkdir dir="${build.classes}"/>
+ <javac destdir="${build.classes}"
+ optimize="${javac.optimize}"
+ source="1.5"
+ debug="${javac.debug}"
+ depend="${javac.depend}"
+ verbose="${javac.verbose}"
+ deprecation="${javac.deprecation}"
+ includeAntRuntime="${javac.include.ant.runtime}"
+ includeJavaRuntime="${javac.include.java.runtime}"
+ failonerror="${javac.fail.onerror}">
+ <src path="${source.java}"/>
+ <classpath refid="javac.classpath"/>
+ </javac>
+ </target>
+
+ <target name="compile-stylesheets">
+ <mkdir dir="${build.stylesheets}"/>
+ <copy todir="${build.stylesheets}" filtering="yes">
+ <fileset dir="${source.stylesheets}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ </target>
+
+
+ <target name="jars" depends="compile">
+ <mkdir dir="${build.lib}"/>
+ <jar jarfile="${build.lib}/bootstrap-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/embedded/test/bootstrap/**/*.class"/>
+ </fileset>
+ </jar>
+ <jar jarfile="${build.lib}/ejb-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/embedded/test/ejb/**/*.class"/>
+ </fileset>
+ <fileset dir="${resources}/ejb">
+ <include name="META-INF/persistence.xml"/>
+ </fileset>
+ </jar>
+
+ </target>
+
+ <target name="main"
+ description="Executes the default target (most)."
+ depends="jars"/>
+
+
+
+ <target name="test" depends="init" if="test"
+ description="Execute all tests in the given test directory.">
+ <mkdir dir="${build.reports}"/>
+ <mkdir dir="${build.testlog}"/>
+ <!-- Remove the test.log so each run has a fresh log -->
+ <delete file="${build.testlog}/test.log"/>
+ <path id="test.classpath">
+ <fileset dir="${build.lib}">
+ <include name="*.jar"/>
+ </fileset>
+ <path refid="thirdparty.classpath"/>
+ </path>
+ <junit dir="${module.output}"
+ printsummary="yes"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <sysproperty key="jbosstest.deploy.dir" value="${build.lib}"/>
+ <sysproperty key="build.testlog" value="${build.testlog}"/>
+ <sysproperty key="jbosstest.threadcount" value="${jbosstest.threadcount}"/>
+ <sysproperty key="jbosstest.iterationcount" value="${jbosstest.iterationcount}"/>
+ <sysproperty key="jbosstest.beancount" value="${jbosstest.beancount}"/>
+
+ <classpath>
+ <path refid="test.classpath"/>
+ </classpath>
+
+ <formatter type="plain" usefile="true"/>
+ <formatter type="xml" usefile="true"/>
+
+ <batchtest todir="${build.reports}"
+ haltonerror="false"
+ haltonfailure="false"
+ fork="true">
+
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/embedded/test/${test}/unit/*TestCase.class"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+
+
+ <target name="tests-report-html" depends="compile-stylesheets">
+ <mkdir dir="${build.reports}/html"/>
+
+ <junitreport todir="${build.reports}">
+ <fileset dir="${build.reports}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames"
+ todir="${build.reports}/html"
+ styledir="${build.stylesheets}"
+ />
+ </junitreport>
+ </target>
+
+ <target name="tests-report-text" depends="tests-report-html">
+ <mkdir dir="${build.reports}/text"/>
+
+ <style basedir="${build.reports}"
+ destdir="${build.reports}/text"
+ extension=".txt"
+ style="${build.stylesheets}/summary1b.xsl"
+ includes="TESTS-TestSuites.xml">
+ <param name="thedate" expression="${TIMENOW}"/>
+ <param name="java_version" expression="${java.version}"/>
+ <param name="java_vendor" expression="${java.vendor}"/>
+ <param name="java_vm_specification_version" expression="${java.vm.specification.version}"/>
+ <param name="java_vm_version" expression="${java.vm.version}"/>
+ <param name="java_vm_name" expression="${java.vm.name}"/>
+ <param name="java_vm_info" expression="${java.vm.info}"/>
+ <param name="java_specification_version" expression="${java.specification.version}"/>
+ <param name="java_class_version" expression="${java.class.version}"/>
+ <param name="os_name" expression="${os.name}"/>
+ <param name="os_arch" expression="${os.arch}"/>
+ <param name="os_version" expression="${os.version}"/>
+ <param name="builduid" expression="${TIMENOW}"/>
+ <param name="results_web" expression="${results_web}"/>
+ </style>
+ </target>
+
+
+ <target name="tests-report-clean">
+ <delete dir="${build.reports}"/>
+ </target>
+
+ <target name="clean"
+ description="Cleans up most generated files." depends="init">
+ <delete dir="${build.classes}"/>
+ <delete dir="${build.lib}"/>
+ <delete dir="${build.reports}"/>
+ </target>
+
+</project>
Added: trunk/embedded/build.bat
===================================================================
--- trunk/embedded/build.bat 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/build.bat 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,89 @@
+ at echo off
+REM ======================================================================
+REM
+REM This is the main entry point for the build system.
+REM
+REM Users should be sure to execute this file rather than 'ant' to ensure
+REM the correct version is being used with the correct configuration.
+REM
+REM ======================================================================
+REM
+REM $Id: build.bat 24242 2004-10-04 20:13:37Z andd $
+REM
+REM Authors:
+REM Jason Dillon <jason at planet57.com>
+REM Sacha Labourey <sacha.labourey at cogito-info.ch>
+REM
+
+REM ******************************************************
+REM Ignore the ANT_HOME variable: we want to use *our*
+REM ANT version and associated JARs.
+REM ******************************************************
+REM Ignore the users classpath, cause it might mess
+REM things up
+REM ******************************************************
+
+SETLOCAL
+
+set CLASSPATH=
+set ANT_HOME=
+set ANT_OPTS=-Djava.protocol.handler.pkgs=org.jboss.net.protocol -Dbuild.script=build.bat
+
+REM ******************************************************
+REM - "for" loops have been unrolled for compatibility
+REM with some WIN32 systems.
+REM ******************************************************
+
+set NAMES=tools;tools\ant;tools\apache\ant
+set SUBFOLDERS=..;..\..;..\..\..;..\..\..\..
+
+REM ******************************************************
+REM ******************************************************
+
+SET EXECUTED=FALSE
+for %%i in (%NAMES%) do call :subLoop %%i %1 %2 %3 %4 %5 %6
+
+goto :EOF
+
+
+REM ******************************************************
+REM ********* Search for names in the subfolders *********
+REM ******************************************************
+
+:subLoop
+for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%1\bin\ant.bat %2 %3 %4 %5 %6 %7
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************ Test if ANT Batch file exists ***********
+REM ******************************************************
+
+:testIfExists
+if exist %1 call :BatchFound %1 %2 %3 %4 %5 %6 %7 %8
+
+goto :EOF
+
+
+REM ******************************************************
+REM ************** Batch file has been found *************
+REM ******************************************************
+
+:BatchFound
+if (%EXECUTED%)==(FALSE) call :ExecuteBatch %1 %2 %3 %4 %5 %6 %7 %8
+set EXECUTED=TRUE
+
+goto :EOF
+
+REM ******************************************************
+REM ************* Execute Batch file only once ***********
+REM ******************************************************
+
+:ExecuteBatch
+echo Calling %1 %2 %3 %4 %5 %6 %7 %8
+call %1 %2 %3 %4 %5 %6 %7 %8
+
+:end
+
+if "%NOPAUSE%" == "" pause
Added: trunk/embedded/build.sh
===================================================================
--- trunk/embedded/build.sh 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/build.sh 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,173 @@
+#!/bin/sh
+### ====================================================================== ###
+## ##
+## This is the main entry point for the build system. ##
+## ##
+## Users should be sure to execute this file rather than 'ant' to ensure ##
+## the correct version is being used with the correct configuration. ##
+## ##
+### ====================================================================== ###
+
+# $Id: build.sh 24242 2004-10-04 20:13:37Z andd $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+GREP="grep"
+ROOT="/"
+
+# Ignore user's ANT_HOME if it is set
+ANT_HOME=""
+
+# the default search path for ant
+ANT_SEARCH_PATH="\
+ tools
+ tools/ant \
+ tools/apache/ant \
+ ant"
+
+# the default build file name
+ANT_BUILD_FILE="build.xml"
+
+# the default arguments
+ANT_OPTIONS="-find $ANT_BUILD_FILE"
+
+# Use the maximum available, or set MAX_FD != -1 to use that
+MAX_FD="maximum"
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+darwin=false;
+case "`uname`" in
+ CYGWIN*)
+ cygwin=true
+ ;;
+
+ Darwin*)
+ darwin=true
+ ;;
+esac
+
+#
+# Helper to complain.
+#
+die() {
+ echo "${PROGNAME}: $*"
+ exit 1
+}
+
+#
+# Helper to complain.
+#
+warn() {
+ echo "${PROGNAME}: $*"
+}
+
+#
+# Helper to source a file if it exists.
+#
+maybe_source() {
+ for file in $*; do
+ if [ -f "$file" ]; then
+ . $file
+ fi
+ done
+}
+
+search() {
+ search="$*"
+ for d in $search; do
+ ANT_HOME="`pwd`/$d"
+ ANT="$ANT_HOME/bin/ant"
+ if [ -x "$ANT" ]; then
+ # found one
+ echo $ANT_HOME
+ break
+ fi
+ done
+}
+
+#
+# Main function.
+#
+main() {
+ # if there is a build config file. then source it
+ maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
+
+ # Increase the maximum file descriptors if we can
+ if [ $cygwin = "false" ]; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ]; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
+ # use the system max
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ]; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+ fi
+
+ # try the search path
+ ANT_HOME=`search $ANT_SEARCH_PATH`
+
+ # try looking up to root
+ if [ "x$ANT_HOME" = "x" ]; then
+ target="build"
+ _cwd=`pwd`
+
+ while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
+ cd ..
+ cwd=`pwd`
+ ANT_HOME=`search $ANT_SEARCH_PATH`
+ done
+
+ # make sure we get back
+ cd $_cwd
+
+ if [ "$cwd" != "$ROOT" ]; then
+ found="true"
+ fi
+
+ # complain if we did not find anything
+ if [ "$found" != "true" ]; then
+ die "Could not locate Ant; check \$ANT or \$ANT_HOME."
+ fi
+ fi
+
+ # make sure we have one
+ ANT=$ANT_HOME/bin/ant
+ if [ ! -x "$ANT" ]; then
+ die "Ant file is not executable: $ANT"
+ fi
+
+ # need to specify planet57/buildmagic protocol handler package
+ ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
+
+ # setup some build properties
+ ANT_OPTS="$ANT_OPTS -Dbuild.script=$0"
+
+ # change to the directory where the script lives so users are not forced
+ # to be in the same directory as build.xml
+ cd $DIRNAME
+
+ # export some stuff for ant
+ export ANT ANT_HOME ANT_OPTS
+
+ # execute in debug mode, or simply execute
+ if [ "x$ANT_DEBUG" != "x" ]; then
+ /bin/sh -x $ANT $ANT_OPTIONS "$@"
+ else
+ exec $ANT $ANT_OPTIONS "$@"
+ fi
+}
+
+##
+## Bootstrap
+##
+
+main "$@"
+
Added: trunk/embedded/build.xml
===================================================================
--- trunk/embedded/build.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/build.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,429 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE project [
+ <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent">
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent">
+ ]>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id: build.xml 58906 2006-12-07 18:21:00Z thomas.diesler at jboss.com $ -->
+
+<project default="main" name="JBoss/Embedded">
+
+ <!-- ================================================================== -->
+ <!-- Setup -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Include the common Buildmagic elements.
+ |
+ | This defines several different targets, properties and paths.
+ | It also sets up the basic extention tasks amoung other things.
+ -->
+
+ &buildmagic;
+
+
+ <!-- ================================================================== -->
+ <!-- Initialization -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Initialize the build system. Must depend on '_buildmagic:init'.
+ | Other targets should depend on 'init' or things will mysteriously fail.
+ -->
+
+ <target name="init" unless="init.disable" depends="_buildmagic:init">
+ </target>
+
+
+ <!-- ================================================================== -->
+ <!-- Configuration -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Configure the build system.
+ |
+ | This target is invoked by the Buildmagic initialization logic and
+ | should contain module specific configuration elements.
+ -->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- =================== -->
+ <!-- Basic Configuration -->
+ <!-- =================== -->
+
+ <!-- Module name(s) & version -->
+ <property name="module.name" value="embedded"/>
+ <property name="module.Name" value="JBoss Embedded"/>
+ <property name="module.version" value="DEV"/>
+
+ <!-- ========= -->
+ <!-- Libraries -->
+ <!-- ========= -->
+ &libraries;
+ <!-- The combined library classpath -->
+ <path id="library.classpath">
+ <path refid="sun.jaf.classpath"/>
+ <path refid="sun.servlet.classpath"/>
+ <path refid="javassist.classpath"/>
+ <path refid="qdox.classpath"/>
+ <path refid="jgroups.jgroups.classpath"/>
+ <path refid="hibernate3.classpath"/>
+ <path refid="ejb3-persistence.classpath"/>
+ <path refid="javassist.classpath"/>
+ <path refid="trove.classpath"/>
+ <path refid="xdoclet.xdoclet.classpath"/>
+ <path refid="apache.ant.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="junit.junit.classpath"/>
+ <path refid="jboss.remoting.classpath"/>
+ <path refid="apache.logging.classpath"/>
+ <path refid="jboss.serialization.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
+ <path refid="quartz.quartz.classpath"/>
+ <path refid="jboss.jbossws.classpath"/>
+ <path refid="jboss.jbossxb.classpath"/>
+ <path refid="jacorb.jacorb.classpath"/>
+ <!-- FIXME: temporary for EJBTHREE-485 -->
+ <path refid="cglib.classpath"/>
+ </path>
+
+ <!-- ======= -->
+ <!-- Modules -->
+ <!-- ======= -->
+
+ &modules;
+
+ <!-- The combined dependent module classpath -->
+ <path id="dependentmodule.classpath">
+ <path refid="jboss.j2ee.classpath"/>
+ <path refid="jboss.j2se.classpath"/>
+ <path refid="jboss.aop.classpath"/>
+ <path refid="jboss.cache.classpath"/>
+ <path refid="jboss.aspects.classpath"/>
+ <path refid="jboss.ejb3x.classpath"/>
+ <path refid="jboss.common.core.classpath"/>
+ <path refid="jboss.common.logging.spi.classpath"/>
+ <path refid="jboss.common.logging.log4j.classpath"/>
+ <path refid="jboss.common.logging.jdk.classpath"/>
+ <path refid="jboss.cluster.classpath"/>
+ <path refid="jboss.system.classpath"/>
+ <path refid="jboss.systemjmx.classpath"/>
+ <path refid="jboss.naming.classpath"/>
+ <path refid="jboss.transaction.classpath"/>
+ <path refid="jboss.security.classpath"/>
+ <path refid="jboss.server.classpath"/>
+ <path refid="jboss.mq.classpath"/>
+ <path refid="jboss.jca.classpath"/>
+ <path refid="jboss.jmx.classpath"/>
+ <path refid="jboss.iiop.classpath"/>
+ </path>
+
+ <!-- ===== -->
+ <!-- Tasks -->
+ <!-- ===== -->
+
+ <!-- Where source files live -->
+ <property name="source.java" value="${module.source}/main/java"/>
+ <property name="source.etc" value="${module.source}/etc"/>
+ <property name="resources" value="${module.source}/main/resources"/>
+
+ <!-- Where build generated files will go -->
+ <property name="build.reports" value="${module.output}/reports"/>
+ <property name="build.classes" value="${module.output}/classes"/>
+ <property name="build.lib" value="${module.output}/lib"/>
+ <property name="build.api" value="${module.output}/api"/>
+ <property name="build.etc" value="${module.output}/etc"/>
+
+ <!-- Install/Release structure -->
+ <property name="install.id" value="${module.name}-${module.version}"/>
+ <property name="release.id" value="${install.id}"/>
+ <property name="install.root" value="${module.output}/${install.id}"/>
+
+ <!-- The combined thirdparty classpath -->
+ <path id="thirdparty.classpath">
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ </path>
+
+ <!-- This module is based on Java 1.2 -->
+ <property name="javac.target" value="1.2"/>
+
+ <!-- classpath and local.classpath must have a value using with a path -->
+ <property name="classpath" value=""/>
+ <property name="local.classpath" value=""/>
+
+ <!-- The classpath required to build classes. -->
+ <path id="javac.classpath">
+ <pathelement path="${classpath}"/>
+ <pathelement path="${local.classpath}"/>
+ <path refid="thirdparty.classpath"/>
+ </path>
+
+ <!-- The classpath required to build javadocs. -->
+ <path id="javadoc.classpath">
+ <path refid="javac.classpath"/>
+ <path refid="jboss.ejb3.classpath"/>
+ </path>
+
+ <!-- Packages to include when generating api documentation -->
+ <property name="javadoc.packages" value="javax.*"/>
+
+ <!-- Override JUnit defaults -->
+ <property name="junit.timeout" value="240000"/>
+ <!-- 4 minutes -->
+ <property name="junit.batchtest.todir" value="${build.reports}"/>
+ <property name="junit.jvm.options" value="-Ddummy"/>
+ </target>
+
+
+ <!-- ================================================================== -->
+ <!-- Compile -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Compile everything.
+ |
+ | This target should depend on other compile-* targets for each
+ | different type of compile that needs to be performed, short of
+ | documentation compiles.
+ -->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="compile-etc, compile-classes"/>
+
+ <!-- Compile all class files -->
+ <target name="compile-classes" depends="init">
+ <mkdir dir="${build.classes}"/>
+ <javac destdir="${build.classes}"
+ optimize="${javac.optimize}"
+ debug="${javac.debug}"
+ source="1.5"
+ target="1.5"
+ depend="${javac.depend}"
+ verbose="${javac.verbose}"
+ includeAntRuntime="${javac.include.ant.runtime}"
+ includeJavaRuntime="${javac.include.java.runtime}"
+ deprecation="${javac.deprecation}"
+ failonerror="${javac.fail.onerror}">
+ <src path="${source.java}"/>
+ <classpath refid="javac.classpath"/>
+ <include name="${javac.includes}"/>
+ <exclude name="${javac.excludes}"/>
+ </javac>
+ </target>
+
+ <!-- Compile manifests -->
+ <target name="compile-etc" depends="init">
+ </target>
+
+
+ <!-- ================================================================== -->
+ <!-- Archives -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Build all jar files.
+ -->
+ <target name="internal-jars"
+ depends="_buildmagic:build-bypass-check"
+ unless="build-bypass.on">
+
+ <call target="compile"/>
+
+ <!-- Update the build marker to allow bypassing -->
+ <touch file="${build-bypass.marker}"/>
+
+ </target>
+
+ <target name="jars"
+ description="Builds all jar files."
+ depends="internal-jars">
+
+ <mkdir dir="${build.lib}"/>
+
+ <mkdir dir="${build.lib}/embedded-jboss/bootstrap"/>
+ <mkdir dir="${build.lib}/embedded-jboss/lib"/>
+ <copy todir="${build.lib}/embedded-jboss/bootstrap">
+ <fileset dir="${resources}/javase">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+
+ <jar jarfile="${build.lib}/jboss-local-jdbc.rar">
+ <fileset dir="../connector/src/resources/local-rar">
+ <include name="META-INF/ra.xml"/>
+ </fileset>
+ </jar>
+ <jar jarfile="${build.lib}/jboss-xa-jdbc.rar">
+ <fileset dir="../connector/src/resources/xa-rar">
+ <include name="META-INF/ra.xml"/>
+ </fileset>
+ </jar>
+
+ <copy todir="${build.lib}/embedded-jboss/bootstrap/deploy">
+ <fileset dir="${build.lib}">
+ <include name="*.rar"/>
+ </fileset>
+ </copy>
+
+ <jar jarfile="${build.lib}/embedded-jboss/lib/jboss-embedded-all.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/**"/>
+ </fileset>
+ <fileset dir="../ejb3/src/resources">
+ <include name="META-INF/persistence.properties"/>
+ </fileset>
+ <fileset dir="../server/output/etc/conf/default">
+ <include name="xmdesc/*"/>
+ </fileset>
+ <fileset dir="${resources}">
+ <include name="stylesheets/*"/>
+ </fileset>
+ <zipfileset src="${jboss.ejb3.lib}/jboss-ejb3.jar"/>
+ <zipfileset src="${jboss.ejb3.lib}/jboss-annotations-ejb3.jar"/>
+ <zipfileset src="${jboss.ejb3x.lib}/jboss-ejb3x.jar"/>
+ <zipfileset src="${jboss.aop.lib}/jboss-aop-jdk50.jar"/>
+ <zipfileset src="${jboss.varia.lib}/hsqldb-plugin.jar"/>
+ <zipfileset src="${jboss.mq.lib}/jbossmq.jar"/>
+ <zipfileset src="${jboss.aspects.lib}/jboss-aspect-library-jdk50.jar"/>
+ <zipfileset src="${jboss.transaction.lib}/jboss-transaction.jar"/>
+ <zipfileset src="${jboss.naming.lib}/jnpserver.jar"/>
+ <zipfileset src="${jboss.j2ee.lib}/jboss-j2ee.jar"/>
+ <zipfileset src="${jboss.common.core.lib}/jboss-common-core.jar"/>
+ <zipfileset src="${jboss.common.logging.log4j.lib}/jboss-logging-log4j.jar"/>
+ <zipfileset src="${jboss.common.logging.spi.lib}/jboss-logging-spi.jar"/>
+ <zipfileset src="${jboss.jbossxb.lib}/jboss-xml-binding.jar"/>
+ <zipfileset src="${jboss.security.lib}/jbosssx.jar"/>
+ <zipfileset src="${jboss.security.spi.lib}/jboss-security-spi.jar"/>
+ <zipfileset src="${jboss.microcontainer.lib}/jboss-microcontainer.jar"/>
+ <zipfileset src="${jboss.microcontainer.lib}/jboss-container.jar"/>
+ <zipfileset src="${jboss.microcontainer.lib}/jboss-dependency.jar"/>
+ <zipfileset src="${jboss.microcontainer.lib}/jboss-deployers.jar"/>
+ <zipfileset src="${jboss.microcontainer.lib}/jboss-aop-mc-int-boot.jar"/>
+ <zipfileset src="${jboss.microcontainer.lib}/jboss-aop-mc-int-deployer.jar"/>
+ <zipfileset src="${jboss.microcontainer.lib}/jboss-aop-mc-int.jar"/>
+ <zipfileset src="${jboss.server.lib}/jboss.jar"/>
+ <zipfileset src="${jboss.remoting.lib}/jboss-remoting.jar"/>
+ <zipfileset src="${jboss.j2se.lib}/jboss-j2se.jar"/>
+ <zipfileset src="${jboss.jca.lib}/jboss-jca.jar"/>
+ <zipfileset src="${jboss.jca.lib}/jboss-common-jdbc-wrapper.jar"/>
+ <zipfileset src="${jboss.jca.lib}/jboss-local-jdbc.jar"/>
+ <zipfileset src="${jboss.jca.lib}/jboss-xa-jdbc.jar"/>
+ <zipfileset src="${jboss.jmx.lib}/jboss-jmx.jar"/>
+ <zipfileset src="${jboss.mbeans.lib}/jboss-mbeans.jar"/>
+ <zipfileset src="${jboss.system.lib}/jboss-system.jar"/>
+ <zipfileset src="${jboss.systemjmx.lib}/jboss-system-jmx.jar"/>
+ <zipfileset src="${jboss.serialization.lib}/jboss-serialization.jar"/>
+ <zipfileset src="${jboss.jbossts.lib}/jbossjta.jar"/>
+ <zipfileset src="${jboss.jbossts.lib}/jbossjta-integration.jar"/>
+ <zipfileset src="${jboss.jbossts.lib}/jbossts-common.jar"/>
+ <zipfileset src="${jboss.jbossws.lib}/jboss-jaxrpc.jar"/>
+ <zipfileset src="${jboss.jbossws.lib}/jboss-jaxws.jar"/>
+ </jar>
+
+
+ <jar jarfile="${build.lib}/embedded-jboss/lib/hibernate-all.jar">
+ <zipfileset src="${hibernate.lib}/hibernate3.jar"/>
+ <zipfileset src="${hibernate.entitymanager.lib}/ejb3-persistence.jar"/>
+ <zipfileset src="${hibernate.entitymanager.lib}/hibernate-entitymanager.jar"/>
+ <zipfileset src="${hibernate.annotations.lib}/hibernate-annotations.jar"/>
+ </jar>
+
+
+ <jar jarfile="${build.lib}/embedded-jboss/lib/thirdparty-all.jar">
+ <zipfileset src="${apache.log4j.lib}/log4j.jar"/>
+ <zipfileset src="${hsqldb.hsqldb.lib}/hsqldb.jar"/>
+ <zipfileset src="${asm.asm.lib}/asm.jar"/>
+ <zipfileset src="${asm.asm.lib}/asm-attrs.jar"/>
+ <zipfileset src="${antlr.antlr.lib}/antlr-2.7.6.jar"/>
+ <zipfileset src="${cglib.lib}/cglib.jar"/>
+ <zipfileset src="${dom4j.dom4j.lib}/dom4j.jar"/>
+ <zipfileset src="${apache.logging.lib}/commons-logging.jar"/>
+ <zipfileset src="${apache.collections.lib}/commons-collections.jar"/>
+ <zipfileset src="${oswego.concurrent.lib}/concurrent.jar"/>
+ <zipfileset src="${apache.xerces.lib}/resolver.jar"/>
+ <zipfileset src="${apache.xerces.lib}/xercesImpl.jar"/>
+ <zipfileset src="${apache.xerces.lib}/xml-apis.jar" excludes="**/license"/>
+ <zipfileset src="${javassist.lib}/javassist.jar"/>
+ <zipfileset src="${trove.lib}/trove.jar"/>
+ <zipfileset src="${quartz.quartz.lib}/quartz-all-1.5.2.jar"/>
+ </jar>
+ </target>
+
+
+ <!-- ================================================================== -->
+ <!-- Install & Release -->
+ <!-- ================================================================== -->
+
+ <target name="install"
+ description="Install the structure for a release."
+ depends="all, _buildmagic:install:default"/>
+
+ <target name="release" depends="install"/>
+
+ <target name="release-zip"
+ description="Builds a ZIP distribution."
+ depends="release, _buildmagic:release:zip"/>
+
+ <target name="release-tar"
+ description="Builds a TAR distribution."
+ depends="release, _buildmagic:release:tar"/>
+
+ <target name="release-tgz"
+ description="Builds a TAR-GZ distribution."
+ depends="release, _buildmagic:release:tgz"/>
+
+ <target name="release-all"
+ description="Builds a distribution for each archive type."
+ depends="release-zip, release-tgz"/>
+
+ <!-- ================================================================== -->
+ <!-- Cleaning -->
+ <!-- ================================================================== -->
+
+ <!-- Clean up all build output -->
+ <target name="clean"
+ description="Cleans up most generated files."
+ depends="_buildmagic:clean">
+ </target>
+
+ <!-- Clean up all generated files -->
+ <target name="clobber"
+ description="Cleans up all generated files."
+ depends="_buildmagic:clobber, clean">
+ </target>
+
+
+ <!-- ================================================================== -->
+ <!-- Misc. -->
+ <!-- ================================================================== -->
+
+ <target name="main"
+ description="Executes the default target (most)."
+ depends="most"/>
+
+ <target name="all"
+ description="Builds everything."
+ depends="jars, docs"/>
+
+ <target name="most"
+ description="Builds almost everything."
+ depends="jars"/>
+
+ <target name="help"
+ description="Show this help message."
+ depends="_buildmagic:help:standard"/>
+
+</project>
Added: trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/Bootstrap.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,245 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer;
+import org.jboss.kernel.Kernel;
+import org.jboss.deployers.spi.deployment.MainDeployer;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.IncompleteDeployments;
+import org.jboss.deployers.spi.IncompleteDeploymentsBuilder;
+import org.jboss.deployers.spi.IncompleteDeploymentException;
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFS;
+
+import java.net.URL;
+import java.io.IOException;
+import java.io.File;
+import java.util.StringTokenizer;
+
+/**
+ * Basic bootstrap class for embeddable JBoss
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class Bootstrap
+{
+ private String bootstrap = "conf/bootstrap-beans.xml";
+ private Kernel kernel;
+ private ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ private MainDeployer mainDeployer;
+
+ public Bootstrap()
+ {
+ kernel = createKernel();
+ }
+
+
+ public Bootstrap(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+
+ public String getBootstrap()
+ {
+ return bootstrap;
+ }
+
+ public void setBootstrap(String bootstrap)
+ {
+ this.bootstrap = bootstrap;
+ }
+
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ public ClassLoader getLoader()
+ {
+ return loader;
+ }
+
+ public void setLoader(ClassLoader loader)
+ {
+ this.loader = loader;
+ }
+
+ private static Kernel createKernel()
+ {
+ BasicBootstrap bootstrap1 = new BasicBootstrap();
+ bootstrap1.run();
+ return bootstrap1.getKernel();
+ }
+
+ /**
+ * Check whether we are incomplete
+ *
+ * @throws DeploymentException the deployment exception
+ */
+ protected void checkIncomplete() throws DeploymentException
+ {
+ IncompleteDeployments incomplete = IncompleteDeploymentsBuilder.build(mainDeployer, kernel.getController());
+ if (incomplete.isIncomplete())
+ throw new IncompleteDeploymentException(incomplete);
+ }
+
+
+
+ public void bootstrap() throws DeploymentException
+ {
+ try
+ {
+ URL url = loader.getResource(bootstrap);
+ BeanXMLDeployer deployer = new BeanXMLDeployer(kernel);
+ deployer.deploy(url);
+ deployer.validate();
+ mainDeployer = (MainDeployer)kernel.getRegistry().getEntry("MainDeployer").getTarget();
+ }
+ catch (Throwable throwable)
+ {
+ throw new RuntimeException("Unable to bootstrap: ", throwable);
+ }
+ checkIncomplete();
+ }
+
+ public void shutdown()
+ {
+ mainDeployer.shutdown();
+ }
+
+ /**
+ * Deploy a file based on its URL
+ *
+ * @param url
+ * @throws DeploymentException
+ */
+ public void deploy(URL url) throws DeploymentException
+ {
+ VirtualFile file = null;
+ try
+ {
+ file = VFS.getRoot(url);
+ }
+ catch (IOException e)
+ {
+ throw new DeploymentException("Unable to get VirtualFile for url: " + url, e);
+ }
+ DeploymentContext deployment = new AbstractDeploymentContext(file);
+ mainDeployer.addDeploymentContext(deployment);
+ mainDeployer.process();
+ }
+
+ /**
+ * Scan all paths/jars in Java CLasspath (found with java.class.path System Property)
+ *
+ *
+ * @throws DeploymentException
+ */
+ public void scanClasspath() throws DeploymentException
+ {
+ String classpath = System.getProperty("java.class.path");
+ StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
+
+ while (tokenizer.hasMoreTokens())
+ {
+ String path = tokenizer.nextToken();
+ File fp = new File(path);
+ if (!fp.exists()) throw new DeploymentException("File in java.class.path does not exist: " + fp);
+ VirtualFile file = null;
+ try
+ {
+ URL url = fp.toURL();
+ file = VFS.getRoot(url);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Unable to get VirtualFile for file: " + fp, e);
+ }
+ DeploymentContext deployment = new AbstractDeploymentContext(file);
+ mainDeployer.addDeploymentContext(deployment);
+ }
+ mainDeployer.process();
+ }
+
+
+ /**
+ * Scan Java Classpath (found with java.class.path)
+ * for a specified list of files you want to deploy
+ *
+ * The files listed should be only the filename. Do not put relative or absolute paths in filenames.
+ * i.e. "myejbs.jar, my-beans.xml"
+ *
+ * @param paths comma delimited list of files
+ * @throws DeploymentException
+ */
+ public void scanClasspath(String paths) throws DeploymentException
+ {
+ String classpath = System.getProperty("java.class.path");
+ StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator);
+ String[] split = paths.split(",");
+ for (int i = 0; i < split.length; i++)
+ {
+ split[i] = split[i].trim();
+ }
+
+ while (tokenizer.hasMoreTokens())
+ {
+ String path = tokenizer.nextToken().trim();
+ boolean found = false;
+ for (String wantedPath : split)
+ {
+ if (path.endsWith(System.getProperty("file.separator") + wantedPath))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found) continue;
+ File fp = new File(path);
+ if (!fp.exists()) throw new DeploymentException("File in java.class.path does not exists: " + fp);
+ VirtualFile file = null;
+ try
+ {
+ URL url = fp.toURL();
+ file = VFS.getRoot(url);
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Unable to get VirtualFile for file: " + fp, e);
+ }
+ DeploymentContext deployment = new AbstractDeploymentContext(file);
+ mainDeployer.addDeploymentContext(deployment);
+ }
+ mainDeployer.process();
+ }
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/ClassLoaderDeployer.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/ClassLoaderDeployer.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/ClassLoaderDeployer.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+import org.jboss.deployers.plugins.deployers.helpers.AbstractTopLevelClassLoaderDeployer;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassLoaderDeployer extends AbstractTopLevelClassLoaderDeployer
+{
+
+ public ClassLoader createTopLevelClassLoader(DeploymentContext context) throws Exception
+ {
+ context.setClassLoader(Thread.currentThread().getContextClassLoader());
+ return context.getClassLoader();
+ }
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/ClasspathResourceScanner.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,288 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+import org.jboss.deployers.spi.deployment.MainDeployer;
+import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFileFilter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.net.URL;
+import java.io.IOException;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClasspathResourceScanner
+{
+ private ArrayList<String> resources;
+ private ArrayList<String> deployDirsByResource;
+ private MainDeployer mainDeployer;
+ private ClassLoader classLoader;
+ private VirtualFileFilter filter;
+
+
+ public ArrayList<String> getResources()
+ {
+ return resources;
+ }
+
+ public void setResources(ArrayList<String> resources)
+ {
+ this.resources = resources;
+ }
+
+
+ public ArrayList<String> getDeployDirsByResource()
+ {
+ return deployDirsByResource;
+ }
+
+
+ public ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+
+ public VirtualFileFilter getFilter()
+ {
+ return filter;
+ }
+
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ /**
+ * List of resources where whose directory will be used as a deploy directory
+ * <p/>
+ * The '.' character can be used to specify the current directory.
+ * The '..' string can be used to specify a higher relative path
+ * <p/>
+ * i.e.
+ * <p/>
+ * "org/jboss/Test.class"
+ * file:/<root>/org/jboss/
+ * <p/>
+ * "org/jboss/Test.class/.."
+ * file:/<root>/org/
+ * <p/>
+ * "org/jboss/Test.class/../acme"
+ * file:/<root>/org/acme/
+ * <p/>
+ * "org/jboss/Test.class/./embedded"
+ * file:/<root>/org/jboss/embedded/
+ */
+ public void setDeployDirsByResource(ArrayList<String> deployDirsByResource)
+ {
+ this.deployDirsByResource = deployDirsByResource;
+ }
+
+ public void setMainDeployer(MainDeployer mainDeployer)
+ {
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * A helper to find all deployments under a directory vf
+ * and add them to the supplied list.
+ *
+ * We may recurse.
+ */
+ private void addDeployments(List<VirtualFile> list, VirtualFile root)
+ throws IOException
+ {
+ List<VirtualFile> components = root.getChildren();
+
+ for (VirtualFile component : components)
+ {
+ // Filter the component regardless of its type
+ if( filter != null && filter.accepts(component) == false)
+ continue;
+ if (component.isLeaf())
+ {
+ list.add(component);
+ }
+ // TODO replace . in the name with isArchive() == false?
+ else if (component.getName().indexOf('.') == -1)
+ {
+ // recurse if not '.' in name and recursive search is enabled
+ addDeployments(list, component);
+ }
+ else
+ {
+ list.add(component);
+ }
+ }
+ }
+
+
+ /**
+ * Find the directory that contains a given resource.
+ * <p/>
+ * The '.' character can be used to specify the current directory.
+ * The '..' string can be used to specify a higher relative path
+ * <p/>
+ * i.e.
+ * <p/>
+ * getDirFromResource(loader, "org/jboss/Test.class")
+ * file:/<root>/org/jboss/
+ * <p/>
+ * getDirFromResource(loader, "org/jboss/Test.class/..")
+ * file:/<root>/org/
+ * <p/>
+ * getDirFromResource(loader, "org/jboss/Test.class/../acme")
+ * file:/<root>/org/acme/
+ * <p/>
+ * getDirFromResource(loader, "org/jboss/Test.class/./embedded")
+ * file:/<root>/org/jboss/embedded/
+ *
+ * @param loader
+ * @param resource
+ * @return
+ * @throws Exception
+ */
+ public static URL getDirFromResource(ClassLoader loader, String resource) throws Exception
+ {
+ int idx = resource.indexOf("/.");
+ String base = resource;
+ String relative = null;
+ if (idx != -1)
+ {
+ base = resource.substring(0, idx);
+ relative = resource.substring(idx + 1);
+ }
+ URL url = loader.getResource(base);
+ if (url == null) return null;
+ String urlAsString = url.toString();
+ String[] paths = urlAsString.split("/");
+ int last = paths.length - 2;
+ if (relative != null)
+ {
+ String[] relativePaths = relative.split("/");
+ int relativeStart = 0;
+ for (String relativePath : relativePaths)
+ {
+ if (relativePath.equals(".."))
+ {
+ last--;
+ relativeStart++;
+ }
+ else if (relativePath.equals("."))
+ {
+ relativeStart++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ urlAsString = "";
+ for (int i = 0; i <= last; i++)
+ {
+ urlAsString += paths[i] + "/";
+ }
+ for (int i = relativeStart; i < relativePaths.length; i++)
+ {
+ urlAsString += relativePaths[i] + "/";
+ }
+ }
+ else
+ {
+ urlAsString = "";
+ for (int i = 0; i <= last; i++)
+ {
+ urlAsString += paths[i] + "/";
+ }
+
+ }
+ url = new URL(urlAsString);
+ return url;
+ }
+
+ public void start() throws Exception
+ {
+ if (classLoader == null) classLoader = Thread.currentThread().getContextClassLoader();
+ if (resources != null)
+ {
+ for (String resource : resources)
+ {
+ URL url = classLoader.getResource(resource);
+ VirtualFile file = null;
+ try
+ {
+ file = VFS.getRoot(url);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Unable to find resource: " + resource, e);
+ }
+ DeploymentContext deployment = new AbstractDeploymentContext(file);
+ mainDeployer.addDeploymentContext(deployment);
+ }
+ mainDeployer.process();
+ }
+ if (deployDirsByResource != null)
+ {
+ for (String deployDir : deployDirsByResource)
+ {
+ URL url = getDirFromResource(classLoader, deployDir);
+ if (url == null)
+ {
+ throw new Exception("Unable to find deployDir from resource: " + deployDir);
+ }
+ VirtualFile file = null;
+ try
+ {
+ file = VFS.getRoot(url);
+ }
+ catch (Exception e)
+ {
+ throw new Exception("Unable to find deployDir from resource: " + deployDir, e);
+ }
+ List<VirtualFile> files = new ArrayList<VirtualFile>();
+ addDeployments(files, file);
+ for (VirtualFile vf : files)
+ {
+ DeploymentContext deployment = new AbstractDeploymentContext(vf);
+ mainDeployer.addDeploymentContext(deployment);
+ }
+ mainDeployer.process();
+ }
+ }
+ }
+
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoader.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class JMXClassLoader extends ClassLoader implements JMXClassLoaderMBean
+{
+ public JMXClassLoader(ClassLoader parent)
+ {
+ super(parent);
+ }
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXClassLoaderMBean.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,32 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public interface JMXClassLoaderMBean
+{
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXKernel.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,343 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.mx.server.MBeanServerBuilderImpl;
+import org.jboss.mx.util.JMXExceptionDecoder;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.jboss.system.ServiceController;
+import org.jboss.system.ServiceControllerMBean;
+import org.jboss.system.deployers.ServiceDeployer;
+import org.jboss.system.server.ServerImplMBean;
+import org.jboss.system.server.ServerConfigImpl;
+import org.jboss.system.server.ServerConfigImplMBean;
+import org.jboss.util.JBossObject;
+
+import javax.management.JMRuntimeException;
+import javax.management.ListenerNotFoundException;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerBuilder;
+import javax.management.MBeanServerDelegate;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
+import javax.management.ObjectName;
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * A pojo that creates a legacy jmx kernel ala the jboss-4.x server bootstrap.
+ * This is used to support the SARDeployer and mbean integration.
+ *
+ * @author Scott.Stark at jboss.org
+ * @author bill at jboss.org
+ * @version $Revision:$
+ */
+public class JMXKernel extends JBossObject implements JMXKernelMBean, NotificationEmitter
+{
+ /**
+ * The JMX MBeanServer which will serve as our communication bus.
+ */
+ private MBeanServer mbeanServer;
+ private MBeanServerBuilder builder = new MBeanServerBuilderImpl();
+ private ServiceController controller;
+ private Kernel kernel;
+ private NotificationBroadcasterSupport broadcasterSupport = new NotificationBroadcasterSupport();
+ private boolean started;
+
+ public ServiceControllerMBean getServiceController()
+ {
+ return this.controller;
+ }
+
+ public MBeanServer getMbeanServer()
+ {
+ return mbeanServer;
+ }
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+
+ public void setBuilder(MBeanServerBuilder builder)
+ {
+ this.builder = builder;
+ }
+
+ /**
+ * We don't want to override platforms default mechanism for creating MBeanServer so lets just do it ourselves
+ *
+ * @param domain
+ * @return
+ */
+ private MBeanServer createMBeanServer(String domain)
+ {
+ final MBeanServerDelegate delegate =
+ builder.newMBeanServerDelegate();
+ if (delegate == null)
+ {
+ final String msg =
+ "MBeanServerBuilder.newMBeanServerDelegate() " +
+ "returned null";
+ throw new JMRuntimeException(msg);
+ }
+ final MBeanServer mbeanServer =
+ builder.newMBeanServer(domain, null, delegate);
+ if (mbeanServer == null)
+ {
+ final String msg =
+ "MBeanServerBuilder.newMBeanServer() returned null";
+ throw new JMRuntimeException(msg);
+ }
+ return mbeanServer;
+
+ }
+
+ private static void setupUrlHandlers()
+ {
+ String pkgs = System.getProperty("java.protocol.handler.pkgs");
+ if (pkgs == null || pkgs.trim().length() == 0)
+ {
+ pkgs = "org.jboss.net.protocol";
+ System.setProperty("java.protocol.handler.pkgs", pkgs);
+ }
+ else if (!pkgs.contains("org.jboss.net.protocol"))
+ {
+ pkgs += "|org.jboss.net.protocol";
+ System.setProperty("java.protocol.handler.pkgs", pkgs);
+ }
+
+ }
+
+ public void start() throws Exception
+ {
+ setupUrlHandlers();
+ mbeanServer = createMBeanServer("jboss");
+ MBeanServerLocator.setJBoss(mbeanServer);
+
+ mbeanServer.registerMBean(new JMXClassLoader(Thread.currentThread().getContextClassLoader()), ServiceDeployer.DEFAULT_CLASSLOADER_OBJECT_NAME);
+
+ controller = new ServiceController();
+ controller.setKernel(kernel);
+ controller.setMBeanServer(mbeanServer);
+ mbeanServer.registerMBean(controller, new ObjectName("jboss.system:service=ServiceController"));
+ // Register mbeanServer components
+ mbeanServer.registerMBean(this, ServerImplMBean.OBJECT_NAME);
+ mbeanServer.registerMBean(new ServerConfigImpl(new ServerConfig()), ServerConfigImplMBean.OBJECT_NAME);
+ started = true;
+ }
+
+ /**
+ * Stop the mbeans
+ *
+ * @throws IllegalStateException - if not started.
+ */
+ public void stop() throws IllegalStateException
+ {
+ if (log.isTraceEnabled())
+ log.trace("stop caller:", new Throwable("Here"));
+
+ if (!started)
+ throw new IllegalStateException("Server not started");
+
+ log.debug("Shutting down all services");
+ shutdownServices();
+
+ // Make sure all mbeans are unregistered
+ removeMBeans();
+ }
+
+ /**
+ * The <code>shutdownServices</code> method calls the one and only
+ * ServiceController to shut down all the mbeans registered with it.
+ */
+ protected void shutdownServices()
+ {
+ try
+ {
+ // get the deployed objects from ServiceController
+ controller.shutdown();
+ }
+ catch (Exception e)
+ {
+ Throwable t = JMXExceptionDecoder.decode(e);
+ log.error("Failed to shutdown services", t);
+ }
+ }
+
+ /**
+ * The <code>removeMBeans</code> method uses the mbean mbeanServer to unregister
+ * all the mbeans registered here.
+ */
+ protected void removeMBeans()
+ {
+ try
+ {
+ mbeanServer.unregisterMBean(ServiceControllerMBean.OBJECT_NAME);
+ }
+ catch (Exception e)
+ {
+ Throwable t = JMXExceptionDecoder.decode(e);
+ log.error("Failed to unregister mbeans", t);
+ }
+ }
+
+
+ public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
+ {
+ broadcasterSupport.addNotificationListener(listener, filter, handback);
+ }
+
+ public void removeNotificationListener(NotificationListener listener)
+ throws ListenerNotFoundException
+ {
+ broadcasterSupport.removeNotificationListener(listener);
+ }
+
+ public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
+ throws ListenerNotFoundException
+ {
+ broadcasterSupport.removeNotificationListener(listener, filter, handback);
+ }
+
+ public MBeanNotificationInfo[] getNotificationInfo()
+ {
+ return broadcasterSupport.getNotificationInfo();
+ }
+
+ public void sendNotification(Notification notification)
+ {
+ broadcasterSupport.sendNotification(notification);
+ }
+
+
+ public void runGarbageCollector()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void runFinalization()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void traceMethodCalls(Boolean flag)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void traceInstructions(Boolean flag)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Date getStartDate()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getVersion()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getVersionName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getBuildNumber()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getBuildJVM()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getBuildOS()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getBuildID()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getBuildDate()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isInShutdown()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void init(Properties props) throws IllegalStateException, Exception
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ServerConfig getConfig() throws IllegalStateException
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean isStarted()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void shutdown() throws IllegalStateException
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void exit(int exitcode)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void exit()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void halt(int exitcode)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void halt()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/JMXKernelMBean.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+import org.jboss.system.server.ServerImplMBean;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public interface JMXKernelMBean extends ServerImplMBean
+{
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/ServerConfig.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,174 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+import org.jboss.system.server.BaseServerConfig;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class ServerConfig implements org.jboss.system.server.ServerConfig
+{
+ private String tempDir = System.getProperty("java.io.tmpdir");
+
+
+ public String getTempDir()
+ {
+ return tempDir;
+ }
+
+ public void setTempDir(String tempDir)
+ {
+ this.tempDir = tempDir;
+ }
+
+ public File getHomeDir()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public URL getHomeURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public URL getLibraryURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public URL getPatchURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getServerName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public File getServerBaseDir()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public File getServerHomeDir()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public File getServerLogDir()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public File getServerTempDir()
+ {
+ return new File(tempDir);
+ }
+
+ public File getServerDataDir()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public URL getServerBaseURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public URL getServerHomeURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public URL getServerLibraryURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public URL getServerConfigURL()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean getPlatformMBeanServer()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setExitOnShutdown(boolean flag)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean getExitOnShutdown()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean getBlockingShutdown()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setBlockingShutdown(boolean blockingShutdown)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean getRequireJBossURLStreamHandlerFactory()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setRequireJBossURLStreamHandlerFactory(boolean requireJBossURLStreamHandlerFactory)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setRootDeploymentFilename(String filename)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRootDeploymentFilename()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public File getServerNativeDir()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public File getServerTempDeployDir()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: trunk/embedded/src/main/java/org/jboss/embedded/Test.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/Test.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/java/org/jboss/embedded/Test.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,120 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFS;
+
+import java.net.URL;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public class Test
+{
+
+ private static VirtualFile getFile(ClassLoader classLoader, String resource)
+ {
+ URL url = classLoader.getResource(resource);
+ VirtualFile file = null;
+ try
+ {
+ file = VFS.getRoot(url);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to find resource: " + resource, e);
+ }
+ return file;
+
+ }
+ private static URL getDirFromResource(ClassLoader loader, String resource) throws Exception
+ {
+ int idx = resource.indexOf("/.");
+ String base = resource;
+ String relative = null;
+ if (idx != -1)
+ {
+ base = resource.substring(0, idx);
+ relative = resource.substring(idx + 1);
+ }
+ URL url = loader.getResource(base);
+ String urlAsString = url.toString();
+ String[] paths = urlAsString.split("/");
+ int last = paths.length - 2;
+ if (relative != null)
+ {
+ String[] relativePaths = relative.split("/");
+ int relativeStart = 0;
+ for (String relativePath : relativePaths)
+ {
+ if (relativePath.equals(".."))
+ {
+ last--;
+ relativeStart++;
+ }
+ else if (relativePath.equals("."))
+ {
+ relativeStart++;
+ }
+ else
+ {
+ break;
+ }
+ }
+ urlAsString = "";
+ for (int i = 0; i <= last; i++)
+ {
+ urlAsString += paths[i] + "/";
+ }
+ for (int i = relativeStart; i < relativePaths.length; i++)
+ {
+ urlAsString += relativePaths[i] + "/";
+ }
+ }
+ else
+ {
+ urlAsString = "";
+ for (int i = 0; i <= last; i++)
+ {
+ urlAsString += paths[i] + "/";
+ }
+
+ }
+ url = new URL(urlAsString);
+ return url;
+ }
+
+ public static void main(String[] args) throws Exception
+ {
+ System.out.println(getFile(Thread.currentThread().getContextClassLoader(), "org/jboss/embedded/Test.class").toURL());
+ System.out.println("url: " + getDirFromResource(Thread.currentThread().getContextClassLoader(), "org/jboss/embedded/Test.class/../../.."));
+ System.out.println("url: " + getDirFromResource(Thread.currentThread().getContextClassLoader(), "org/jboss/embedded/Test.class/../../../javax/ejb"));
+ System.out.println("url: " + getDirFromResource(Thread.currentThread().getContextClassLoader(), "org/jboss/embedded/Test.class"));
+ System.out.println("url: " + getDirFromResource(Thread.currentThread().getContextClassLoader(), "org/jboss/embedded/Test.class/./javax/ejb"));
+
+ }
+
+}
Added: trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/conf/bootstrap-beans.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ The bootstrap of the server
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- The legacy JMX kernel -->
+ <bean name="JMXKernel" class="org.jboss.embedded.JMXKernel">
+ <property name="kernel">
+ <inject bean="jboss.kernel:service=Kernel"/>
+ </property>
+ </bean>
+
+ <!-- The MainDeployer -->
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.deployment.MainDeployerImpl">
+ <property name="structureDeployers">
+ <list>
+ <!-- A declared structure descriptor deployer -->
+ <bean name="DeclaredStructure" class="org.jboss.deployers.plugins.structure.vfs.explicit.DeclaredStructure">
+ </bean>
+ <!-- JAR Structure -->
+ <bean name="JARStructure" class="org.jboss.deployers.plugins.structure.vfs.jar.JARStructure">
+ <!-- Unless specified the default list of suffixes is .zip, .ear, .jar, ,.rar, .war, .sar, .har, .aop -->
+ <constructor>
+ <parameter>
+ <set elementClass="java.lang.String">
+ <value>.zip</value>
+ <value>.ear</value>
+ <value>.jar</value>
+ <value>.rar</value>
+ <value>.war</value>
+ <value>.sar</value>
+ <value>.har</value>
+ <value>.aop</value>
+ <value>.deployer</value>
+ <value>.beans</value>
+ </set>
+ </parameter>
+ </constructor>
+ <property name="candidateStructureVisitorFactory">
+ <!-- Any file that is not an ordinary directory is a candidate -->
+ <bean name="JARStructureCandidates"
+ class="org.jboss.deployers.plugins.structure.vfs.jar.JARCandidateStructureVisitorFactory">
+ <!-- A filter to exclude some obvious non-subdeployments -->
+ <property name="filter">
+ <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
+ <constructor>
+ <parameter>
+ <list elementClass="java.lang.String">
+ <!-- Exclude class files as subdeployments -->
+ <value>.class</value>
+ </list>
+ </parameter>
+ </constructor>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+ <!-- File Structure -->
+ <bean name="FileStructure" class="org.jboss.deployers.plugins.structure.vfs.file.FileStructure">
+ <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
+ <constructor>
+ <parameter>
+ <set elementClass="java.lang.String">
+ <value>-service.xml</value>
+ <value>-beans.xml</value>
+ <value>-ds.xml</value>
+ <value>-aop.xml</value>
+ </set>
+ </parameter>
+ </constructor>
+ </bean>
+ </list>
+ </property>
+ <property name="deployers">
+ <list>
+ <!-- POJO Deployment -->
+ <bean name="BeanDeployer" class="org.jboss.deployers.plugins.deployers.kernel.BeanDeployer"/>
+ <bean name="KernelDeploymentDeployer"
+ class="org.jboss.deployers.plugins.deployers.kernel.KernelDeploymentDeployer"/>
+ <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.plugins.deployers.kernel.BeanMetaDataDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="jboss.kernel:service=Kernel"/>
+ </parameter>
+ </constructor>
+ </bean>
+ <!-- JMX Deployment -->
+ <bean name="SARDeployer" class="org.jboss.system.deployers.SARDeployer"/>
+ <bean name="ServiceClassLoaderDeployer" class="org.jboss.embedded.ClassLoaderDeployer"/>
+ <bean name="ServiceDeploymentDeployer" class="org.jboss.system.deployers.ServiceDeploymentDeployer"/>
+ <bean name="ServiceDeployer" class="org.jboss.system.deployers.ServiceDeployer">
+ <constructor>
+ <parameter>
+ <inject bean="JMXKernel" property="serviceController"/>
+ </parameter>
+ </constructor>
+ </bean>
+ </list>
+ </property>
+ </bean>
+
+ <!-- A filter for excluding files from the scanner -->
+ <bean name="DeploymentFilter" class="org.jboss.virtual.plugins.vfs.helpers.ExtensibleFilter">
+ <!-- Files starting with theses strings are ignored -->
+ <property name="prefixes">#,%,\,,.,_$</property>
+ <!-- Files ending with theses strings are ignored -->
+ <property name="suffixes">#,$,%,~,\,v,.BAK,.bak,.old,.orig,.tmp,.rej,.sh</property>
+ <!-- Files matching with theses strings are ignored -->
+ <property name="matches">.make.state,.nse_depinfo,CVS,CVS.admin,RCS,RCSLOG,SCCS,TAGS,core,tags</property>
+ </bean>
+
+ <!--
+ JNDI Initialization of basic beans (NO REMOTING)
+ -->
+ <bean name="Naming" class="org.jnp.server.SingletonNamingServer"/>
+ <bean name="java:comp" class="org.jboss.naming.JavaCompInitializer"/>
+
+ <!--
+ Bootstrap old JMX-based core services
+ setup deployers
+ setup deploy/ directory
+ -->
+ <bean name="ResourcesToDeploy" class="org.jboss.embedded.ClasspathResourceScanner">
+ <property name="filter"><inject bean="DeploymentFilter"/></property>
+ <property name="mainDeployer">
+ <inject bean="MainDeployer"/>
+ </property>
+ <property name="resources">
+ <list elementClass="java.lang.String">
+ <value>conf/jboss-service.xml</value>
+ </list>
+ </property>
+ <property name="deployDirsByResource">
+ <list elementClass="java.lang.String">
+ <value>conf/jboss-service.xml/../deployers</value>
+ <value>conf/jboss-service.xml/../deploy</value>
+ </list>
+ </property>
+ </bean>
+</deployment>
Added: trunk/embedded/src/main/resources/javase/conf/jboss-service.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/conf/jboss-service.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/conf/jboss-service.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id: jboss-service.xml 58969 2006-12-11 01:17:41Z scott.stark at jboss.org $ -->
+
+<!-- ===================================================================== -->
+<!-- JBoss Server Configuration -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <!-- ==================================================================== -->
+ <!-- Main Deployer -->
+ <!-- ==================================================================== -->
+ <mbean code="org.jboss.deployment.MainDeployer"
+ name="jboss.system:service=MainDeployer">
+ <!-- This is used to delegate the deployment handling -->
+ <attribute name="KernelMainDeployer"><inject bean="MainDeployer" /></attribute>
+ </mbean>
+
+ <!-- ==================================================================== -->
+ <!-- SAR Deployer -->
+ <!-- ==================================================================== -->
+ <mbean code="org.jboss.deployment.SARDeployer"
+ name="jboss.system:service=ServiceDeployer">
+ <depends>jboss.system:service=MainDeployer</depends>
+ </mbean>
+
+ <!-- ==================================================================== -->
+ <!-- Security -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.security.plugins.SecurityConfig"
+ name="jboss.security:service=SecurityConfig">
+ <attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>
+ <depends>jboss.security:service=XMLLoginConfig</depends>
+ </mbean>
+ <mbean code="org.jboss.security.auth.login.XMLLoginConfig"
+ name="jboss.security:service=XMLLoginConfig">
+ <attribute name="ConfigResource">conf/login-config.xml</attribute>
+ </mbean>
+
+ <!-- JAAS security manager and realm mapping -->
+ <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
+ name="jboss.security:service=JaasSecurityManager">
+ <!-- A flag which indicates whether the SecurityAssociation server mode
+ is set on service creation. This is true by default since the
+ SecurityAssociation should be thread local for multi-threaded server
+ operation.
+ -->
+ <attribute name="ServerMode">true</attribute>
+ <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
+ <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
+ <!-- DefaultCacheTimeout: Specifies the default timed cache policy timeout
+ in seconds.
+ If you want to disable caching of security credentials, set this to 0 to
+ force authentication to occur every time. This has no affect if the
+ AuthenticationCacheJndiName has been changed from the default value.
+ -->
+ <attribute name="DefaultCacheTimeout">1800</attribute>
+ <!-- DefaultCacheResolution: Specifies the default timed cache policy
+ resolution in seconds. This controls the interval at which the cache
+ current timestamp is updated and should be less than the DefaultCacheTimeout
+ in order for the timeout to be meaningful. This has no affect if the
+ AuthenticationCacheJndiName has been changed from the default value.
+ -->
+ <attribute name="DefaultCacheResolution">60</attribute>
+ <!-- DeepCopySubjectMode: This set the copy mode of subjects done by the
+ security managers to be deep copies that makes copies of the subject
+ principals and credentials if they are cloneable. It should be set to
+ true if subject include mutable content that can be corrupted when
+ multiple threads have the same identity and cache flushes/logout clearing
+ the subject in one thread results in subject references affecting other
+ threads.
+ -->
+ <attribute name="DeepCopySubjectMode">false</attribute>
+ </mbean>
+
+ <!-- Authorization manager-->
+ <mbean code="org.jboss.security.plugins.AuthorizationManagerService"
+ name="jboss.security:service=AuthorizationManager">
+ <attribute name="AuthorizationManagerClassName">org.jboss.security.plugins.JBossAuthorizationManager</attribute>
+ </mbean>
+
+ <!-- ==================================================================== -->
+ <!-- Transactions -->
+ <!-- ==================================================================== -->
+ <!-- The configurable Xid factory. For use with Oracle, set pad to true -->
+ <mbean code="org.jboss.tm.XidFactory"
+ name="jboss:service=XidFactory">
+ <!--attribute name="Pad">true</attribute-->
+ </mbean>
+
+ <!-- JBossTS JTA -->
+ <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
+ name="jboss:service=TransactionManager">
+ <attribute name="TransactionTimeout">300</attribute>
+ </mbean>
+
+ <mbean code="org.jboss.util.threadpool.BasicThreadPool"
+ name="jboss.jca:service=WorkManagerThreadPool">
+ <!-- The name that appears in thread names -->
+ <attribute name="Name">WorkManager</attribute>
+ <!-- The maximum amount of work in the queue -->
+ <attribute name="MaximumQueueSize">1024</attribute>
+ <!-- The maximum number of active threads -->
+ <attribute name="MaximumPoolSize">100</attribute>
+ <!-- How long to keep threads alive after their last work (default one minute) -->
+ <attribute name="KeepAliveTime">60000</attribute>
+ </mbean>
+
+ <mbean code="org.jboss.resource.work.JBossWorkManager"
+ name="jboss.jca:service=WorkManager">
+ <depends optional-attribute-name="ThreadPoolName">jboss.jca:service=WorkManagerThreadPool</depends>
+ <depends optional-attribute-name="XATerminatorName">jboss:service=TransactionManager</depends>
+ </mbean>
+
+ <!--
+ | The CachedConnectionManager is used partly to relay started UserTransactions to
+ | open connections so they may be enrolled in the new tx.
+ -->
+ <mbean code="org.jboss.resource.connectionmanager.CachedConnectionManager"
+ name="jboss.jca:service=CachedConnectionManager">
+ <depends optional-attribute-name="TransactionManagerServiceName">jboss:service=TransactionManager</depends>
+
+ <!-- Enable connection close debug monitoring -->
+ <attribute name="Debug">true</attribute>
+
+ </mbean>
+
+ <mbean code="org.jboss.naming.JNDIView"
+ name="jboss:service=JNDIView"
+ xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
+ <!-- The HANamingService service name -->
+ <attribute name="HANamingService">jboss:service=HAJNDI</attribute>
+ </mbean>
+
+</server>
Added: trunk/embedded/src/main/resources/javase/conf/login-config.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/conf/login-config.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/conf/login-config.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,75 @@
+<?xml version='1.0'?>
+
+<!DOCTYPE policy PUBLIC
+ "-//JBoss//DTD JBOSS Security Config 3.0//EN"
+ "http://www.jboss.org/j2ee/dtd/security_config.dtd">
+
+<!-- The XML based JAAS login configuration read by the
+org.jboss.security.auth.login.XMLLoginConfig mbean. Add
+an application-policy element for each security domain.
+
+The outline of the application-policy is:
+<application-policy name="security-domain-name">
+ <authentication>
+ <login-module code="login.module1.class.name" flag="control_flag">
+ <module-option name = "option1-name">option1-value</module-option>
+ <module-option name = "option2-name">option2-value</module-option>
+ ...
+ </login-module>
+
+ <login-module code="login.module2.class.name" flag="control_flag">
+ ...
+ </login-module>
+ ...
+ </authentication>
+</application-policy>
+
+$Revision: 42748 $
+-->
+
+<policy>
+ <application-policy name="HsqlDbRealm">
+ <authentication>
+ <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
+ flag="required">
+ <module-option name="principal">sa</module-option>
+ <module-option name="userName">sa</module-option>
+ <module-option name="password"></module-option>
+ <module-option name="managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <!-- Used by clients within the application server VM such as
+ mbeans and servlets that access EJBs.
+ -->
+ <application-policy name="client-login">
+ <authentication>
+ <login-module code="org.jboss.security.ClientLoginModule"
+ flag="required">
+ <!-- Any existing security context will be restored on logout -->
+ <module-option name="restore-login-identity">true</module-option>
+ </login-module>
+ </authentication>
+ </application-policy>
+
+ <application-policy name="other">
+ <!-- A simple server login module, which can be used when the number
+ of users is relatively small. It uses two properties files:
+ users.properties, which holds users (key) and their password (value).
+ roles.properties, which holds users (key) and a comma-separated list of
+ their roles (value).
+ The unauthenticatedIdentity property defines the name of the principal
+ that will be used when a null username and password are presented as is
+ the case for an unuathenticated web client or MDB. If you want to
+ allow such users to be authenticated add the property, e.g.,
+ unauthenticatedIdentity="nobody"
+ -->
+ <authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag="required"/>
+ </authentication>
+ </application-policy>
+
+</policy>
+
Added: trunk/embedded/src/main/resources/javase/deploy/ejb3-interceptors-aop.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/deploy/ejb3-interceptors-aop.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/deploy/ejb3-interceptors-aop.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,360 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE aop PUBLIC
+ "-//JBoss//DTD JBOSS AOP 1.0//EN"
+ "http://labs.jboss.com/portal/jbossaop/dtd/jboss-aop_1_0.dtd">
+
+<aop>
+ <interceptor class="org.jboss.aspects.remoting.InvokeRemoteInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.aspects.security.SecurityClientInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.aspects.tx.ClientTxPropagationInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.remoting.IsLocalInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.aspects.remoting.ClusterChooserInterceptor" scope="PER_VM"/>
+
+ <interceptor class="org.jboss.aspects.tx.TxPropagationInterceptor" scope="PER_VM"/>
+
+ <stack name="ServiceClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="AsynchronousStatelessSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="AsynchronousStatefulSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="StatelessSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="StatefulSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="ClusteredStatelessSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <stack name="ClusteredStatefulSessionClientInterceptors">
+ <interceptor-ref name="org.jboss.ejb3.remoting.IsLocalInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.security.SecurityClientInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.ClientTxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.ClusterChooserInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.remoting.InvokeRemoteInterceptor"/>
+ </stack>
+
+ <interceptor class="org.jboss.ejb3.asynchronous.AsynchronousInterceptor" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.ENCPropagationInterceptor" scope="PER_VM"/>
+ <interceptor name="Basic Authorization" factory="org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor name="JACC Authorization" factory="org.jboss.ejb3.security.JaccAuthorizationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor factory="org.jboss.ejb3.security.AuthenticationInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor factory="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.stateless.StatelessInstanceInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.stateful.StatefulInstanceInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.service.ServiceSingletonInterceptor" scope="PER_VM"/>
+ <interceptor class="org.jboss.ejb3.cache.StatefulReplicationInterceptor" scope="PER_VM"/>
+ <interceptor factory="org.jboss.ejb3.stateful.StatefulRemoveFactory" scope="PER_CLASS_JOINPOINT"/>
+ <interceptor factory="org.jboss.ejb3.tx.TxInterceptorFactory" scope="PER_CLASS_JOINPOINT"/>
+ <interceptor factory="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory" scope="PER_CLASS_JOINPOINT"/>
+ <interceptor factory="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.AllowedOperationsInterceptor" scope="PER_VM"/>
+ <interceptor factory="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory" scope="PER_CLASS"/>
+ <interceptor class="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor" scope="PER_VM"/>
+
+ <domain name="Stateless Bean">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+ @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="JACC Stateless Bean">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))">
+ <interceptor-ref name="JACC Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+ @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Base Stateful Bean">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+
+ <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+ @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
+ <!-- NON Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND !class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.simple.SimpleStatefulCache.class)
+ </annotation>
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.PersistenceManager) AND !class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.simple.PersistenceManager (org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.class)
+ </annotation>
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=300)
+ </annotation>
+
+ <!-- Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.tree.StatefulTreeCache.class)
+ </annotation>
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.tree.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300)
+ </annotation>
+ </domain>
+
+ <domain name="JACC Stateful Bean">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))">
+ <interceptor-ref name="JACC Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulRemoveFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.StatefulInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * $instanceof{javax.ejb.SessionSynchronization}->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateful.SessionSynchronizationInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+
+ <bind pointcut="execution(public * @org.jboss.annotation.ejb.Clustered->*(..)) AND !execution(public * *->@javax.ejb.Remove(..))">
+ <interceptor-ref name="org.jboss.ejb3.cache.StatefulReplicationInterceptor"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+ @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.ThreadlocalPool.class, maxSize=30, timeout=10000)
+ </annotation>
+
+ <!-- NON Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND !class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.simple.SimpleStatefulCache.class)
+ </annotation>
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.PersistenceManager) AND !class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.simple.PersistenceManager (org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager.class)
+ </annotation>
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.simple.CacheConfig) AND !class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.simple.CacheConfig (maxSize=100000, idleTimeoutSeconds=300)
+ </annotation>
+
+ <!-- Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.tree.StatefulTreeCache.class)
+ </annotation>
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.tree.CacheConfig) AND class(@org.jboss.annotation.ejb.Clustered)">
+ @org.jboss.annotation.ejb.cache.tree.CacheConfig (name="jboss.cache:service=EJB3SFSBClusteredCache", maxSize=100000, idleTimeoutSeconds=300)
+ </annotation>
+ </domain>
+
+ <domain name="Embedded Stateful Bean" extends="Base Stateful Bean" inheritBindings="true">
+ <!-- NON Clustered cache configuration -->
+ <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache)">
+ @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.NoPassivationCache.class)
+ </annotation>
+
+ </domain>
+
+ <domain name="Message Driven Bean">
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+ @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Consumer Bean">
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..)) AND (has(* *->@org.jboss.annotation.ejb.CurrentMessage(..)) OR hasfield(* *->@org.jboss.annotation.ejb.CurrentMessage))">
+ <interceptor-ref name="org.jboss.ejb3.mdb.CurrentMessageInjectorInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+ <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
+ @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=30, timeout=10000)
+ </annotation>
+ </domain>
+
+ <domain name="Service Bean">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ </bind>
+ <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())">
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+ </domain>
+
+ <domain name="JACC Service Bean">
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.asynchronous.AsynchronousInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/>
+ </bind>
+ <bind pointcut="!execution(* *->create()) AND !execution(* *->start()) AND !execution(*->new(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * @org.jboss.annotation.security.SecurityDomain->*(..))">
+ <interceptor-ref name="Basic Authorization"/>
+ </bind>
+ <bind pointcut="execution(public * @javax.annotation.security.RunAs->*(..))">
+ <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..))">
+ <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.tx.TxInterceptorFactory"/>
+ <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/>
+ <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>
+ </bind>
+ <bind pointcut="execution(public * *->*(..)) AND !execution(* *->create()) AND !execution(* *->start())">
+ <interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/>
+ </bind>
+ </domain>
+
+
+</aop>
\ No newline at end of file
Added: trunk/embedded/src/main/resources/javase/deploy/hsqldb-ds.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/deploy/hsqldb-ds.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/deploy/hsqldb-ds.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- The Hypersonic embedded database JCA connection factory config -->
+
+<!-- $Id: hsqldb-ds.xml 39791 2006-01-10 18:14:42Z dimitris $ -->
+
+<datasources>
+ <local-tx-datasource>
+
+ <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
+ <!-- Datasources are not available outside the virtual machine -->
+ <jndi-name>DefaultDS</jndi-name>
+
+ <!-- For server mode db, allowing other processes to use hsqldb over tcp.
+ This requires the org.jboss.jdbc.HypersonicDatabase mbean.
+ <connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:1701</connection-url>
+ -->
+ <!-- For totally in-memory db, not saved when jboss stops.
+ The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ -->
+ <!-- For in-process persistent db, saved when jboss stops.
+ The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
+ -->
+ <connection-url>jdbc:hsqldb:.</connection-url>
+
+ <!-- The driver class -->
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+
+ <!-- The login and password -->
+ <user-name>sa</user-name>
+ <password></password>
+
+ <!--example of how to specify class that determines if exception means connection should be destroyed-->
+ <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
+
+ <!-- this will be run before a managed connection is removed from the pool for use by a client-->
+ <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
+
+ <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
+ <min-pool-size>5</min-pool-size>
+
+ <!-- The maximum connections in a pool/sub-pool -->
+ <max-pool-size>20</max-pool-size>
+
+ <!-- The time before an unused connection is destroyed -->
+ <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
+ <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
+ <idle-timeout-minutes>0</idle-timeout-minutes>
+
+ <!-- sql to call when connection is created
+ <new-connection-sql>some arbitrary sql</new-connection-sql>
+ -->
+
+ <!-- sql to call on an existing pooled connection when it is obtained from pool
+ <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
+ -->
+
+ <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
+ <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
+ -->
+
+ <!-- Whether to check all statements are closed when the connection is returned to the pool,
+ this is a debugging feature that should be turned off in production -->
+ <track-statements/>
+
+ <!-- Use the getConnection(user, pw) for logins
+ <application-managed-security/>
+ -->
+
+ <!-- Use the security domain defined in conf/login-config.xml -->
+ <security-domain>HsqlDbRealm</security-domain>
+
+ <!-- Use the security domain defined in conf/login-config.xml or the
+ getConnection(user, pw) for logins. The security domain takes precedence.
+ <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
+ -->
+
+ <!-- HSQL DB benefits from prepared statement caching -->
+ <prepared-statement-cache-size>32</prepared-statement-cache-size>
+
+ </local-tx-datasource>
+
+</datasources>
Added: trunk/embedded/src/main/resources/javase/deployers/aspect-deployer-beans.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/deployers/aspect-deployer-beans.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/deployers/aspect-deployer-beans.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Aspect Deployer
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <!-- Aspect Deployment -->
+ <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+</deployment>
Added: trunk/embedded/src/main/resources/javase/deployers/ejb3-deployers-beans.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/deployers/ejb3-deployers-beans.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/deployers/ejb3-deployers-beans.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JCA Deployers
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="DefaultPersistenceProperties" class="org.jboss.ejb3.DefaultPersistenceProperties"/>
+
+ <bean name="EJBRegistrationDeployer" class="org.jboss.ejb3.deployers.EJBRegistrationDeployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="defaultPersistenceProperties"><inject bean="DefaultPersistenceProperties" property="properties"/></property>
+ <property name="ignoredJarsSet">
+ <set elementClass="java.lang.String">
+ <value>snmp-adaptor.jar</value>
+ <value>otherimages.jar</value>
+ <value>applet.jar</value>
+ <value>jcommon.jar</value>
+ <value>console-mgr-classes.jar</value>
+ <value>jfreechart.jar</value>
+ <value>juddi-service.jar</value>
+ <value>wsdl4j.jar</value>
+ <value>commons-collections.jar</value>
+ <value>commons-pool.jar</value>
+ <value>juddi.jar</value>
+ <value>commons-discovery.jar</value>
+ <value>uddi4j.jar</value>
+ <value>axis.jar</value>
+ <value>commons-dbcp.jar</value>
+ <value>jboss-juddiaxis.jar</value>
+ <value>trove.jar</value>
+ <value>javassist.jar</value>
+ <value>jboss-aop-jdk50.jar</value>
+ <value>jboss-aspect-library-jdk50.jar</value>
+ <value>ejb3-persistence.jar</value>
+ <value>commons-validator-1.1.3.jar</value>
+ <value>commons-collections.jar</value>
+ <value>commons-fileupload.jar</value>
+ <value>commons-pool.jar</value>
+ <value>hibernate-entitymanager.jar</value>
+ <value>jboss-ejb3x.jar</value>
+ <value>commons-digester-1.6.jar</value>
+ <value>cglib-2.1.1.jar</value>
+ <value>commons-discovery.jar</value>
+ <value>jboss-annotations-ejb3.jar</value>
+ <value>jaxen-1.1-beta-4.jar</value>
+ <value>hibernate-annotations.jar</value>
+ <value>commons-httpclient.jar</value>
+ <value>commons-logging.jar</value>
+ <value>commons-vfs.jar</value>
+ <value>hibernate3.jar</value>
+ <value>commons-logging-api.jar</value>
+ <value>asm.jar</value>
+ <value>asm-attrs.jar</value>
+ <value>commons-lang-2.0.jar</value>
+ <value>commons-beanutils.jar</value>
+ <value>jboss-ejb3.jar</value>
+ <value>dom4j.jar</value>
+ <value>commons-codec-1.2.jar</value>
+ <value>wsdl4j.jar</value>
+ <value>xmlsec.jar</value>
+ <value>jbossws.jar</value>
+ <value>jboss-bean-deployer.jar</value>
+ <value>jboss-microcontainer.jar</value>
+ <value>jboss-dependency.jar</value>
+ <value>jboss-container.jar</value>
+ <value>tomcat-coyote.jar</value>
+ <value>commons-collections.jar</value>
+ <value>myfaces.jar</value>
+ <value>jstl.jar</value>
+ <value>commons-digester-1.6.jar</value>
+ <value>myfaces-impl.jar</value>
+ <value>commons-beanutils.jar</value>
+ <value>myfaces-jsf-api.jar</value>
+ <value>commons-codec-1.2.jar</value>
+ <value>catalina-optional.jar</value>
+ <value>tomcat-util.jar</value>
+ <value>jasper-compiler.jar</value>
+ <value>commons-el.jar</value>
+ <value>jasper-compiler-jdt.jar</value>
+ <value>tomcat-http.jar</value>
+ <value>catalina-manager.jar</value>
+ <value>jasper-runtime.jar</value>
+ <value>tomcat55-service.jar</value>
+ <value>servlets-invoker.jar</value>
+ <value>catalina.jar</value>
+ <value>naming-resources.jar</value>
+ <value>servlets-default.jar</value>
+ <value>tomcat-ajp.jar</value>
+ <value>commons-modeler.jar</value>
+ <value>tomcat-apr.jar</value>
+ <value>servlets-webdav.jar</value>
+ </set>
+ </property>
+ <depends>AspectDeployer</depends>
+ </bean>
+ <bean name="EJBStage2Deployer" class="org.jboss.ejb3.deployers.EJBStage2Deployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter>
+ <this/>
+ </parameter>
+ </uninstall>
+ <depends>AspectDeployer</depends>
+ </bean>
+
+</deployment>
Added: trunk/embedded/src/main/resources/javase/deployers/jca-deployers-beans.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/deployers/jca-deployers-beans.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/deployers/jca-deployers-beans.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JCA Deployers
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- RAR Deployment -->
+ <bean name="RARParserDeployer" class="org.jboss.resource.deployers.RARParserDeployer">
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+ <bean name="RARDeployer" class="org.jboss.resource.deployers.RARDeployer">
+ <property name="workManagerName">jboss.jca:service=WorkManager</property>
+ <property name="XATerminatorName">jboss:service=TransactionManager</property>
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+
+ <!-- ConnectionFactory Deployment -->
+ <bean name="ConnectionFactoryDeployer" class="org.jboss.system.deployers.ServiceXSLDeployer">
+ <property name="suffix">-ds.xml</property>
+ <property name="XSLPath">stylesheets/NoJRMPConnectionFactoryTemplate.xsl</property>
+ <install bean="MainDeployer" method="addDeployer">
+ <parameter><this/></parameter>
+ </install>
+ <uninstall bean="MainDeployer" method="removeDeployer">
+ <parameter><this/></parameter>
+ </uninstall>
+ </bean>
+
+</deployment>
Added: trunk/embedded/src/main/resources/javase/jndi.properties
===================================================================
--- trunk/embedded/src/main/resources/javase/jndi.properties 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/jndi.properties 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,4 @@
+# DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
+#
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Added: trunk/embedded/src/main/resources/javase/log4j.xml
===================================================================
--- trunk/embedded/src/main/resources/javase/log4j.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/javase/log4j.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 39945 2006-01-12 02:44:07Z bill $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="INFO"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Messagen -->
+ <!--
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ -->
+ <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) -%m%n"/>
+ </layout>
+</appender>
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: trunk/embedded/src/main/resources/stylesheets/NoJRMPConnectionFactoryTemplate.xsl
===================================================================
--- trunk/embedded/src/main/resources/stylesheets/NoJRMPConnectionFactoryTemplate.xsl 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/main/resources/stylesheets/NoJRMPConnectionFactoryTemplate.xsl 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,790 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+ <xsl:output method="xml" indent="yes"/>
+
+ <!--top level template converts to top level "server" tag-->
+ <xsl:template match="datasources|connection-factories"><!--|server|service"-->
+
+ <server>
+
+ <xsl:apply-templates/>
+
+ </server>
+
+ </xsl:template>
+
+
+ <!-- template for generic resource adapters supporting transactions -->
+ <xsl:template match="tx-connection-factory">
+
+ <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager"
+ name="jboss.jca:service=TxCM,name={jndi-name}"
+ display-name="ConnectionManager for ConnectionFactory {jndi-name}">
+
+ <xsl:choose>
+ <xsl:when test="(xa-transaction) and (track-connection-by-tx)">
+ <attribute name="TrackConnectionByTx">true</attribute>
+ <attribute name="LocalTransactions">false</attribute>
+ </xsl:when>
+ <xsl:when test="(xa-transaction)">
+ <attribute name="TrackConnectionByTx">false</attribute>
+ <attribute name="LocalTransactions">false</attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="TrackConnectionByTx">true</attribute>
+ <attribute name="LocalTransactions">true</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="wrap-xa-resource">
+ <attribute name="WrapXAResource"><xsl:value-of select="normalize-space(wrap-xa-resource)"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="WrapXAResource">false</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="pad-xid">
+ <attribute name="PadXid"><xsl:value-of select="normalize-space(pad-xid)"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="PadXid">false</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="isSameRM-override-value">
+ <config-property name="IsSameRMOverrideValue" type="java.lang.Boolean"><xsl:value-of select="normalize-space(isSameRM-override-value)"/></config-property>
+ </xsl:if>
+
+ <xsl:if test="xa-resource-timeout">
+ <attribute name="XAResourceTransactionTimeout"><xsl:value-of select="normalize-space(xa-resource-timeout)"/></attribute>
+ </xsl:if>
+
+ <xsl:call-template name="pool">
+ <xsl:with-param name="mcf-template">generic-mcf</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="cm-common"/>
+ <xsl:call-template name="tx-manager"/>
+
+ </mbean>
+ <xsl:call-template name="cf-binding">
+ <xsl:with-param name="cm-name">jboss.jca:service=TxCM</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="type-mapping">
+ <xsl:with-param name="datasource" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <!--template for generic resource adapters that do not support transactions-->
+ <xsl:template match="no-tx-connection-factory">
+
+ <mbean code="org.jboss.resource.connectionmanager.NoTxConnectionManager"
+ name="jboss.jca:service=NoTxCM,name={jndi-name}"
+ display-name="ConnectionManager for ConnectionFactory {jndi-name}">
+
+ <xsl:call-template name="pool">
+ <xsl:with-param name="mcf-template">generic-mcf</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="cm-common"/>
+ </mbean>
+ <xsl:call-template name="cf-binding">
+ <xsl:with-param name="cm-name">jboss.jca:service=NoTxCM</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="type-mapping">
+ <xsl:with-param name="datasource" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+
+ <!-- Template for our jca-jdbc non-XADatasource (local) wrapper, using local transactions. -->
+ <xsl:template match="local-tx-datasource">
+
+ <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager"
+ name="jboss.jca:service=LocalTxCM,name={jndi-name}"
+ display-name="ConnectionManager for DataSource {jndi-name}">
+
+ <attribute name="TrackConnectionByTx">true</attribute>
+ <attribute name="LocalTransactions">true</attribute>
+
+ <xsl:call-template name="pool">
+ <xsl:with-param name="mcf-template">local-wrapper</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="cm-common"/>
+ <xsl:call-template name="tx-manager"/>
+
+ </mbean>
+ <xsl:call-template name="cf-binding">
+ <xsl:with-param name="cm-name">jboss.jca:service=LocalTxCM</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="type-mapping">
+ <xsl:with-param name="datasource" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- Template for our jca-jdbc non-XADatasource (local) wrapper, using no transactions. -->
+ <xsl:template match="no-tx-datasource">
+
+ <mbean code="org.jboss.resource.connectionmanager.NoTxConnectionManager"
+ name="jboss.jca:service=NoTxCM,name={jndi-name}"
+ display-name="ConnectionManager for DataSource {jndi-name}">
+
+ <xsl:call-template name="pool">
+ <xsl:with-param name="mcf-template">local-wrapper</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="cm-common"/>
+ </mbean>
+ <xsl:call-template name="cf-binding">
+ <xsl:with-param name="cm-name">jboss.jca:service=NoTxCM</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="type-mapping">
+ <xsl:with-param name="datasource" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- Template for our jca-jdbc XADatasource wrapper. -->
+ <xsl:template match="xa-datasource">
+
+ <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager"
+ name="jboss.jca:service=XATxCM,name={jndi-name}"
+ display-name="ConnectionManager for DataSource {jndi-name}">
+
+ <xsl:choose>
+ <xsl:when test="track-connection-by-tx">
+ <attribute name="TrackConnectionByTx">true</attribute>
+ <attribute name="LocalTransactions">false</attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="TrackConnectionByTx">false</attribute>
+ <attribute name="LocalTransactions">false</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="isSameRM-override-value">
+ <config-property name="IsSameRMOverrideValue" type="java.lang.Boolean"><xsl:value-of select="normalize-space(isSameRM-override-value)"/></config-property>
+ </xsl:if>
+
+ <xsl:choose>
+ <xsl:when test="wrap-xa-resource">
+ <attribute name="WrapXAResource"><xsl:value-of select="normalize-space(wrap-xa-resource)"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="WrapXAResource">false</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when test="pad-xid">
+ <attribute name="PadXid"><xsl:value-of select="normalize-space(pad-xid)"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="PadXid">false</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+ <xsl:if test="xa-resource-timeout">
+ <attribute name="XAResourceTransactionTimeout"><xsl:value-of select="normalize-space(xa-resource-timeout)"/></attribute>
+ </xsl:if>
+
+ <xsl:call-template name="pool">
+ <xsl:with-param name="mcf-template">xa-wrapper</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="cm-common"/>
+ <xsl:call-template name="tx-manager"/>
+
+ </mbean>
+ <xsl:call-template name="cf-binding">
+ <xsl:with-param name="cm-name">jboss.jca:service=XATxCM</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="type-mapping">
+ <xsl:with-param name="datasource" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- template to generate a property file format from a set of -->
+ <!-- <xa-datasource-property name="blah">blah-value</xa-datasource-property> -->
+ <!-- or -->
+ <!-- <connection-property name="foo">bar</connection-property> -->
+ <!-- tags. The newline in the xsl:text element is crucial! -->
+ <!-- this makes a property file format, not the ; delimited format-->
+ <xsl:template match="xa-datasource-property|connection-property">
+ <xsl:value-of select="@name"/>=<xsl:value-of select="normalize-space(.)"/><xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <!-- template to generate the ManagedConnectionFactory mbean for a generic jca adapter -->
+ <xsl:template name="generic-mcf">
+ <depends optional-attribute-name="ManagedConnectionFactoryName">
+ <!--embedded mbean-->
+ <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=ManagedConnectionFactory,name={jndi-name}" display-name="ManagedConnectionFactory for ConnectionFactory {jndi-name}">
+
+ <xsl:apply-templates select="depends" mode="anonymous"/>
+ <attribute name="ManagedConnectionFactoryProperties">
+ <properties>
+
+ <!--we need the other standard properties here-->
+ <xsl:if test="user-name">
+ <config-property name="UserName" type="java.lang.String"><xsl:value-of select="normalize-space(user-name)"/></config-property>
+ </xsl:if>
+ <xsl:if test="password">
+ <config-property name="Password" type="java.lang.String"><xsl:value-of select="normalize-space(password)"/></config-property>
+ </xsl:if>
+ <xsl:apply-templates select="config-property"/>
+ </properties>
+ </attribute>
+
+ <attribute name="RARName"><xsl:value-of select="rar-name"/></attribute>
+ <attribute name="ConnectionDefinition"><xsl:value-of select="connection-definition"/></attribute>
+
+ <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name='<xsl:value-of select="rar-name"/>'</depends>
+
+ </mbean>
+ </depends>
+ </xsl:template>
+
+ <!-- template to copy config-property elements. This actually does a literal copy -->
+ <!-- Please keep this for consistency with the jb4 version which does not do a literal copy -->
+ <xsl:template match="config-property">
+ <config-property name="{@name}" type="{@type}"><xsl:apply-templates/></config-property>
+ </xsl:template>
+
+ <!-- template to generate the ManagedConnectionFactory mbean for our jca-jdbc local wrapper -->
+ <xsl:template name="local-wrapper">
+
+ <depends optional-attribute-name="ManagedConnectionFactoryName">
+ <!--embedded mbean-->
+ <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=ManagedConnectionFactory,name={jndi-name}" display-name="ManagedConnectionFactory for DataSource {jndi-name}">
+
+ <xsl:apply-templates select="depends" mode="anonymous"/>
+
+ <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name='jboss-local-jdbc.rar'</depends>
+ <attribute name="RARName"><xsl:value-of select="jboss-local-jdbc.rar"/></attribute>
+ <attribute name="ConnectionDefinition">javax.sql.DataSource</attribute>
+
+ <attribute name="ManagedConnectionFactoryProperties">
+ <properties>
+ <config-property name="ConnectionURL" type="java.lang.String"><xsl:value-of select="normalize-space(connection-url)"/></config-property>
+ <config-property name="DriverClass" type="java.lang.String"><xsl:value-of select="normalize-space(driver-class)"/></config-property>
+
+ <xsl:call-template name="wrapper-common-properties"/>
+ <xsl:if test="connection-property">
+ <config-property name="ConnectionProperties" type="java.lang.String">
+ <xsl:apply-templates select="connection-property"/>
+ </config-property>
+ </xsl:if>
+
+ </properties>
+ </attribute>
+ </mbean>
+ </depends>
+ </xsl:template>
+
+ <xsl:template name="xa-wrapper">
+ <depends optional-attribute-name="ManagedConnectionFactoryName">
+ <!--embedded mbean-->
+ <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
+ name="jboss.jca:service=ManagedConnectionFactory,name={jndi-name}"
+ displayname="ManagedConnectionFactory for DataSource {jndi-name}">
+
+ <xsl:apply-templates select="depends" mode="anonymous"/>
+
+ <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name='jboss-xa-jdbc.rar'</depends>
+ <attribute name="RARName"><xsl:value-of select="jboss-xa-jdbc.rar"/></attribute>
+ <attribute name="ConnectionDefinition">javax.sql.DataSource</attribute>
+
+ <attribute name="ManagedConnectionFactoryProperties">
+ <properties>
+ <config-property name="XADataSourceClass" type="java.lang.String"><xsl:value-of select="normalize-space(xa-datasource-class)"/></config-property>
+
+ <config-property name="XADataSourceProperties" type="java.lang.String">
+ <xsl:apply-templates select="xa-datasource-property"/>
+ </config-property>
+
+ <!-- remove for new XA handling
+ <xsl:if test="isSameRM-override-value">
+ <config-property name="IsSameRMOverrideValue" type="java.lang.Boolean"><xsl:value-of select="normalize-space(isSameRM-override-value)"/></config-property>
+ </xsl:if>
+ -->
+ <xsl:call-template name="wrapper-common-properties"/>
+
+ </properties>
+ </attribute>
+ </mbean>
+ </depends>
+ </xsl:template>
+
+ <!-- template for the ManagedConnectionFactory properties shared between our local and xa wrappers -->
+ <xsl:template name="wrapper-common-properties">
+
+ <xsl:if test="transaction-isolation">
+ <config-property name="TransactionIsolation" type="java.lang.String"><xsl:value-of select="normalize-space(transaction-isolation)"/></config-property>
+ </xsl:if>
+ <xsl:if test="user-name">
+ <config-property name="UserName" type="java.lang.String"><xsl:value-of select="normalize-space(user-name)"/></config-property>
+ </xsl:if>
+ <xsl:if test="password">
+ <config-property name="Password" type="java.lang.String"><xsl:value-of select="normalize-space(password)"/></config-property>
+ </xsl:if>
+ <xsl:if test="new-connection-sql">
+ <config-property name="NewConnectionSQL" type="java.lang.String"><xsl:value-of select="normalize-space(new-connection-sql)"/></config-property>
+ </xsl:if>
+ <xsl:if test="check-valid-connection-sql">
+ <config-property name="CheckValidConnectionSQL" type="java.lang.String"><xsl:value-of select="normalize-space(check-valid-connection-sql)"/></config-property>
+ </xsl:if>
+ <xsl:if test="valid-connection-checker-class-name">
+ <config-property name="ValidConnectionCheckerClassName" type="java.lang.String"><xsl:value-of select="normalize-space(valid-connection-checker-class-name)"/></config-property>
+ </xsl:if>
+ <xsl:if test="exception-sorter-class-name">
+ <config-property name="ExceptionSorterClassName" type="java.lang.String"><xsl:value-of select="normalize-space(exception-sorter-class-name)"/></config-property>
+ </xsl:if>
+ <xsl:if test="stale-connection-checker-class-name">
+ <config-property name="StaleConnectionCheckerClassName" type="java.lang.String"><xsl:value-of select="normalize-space(stale-connection-checker-class-name)"/></config-property>
+ </xsl:if>
+ <xsl:if test="track-statements">
+ <config-property name="TrackStatements" type="java.lang.String"><xsl:value-of select="normalize-space(track-statements)"/></config-property>
+ </xsl:if>
+ <xsl:if test="prepared-statement-cache-size">
+ <config-property name="PreparedStatementCacheSize" type="int"><xsl:value-of select="normalize-space(prepared-statement-cache-size)"/></config-property>
+ </xsl:if>
+ <xsl:if test="share-prepared-statements">
+ <config-property name="SharePreparedStatements" type="boolean"><xsl:value-of select="normalize-space(share-prepared-statements)"/></config-property>
+ </xsl:if>
+ <xsl:if test="set-tx-query-timeout">
+ <config-property name="TransactionQueryTimeout" type="boolean">true</config-property>
+ </xsl:if>
+ <xsl:if test="query-timeout">
+ <config-property name="QueryTimeout" type="int"><xsl:value-of select="normalize-space(query-timeout)"/></config-property>
+ </xsl:if>
+ <xsl:if test="url-delimeter">
+ <config-property name="URLDelimeter" type="java.lang.String"><xsl:value-of select="normalize-space(url-delimeter)"/></config-property>
+ </xsl:if>
+ <!-- new matching/background validation-->
+ <xsl:choose>
+ <xsl:when test="validate-on-match">
+ <config-property name="ValidateOnMatch" type="boolean"><xsl:value-of select="normalize-space(validate-on-match)"/></config-property>
+ </xsl:when>
+ <xsl:otherwise>
+ <config-property name="ValidateOnMatch" type="boolean">true</config-property>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- template to generate the pool mbean -->
+ <xsl:template name="pool">
+ <xsl:param name="mcf-template">generic-mcf</xsl:param>
+ <depends optional-attribute-name="ManagedConnectionPool">
+
+ <!--embedded mbean-->
+ <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=ManagedConnectionPool,name={jndi-name}" display-name="Connection Pool for DataSource {jndi-name}">
+ <xsl:choose>
+ <xsl:when test="$mcf-template='generic-mcf'">
+ <xsl:call-template name="generic-mcf"/>
+ </xsl:when>
+ <xsl:when test="$mcf-template='local-wrapper'">
+ <xsl:call-template name="local-wrapper"/>
+ </xsl:when>
+ <xsl:when test="$mcf-template='ha-local-wrapper'">
+ <xsl:call-template name="ha-local-wrapper"/>
+ </xsl:when>
+ <xsl:when test="$mcf-template='ha-xa-wrapper'">
+ <xsl:call-template name="ha-xa-wrapper"/>
+ </xsl:when>
+ <xsl:when test="$mcf-template='xa-wrapper'">
+ <xsl:call-template name="xa-wrapper"/>
+ </xsl:when>
+ </xsl:choose>
+
+ <attribute name="PoolJndiName"><xsl:value-of select="jndi-name"/></attribute>
+
+ <xsl:choose>
+ <xsl:when test="min-pool-size">
+ <attribute name="MinSize"><xsl:value-of select="min-pool-size"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="MinSize">0</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="max-pool-size">
+ <attribute name="MaxSize"><xsl:value-of select="max-pool-size"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="MaxSize">20</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="blocking-timeout-millis">
+ <attribute name="BlockingTimeoutMillis"><xsl:value-of select="blocking-timeout-millis"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="BlockingTimeoutMillis">30000</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="idle-timeout-minutes">
+ <attribute name="IdleTimeoutMinutes"><xsl:value-of select="idle-timeout-minutes"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="IdleTimeoutMinutes">15</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- background validation -->
+ <xsl:choose>
+ <xsl:when test="background-validation">
+ <attribute name="BackGroundValidation"><xsl:value-of select="background-validation"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="BackGroundValidation">False</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="background-validation-minutes">
+ <attribute name="BackGroundValidationMinutes"><xsl:value-of select="background-validation-minutes"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="BackGroundValidationMinutes">10</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="prefill">
+ <attribute name="PreFill"><xsl:value-of select="prefill"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="PreFill">False</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="strict-min">
+ <attribute name="StrictMin"><xsl:value-of select="strict-min"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="StrictMin">False</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+ <xsl:choose>
+ <xsl:when test="statistics-formatter">
+ <attribute name="StatisticsFormatter"><xsl:value-of select="statistics-formatter"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="StatisticsFormatter">org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!--
+ criteria indicates if Subject (from security domain) or app supplied
+ parameters (such as from getConnection(user, pw)) are used to distinguish
+ connections in the pool. Choices are
+ ByContainerAndApplication (use both),
+ ByContainer (use Subject),
+ ByApplication (use app supplied params only),
+ ByNothing (all connections are equivalent, usually if adapter supports
+ reauthentication)-->
+ <attribute name="Criteria">
+ <xsl:choose>
+ <xsl:when test="application-managed-security">ByApplication</xsl:when>
+ <xsl:when test="security-domain-and-application">ByContainerAndApplication</xsl:when>
+ <xsl:when test="security-domain">ByContainer</xsl:when>
+ <xsl:otherwise>ByNothing</xsl:otherwise>
+ </xsl:choose>
+ </attribute>
+ <xsl:choose>
+ <xsl:when test="no-tx-separate-pools">
+ <attribute name="NoTxSeparatePools">true</attribute>
+ </xsl:when>
+ </xsl:choose>
+ </mbean>
+ </depends>
+ </xsl:template>
+
+
+ <!-- template for ConnectionManager attributes shared among all ConnectionManagers.-->
+ <xsl:template name="cm-common">
+
+ <attribute name="JndiName"><xsl:value-of select="jndi-name"/></attribute>
+ <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
+
+ <xsl:if test="security-domain|security-domain-and-application">
+ <attribute name="SecurityDomainJndiName"><xsl:value-of select="security-domain|security-domain-and-application"/></attribute>
+ <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>
+ </xsl:if>
+
+ </xsl:template>
+
+ <!-- Datasource binding -->
+ <xsl:template name="ds-binding">
+ <xsl:param name="cm-name"></xsl:param>
+
+ <mbean code="org.jboss.resource.adapter.jdbc.remote.WrapperDataSourceService"
+ name="jboss.jca:service=DataSourceBinding,name={jndi-name}"
+ display-name="Binding for DataSource {jndi-name}">
+ <attribute name="JndiName"><xsl:value-of select="jndi-name"/></attribute>
+ <!--
+ <xsl:choose>
+ <xsl:when test="use-java-context">
+ <xsl:call-template name="use-java-context">
+ <xsl:with-param name="use-java"><xsl:value-of select="use-java-context"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="UseJavaContext">true</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ -->
+ <xsl:choose>
+ <xsl:when test="use-java-context">
+ <attribute name="UseJavaContext"><xsl:value-of select="use-java-context"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="UseJavaContext">true</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <depends optional-attribute-name="ConnectionManager">
+ <xsl:value-of select="$cm-name"/>,name=<xsl:value-of select="jndi-name"/>
+ </depends>
+ <xsl:choose>
+ <xsl:when test="jmx-invoker-name">
+ <depends optional-attribute-name="JMXInvokerName"><xsl:value-of select="jmx-invoker-name"/></depends>
+ </xsl:when>
+ <xsl:otherwise>
+ <depends optional-attribute-name="JMXInvokerName">jboss:service=invoker,type=jrmp</depends>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ </mbean>
+ </xsl:template>
+
+ <xsl:template name="use-java-context">
+ <xsl:param name="use-java" />
+ <attribute name="UseJavaContext"><xsl:value-of select="$use-java"/></attribute>
+ <!-- Only assign the JMXInvokerName attribute and dependency if use-java-context is false -->
+ <xsl:if test="$use-java = 'false'">
+ <xsl:choose>
+ <xsl:when test="jmx-invoker-name">
+ <depends optional-attribute-name="JMXInvokerName"><xsl:value-of select="jmx-invoker-name"/></depends>
+ </xsl:when>
+ <xsl:otherwise>
+ <depends optional-attribute-name="JMXInvokerName">jboss:service=invoker,type=jrmp</depends>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- Connection factory binding -->
+ <xsl:template name="cf-binding">
+ <xsl:param name="cm-name"></xsl:param>
+
+ <mbean code="org.jboss.resource.connectionmanager.ConnectionFactoryBindingService"
+ name="jboss.jca:service=DataSourceBinding,name={jndi-name}"
+ display-name="Binding for ConnectionFactory {jndi-name}">
+ <attribute name="JndiName"><xsl:value-of select="jndi-name"/></attribute>
+ <xsl:choose>
+ <xsl:when test="use-java-context">
+ <attribute name="UseJavaContext"><xsl:value-of select="use-java-context"/></attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="UseJavaContext">true</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ <depends optional-attribute-name="ConnectionManager">
+ <xsl:value-of select="$cm-name"/>,name=<xsl:value-of select="jndi-name"/>
+ </depends>
+ </mbean>
+ </xsl:template>
+
+ <xsl:template name="tx-manager">
+ <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
+ </xsl:template>
+
+ <xsl:template name="type-mapping">
+ <xsl:param name="datasource"/>
+
+ <xsl:if test="$datasource/metadata or $datasource/type-mapping">
+ <xsl:element name="mbean">
+ <xsl:attribute name="code">org.jboss.ejb.plugins.cmp.jdbc.metadata.DataSourceMetaData</xsl:attribute>
+ <xsl:attribute name="name">
+ <xsl:text>jboss.jdbc:service=metadata,datasource=</xsl:text>
+ <xsl:value-of select="$datasource/jndi-name"/>
+ </xsl:attribute>
+
+ <xsl:element name="depends">
+ <xsl:attribute name="optional-attribute-name">MetadataLibrary</xsl:attribute>
+ <xsl:text>jboss.jdbc:service=metadata</xsl:text>
+ </xsl:element>
+
+ <xsl:if test="$datasource/type-mapping">
+ <xsl:element name="attribute">
+ <xsl:attribute name="name">TypeMapping</xsl:attribute>
+ <xsl:value-of select="$datasource/type-mapping"/>
+ </xsl:element>
+ </xsl:if>
+
+ <!-- DEPRECATED in favor of type-mapping -->
+ <xsl:if test="$datasource/metadata">
+ <xsl:element name="attribute">
+ <xsl:attribute name="name">TypeMapping</xsl:attribute>
+ <xsl:value-of select="$datasource/metadata/type-mapping"/>
+ </xsl:element>
+ </xsl:if>
+ </xsl:element>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- template to copy any anonymous depends elements inside a cf/ds configuration element -->
+ <xsl:template match="depends" mode="anonymous">
+ <depends><xsl:value-of select="."/></depends>
+ </xsl:template>
+
+ <!-- template to copy all other elements literally, mbeans for instance-->
+ <xsl:template match="*|@*|text()">
+ <xsl:copy>
+ <xsl:apply-templates select="*|@*|text()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <!--
+ | new experimental ha stuff
+ -->
+
+ <xsl:template match="ha-local-tx-datasource">
+
+ <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager"
+ name="jboss.jca:service=LocalTxCM,name={jndi-name}"
+ display-name="ConnectionManager for DataSource {jndi-name}">
+
+ <attribute name="TrackConnectionByTx">true</attribute>
+ <attribute name="LocalTransactions">true</attribute>
+
+ <xsl:call-template name="pool">
+ <xsl:with-param name="mcf-template">ha-local-wrapper</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="cm-common"/>
+ <xsl:call-template name="tx-manager"/>
+
+ </mbean>
+ <xsl:call-template name="ds-binding">
+ <xsl:with-param name="cm-name">jboss.jca:service=LocalTxCM</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="type-mapping">
+ <xsl:with-param name="datasource" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <!-- template to generate the ManagedConnectionFactory mbean for our jca-jdbc local wrapper -->
+ <xsl:template name="ha-local-wrapper">
+
+ <depends optional-attribute-name="ManagedConnectionFactoryName">
+ <!--embedded mbean-->
+ <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=ManagedConnectionFactory,name={jndi-name}" display-name="ManagedConnectionFactory for DataSource {jndi-name}">
+
+ <xsl:apply-templates select="depends" mode="anonymous"/>
+
+ <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name='jboss-ha-local-jdbc.rar'</depends>
+ <attribute name="RARName"><xsl:value-of select="jboss-ha-local-jdbc.rar"/></attribute>
+ <attribute name="ConnectionDefinition">javax.sql.DataSource</attribute>
+
+ <attribute name="ManagedConnectionFactoryProperties">
+ <properties>
+ <config-property name="ConnectionURL" type="java.lang.String"><xsl:value-of select="normalize-space(connection-url)"/></config-property>
+ <config-property name="DriverClass" type="java.lang.String"><xsl:value-of select="normalize-space(driver-class)"/></config-property>
+
+ <xsl:call-template name="wrapper-common-properties"/>
+ <xsl:if test="connection-property">
+ <config-property name="ConnectionProperties" type="java.lang.String">
+ <xsl:apply-templates select="connection-property"/>
+ </config-property>
+ </xsl:if>
+
+ </properties>
+ </attribute>
+ </mbean>
+ </depends>
+ </xsl:template>
+
+ <xsl:template match="ha-xa-datasource">
+
+ <mbean code="org.jboss.resource.connectionmanager.TxConnectionManager"
+ name="jboss.jca:service=XATxCM,name={jndi-name}"
+ display-name="ConnectionManager for DataSource {jndi-name}">
+
+ <xsl:choose>
+ <xsl:when test="track-connection-by-tx">
+ <attribute name="TrackConnectionByTx">true</attribute>
+ <attribute name="LocalTransactions">false</attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <attribute name="TrackConnectionByTx">false</attribute>
+ <attribute name="LocalTransactions">false</attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="xa-resource-timeout">
+ <attribute name="XAResourceTransactionTimeout"><xsl:value-of select="normalize-space(xa-resource-timeout)"/></attribute>
+ </xsl:if>
+
+ <xsl:call-template name="pool">
+ <xsl:with-param name="mcf-template">ha-xa-wrapper</xsl:with-param>
+ </xsl:call-template>
+ <xsl:call-template name="cm-common"/>
+ <xsl:call-template name="tx-manager"/>
+
+ </mbean>
+ <xsl:call-template name="ds-binding">
+ <xsl:with-param name="cm-name">jboss.jca:service=XATxCM</xsl:with-param>
+ </xsl:call-template>
+
+ <xsl:call-template name="type-mapping">
+ <xsl:with-param name="datasource" select="."/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="ha-xa-wrapper">
+ <depends optional-attribute-name="ManagedConnectionFactoryName">
+ <!--embedded mbean-->
+ <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
+ name="jboss.jca:service=ManagedConnectionFactory,name={jndi-name}"
+ displayname="ManagedConnectionFactory for DataSource {jndi-name}">
+
+ <xsl:apply-templates select="depends" mode="anonymous"/>
+
+ <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name='jboss-ha-xa-jdbc.rar'</depends>
+ <attribute name="RARName"><xsl:value-of select="jboss-ha-xa-jdbc.rar"/></attribute>
+ <attribute name="ConnectionDefinition">javax.sql.DataSource</attribute>
+
+ <attribute name="ManagedConnectionFactoryProperties">
+ <properties>
+ <config-property name="XADataSourceClass" type="java.lang.String"><xsl:value-of select="normalize-space(xa-datasource-class)"/></config-property>
+
+ <config-property name="XADataSourceProperties" type="java.lang.String">
+ <xsl:apply-templates select="xa-datasource-property"/>
+ </config-property>
+
+ <xsl:if test="isSameRM-override-value">
+ <config-property name="IsSameRMOverrideValue" type="java.lang.Boolean"><xsl:value-of select="normalize-space(isSameRM-override-value)"/></config-property>
+ </xsl:if>
+
+ <xsl:if test="url-property">
+ <config-property name="URLProperty" type="java.lang.String"><xsl:value-of select="normalize-space(url-property)"/></config-property>
+ </xsl:if>
+
+ <xsl:call-template name="wrapper-common-properties"/>
+
+ </properties>
+ </attribute>
+ </mbean>
+ </depends>
+ </xsl:template>
+
+</xsl:stylesheet>
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/bootstrap/unit/BootstrapTestCase.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,130 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.bootstrap.unit;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.jboss.embedded.Bootstrap;
+import org.jboss.embedded.JMXKernel;
+import org.jboss.naming.JNDIViewMBean;
+import org.jboss.deployers.spi.DeploymentException;
+
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.MalformedObjectNameException;
+import java.sql.Connection;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 42757 $
+ */
+public class BootstrapTestCase extends TestCase
+{
+ private static Bootstrap bootstrap = new Bootstrap();
+
+ public BootstrapTestCase()
+ {
+ super("BootstrapTestCase");
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(BootstrapTestCase.class);
+
+
+ // setup test so that embedded JBoss is started/stopped once for all tests here.
+ TestSetup wrapper = new TestSetup(suite)
+ {
+ protected void setUp()
+ {
+ long start = System.currentTimeMillis();
+ try
+ {
+ startupEmbeddedJboss();
+ }
+ finally
+ {
+ System.out.println("Bootstrap took " + (System.currentTimeMillis() - start) + " (ms)");
+ }
+
+ }
+
+ protected void tearDown()
+ {
+ shutdownEmbeddedJboss();
+ }
+ };
+
+ return wrapper;
+ }
+
+ public static void startupEmbeddedJboss()
+ {
+ try
+ {
+ bootstrap.bootstrap();
+ }
+ catch (DeploymentException e)
+ {
+ throw new RuntimeException("Failed to bootstrap", e);
+ }
+ }
+
+ public static void shutdownEmbeddedJboss()
+ {
+ bootstrap.shutdown();
+ }
+
+ public void testDefaultDS() throws Exception
+ {
+ outputJNDI();
+ InitialContext ctx = new InitialContext();
+ DataSource ds = (DataSource)ctx.lookup("java:/DefaultDS");
+ Connection conn = ds.getConnection();
+ conn.close();
+ }
+
+ private void outputJNDI()
+ throws InstanceNotFoundException, MBeanException, ReflectionException, MalformedObjectNameException
+ {
+ MBeanServer server = getMBeanServer();
+ String xml = (String)server.invoke(new ObjectName("jboss:service=JNDIView"), "listXML", null, null);
+ System.out.println(xml);
+ }
+
+ private static MBeanServer getMBeanServer()
+ {
+ JMXKernel jmxKernel = (JMXKernel)bootstrap.getKernel().getRegistry().getEntry("JMXKernel").getTarget();
+ MBeanServer server = jmxKernel.getMbeanServer();
+ return server;
+ }
+}
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/Customer.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/Customer.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/Customer.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,48 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.ejb;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Entity
+public class Customer
+{
+ private String name;
+
+ @Id
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAO.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAO.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAO.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.ejb;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DAO
+{
+ Customer createCustomer(String name)
+ ;
+
+ Customer findCustomer(String name)
+ ;
+}
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAOBean.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAOBean.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/DAOBean.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.ejb;
+
+import javax.ejb.Stateless;
+import javax.persistence.PersistenceContext;
+import javax.persistence.EntityManager;
+
+/**
+ * comment
+ *
+ * @author <a href="bill at jboss.com">Bill Burke</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+public class DAOBean implements DAO
+{
+ @PersistenceContext
+ EntityManager manager;
+
+ public Customer createCustomer(String name)
+ {
+ Customer cust = new Customer();
+ cust.setName(name);
+ manager.persist(cust);
+ return cust;
+ }
+
+ public Customer findCustomer(String name)
+ {
+ return manager.find(Customer.class, name);
+ }
+
+}
Added: trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java
===================================================================
--- trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/test/java/org/jboss/embedded/test/ejb/unit/EjbTestCase.java 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,137 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.embedded.test.ejb.unit;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.extensions.TestSetup;
+import org.jboss.embedded.Bootstrap;
+import org.jboss.embedded.JMXKernel;
+import org.jboss.embedded.test.bootstrap.unit.BootstrapTestCase;
+import org.jboss.embedded.test.ejb.DAO;
+import org.jboss.embedded.test.ejb.Customer;
+import org.jboss.deployers.spi.DeploymentException;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.ReflectionException;
+import javax.management.MalformedObjectNameException;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+import java.sql.Connection;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 42757 $
+ */
+public class EjbTestCase extends TestCase
+{
+ private static Bootstrap bootstrap = new Bootstrap();
+
+ public EjbTestCase()
+ {
+ super("BootstrapTestCase");
+ }
+
+ public static Test suite() throws Exception
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTestSuite(EjbTestCase.class);
+
+
+ // setup test so that embedded JBoss is started/stopped once for all tests here.
+ TestSetup wrapper = new TestSetup(suite)
+ {
+ protected void setUp()
+ {
+ long start = System.currentTimeMillis();
+ try
+ {
+ startupEmbeddedJboss();
+ }
+ finally
+ {
+ System.out.println("Bootstrap took " + (System.currentTimeMillis() - start) + " (ms)");
+ }
+
+ }
+
+ protected void tearDown()
+ {
+ shutdownEmbeddedJboss();
+ }
+ };
+
+ return wrapper;
+ }
+
+ public static void startupEmbeddedJboss()
+ {
+ try
+ {
+ bootstrap.bootstrap();
+ }
+ catch (DeploymentException e)
+ {
+ throw new RuntimeException("Failed to bootstrap", e);
+ }
+ }
+
+ public static void shutdownEmbeddedJboss()
+ {
+ bootstrap.shutdown();
+ }
+
+ private static void outputJNDI()
+ throws InstanceNotFoundException, MBeanException, ReflectionException, MalformedObjectNameException
+ {
+ MBeanServer server = getMBeanServer();
+ String xml = (String)server.invoke(new ObjectName("jboss:service=JNDIView"), "listXML", null, null);
+ System.out.println(xml);
+ }
+
+ private static MBeanServer getMBeanServer()
+ {
+ JMXKernel jmxKernel = (JMXKernel)bootstrap.getKernel().getRegistry().getEntry("JMXKernel").getTarget();
+ MBeanServer server = jmxKernel.getMbeanServer();
+ return server;
+ }
+
+
+ public void testSimpleEjb() throws Exception
+ {
+ bootstrap.scanClasspath("ejb-test.jar");
+ outputJNDI();
+ InitialContext ctx = new InitialContext();
+ DAO dao = (DAO)ctx.lookup("DAOBean/local");
+ Customer cust = dao.createCustomer("Bill");
+ cust = dao.findCustomer("Bill");
+ assert cust != null;
+ assert cust.getName().equals("Bill");
+ }
+
+}
Added: trunk/embedded/src/test/resources/ejb/META-INF/persistence.xml
===================================================================
--- trunk/embedded/src/test/resources/ejb/META-INF/persistence.xml 2007-01-05 21:27:43 UTC (rev 59388)
+++ trunk/embedded/src/test/resources/ejb/META-INF/persistence.xml 2007-01-05 22:14:20 UTC (rev 59389)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+ <persistence-unit name="tempdb">
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ </properties>
+ </persistence-unit>
+</persistence>
More information about the jboss-cvs-commits
mailing list