[jboss-cvs] JBossAS SVN: r105835 - in projects/metadata/ejb/trunk: src/main/java/org/jboss/metadata/ejb/spec and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 9 06:32:13 EDT 2010


Author: jaikiran
Date: 2010-06-09 06:32:13 -0400 (Wed, 09 Jun 2010)
New Revision: 105835

Modified:
   projects/metadata/ejb/trunk/pom.xml
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java
Log:
Minor addition to TimerMetadata to allow creating a ScheduleExpression out of it

Modified: projects/metadata/ejb/trunk/pom.xml
===================================================================
--- projects/metadata/ejb/trunk/pom.xml	2010-06-09 09:23:40 UTC (rev 105834)
+++ projects/metadata/ejb/trunk/pom.xml	2010-06-09 10:32:13 UTC (rev 105835)
@@ -23,6 +23,13 @@
           <name>JBoss Releases Repository</name>
           <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
         </repository>
+
+		<snapshotRepository>
+			<id>jboss-snapshots-repository</id>
+			<name>JBoss Snapshots Repository</name>
+			<url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
+		</snapshotRepository>			
+        
     </distributionManagement>
 
   <build>
@@ -209,4 +216,4 @@
 
   </dependencies>
 
-</project>
\ No newline at end of file
+</project>

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java	2010-06-09 09:23:40 UTC (rev 105834)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java	2010-06-09 10:32:13 UTC (rev 105835)
@@ -24,6 +24,7 @@
 import java.io.Serializable;
 import java.util.Calendar;
 
+import javax.ejb.ScheduleExpression;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
 
@@ -127,4 +128,39 @@
       this.info = info;
    }
 
+   /**
+    * Returns a {@link ScheduleExpression} created out of the current snapshot state
+    * of this {@link TimerMetaData}
+    * 
+    * @return
+    * @throws IllegalStateException If no {@link #schedule} is associated with this {@link TimerMetaData}
+    */
+   public ScheduleExpression getScheduleExpression()
+   {
+      if (this.schedule == null)
+      {
+         throw new IllegalStateException("Schedule is null on " + this);
+      }
+      ScheduleExpression scheduleExpr = new ScheduleExpression();
+      // set timezone
+      scheduleExpr.timezone(this.getTimezone());
+      if (this.start != null)
+      {
+         scheduleExpr.start(this.start.getTime());
+      }
+      if (this.end != null)
+      {
+         scheduleExpr.end(this.end.getTime());
+      }
+
+      scheduleExpr.second(this.schedule.getSecond());
+      scheduleExpr.minute(this.schedule.getMinute());
+      scheduleExpr.hour(this.schedule.getHour());
+      scheduleExpr.dayOfMonth(this.schedule.getDayOfMonth());
+      scheduleExpr.dayOfWeek(this.schedule.getDayOfWeek());
+      scheduleExpr.month(this.schedule.getMonth());
+      scheduleExpr.year(this.schedule.getYear());
+      
+      return scheduleExpr;
+   }
 }



More information about the jboss-cvs-commits mailing list