[jboss-cvs] JBossAS SVN: r83935 - in projects/ejb3/trunk/api: src/main/java/javax/ejb and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 6 04:04:21 EST 2009
Author: wolfc
Date: 2009-02-06 04:04:21 -0500 (Fri, 06 Feb 2009)
New Revision: 83935
Added:
projects/ejb3/trunk/api/src/main/java/javax/ejb/IllegalLoopbackException.java
projects/ejb3/trunk/api/src/main/java/javax/ejb/NoMoreTimeoutsException.java
projects/ejb3/trunk/api/src/main/java/javax/ejb/StatefulTimeout.java
projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/
projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/
projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java
projects/ejb3/trunk/api/src/test/resources/log4j.xml
Modified:
projects/ejb3/trunk/api/pom.xml
projects/ejb3/trunk/api/src/main/java/javax/ejb/AccessTimeout.java
projects/ejb3/trunk/api/src/main/java/javax/ejb/ConcurrencyManagementType.java
projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java
projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java
Log:
EJBTHREE-1484: EJB 3.1 PFD 22-DEC-2008 (plus JDK 6 building)
Modified: projects/ejb3/trunk/api/pom.xml
===================================================================
--- projects/ejb3/trunk/api/pom.xml 2009-02-06 08:41:03 UTC (rev 83934)
+++ projects/ejb3/trunk/api/pom.xml 2009-02-06 09:04:21 UTC (rev 83935)
@@ -16,6 +16,47 @@
<version>3.1.0-SNAPSHOT</version>
<name>JBoss EJB 3.1 API</name>
<description>JBoss EJB 3.1 API classes</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <executable>${JDK6_HOME}/bin/javac</executable>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-jdk6</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>env.JDK6_HOME</property>
+ <message>JDK6_HOME is not set</message>
+ </requireProperty>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>once</forkMode>
+ <jvm>${JDK6_HOME}/bin/java</jvm>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
@@ -31,9 +72,70 @@
</dependency>
<dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>2.0.1.GA</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-transaction-api</artifactId>
<version>1.0.1.CR2</version>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>signaturetest</id>
+ <activation>
+ <property>
+ <name>env.javax_ejb_jar_path</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java</include>
+ </includes>
+ <systemProperties>
+ <property>
+ <name>javax.ejb.jar.path</name>
+ <value>${env.javax_ejb_jar_path}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/AccessTimeout.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/AccessTimeout.java 2009-02-06 08:41:03 UTC (rev 83934)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/AccessTimeout.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -27,9 +27,10 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
+import java.util.concurrent.TimeUnit;
/**
- * Specifies the amount of time(in milliseconds) that a concurrent access
+ * Specifies the amount of time in a given time unit that a concurrent access
* attempt on a Singleton session bean should block before timing out.
*
* @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
@@ -40,7 +41,9 @@
@Retention(RUNTIME)
public @interface AccessTimeout {
/**
- * Timeout in milliseconds.
+ * The maximum time to wait for access.
*/
- int value();
+ long value();
+
+ TimeUnit unit() default TimeUnit.MILLISECONDS;
}
Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/ConcurrencyManagementType.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/ConcurrencyManagementType.java 2009-02-06 08:41:03 UTC (rev 83934)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/ConcurrencyManagementType.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -24,8 +24,9 @@
/**
* A Singleton bean's concurrency management type.
* <ul>
+ * <li>BEAN : Bean managed concurrency</li>
+ * <li>CONCURRENCY_NOT_ALLOWED : Concurrency not allowed</li>
* <li>CONTAINER : Container managed concurrency</li>
- * <li>BEAN : Bean managed concurrency</li>
* </ul>
*
* @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
@@ -34,5 +35,6 @@
*/
public enum ConcurrencyManagementType {
BEAN,
+ CONCURRENCY_NOT_ALLOWED,
CONTAINER
}
Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java 2009-02-06 08:41:03 UTC (rev 83934)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/EJBContainer.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -49,7 +49,10 @@
*/
public abstract class EJBContainer
{
- public static final String EMBEDDABLE_INITIAL = "javax.ejb.embeddable.initial";
+ public static final String EMBEDDABLE_APP_NAME_PROPERTY = "javax.ejb.embeddable.appName";
+ public static final String EMBEDDABLE_INITIAL_PROPERTY = "javax.ejb.embeddable.initial";
+ @Deprecated
+ public static final String EMBEDDABLE_INITIAL = EMBEDDABLE_INITIAL_PROPERTY;
public static final String EMBEDDABLE_MODULES_PROPERTY = "javax.ejb.embeddable.modules";
private static EJBContainerWrapper currentEJBContainer;
@@ -172,6 +175,7 @@
* @return EJBContainer instance, or null if none exists or if the last EJBContainer
* instance has been closed.
*/
+ @Deprecated
public static EJBContainer getCurrentEJBContainer()
{
if(currentEJBContainer != null && currentEJBContainer.isClosed())
Added: projects/ejb3/trunk/api/src/main/java/javax/ejb/IllegalLoopbackException.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/IllegalLoopbackException.java (rev 0)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/IllegalLoopbackException.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package javax.ejb;
+
+/**
+ * This exception indicates that an attempt was made to perform an illegal loopback
+ * invocation on a Singleton with container-managed concurrency. One possible cause
+ * is a loopback call to a WRITE method where the current thread does not already
+ * hold a WRITE lock.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ * @since 3.1
+ */
+public class IllegalLoopbackException extends ConcurrentAccessException
+{
+ private static final long serialVersionUID = 1L;
+
+ public IllegalLoopbackException()
+ {
+ super();
+ }
+
+ public IllegalLoopbackException(String message)
+ {
+ super(message);
+ }
+}
Added: projects/ejb3/trunk/api/src/main/java/javax/ejb/NoMoreTimeoutsException.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/NoMoreTimeoutsException.java (rev 0)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/NoMoreTimeoutsException.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package javax.ejb;
+
+/**
+ * This exception indicates that a calendar-based timer will not result in any more timeouts.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ * @since 3.1
+ */
+public class NoMoreTimeoutsException extends EJBException
+{
+ private static final long serialVersionUID = 1L;
+
+ public NoMoreTimeoutsException()
+ {
+ super();
+ }
+
+ public NoMoreTimeoutsException(String message)
+ {
+ super(message);
+ }
+}
Added: projects/ejb3/trunk/api/src/main/java/javax/ejb/StatefulTimeout.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/StatefulTimeout.java (rev 0)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/StatefulTimeout.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package javax.ejb;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Specifies the amount of time a stateful session bean can be idle
+ * ( not receive any client invocations ) before it is eligible
+ * for removal by the container.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ * @since 3.1
+ */
+ at Target(TYPE)
+ at Retention(RUNTIME)
+public @interface StatefulTimeout {
+ long value();
+
+ TimeUnit unit() default TimeUnit.MINUTES;
+}
Modified: projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java
===================================================================
--- projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java 2009-02-06 08:41:03 UTC (rev 83934)
+++ projects/ejb3/trunk/api/src/main/java/javax/ejb/TimerService.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -32,42 +32,62 @@
* a specified time, after a specified elapsed time, or after a specified interval.
**/
public interface TimerService {
-
/**
- * Create a single-action timer that expires after a specified duration.
- *
- * @param duration The number of milliseconds that must elapse before the timer expires.
- * @param info Application information to be delivered along with the timer expiration
- * notification. This can be null.
- *
- * @return The newly created Timer.
- *
- * @throws IllegalArgumentException If duration is negative
- * @throws IllegalStateException If this method is invoked while the instance is in
- * a state that does not allow access to this method.
+ * Create a calendar-based timer based on the input schedule expression.
+ *
+ * @param schedule A schedule expression describing the timeouts for this timer.
+ * @param info Application information to be delivered along with the timer
+ * expiration. This can be null.
+ * @return The newly created Timer.
+ * @throws IllegalArgumentException If Schedule represents an invalid schedule
+ * expression.
+ * @throws IllegalStateException If this method is invoked while the instance
+ * is in a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
- **/
- public Timer createTimer( long duration, Serializable info )
- throws
- IllegalArgumentException,
- IllegalStateException,
- EJBException;
-
+ * @since 3.1
+ */
+ Timer createCalendarTimer(ScheduleExpression schedule, Serializable info)
+ throws IllegalArgumentException, IllegalStateException, EJBException;
+
/**
- * Create a single-action timer that expires after a specified duration.
+ * Create a calendar-based timer based on the input schedule expression.
+ *
+ * @param schedule A schedule expression describing the timeouts for this timer.
+ * @param timerConfig Timer configuration.
+ * @return The newly created Timer.
+ * @throws IllegalArgumentException If Schedule represents an invalid schedule
+ * expression.
+ * @throws IllegalStateException If this method is invoked while the instance
+ * is in a state that does not allow access to this method.
+ * @throws EJBException If this method could not complete due to a system-level failure.
+ * @since 3.1
+ */
+ Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig)
+ throws IllegalArgumentException, IllegalStateException, EJBException;
+
+ /**
+ * Create an interval timer whose first expiration occurs at a given point in time and
+ * whose subsequent expirations occur after a specified interval.
*
- * @param duration The number of milliseconds that must elapse before the timer expires.
+ * @param initialExpiration The point in time at which the first timer expiration must occur.
+ * @param intervalDuration The number of milliseconds that must elapse between timer
+ * expiration notifications. Expiration notifications are
+ * scheduled relative to the time of the first expiration. If
+ * expiration is delayed(e.g. due to the interleaving of other
+ * method calls on the bean) two or more expiration notifications
+ * may occur in close succession to "catch up".
* @param timerConfig Timer configuration.
*
* @return The newly created Timer.
*
- * @throws IllegalArgumentException If duration is negative
+ * @throws IllegalArgumentException If initialExpiration is null, or initialExpiration.getTime()
+ * is negative, or intervalDuration is negative.
* @throws IllegalStateException If this method is invoked while the instance is in
* a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
* @since 3.1
**/
- public Timer createTimer( long duration, TimerConfig timerConfig )
+ public Timer createIntervalTimer( Date initialExpiration, long intervalDuration, TimerConfig timerConfig )
throws
IllegalArgumentException,
IllegalStateException,
@@ -85,8 +105,7 @@
* expiration is delayed(e.g. due to the interleaving of other
* method calls on the bean) two or more expiration notifications
* may occur in close succession to "catch up".
- * @param info Application information to be delivered along with the timer expiration
- * notification. This can be null.
+ * @param timerConfig Timer configuration.
*
* @return The newly created Timer.
*
@@ -95,87 +114,80 @@
* @throws IllegalStateException If this method is invoked while the instance is in
* a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
+ * @since 3.1
**/
- public Timer createTimer( long initialDuration, long intervalDuration, Serializable info )
+ public Timer createIntervalTimer( long initialDuration, long intervalDuration, TimerConfig timerConfig )
throws
IllegalArgumentException,
IllegalStateException,
EJBException;
/**
- * Create an interval timer whose first expiration occurs after a specified duration,
- * and whose subsequent expirations occur after a specified interval.
+ * Create a single-action timer that expires at a given point in time.
*
- * @param initialDuration The number of milliseconds that must elapse before the first
- * timer expiration notification.
- * @param intervalDuration The number of milliseconds that must elapse between timer
- * expiration notifications. Expiration notifications are
- * scheduled relative to the time of the first expiration. If
- * expiration is delayed(e.g. due to the interleaving of other
- * method calls on the bean) two or more expiration notifications
- * may occur in close succession to "catch up".
+ * @param expiration The point in time at which the timer must expire.
* @param timerConfig Timer configuration.
*
* @return The newly created Timer.
*
- * @throws IllegalArgumentException If initialDuration is negative, or intervalDuration
- * is negative.
+ * @throws IllegalArgumentException If expiration is null, or expiration.getTime() is negative.
* @throws IllegalStateException If this method is invoked while the instance is in
* a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
* @since 3.1
**/
- public Timer createTimer( long initialDuration, long intervalDuration, TimerConfig timerConfig )
+ public Timer createSingleActionTimer( Date expiration, TimerConfig timerConfig )
throws
IllegalArgumentException,
IllegalStateException,
EJBException;
/**
- * Create a single-action timer that expires at a given point in time.
+ * Create a single-action timer that expires after a specified duration.
*
- * @param expiration The point in time at which the timer must expire.
- * @param info Application information to be delivered along with the timer expiration
- * notification. This can be null.
+ * @param duration The number of milliseconds that must elapse before the timer expires.
+ * @param timerConfig Timer configuration.
*
* @return The newly created Timer.
*
- * @throws IllegalArgumentException If expiration is null, or expiration.getTime() is negative.
+ * @throws IllegalArgumentException If duration is negative
* @throws IllegalStateException If this method is invoked while the instance is in
* a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
+ * @since 3.1
**/
- public Timer createTimer( Date expiration, Serializable info )
+ public Timer createSingleActionTimer( long duration, TimerConfig timerConfig )
throws
IllegalArgumentException,
IllegalStateException,
EJBException;
/**
- * Create a single-action timer that expires at a given point in time.
+ * Create a single-action timer that expires after a specified duration.
*
- * @param expiration The point in time at which the timer must expire.
- * @param timerConfig Timer configuration.
+ * @param duration The number of milliseconds that must elapse before the timer expires.
+ * @param info Application information to be delivered along with the timer expiration
+ * notification. This can be null.
*
* @return The newly created Timer.
*
- * @throws IllegalArgumentException If expiration is null, or expiration.getTime() is negative.
+ * @throws IllegalArgumentException If duration is negative
* @throws IllegalStateException If this method is invoked while the instance is in
* a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
- * @since 3.1
**/
- public Timer createTimer( Date expiration, TimerConfig timerConfig )
+ public Timer createTimer( long duration, Serializable info )
throws
IllegalArgumentException,
IllegalStateException,
EJBException;
/**
- * Create an interval timer whose first expiration occurs at a given point in time and
- * whose subsequent expirations occur after a specified interval.
+ * Create an interval timer whose first expiration occurs after a specified duration,
+ * and whose subsequent expirations occur after a specified interval.
*
- * @param initialExpiration The point in time at which the first timer expiration must occur.
+ * @param initialDuration The number of milliseconds that must elapse before the first
+ * timer expiration notification.
* @param intervalDuration The number of milliseconds that must elapse between timer
* expiration notifications. Expiration notifications are
* scheduled relative to the time of the first expiration. If
@@ -187,19 +199,39 @@
*
* @return The newly created Timer.
*
- * @throws IllegalArgumentException If initialExpiration is null, or initialExpiration.getTime()
- * is negative, or intervalDuration is negative.
+ * @throws IllegalArgumentException If initialDuration is negative, or intervalDuration
+ * is negative.
* @throws IllegalStateException If this method is invoked while the instance is in
* a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
**/
- public Timer createTimer( Date initialExpiration, long intervalDuration, Serializable info )
+ public Timer createTimer( long initialDuration, long intervalDuration, Serializable info )
throws
IllegalArgumentException,
IllegalStateException,
EJBException;
/**
+ * Create a single-action timer that expires at a given point in time.
+ *
+ * @param expiration The point in time at which the timer must expire.
+ * @param info Application information to be delivered along with the timer expiration
+ * notification. This can be null.
+ *
+ * @return The newly created Timer.
+ *
+ * @throws IllegalArgumentException If expiration is null, or expiration.getTime() is negative.
+ * @throws IllegalStateException If this method is invoked while the instance is in
+ * a state that does not allow access to this method.
+ * @throws EJBException If this method could not complete due to a system-level failure.
+ **/
+ public Timer createTimer( Date expiration, Serializable info )
+ throws
+ IllegalArgumentException,
+ IllegalStateException,
+ EJBException;
+
+ /**
* Create an interval timer whose first expiration occurs at a given point in time and
* whose subsequent expirations occur after a specified interval.
*
@@ -210,7 +242,8 @@
* expiration is delayed(e.g. due to the interleaving of other
* method calls on the bean) two or more expiration notifications
* may occur in close succession to "catch up".
- * @param timerConfig Timer configuration.
+ * @param info Application information to be delivered along with the timer expiration
+ * notification. This can be null.
*
* @return The newly created Timer.
*
@@ -219,48 +252,14 @@
* @throws IllegalStateException If this method is invoked while the instance is in
* a state that does not allow access to this method.
* @throws EJBException If this method could not complete due to a system-level failure.
- * @since 3.1
**/
- public Timer createTimer( Date initialExpiration, long intervalDuration, TimerConfig timerConfig )
+ public Timer createTimer( Date initialExpiration, long intervalDuration, Serializable info )
throws
IllegalArgumentException,
IllegalStateException,
EJBException;
/**
- * Create a calendar-based timer based on the input schedule expression.
- *
- * @param schedule A schedule expression describing the timeouts for this timer.
- * @param info Application information to be delivered along with the timer
- * expiration. This can be null.
- * @return The newly created Timer.
- * @throws IllegalArgumentException If Schedule represents an invalid schedule
- * expression.
- * @throws IllegalStateException If this method is invoked while the instance
- * is in a state that does not allow access to this method.
- * @throws EJBException If this method could not complete due to a system-level failure.
- * @since 3.1
- */
- Timer createTimer(ScheduleExpression schedule, Serializable info)
- throws IllegalArgumentException, IllegalStateException, EJBException;
-
- /**
- * Create a calendar-based timer based on the input schedule expression.
- *
- * @param schedule A schedule expression describing the timeouts for this timer.
- * @param timerConfig Timer configuration.
- * @return The newly created Timer.
- * @throws IllegalArgumentException If Schedule represents an invalid schedule
- * expression.
- * @throws IllegalStateException If this method is invoked while the instance
- * is in a state that does not allow access to this method.
- * @throws EJBException If this method could not complete due to a system-level failure.
- * @since 3.1
- */
- Timer createTimer(ScheduleExpression schedule, TimerConfig timerConfig)
- throws IllegalArgumentException, IllegalStateException, EJBException;
-
- /**
* Get all the active timers associated with this bean.
*
* @return A collection of javax.ejb.Timer objects.
Added: projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java
===================================================================
--- projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java (rev 0)
+++ projects/ejb3/trunk/api/src/test/java/org/jboss/ejb3/api/test/signature/unit/SignatureUnitTestCase.java 2009-02-06 09:04:21 UTC (rev 83935)
@@ -0,0 +1,223 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.api.test.signature.unit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.transaction.UserTransaction;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SignatureUnitTestCase
+{
+ private static final Logger log = Logger.getLogger(SignatureUnitTestCase.class);
+
+ private static void assertFieldsEquals(String message, Field expectedFields[], Field actualFields[])
+ {
+ for(Field expected : expectedFields)
+ {
+ Field actual = findField(actualFields, expected);
+ if(actual == null)
+ throw new AssertionError(message + ": expected <" + expected + "> but is not found " + Arrays.asList(actualFields));
+ }
+ // TODO: check too many fields defined
+ }
+
+ private static void assertSameClass(Class<?> expected, Class<?> actual)
+ {
+ assertNotSame(expected.getProtectionDomain().getCodeSource(), actual.getProtectionDomain().getCodeSource());
+ try
+ {
+ assertEquals(expected.getName(), asSet(expected.getAnnotations()), asSet(actual.getAnnotations()));
+ }
+ catch(AssertionError e)
+ {
+ log.warn(e);
+ }
+ assertSetEquals(expected.getName(), asSet(expected.getMethods()), asSet(actual.getMethods()));
+
+ assertFieldsEquals(expected.getName(), expected.getFields(), actual.getFields());
+ }
+
+ private static void assertSetEquals(String message, Set<Method> expected, Set<Method> actual)
+ {
+ for(Method m1 : expected)
+ {
+ Method m2 = findMethod(actual, m1);
+ if(m2 == null)
+ throw new AssertionError(message + ": expected <" + m1 + "> but is not found " + actual);
+ }
+ // TODO: check for too many methods defined
+ }
+
+ private static <T> Set<T> asSet(T objs[])
+ {
+ Set<T> set = new HashSet<T>();
+ for(T obj : objs)
+ set.add(obj);
+ return set;
+ }
+
+ private static ClassLoader createClassLoader(URL... urls)
+ {
+ return new URLClassLoader(urls, null);
+ }
+
+ private static boolean equalSignature(Method m1, Method m2)
+ {
+ if(m1 == m2)
+ return true;
+ if(m1 == null || m2 == null)
+ return false;
+ if(!m1.getName().equals(m2.getName()))
+ return false;
+ if(!m1.getReturnType().getName().equals(m2.getReturnType().getName()))
+ return false;
+ Class<?> m1p[] = m1.getParameterTypes();
+ Class<?> m2p[] = m2.getParameterTypes();
+ if(m1p.length != m2p.length)
+ return false;
+ for(int i = 0; i < m1p.length; i++)
+ {
+ if(!m1p[i].getName().equals(m2p[i].getName()))
+ return false;
+ }
+ Class<?> m1e[] = m1.getExceptionTypes();
+ Class<?> m2e[] = m2.getExceptionTypes();
+ int j = 0;
+ for(int i = 0; i < m1e.length; i++)
+ {
+ if(i >= m2e.length || !m1e[i].getName().equals(m2e[i].getName()))
+ {
+ if(RuntimeException.class.isAssignableFrom(m1e[i]))
+ continue;
+ return false;
+ }
+ j++;
+ }
+ if(j != m2e.length)
+ return false;
+ return true;
+ }
+
+ private static Field findField(Field candidates[], Field signature)
+ {
+ for(Field candidate : candidates)
+ {
+ if(!candidate.getName().equals(signature.getName()))
+ continue;
+ if(!candidate.getType().getName().equals(signature.getType().getName()))
+ continue;
+ if(candidate.getModifiers() != signature.getModifiers())
+ continue;
+ return candidate;
+ }
+ return null;
+ }
+
+ /**
+ * Find the correct method based on the signature.
+ * @param methods
+ * @param signature
+ * @return
+ */
+ private static Method findMethod(Set<Method> methods, Method signature)
+ {
+ for(Method candidate : methods)
+ {
+ if(equalSignature(candidate, signature))
+ {
+ return candidate;
+ }
+ }
+ return null;
+ }
+
+ @Test
+ public void testSignatures() throws Exception
+ {
+ String path = System.getProperty("javax.ejb.jar.path");
+ assertNotNull("javax.ejb.jar.path not set", path);
+ URI rootURI = new File(path).toURI();
+ VirtualFile file = VFS.getRoot(rootURI);
+ final Set<String> classNames = new HashSet<String>();
+ VirtualFileVisitor visitor = new VirtualFileVisitor() {
+ public VisitorAttributes getAttributes()
+ {
+ return VisitorAttributes.RECURSE_LEAVES_ONLY;
+ }
+
+ public void visit(VirtualFile virtualFile)
+ {
+ String name = virtualFile.getPathName();
+ if(name.endsWith(".class"))
+ classNames.add(name.substring(0, name.length() - 6).replace('/', '.'));
+ }
+
+ };
+ file.visit(visitor);
+
+ ClassLoader cl = createClassLoader(rootURI.toURL(), UserTransaction.class.getProtectionDomain().getCodeSource().getLocation());
+
+ for(String className : classNames)
+ {
+ Class<?> expected = cl.loadClass(className);
+ try
+ {
+ Class<?> actual = Class.forName(className);
+ assertSameClass(expected, actual);
+ }
+ catch(ClassNotFoundException e)
+ {
+ log.warn("class not found " + expected);
+ }
+ }
+ }
+
+ @Test
+ public void testFail()
+ {
+ fail("test");
+ }
+}
Added: projects/ejb3/trunk/api/src/test/resources/log4j.xml
===================================================================
--- projects/ejb3/trunk/api/src/test/resources/log4j.xml (rev 0)
+++ projects/ejb3/trunk/api/src/test/resources/log4j.xml 2009-02-06 09:04:21 UTC (rev 83935)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 68671 2008-01-08 10:04:25Z wolfc $ -->
+
+<!--
+ | 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">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="target/test.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <!-- Rollover at the top of each hour
+ <param name="DatePattern" value="'.'yyyy-MM-dd-HH"/>
+ -->
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+
+ <!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
+ <param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
+ -->
+ </layout>
+ </appender>
+
+ <!-- A size based file rolling appender
+ <appender name="FILE" class="org.jboss.logging.appender.RollingFileAppender">
+ <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
+ <param name="Append" value="false"/>
+ <param name="MaxFileSize" value="500KB"/>
+ <param name="MaxBackupIndex" value="1"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+ -->
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+ <param name="Threshold" value="ALL"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Limit JBoss categories to INFO
+ <category name="org.jboss">
+ <priority value="INFO" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <!-- Increase the priority threshold for the DefaultDS category
+ <category name="DefaultDS">
+ <priority value="FATAL"/>
+ </category>
+ -->
+
+ <!-- Decrease the priority threshold for the org.jboss.varia category
+ <category name="org.jboss.varia">
+ <priority value="DEBUG"/>
+ </category>
+ -->
+
+ <!--
+ | An example of enabling the custom TRACE level priority that is used
+ | by the JBoss internals to diagnose low level details. This example
+ | turns on TRACE level msgs for the org.jboss.ejb.plugins package and its
+ | subpackages. This will produce A LOT of logging output.
+ <category name="org.jboss.system">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <category name="org.jboss">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <priority value="WARN" />
+ <appender-ref ref="CONSOLE"/>
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
More information about the jboss-cvs-commits
mailing list