You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jl...@apache.org on 2009/06/12 15:23:58 UTC
svn commit: r784112 - in /openejb/trunk/openejb3:
container/openejb-core/src/main/java/org/apache/openejb/config/
container/openejb-core/src/test/java/org/apache/openejb/config/ examples/
examples/applicationexception/ examples/applicationexception/src...
Author: jlaskowski
Date: Fri Jun 12 13:23:57 2009
New Revision: 784112
URL: http://svn.apache.org/viewvc?rev=784112&view=rev
Log:
OPENEJB-980 @ApplicationException inheritance
@ApplicationException is inheritable now, i.e. exceptions that inherit from @ApplicationException-annotated exceptions are application exceptions too. The remaining piece is to handle inherited element of the annotation.
BTW, although @ApplicationException is not @Inherited as far as Java annotation mechanism goes, but it is extended with inherited element so by default it *is* inherited (cf. 14.2.1 Application Exceptions in EJB 3.1 PFD - page 378)
Added:
openejb/trunk/openejb3/examples/applicationexception/
openejb/trunk/openejb3/examples/applicationexception/README.txt (with props)
openejb/trunk/openejb3/examples/applicationexception/build.xml (with props)
openejb/trunk/openejb3/examples/applicationexception/pom.xml (with props)
openejb/trunk/openejb3/examples/applicationexception/src/
openejb/trunk/openejb3/examples/applicationexception/src/main/
openejb/trunk/openejb3/examples/applicationexception/src/main/java/
openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/
openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/
openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/
openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java (with props)
openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java (with props)
openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java (with props)
openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java (with props)
openejb/trunk/openejb3/examples/applicationexception/src/main/resources/
openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/
openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml (with props)
openejb/trunk/openejb3/examples/applicationexception/src/test/
openejb/trunk/openejb3/examples/applicationexception/src/test/java/
openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/
openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/
openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/
openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java (with props)
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java
openejb/trunk/openejb3/examples/pom.xml
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=784112&r1=784111&r2=784112&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Fri Jun 12 13:23:57 2009
@@ -16,8 +16,7 @@
*/
package org.apache.openejb.config;
-import org.apache.openejb.DeploymentInfo;
-import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.*;
import org.apache.openejb.api.LocalClient;
import org.apache.openejb.api.RemoteClient;
import org.apache.openejb.loader.SystemInstance;
@@ -509,9 +508,23 @@
ejbModule.getEjbJar().setAssemblyDescriptor(assemblyDescriptor);
}
- for (Class<?> exceptionClass : finder.findAnnotatedClasses(ApplicationException.class)) {
+ // https://issues.apache.org/jira/browse/OPENEJB-980
+ startupLogger.debug("Searching for inherited application exceptions (see OPENEJB-980) - it doesn't care whether inherited is true/false");
+ List<Class> appExceptions;
+ appExceptions = finder.findInheritedAnnotatedClasses(ApplicationException.class);
+ for (Class<?> exceptionClass : appExceptions) {
+ startupLogger.debug("...handling " + exceptionClass);
if (assemblyDescriptor.getApplicationException(exceptionClass) == null) {
ApplicationException annotation = exceptionClass.getAnnotation(ApplicationException.class);
+ // OPENEJB-980
+ if (annotation == null) {
+ Class<?> parentExceptionClass = exceptionClass;
+ while (annotation == null) {
+ parentExceptionClass = parentExceptionClass.getSuperclass();
+ annotation = parentExceptionClass.getAnnotation(ApplicationException.class);
+ }
+ }
+ startupLogger.debug("...adding " + exceptionClass + " with rollback=" + annotation.rollback());
assemblyDescriptor.addApplicationException(exceptionClass, annotation.rollback());
}
}
Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java?rev=784112&r1=784111&r2=784112&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java Fri Jun 12 13:23:57 2009
@@ -47,7 +47,9 @@
assertThat(appEx.getRollback(), is(true));
appEx = assemblyDescriptor.getApplicationException(ValueRequiredException.class);
- assertThat(appEx, nullValue());
+ assertThat(appEx, notNullValue());
+ assertThat(appEx.getExceptionClass(), is(ValueRequiredException.class.getName()));
+ assertThat(appEx.getRollback(), is(true));
}
@ApplicationException(rollback = true)
Added: openejb/trunk/openejb3/examples/applicationexception/README.txt
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/README.txt?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/README.txt (added)
+++ openejb/trunk/openejb3/examples/applicationexception/README.txt Fri Jun 12 13:23:57 2009
@@ -0,0 +1,16 @@
+This example shows how to create a session stateful EJB using annotations.
+
+A stateful session bean is a session bean whose instances can maintain the conversational state with the client.
+The conversational state of the stateful session bean, which describes the conversation between a speciï¬c
+client and a session bean, is contained in the fields of the stateful session bean.
+
+With EJB 3.0, it's now possible to write stateful session bean without specifying a deployment descriptor; you basically have to write just
+
+ * a remote or local business interface, which is a plain-old-java-interface, annotated with the @Remote or @Local annotation
+ * the stateful session bean implementation, a plain-old-java-object which implements the remote or the local business interface and is annotated with the @Stateful annotation
+
+To run the example simply type:
+
+ $ mvn clean install
+
+
Propchange: openejb/trunk/openejb3/examples/applicationexception/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/README.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/README.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: openejb/trunk/openejb3/examples/applicationexception/build.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/build.xml?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/build.xml (added)
+++ openejb/trunk/openejb3/examples/applicationexception/build.xml Fri Jun 12 13:23:57 2009
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project name="MyProject" default="dist" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+ <!-- ===============================================================
+
+ HOW TO RUN
+
+ Download http://archive.apache.org/dist/maven/binaries/maven-ant-tasks-2.0.9.jar
+ Then execute ant as follows:
+
+ ant -lib maven-ant-tasks-2.0.9.jar
+
+ NOTE
+
+ You do NOT need maven-ant-tasks-2.0.9.jar to use OpenEJB for embedded EJB
+ testing with Ant. It is simply used in this example to make the build.xml
+ a bit simpler. As long as OpenEJB and it's required libraries are in the
+ <junit> classpath, the tests will run with OpenEJB embedded.
+
+ ================================================================= -->
+
+ <artifact:remoteRepository id="apache.snapshot.repository" url="http://repository.apache.org/snapshots/" />
+ <artifact:remoteRepository id="m2.repository" url="http://repo1.maven.org/maven2/" />
+
+ <!-- Build Classpath -->
+ <artifact:dependencies pathId="classpath.main">
+ <dependency groupId="org.apache.openejb" artifactId="javaee-api" version="5.0-1"/>
+ </artifact:dependencies>
+
+ <!-- Test Build Classpath -->
+ <artifact:dependencies pathId="classpath.test.build">
+ <dependency groupId="junit" artifactId="junit" version="4.3.1"/>
+ </artifact:dependencies>
+
+ <!-- Test Run Classpath -->
+ <artifact:dependencies pathId="classpath.test.run">
+ <remoteRepository refid="apache.snapshot.repository" />
+ <remoteRepository refid="m2.repository" />
+
+ <dependency groupId="org.apache.openejb" artifactId="openejb-core" version="3.1.1-SNAPSHOT"/>
+ <dependency groupId="junit" artifactId="junit" version="4.3.1"/>
+ </artifact:dependencies>
+
+ <!-- Properties -->
+
+ <property name="src.main.java" location="src/main/java"/>
+ <property name="src.main.resources" location="src/main/resources"/>
+ <property name="src.test.java" location="src/test/java"/>
+ <property name="build.main" location="target/classes"/>
+ <property name="build.test" location="target/test-classes"/>
+ <property name="test.reports" location="target/test-reports"/>
+ <property name="dist" location="target"/>
+
+
+ <target name="init">
+ <mkdir dir="${build.main}"/>
+ <mkdir dir="${build.test}"/>
+ <mkdir dir="${test.reports}"/>
+ </target>
+
+ <target name="compile" depends="init">
+
+ <javac srcdir="${src.main.java}" destdir="${build.main}">
+ <classpath refid="classpath.main" />
+ </javac>
+ <copy todir="${build.main}">
+ <fileset dir="${src.main.resources}"/>
+ </copy>
+
+ <javac srcdir="${src.test.java}" destdir="${build.test}">
+ <classpath location="${build.main}"/>
+ <classpath refid="classpath.main"/>
+ <classpath refid="classpath.test.build"/>
+ </javac>
+ </target>
+
+ <target name="test" depends="compile">
+ <junit fork="yes" printsummary="yes">
+ <classpath location="${build.main}"/>
+ <classpath location="${build.test}"/>
+ <classpath refid="classpath.main"/>
+ <classpath refid="classpath.test.build"/>
+ <classpath refid="classpath.test.run"/>
+
+ <formatter type="plain"/>
+
+ <batchtest fork="yes" todir="${test.reports}">
+ <fileset dir="${src.test.java}">
+ <include name="**/*Test.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="dist" depends="test">
+ <jar jarfile="${dist}/myproject-1.0.jar" basedir="${build.main}"/>
+ </target>
+
+</project>
Propchange: openejb/trunk/openejb3/examples/applicationexception/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/build.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: openejb/trunk/openejb3/examples/applicationexception/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/pom.xml?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/pom.xml (added)
+++ openejb/trunk/openejb3/examples/applicationexception/pom.xml Fri Jun 12 13:23:57 2009
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.superbiz</groupId>
+ <artifactId>applicationexception</artifactId>
+ <packaging>jar</packaging>
+ <version>1.1-SNAPSHOT</version>
+ <name>OpenEJB :: Examples :: @ApplicationException inheritance</name>
+ <properties>
+ <!--
+ - http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding
+ -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.2</version>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>openejb.applicationexceptions.inherited</name>
+ <value>true</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <repositories>
+ <repository>
+ <id>apache-m2-snapshot</id>
+ <name>Apache Snapshot Repository</name>
+ <url>http://repository.apache.org/snapshots</url>
+ </repository>
+ </repositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>5.0-1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.6</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!--
+ The <scope>test</scope> guarantees that non of your runtime
+ code is dependent on any OpenEJB classes.
+ -->
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>openejb-core</artifactId>
+ <version>3.1.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <!--
+ This section allows you to configure where to publish libraries for sharing.
+ It is not required and may be deleted. For more information see:
+ http://maven.apache.org/plugins/maven-deploy-plugin/
+ -->
+ <distributionManagement>
+ <repository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/repo/</url>
+ </repository>
+ <snapshotRepository>
+ <id>localhost</id>
+ <url>file://${basedir}/target/snapshot-repo/</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+</project>
+
Propchange: openejb/trunk/openejb3/examples/applicationexception/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java (added)
+++ openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java Fri Jun 12 13:23:57 2009
@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.appexception;
+
+import javax.ejb.ApplicationException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@ApplicationException(rollback = true)
+public abstract class BusinessException extends RuntimeException {
+}
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/BusinessException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java (added)
+++ openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java Fri Jun 12 13:23:57 2009
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.appexception;
+
+import javax.ejb.Remote;
+
+/**
+ * This is an EJB 3 remote business interface
+ * A remote business interface must be annotated with the @Remote
+ * annotation
+ */
+//START SNIPPET: code
+@Remote
+public interface ThrowBusinessException {
+
+ public void throwValueRequiredException() throws BusinessException;
+
+}
+//END SNIPPET: code
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java (added)
+++ openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java Fri Jun 12 13:23:57 2009
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.appexception;
+
+import javax.ejb.Stateless;
+
+//START SNIPPET: code
+@Stateless
+public class ThrowBusinessExceptionImpl implements ThrowBusinessException {
+
+ public void throwValueRequiredException() throws BusinessException {
+ throw new ValueRequiredException();
+ }
+
+}
+//END SNIPPET: code
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ThrowBusinessExceptionImpl.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java (added)
+++ openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java Fri Jun 12 13:23:57 2009
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.appexception;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ValueRequiredException extends BusinessException {
+}
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/java/org/superbiz/appexception/ValueRequiredException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml (added)
+++ openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml Fri Jun 12 13:23:57 2009
@@ -0,0 +1 @@
+<ejb-jar/>
\ No newline at end of file
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/main/resources/META-INF/ejb-jar.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java?rev=784112&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java (added)
+++ openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java Fri Jun 12 13:23:57 2009
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.superbiz.appexception;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import junit.framework.TestCase;
+import org.junit.Test;
+import org.junit.Assert;
+import org.junit.Before;
+
+public class ThrowBusinessExceptionImplTest {
+
+ //START SNIPPET: setup
+ private InitialContext initialContext;
+
+ @Before
+ public void setUp() throws Exception {
+ Properties properties = new Properties();
+ properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+
+ initialContext = new InitialContext(properties);
+ }
+ //END SNIPPET: setup
+
+ /**
+ * Lookup the Counter bean via its remote home interface
+ *
+ * @throws Exception
+ */
+ //START SNIPPET: remote
+ @Test(expected = ValueRequiredException.class)
+ public void testCounterViaRemoteInterface() throws Exception {
+ Object object = initialContext.lookup("ThrowBusinessExceptionImplRemote");
+
+ Assert.assertNotNull(object);
+ Assert.assertTrue(object instanceof ThrowBusinessException);
+ ThrowBusinessException bean = (ThrowBusinessException) object;
+ bean.throwValueRequiredException();
+ }
+ //END SNIPPET: remote
+
+}
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: openejb/trunk/openejb3/examples/applicationexception/src/test/java/org/superbiz/appexception/ThrowBusinessExceptionImplTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: openejb/trunk/openejb3/examples/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/pom.xml?rev=784112&r1=784111&r2=784112&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/pom.xml (original)
+++ openejb/trunk/openejb3/examples/pom.xml Fri Jun 12 13:23:57 2009
@@ -31,6 +31,7 @@
<packaging>pom</packaging>
<name>OpenEJB :: Examples</name>
<modules>
+ <module>applicationexception</module>
<module>simple-stateful</module>
<module>simple-stateless</module>
<module>simple-stateless-with-descriptor</module>