[jbpm-commits] JBoss JBPM SVN: r5288 - in jbpm4/trunk: modules/devguide/src/main/docbook/en/modules and 44 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jul 13 16:21:45 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-07-13 16:21:43 -0400 (Mon, 13 Jul 2009)
New Revision: 5288

Added:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendarImpl.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.businesscalendar.cfg.xml
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java
   jbpm4/trunk/modules/test-cfg/
   jbpm4/trunk/modules/test-cfg/.classpath
   jbpm4/trunk/modules/test-cfg/.project
   jbpm4/trunk/modules/test-cfg/pom.xml
   jbpm4/trunk/modules/test-cfg/src/
   jbpm4/trunk/modules/test-cfg/src/test/
   jbpm4/trunk/modules/test-cfg/src/test/java/
   jbpm4/trunk/modules/test-cfg/src/test/java/org/
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.java
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java
   jbpm4/trunk/modules/test-cfg/src/test/resources/
   jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.hibernate.cfg.xml
   jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.mail.properties
   jbpm4/trunk/modules/test-cfg/src/test/resources/logging.properties
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarcfg/
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarimpl/
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml
   jbpm4/trunk/modules/test-cfg/target/
   jbpm4/trunk/modules/test-cfg/target/test-classes/
   jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.hibernate.cfg.xml
   jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.mail.properties
   jbpm4/trunk/modules/test-cfg/target/test-classes/logging.properties
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.class
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.class
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.class
   jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
Removed:
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Identity.xml
Modified:
   jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Configuration.xml
   jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml
   jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml
   jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml
   jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Day.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/DayPart.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Holiday.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/BusinessCalendarDescriptor.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
   jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
   jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/test-db/pom.xml
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/reporting/SQLStmtTest.java
   jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml
   jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml
   jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
   jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml
   jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml
Log:
JBPM-2334 making business calendar configurable and customizable

Modified: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Configuration.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Configuration.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch09-Configuration.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -21,6 +21,7 @@
     </para>
     <para>Configuration files that can be imported by the user's <literal>jbpm.cfg.xml</literal>:</para>
     <itemizedlist>
+      <listitem>jbpm.businesscalendar.cfg.xml</listitem>
       <listitem>jbpm.default.cfg.xml</listitem>
       <listitem>jbpm.identity.cfg.xml</listitem>
       <listitem>jbpm.jbossremote.cfg.xml</listitem>
@@ -39,6 +40,7 @@
   &lt;jbpm-configuration&gt;
   
     &lt;import resource=&quot;jbpm.default.cfg.xml&quot; /&gt;
+    &lt;import resource=&quot;jbpm.businesscalendar.cfg.xml&quot; /&gt;
     &lt;import resource=&quot;jbpm.tx.hibernate.cfg.xml&quot; /&gt;
     &lt;import resource=&quot;jbpm.jpdl.cfg.xml&quot; /&gt;
     &lt;import resource=&quot;jbpm.identity.cfg.xml&quot; /&gt;
@@ -88,7 +90,41 @@
       <listitem>package modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding</listitem>
     </itemizedlist>
   </section>
+
+  <section id="customizingthebusinesscalendar">
+    <title>Customizing the business calendar</title>
+    <para>For specifying a different configuration for the default 
+    business calendar implementation, see the userguide.
+    </para>
+    <para>To provide a custom implementation for the business calendar, 
+    specify a custom business calendar implementation like this in 
+    the jbpm.cfg.xml
+    </para>
+    <programlisting>&lt;jbpm-configuration&gt;
+
+  &lt;import resource=&quot;jbpm.default.cfg.xml&quot; /&gt;
+  ...
+
+  &lt;process-engine-context&gt;
+    &lt;object class=&quot;org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendar&quot; /&gt;
+  &lt;/process-engine-context&gt;
+
+&lt;/jbpm-configuration&gt;</programlisting>
+    <para>Here's an example implementation</para>
+    <programlisting>public class CustomBusinessCalendar implements BusinessCalendar {
   
+  public Date add(Date date, String duration) {
+    if (&quot;my next birthday&quot;.equals(duration)) {
+      GregorianCalendar gregorianCalendar = new GregorianCalendar();
+      gregorianCalendar.set(Calendar.MONTH, Calendar.JULY);
+      gregorianCalendar.set(Calendar.DAY_OF_MONTH, 21);
+      return gregorianCalendar.getTime();
+    }
+    return null;
+  }
+}</programlisting>
+  </section>
+  
   <section id="customizingtheidentitycomponent">
     <title>Customizing the identity component</title>
     <para>There are 2 identity components that we support out of the box:

Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,10 +3,10 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.jta.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />
-
   <import resource="jbpm.jobexecutor.cfg.xml" />
 
 </jbpm-configuration>

Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.idm/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.jta.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.jboss.idm.cfg.xml" />

Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.hibernate.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />

Modified: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,7 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
-  
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />
 

Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.hibernate.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />

Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -1,273 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.jbpm.pvm.internal.cal;
-
-import java.io.Serializable;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-/**
- * a calendar that knows about business hours.
- */
-public class BusinessCalendar implements Serializable {
-  
-  private static final long serialVersionUID = 1L;
-  private static BusinessCalendar instance = null;
-  
-  protected long oid = -1;
-  protected int version = 0;
-  protected TimeZone timeZone = TimeZone.getDefault();
-  /** array that contains the weekdays in the index as specified by {@link Calendar#SUNDAY} (=1),
-   * {@link Calendar#MONDAY} (=2),... {@link Calendar#SATURDAY} (=7).  
-   */ 
-  protected Day[] days = null;
-  protected Holiday[] holidays = null;
-  
-  protected long secondInMillis = 1000; 
-  protected long minuteInMillis = 60000; 
-  protected long hourInMillis = 3600000; 
-  protected long dayInMillis = 24*hourInMillis; 
-  protected long weekInMillis = 7*dayInMillis; 
-  protected long monthInMillis = 30*dayInMillis; 
-  protected long yearInMillis = 365*dayInMillis; 
-
-  protected long businessDayInMillis = 8*hourInMillis; 
-  protected long businessWeekInMillis = 40*hourInMillis; 
-  protected long businessMonthInMillis = 21*dayInMillis; 
-  protected long businessYearInMillis = 220*dayInMillis; 
-  
-  /** constructor for persistence and creating an empty business calendar */
-  public BusinessCalendar() {
-  }
-
-  public static synchronized BusinessCalendar getInstance() {
-    if (instance==null) {
-      instance = new BusinessCalendar();
-    }
-    return instance;
-  }
-
-  public Date add(Date date, Duration duration) {
-    Date end = null;
-    if (duration.isBusinessTime()) {
-      DayPart dayPart = findDayPart(date);
-      boolean isInbusinessHours = (dayPart!=null);
-      if (! isInbusinessHours) {
-        Object[] result = new Object[2];
-        findDay(date).findNextDayPartStart(0, date, result);
-        date = (Date) result[0];
-        dayPart = (DayPart) result[1];
-      }
-      long millis = convertToMillis(duration);
-      end = dayPart.add(date, millis, duration.isBusinessTime());
-    } else {
-      long millis = convertToMillis(duration);
-      end = new Date(date.getTime()+millis);
-    }
-    return end;
-  }
-
-  public long convertToMillis(Duration duration){
-    long millis = duration.getMillis();
-    millis += duration.getSeconds() * secondInMillis;
-    millis += duration.getMinutes() * minuteInMillis;
-    millis += duration.getHours() * hourInMillis;
-    if (duration.isBusinessTime()) {
-      millis += duration.getDays() * businessDayInMillis;
-      millis += duration.getWeeks() * businessWeekInMillis;
-      millis += duration.getMonths() * businessMonthInMillis;
-      millis += duration.getYears() * businessYearInMillis;
-    } else {
-      millis += duration.getDays() * dayInMillis;
-      millis += duration.getWeeks() * weekInMillis;
-      millis += duration.getMonths() * monthInMillis;
-      millis += duration.getYears() * yearInMillis;
-    }
-    return millis;
-  }
-
-  public boolean isInBusinessHours(Date date) { 
-    return (findDayPart(date)!=null); 
-  } 
-
-  public boolean isHoliday(Date date) {
-    if (holidays!=null) {
-      for(Holiday holiday: holidays) {
-        if (holiday.includes(date)) {
-          return true;
-        }
-      }
-    }
-    return false;
-  }
-
-  protected Date findStartOfNextDay(Date date) {
-    Calendar calendar = createCalendar();
-    calendar.setTime(date);
-    calendar.add(Calendar.DATE, 1);
-    calendar.set(Calendar.HOUR_OF_DAY, 0);
-    calendar.set(Calendar.MINUTE, 0);
-    calendar.set(Calendar.SECOND, 0);
-    calendar.set(Calendar.MILLISECOND, 0);
-    date = calendar.getTime();
-    while(isHoliday(date)) {
-      calendar.setTime(date);
-      calendar.add(Calendar.DATE, 1);
-      date = calendar.getTime();
-    }
-    return date;
-  }
-
-  public Calendar createCalendar() {
-    return new GregorianCalendar();
-  }
-
-  protected Day findDay(Date date) {
-    Calendar calendar = createCalendar();
-    calendar.setTime(date);
-    int weekDayIndex = calendar.get(Calendar.DAY_OF_WEEK);
-    return days[weekDayIndex];
-  }
-
-  protected DayPart findDayPart(Date date) {
-    DayPart dayPart = null;
-    if (! isHoliday(date)) {
-      Day day = findDay(date);
-      DayPart[] dayParts = day.getDayParts();
-      if (dayParts!=null) {
-        for (int i=0; ((i < dayParts.length) && (dayPart==null)); i++) {
-          DayPart candidate = dayParts[i];
-          if (candidate.includes(date)) {
-            dayPart = candidate;
-          }
-        }
-      }
-    }
-    return dayPart;
-  }
-
-  protected DayPart findNextDayPart(Date date) { 
-    DayPart nextDayPart = null; 
-    while(nextDayPart==null) { 
-      nextDayPart = findDayPart(date); 
-      if (nextDayPart==null) { 
-        date = findStartOfNextDay(date); 
-        Object result[] = new Object[2]; 
-        Day day = findDay(date); 
-        day.findNextDayPartStart(0, date, result); 
-        nextDayPart = (DayPart) result[1]; 
-      } 
-    } 
-    return nextDayPart; 
-  }
-
-  
-
-  // getters and setters //////////////////////////////////////////////////////
-  
-  public long getBusinessDayInMillis() {
-    return businessDayInMillis;
-  }
-  public void setBusinessDayInMillis(long businessDayInMillis) {
-    this.businessDayInMillis = businessDayInMillis;
-  }
-  public long getBusinessMonthInMillis() {
-    return businessMonthInMillis;
-  }
-  public void setBusinessMonthInMillis(long businessMonthInMillis) {
-    this.businessMonthInMillis = businessMonthInMillis;
-  }
-  public long getBusinessWeekInMillis() {
-    return businessWeekInMillis;
-  }
-  public void setBusinessWeekInMillis(long businessWeekInMillis) {
-    this.businessWeekInMillis = businessWeekInMillis;
-  }
-  public long getBusinessYearInMillis() {
-    return businessYearInMillis;
-  }
-  public void setBusinessYearInMillis(long businessYearInMillis) {
-    this.businessYearInMillis = businessYearInMillis;
-  }
-  public long getDayInMillis() {
-    return dayInMillis;
-  }
-  public void setDayInMillis(long dayInMillis) {
-    this.dayInMillis = dayInMillis;
-  }
-  public Day[] getDays() {
-    return days;
-  }
-  public void setDays(Day[] days) {
-    this.days = days;
-  }
-  public Holiday[] getHolidays() {
-    return holidays;
-  }
-  public void setHolidays(Holiday[] holidays) {
-    this.holidays = holidays;
-  }
-  public long getHourInMillis() {
-    return hourInMillis;
-  }
-  public void setHourInMillis(long hourInMillis) {
-    this.hourInMillis = hourInMillis;
-  }
-  public long getMinuteInMillis() {
-    return minuteInMillis;
-  }
-  public void setMinuteInMillis(long minuteInMillis) {
-    this.minuteInMillis = minuteInMillis;
-  }
-  public long getMonthInMillis() {
-    return monthInMillis;
-  }
-  public void setMonthInMillis(long monthInMillis) {
-    this.monthInMillis = monthInMillis;
-  }
-  public long getSecondInMillis() {
-    return secondInMillis;
-  }
-  public void setSecondInMillis(long secondInMillis) {
-    this.secondInMillis = secondInMillis;
-  }
-  public TimeZone getTimeZone() {
-    return timeZone;
-  }
-  public void setTimeZone(TimeZone timeZone) {
-    this.timeZone = timeZone;
-  }
-  public long getWeekInMillis() {
-    return weekInMillis;
-  }
-  public void setWeekInMillis(long weekInMillis) {
-    this.weekInMillis = weekInMillis;
-  }
-  public long getYearInMillis() {
-    return yearInMillis;
-  }
-  public void setYearInMillis(long yearInMillis) {
-    this.yearInMillis = yearInMillis;
-  } 
-}

Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.pvm.internal.cal;
+
+import java.util.Date;
+
+/** 
+ * @author Tom Baeyens
+ */
+public interface BusinessCalendar {
+
+  Date add(Date date, String duration);
+
+}
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendarImpl.java (from rev 5286, jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendar.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendarImpl.java	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendarImpl.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,277 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.pvm.internal.cal;
+
+import java.io.Serializable;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+/**
+ * a calendar that knows about business hours.
+ */
+public class BusinessCalendarImpl implements Serializable, BusinessCalendar {
+  
+  private static final long serialVersionUID = 1L;
+  private static BusinessCalendarImpl instance = null;
+  
+  protected long oid = -1;
+  protected int version = 0;
+  protected TimeZone timeZone = TimeZone.getDefault();
+  /** array that contains the weekdays in the index as specified by {@link Calendar#SUNDAY} (=1),
+   * {@link Calendar#MONDAY} (=2),... {@link Calendar#SATURDAY} (=7).  
+   */ 
+  protected Day[] days = null;
+  protected Holiday[] holidays = null;
+  
+  protected long secondInMillis = 1000; 
+  protected long minuteInMillis = 60000; 
+  protected long hourInMillis = 3600000; 
+  protected long dayInMillis = 24*hourInMillis; 
+  protected long weekInMillis = 7*dayInMillis; 
+  protected long monthInMillis = 30*dayInMillis; 
+  protected long yearInMillis = 365*dayInMillis; 
+
+  protected long businessDayInMillis = 8*hourInMillis; 
+  protected long businessWeekInMillis = 40*hourInMillis; 
+  protected long businessMonthInMillis = 21*dayInMillis; 
+  protected long businessYearInMillis = 220*dayInMillis; 
+  
+  /** constructor for persistence and creating an empty business calendar */
+  public BusinessCalendarImpl() {
+  }
+
+  public static synchronized BusinessCalendarImpl getInstance() {
+    if (instance==null) {
+      instance = new BusinessCalendarImpl();
+    }
+    return instance;
+  }
+
+  public Date add(Date date, String duration) {
+    return add(date, new Duration(duration));
+  }
+
+  public Date add(Date date, Duration duration) {
+    Date end = null;
+    if (duration.isBusinessTime()) {
+      DayPart dayPart = findDayPart(date);
+      boolean isInbusinessHours = (dayPart!=null);
+      if (! isInbusinessHours) {
+        Object[] result = new Object[2];
+        findDay(date).findNextDayPartStart(0, date, result);
+        date = (Date) result[0];
+        dayPart = (DayPart) result[1];
+      }
+      long millis = convertToMillis(duration);
+      end = dayPart.add(date, millis, duration.isBusinessTime());
+    } else {
+      long millis = convertToMillis(duration);
+      end = new Date(date.getTime()+millis);
+    }
+    return end;
+  }
+
+  public long convertToMillis(Duration duration){
+    long millis = duration.getMillis();
+    millis += duration.getSeconds() * secondInMillis;
+    millis += duration.getMinutes() * minuteInMillis;
+    millis += duration.getHours() * hourInMillis;
+    if (duration.isBusinessTime()) {
+      millis += duration.getDays() * businessDayInMillis;
+      millis += duration.getWeeks() * businessWeekInMillis;
+      millis += duration.getMonths() * businessMonthInMillis;
+      millis += duration.getYears() * businessYearInMillis;
+    } else {
+      millis += duration.getDays() * dayInMillis;
+      millis += duration.getWeeks() * weekInMillis;
+      millis += duration.getMonths() * monthInMillis;
+      millis += duration.getYears() * yearInMillis;
+    }
+    return millis;
+  }
+
+  public boolean isInBusinessHours(Date date) { 
+    return (findDayPart(date)!=null); 
+  } 
+
+  public boolean isHoliday(Date date) {
+    if (holidays!=null) {
+      for(Holiday holiday: holidays) {
+        if (holiday.includes(date)) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  protected Date findStartOfNextDay(Date date) {
+    Calendar calendar = createCalendar();
+    calendar.setTime(date);
+    calendar.add(Calendar.DATE, 1);
+    calendar.set(Calendar.HOUR_OF_DAY, 0);
+    calendar.set(Calendar.MINUTE, 0);
+    calendar.set(Calendar.SECOND, 0);
+    calendar.set(Calendar.MILLISECOND, 0);
+    date = calendar.getTime();
+    while(isHoliday(date)) {
+      calendar.setTime(date);
+      calendar.add(Calendar.DATE, 1);
+      date = calendar.getTime();
+    }
+    return date;
+  }
+
+  public Calendar createCalendar() {
+    return new GregorianCalendar();
+  }
+
+  protected Day findDay(Date date) {
+    Calendar calendar = createCalendar();
+    calendar.setTime(date);
+    int weekDayIndex = calendar.get(Calendar.DAY_OF_WEEK);
+    return days[weekDayIndex];
+  }
+
+  protected DayPart findDayPart(Date date) {
+    DayPart dayPart = null;
+    if (! isHoliday(date)) {
+      Day day = findDay(date);
+      DayPart[] dayParts = day.getDayParts();
+      if (dayParts!=null) {
+        for (int i=0; ((i < dayParts.length) && (dayPart==null)); i++) {
+          DayPart candidate = dayParts[i];
+          if (candidate.includes(date)) {
+            dayPart = candidate;
+          }
+        }
+      }
+    }
+    return dayPart;
+  }
+
+  protected DayPart findNextDayPart(Date date) { 
+    DayPart nextDayPart = null; 
+    while(nextDayPart==null) { 
+      nextDayPart = findDayPart(date); 
+      if (nextDayPart==null) { 
+        date = findStartOfNextDay(date); 
+        Object result[] = new Object[2]; 
+        Day day = findDay(date); 
+        day.findNextDayPartStart(0, date, result); 
+        nextDayPart = (DayPart) result[1]; 
+      } 
+    } 
+    return nextDayPart; 
+  }
+
+  
+
+  // getters and setters //////////////////////////////////////////////////////
+  
+  public long getBusinessDayInMillis() {
+    return businessDayInMillis;
+  }
+  public void setBusinessDayInMillis(long businessDayInMillis) {
+    this.businessDayInMillis = businessDayInMillis;
+  }
+  public long getBusinessMonthInMillis() {
+    return businessMonthInMillis;
+  }
+  public void setBusinessMonthInMillis(long businessMonthInMillis) {
+    this.businessMonthInMillis = businessMonthInMillis;
+  }
+  public long getBusinessWeekInMillis() {
+    return businessWeekInMillis;
+  }
+  public void setBusinessWeekInMillis(long businessWeekInMillis) {
+    this.businessWeekInMillis = businessWeekInMillis;
+  }
+  public long getBusinessYearInMillis() {
+    return businessYearInMillis;
+  }
+  public void setBusinessYearInMillis(long businessYearInMillis) {
+    this.businessYearInMillis = businessYearInMillis;
+  }
+  public long getDayInMillis() {
+    return dayInMillis;
+  }
+  public void setDayInMillis(long dayInMillis) {
+    this.dayInMillis = dayInMillis;
+  }
+  public Day[] getDays() {
+    return days;
+  }
+  public void setDays(Day[] days) {
+    this.days = days;
+  }
+  public Holiday[] getHolidays() {
+    return holidays;
+  }
+  public void setHolidays(Holiday[] holidays) {
+    this.holidays = holidays;
+  }
+  public long getHourInMillis() {
+    return hourInMillis;
+  }
+  public void setHourInMillis(long hourInMillis) {
+    this.hourInMillis = hourInMillis;
+  }
+  public long getMinuteInMillis() {
+    return minuteInMillis;
+  }
+  public void setMinuteInMillis(long minuteInMillis) {
+    this.minuteInMillis = minuteInMillis;
+  }
+  public long getMonthInMillis() {
+    return monthInMillis;
+  }
+  public void setMonthInMillis(long monthInMillis) {
+    this.monthInMillis = monthInMillis;
+  }
+  public long getSecondInMillis() {
+    return secondInMillis;
+  }
+  public void setSecondInMillis(long secondInMillis) {
+    this.secondInMillis = secondInMillis;
+  }
+  public TimeZone getTimeZone() {
+    return timeZone;
+  }
+  public void setTimeZone(TimeZone timeZone) {
+    this.timeZone = timeZone;
+  }
+  public long getWeekInMillis() {
+    return weekInMillis;
+  }
+  public void setWeekInMillis(long weekInMillis) {
+    this.weekInMillis = weekInMillis;
+  }
+  public long getYearInMillis() {
+    return yearInMillis;
+  }
+  public void setYearInMillis(long yearInMillis) {
+    this.yearInMillis = yearInMillis;
+  } 
+}


Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/BusinessCalendarImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Day.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Day.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Day.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -34,7 +34,7 @@
   protected long oid = -1;
   protected int version = 0;
   protected DayPart[] dayParts = null;
-  protected BusinessCalendar businessCalendar = null;
+  protected BusinessCalendarImpl businessCalendarImpl = null;
 
   public void findNextDayPartStart(int dayPartIndex, Date date, Object[] result) {
     // if there is a day part in this day that starts after the given date
@@ -49,20 +49,20 @@
       }
     } else {
       // descend recustively
-      date = businessCalendar.findStartOfNextDay(date);
-      Day nextDay = businessCalendar.findDay(date);
+      date = businessCalendarImpl.findStartOfNextDay(date);
+      Day nextDay = businessCalendarImpl.findDay(date);
       nextDay.findNextDayPartStart(0, date, result);
     }
   }
 
-  public BusinessCalendar getBusinessCalendar() {
-    return businessCalendar;
+  public BusinessCalendarImpl getBusinessCalendar() {
+    return businessCalendarImpl;
   }
   public DayPart[] getDayParts() {
     return dayParts;
   }
-  public void setBusinessCalendar(BusinessCalendar businessCalendar) {
-    this.businessCalendar = businessCalendar;
+  public void setBusinessCalendar(BusinessCalendarImpl businessCalendarImpl) {
+    this.businessCalendarImpl = businessCalendarImpl;
   }
   public void setDayParts(DayPart[] dayParts) {
     this.dayParts = dayParts;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/DayPart.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/DayPart.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/DayPart.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -45,8 +45,8 @@
   public Date add(Date date, long millis, boolean isBusinessTime) {
     Date end = null;
     
-    BusinessCalendar businessCalendar = day.getBusinessCalendar();
-    Calendar calendar = businessCalendar.createCalendar();
+    BusinessCalendarImpl businessCalendarImpl = day.getBusinessCalendar();
+    Calendar calendar = businessCalendarImpl.createCalendar();
     calendar.setTime(date);
     int hour = calendar.get(Calendar.HOUR_OF_DAY);
     int minute = calendar.get(Calendar.MINUTE);

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Holiday.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Holiday.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cal/Holiday.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -35,7 +35,7 @@
   protected int version = 0;
   protected Date fromDay = null;
   protected Date toDay = null;
-  protected BusinessCalendar businessCalendar = null;
+  protected BusinessCalendarImpl businessCalendarImpl = null;
 
   /*
   public static List parseHolidays(Properties calendarProperties, BusinessCalendar businessCalendar) {
@@ -85,11 +85,11 @@
              && (date.getTime()<toDay.getTime())
            );
   }
-  public BusinessCalendar getBusinessCalendar() {
-    return businessCalendar;
+  public BusinessCalendarImpl getBusinessCalendar() {
+    return businessCalendarImpl;
   }
-  public void setBusinessCalendar(BusinessCalendar businessCalendar) {
-    this.businessCalendar = businessCalendar;
+  public void setBusinessCalendar(BusinessCalendarImpl businessCalendarImpl) {
+    this.businessCalendarImpl = businessCalendarImpl;
   }
   public Date getFromDay() {
     return fromDay;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -28,7 +28,6 @@
 import org.jbpm.api.job.Timer;
 import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.cal.BusinessCalendar;
-import org.jbpm.pvm.internal.cal.Duration;
 import org.jbpm.pvm.internal.env.Environment;
 import org.jbpm.pvm.internal.env.EnvironmentDefaults;
 import org.jbpm.pvm.internal.env.Transaction;
@@ -71,33 +70,11 @@
   }
 
   public void setDueDateDescription(String dueDateDescription) {
-
     ScriptManager scriptManager = EnvironmentDefaults.getScriptManager();
     dueDateDescription = (String) scriptManager.evaluateExpression(dueDateDescription, null);
-    
-    Duration duration = new Duration(dueDateDescription);
     Date now = Clock.getCurrentTime();
-    
-    if ( duration.isBusinessTime()
-         || duration.getMonths()>0 
-         || duration.getYears()>0
-       ) {
-      Environment environment = Environment.getCurrent();
-      if (environment==null) {
-        throw new JbpmException("no environment to get business calendar for calculating duedate "+dueDateDescription);
-      }
-      BusinessCalendar businessCalendar = environment.get(BusinessCalendar.class);
-      dueDate = businessCalendar.add(now, duration);
-
-    } else {
-      long millis = duration.getMillis() + 
-                    1000*( duration.getSeconds() + 
-                           60*( duration.getMinutes() + 
-                                60*( duration.getHours() + 
-                                     24*( duration.getDays() + 
-                                          7*duration.getWeeks()))));
-      dueDate = new Date(now.getTime() + millis);
-    }
+    BusinessCalendar businessCalendar = Environment.getFromCurrent(BusinessCalendar.class);
+    dueDate = businessCalendar.add(now, dueDateDescription);
   }
 
   public Boolean execute(Environment environment) throws Exception {

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -31,7 +31,7 @@
 import java.util.StringTokenizer;
 import java.util.TimeZone;
 
-import org.jbpm.pvm.internal.cal.BusinessCalendar;
+import org.jbpm.pvm.internal.cal.BusinessCalendarImpl;
 import org.jbpm.pvm.internal.cal.Day;
 import org.jbpm.pvm.internal.cal.DayPart;
 import org.jbpm.pvm.internal.cal.Holiday;
@@ -53,7 +53,7 @@
   }
 
   public Object parse(Element element, Parse parse, Parser parser) {
-    BusinessCalendar businessCalendar = new BusinessCalendar();
+    BusinessCalendarImpl businessCalendarImpl = new BusinessCalendarImpl();
     
     TimeZone timeZone = null;
     if (element.hasAttribute("timezone")) {
@@ -61,7 +61,7 @@
     } else {
       timeZone = TimeZone.getDefault();
     }
-    businessCalendar.setTimeZone(timeZone);
+    businessCalendarImpl.setTimeZone(timeZone);
     
     String hourFormatText = "HH:mm";
     if (element.hasAttribute("hour-format")) {
@@ -70,14 +70,14 @@
     DateFormat hourFormat = new SimpleDateFormat(hourFormatText);
 
     Day[] days = new Day[8];
-    days[Calendar.SUNDAY] = parseDay(element, "sunday", hourFormat, businessCalendar, parse);
-    days[Calendar.MONDAY] = parseDay(element, "monday", hourFormat, businessCalendar, parse);
-    days[Calendar.TUESDAY] = parseDay(element, "tuesday", hourFormat, businessCalendar, parse);
-    days[Calendar.WEDNESDAY] = parseDay(element, "wednesday", hourFormat, businessCalendar, parse);
-    days[Calendar.THURSDAY] = parseDay(element, "thursday", hourFormat, businessCalendar, parse);
-    days[Calendar.FRIDAY] = parseDay(element, "friday", hourFormat, businessCalendar, parse);
-    days[Calendar.SATURDAY] = parseDay(element, "saturday", hourFormat, businessCalendar, parse);
-    businessCalendar.setDays(days);
+    days[Calendar.SUNDAY] = parseDay(element, "sunday", hourFormat, businessCalendarImpl, parse);
+    days[Calendar.MONDAY] = parseDay(element, "monday", hourFormat, businessCalendarImpl, parse);
+    days[Calendar.TUESDAY] = parseDay(element, "tuesday", hourFormat, businessCalendarImpl, parse);
+    days[Calendar.WEDNESDAY] = parseDay(element, "wednesday", hourFormat, businessCalendarImpl, parse);
+    days[Calendar.THURSDAY] = parseDay(element, "thursday", hourFormat, businessCalendarImpl, parse);
+    days[Calendar.FRIDAY] = parseDay(element, "friday", hourFormat, businessCalendarImpl, parse);
+    days[Calendar.SATURDAY] = parseDay(element, "saturday", hourFormat, businessCalendarImpl, parse);
+    businessCalendarImpl.setDays(days);
 
     String dayFormatText = "dd/MM/yyyy";
     if (element.hasAttribute("day-format")) {
@@ -90,18 +90,18 @@
     if (!holidayElements.isEmpty()) {
       holidays = new Holiday[holidayElements.size()];
       for (int i=0; i<holidayElements.size(); i++) {
-        holidays[i] = parseHoliday(holidayElements.get(i), dayFormat, businessCalendar, parse);
+        holidays[i] = parseHoliday(holidayElements.get(i), dayFormat, businessCalendarImpl, parse);
       }
     }
-    businessCalendar.setHolidays(holidays);
+    businessCalendarImpl.setHolidays(holidays);
     
-    ProvidedObjectDescriptor descriptor = new ProvidedObjectDescriptor(businessCalendar, true);
+    ProvidedObjectDescriptor descriptor = new ProvidedObjectDescriptor(businessCalendarImpl, true);
     return descriptor;
   }
 
-  private Day parseDay(Element daysElement, String dayText, DateFormat hourFormat, BusinessCalendar businessCalendar, Parse parse) {
+  private Day parseDay(Element daysElement, String dayText, DateFormat hourFormat, BusinessCalendarImpl businessCalendarImpl, Parse parse) {
     Day day = new Day();
-    day.setBusinessCalendar(businessCalendar);
+    day.setBusinessCalendar(businessCalendarImpl);
 
     Element dayElement = XmlUtil.element(daysElement, dayText);
     if (dayElement!=null) {
@@ -159,7 +159,7 @@
     return day;
   }
   
-  private Holiday parseHoliday(Element holidayElement, DateFormat dayFormat, BusinessCalendar businessCalendar, Parse parse) {
+  private Holiday parseHoliday(Element holidayElement, DateFormat dayFormat, BusinessCalendarImpl businessCalendarImpl, Parse parse) {
     Holiday holiday = new Holiday();
     try {
       if (holidayElement.hasAttribute("period")) {
@@ -191,7 +191,7 @@
 
       // now we are going to set the toDay to the end of the day, rather then the beginning.
       // we take the start of the next day as the end of the toDay.
-      Calendar calendar = businessCalendar.createCalendar();
+      Calendar calendar = businessCalendarImpl.createCalendar();
       calendar.setTime(holiday.getToDay());
       calendar.add(Calendar.DATE, 1);
       Date toDay = calendar.getTime();

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/BusinessCalendarDescriptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/BusinessCalendarDescriptor.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/BusinessCalendarDescriptor.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -21,7 +21,7 @@
  */
 package org.jbpm.pvm.internal.wire.descriptor;
 
-import org.jbpm.pvm.internal.cal.BusinessCalendar;
+import org.jbpm.pvm.internal.cal.BusinessCalendarImpl;
 import org.jbpm.pvm.internal.wire.WireContext;
 import org.jbpm.pvm.internal.wire.WireDefinition;
 
@@ -29,20 +29,20 @@
 
   private static final long serialVersionUID = 1L;
 
-  BusinessCalendar businessCalendar;
+  BusinessCalendarImpl businessCalendarImpl;
   
   public BusinessCalendarDescriptor() {
   }
 
-  public BusinessCalendarDescriptor(BusinessCalendar businessCalendar) {
-    this.businessCalendar = businessCalendar;
+  public BusinessCalendarDescriptor(BusinessCalendarImpl businessCalendarImpl) {
+    this.businessCalendarImpl = businessCalendarImpl;
   }
 
   public Object construct(WireContext wireContext) {
-    return businessCalendar;
+    return businessCalendarImpl;
   }
 
   public Class<?> getType(WireDefinition wireDefinition) {
-    return BusinessCalendar.class;
+    return BusinessCalendarImpl.class;
   }
 }

Added: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.businesscalendar.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.businesscalendar.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.businesscalendar.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <process-engine-context>
+  
+    <business-calendar>
+      <monday    hours="9:00-12:00 and 12:30-17:00"/>
+      <tuesday   hours="9:00-12:00 and 12:30-17:00"/>
+      <wednesday hours="9:00-12:00 and 12:30-17:00"/>
+      <thursday  hours="9:00-12:00 and 12:30-17:00"/>
+      <friday    hours="9:00-12:00 and 12:30-17:00"/>
+      <holiday period="01/07/2008 - 31/08/2008"/>
+    </business-calendar>
+
+  </process-engine-context>
+    
+</jbpm-configuration>


Property changes on: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.businesscalendar.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -30,15 +30,6 @@
 
     <address-resolver />
 
-    <business-calendar>
-      <monday    hours="9:00-12:00 and 12:30-17:00"/>
-      <tuesday   hours="9:00-12:00 and 12:30-17:00"/>
-      <wednesday hours="9:00-12:00 and 12:30-17:00"/>
-      <thursday  hours="9:00-12:00 and 12:30-17:00"/>
-      <friday    hours="9:00-12:00 and 12:30-17:00"/>
-      <holiday period="01/07/2008 - 31/08/2008"/>
-    </business-calendar>
-    
     <mail-template name='task-notification'>
       <to users="${task.assignee}"/>
       <subject>${task.name}</subject>

Modified: jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/pvm/src/test/resources/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.hibernate.cfg.xml" />
 
 </jbpm-configuration>

Added: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.test;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JbpmCustomCfgTestCase extends JbpmTestCase {
+
+  protected synchronized void initialize() {
+    String cfgResource = getClass().getPackage().getName().replace(".", "/")+"/jbpm.cfg.xml";
+    initialize(cfgResource);
+  }
+
+}


Property changes on: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmCustomCfgTestCase.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/JbpmTestCase.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -79,19 +79,34 @@
 
   protected synchronized void initialize() {
     if (processEngine==null) {
+      String jbpmTestCfgType = System.getProperty("jbpm.test.cfg.type");
+      String jbpmTestCfgResource = System.getProperty("jbpm.test.cfg.resource");
+      initialize(jbpmTestCfgType, jbpmTestCfgResource);
+    }
+  }
 
-      String jbpmTestCfgType = System.getProperty("jbpm.test.cfg.type");
+  protected synchronized void initialize(String jbpmTestCfgResource) {
+    if (processEngine==null) {
+      initialize(jbpmTestCfgResource, null);
+    }
+  }
+
+  protected synchronized void initialize(String jbpmTestCfgResource, String jbpmTestCfgType) {
+    if (processEngine==null) {
+
+      if (log.isDebugEnabled()) {
+        log.debug("building "+
+                  (jbpmTestCfgType!=null ? jbpmTestCfgType+" " : "")+
+                  "ProcessEngine "+
+                  (jbpmTestCfgResource!=null ? "from resource "+jbpmTestCfgResource : "from default resource jbpm.cfg.xml"));
+      }
+
       Configuration configuration = new Configuration(jbpmTestCfgType);
-
-      String jbpmTestCfgResource = System.getProperty("jbpm.test.cfg.resource");
       if (jbpmTestCfgResource!=null) {
         configuration.setResource(jbpmTestCfgResource);
       }
-
       processEngine = configuration.buildProcessEngine();
       
-      log.debug("using ProcessEngine "+System.identityHashCode(processEngine));
-
       repositoryService = processEngine.get(RepositoryService.class);
       executionService = processEngine.getExecutionService();
       historyService = processEngine.getHistoryService();
@@ -100,7 +115,7 @@
       identityService = processEngine.getIdentityService();
     }
   }
-
+  
   protected void tearDown() throws Exception {
     for (String deploymentId : registeredDeployments) {
       repositoryService.deleteDeploymentCascade(deploymentId);

Added: jbpm4/trunk/modules/test-cfg/.classpath
===================================================================
--- jbpm4/trunk/modules/test-cfg/.classpath	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/.classpath	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+  <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+  <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>


Property changes on: jbpm4/trunk/modules/test-cfg/.classpath
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/.project
===================================================================
--- jbpm4/trunk/modules/test-cfg/.project	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/.project	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>test-cfg</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>


Property changes on: jbpm4/trunk/modules/test-cfg/.project
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/pom.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/pom.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id: pom.xml 5246 2009-07-06 11:07:48Z tom.baeyens at jboss.com $ -->
+<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>
+  <name>jBPM 4 - Test Cfg</name>
+  <groupId>org.jbpm.jbpm4</groupId>
+  <artifactId>jbpm-test-cfg</artifactId>
+  <packaging>jar</packaging>
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jbpm.jbpm4</groupId>
+    <artifactId>jbpm</artifactId>
+    <version>4.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+
+  <!-- Dependencies -->
+  <dependencies>
+
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-test-base</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-jpdl</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-test-base</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jbpm.jbpm4</groupId>
+      <artifactId>jbpm-console-reports</artifactId>
+      <scope>test</scope>
+    </dependency>    
+
+  </dependencies>
+  
+</project>


Property changes on: jbpm4/trunk/modules/test-cfg/pom.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.test.custombusinesscalendarcfg;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.pvm.internal.util.Clock;
+import org.jbpm.test.JbpmCustomCfgTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomBusinessCalendarCfgTest extends JbpmCustomCfgTestCase {
+
+  public void testCustomBusinessCalendarCfg() {
+    deployJpdlXmlString(
+      "<process name='CustomBusinessCalendarCfg'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a'>" +
+      "    <transition to='b' />" +
+      "    <transition name='timeout' to='escalate'>" +
+      "      <timer duedate='8 business hours' />" +
+      "    </transition>" +
+      "  </state>" +
+      "  <state name='b' />" +
+      "  <end name='escalate' />" +
+      "</process>"
+    );
+    
+    GregorianCalendar gregorianCalendar = new GregorianCalendar();
+    gregorianCalendar.set(2009, Calendar.JANUARY, 30, 11, 0, 0);
+    Date clockDate = gregorianCalendar.getTime();
+    Clock.setCurrentTime(clockDate);
+
+    ProcessInstance processInstance = executionService.startProcessInstanceByKey("CustomBusinessCalendarCfg");
+
+    Job job = managementService.createJobQuery()
+      .processInstanceId(processInstance.getId())
+      .uniqueResult();
+    
+    Date duedate = job.getDueDate();
+    
+    gregorianCalendar = new GregorianCalendar();
+    gregorianCalendar.setTime(duedate);
+    assertEquals(2009, gregorianCalendar.get(Calendar.YEAR));
+    assertEquals(Calendar.NOVEMBER, gregorianCalendar.get(Calendar.MONTH));
+    assertEquals(2, gregorianCalendar.get(Calendar.DAY_OF_MONTH));
+    assertEquals(10, gregorianCalendar.get(Calendar.HOUR_OF_DAY));
+    assertEquals(0, gregorianCalendar.get(Calendar.MINUTE));
+    assertEquals(0, gregorianCalendar.get(Calendar.SECOND));
+    
+  }
+}


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.test.custombusinesscalendarimpl;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import org.jbpm.pvm.internal.cal.BusinessCalendar;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomBusinessCalendar implements BusinessCalendar {
+  
+  public Date add(Date date, String duration) {
+    if ("my next birthday".equals(duration)) {
+      GregorianCalendar gregorianCalendar = new GregorianCalendar();
+      gregorianCalendar.set(Calendar.MONTH, Calendar.JULY);
+      gregorianCalendar.set(Calendar.DAY_OF_MONTH, 21);
+      return gregorianCalendar.getTime();
+    }
+    return null;
+  }
+}


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbpm.test.custombusinesscalendarimpl;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.pvm.internal.cal.BusinessCalendar;
+import org.jbpm.test.JbpmCustomCfgTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CustomBusinessCalendarImplTest extends JbpmCustomCfgTestCase {
+
+  public void testCustomBusinessCalendar() {
+    BusinessCalendar customBusinessCalendar = processEngine.get(BusinessCalendar.class);
+    assertNotNull(customBusinessCalendar);
+    assertEquals(CustomBusinessCalendar.class, customBusinessCalendar.getClass());
+  }
+
+  public void testCustomBusinessCalendarUsage() {
+    deployJpdlXmlString(
+      "<process name='CustomBusinessCalendar'>" +
+      "  <start>" +
+      "    <transition to='a' />" +
+      "  </start>" +
+      "  <state name='a'>" +
+      "    <transition to='b' />" +
+      "    <transition name='timeout' to='escalate'>" +
+      "      <timer duedate='my next birthday' />" +
+      "    </transition>" +
+      "  </state>" +
+      "  <state name='b' />" +
+      "  <end name='escalate' />" +
+      "</process>"
+    );
+
+    ProcessInstance processInstance = executionService.startProcessInstanceByKey("CustomBusinessCalendar");
+
+    Job job = managementService.createJobQuery()
+      .processInstanceId(processInstance.getId())
+      .uniqueResult();
+    
+    Date duedate = job.getDueDate();
+    
+    GregorianCalendar gregorianCalendar = new GregorianCalendar();
+    gregorianCalendar.setTime(duedate);
+    assertEquals(Calendar.JULY, gregorianCalendar.get(Calendar.MONTH));
+    assertEquals(21, gregorianCalendar.get(Calendar.DAY_OF_MONTH));
+  }
+}


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.hibernate.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.hibernate.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+  <session-factory>
+  
+     <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+     <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+     <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
+     <property name="hibernate.connection.username">sa</property>
+     <property name="hibernate.connection.password"></property>
+     <property name="hibernate.hbm2ddl.auto">create-drop</property>
+     <property name="hibernate.format_sql">true</property>
+     
+     <mapping resource="jbpm.repository.hbm.xml" />
+     <mapping resource="jbpm.execution.hbm.xml" />
+     <mapping resource="jbpm.history.hbm.xml" />
+     <mapping resource="jbpm.task.hbm.xml" />
+     <mapping resource="jbpm.identity.hbm.xml" />
+     
+  </session-factory>
+</hibernate-configuration>


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.hibernate.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.mail.properties
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.mail.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.mail.properties	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,3 @@
+mail.smtp.host	localhost
+mail.smtp.port	2525
+mail.from		noreply at jbpm.org
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/resources/jbpm.mail.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/logging.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/logging.properties	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINE
+# org.jbpm.pvm.internal.tx.level=FINE
+# org.jbpm.pvm.internal.wire.level=FINE
+# org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=INFO
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/resources/logging.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.tx.hibernate.cfg.xml" />
+  <import resource="jbpm.jpdl.cfg.xml" />
+  <import resource="jbpm.identity.cfg.xml" />
+
+  <process-engine-context>
+    <business-calendar>
+      <monday    hours="9:00-18:00"/>
+      <tuesday   hours="9:00-18:00"/>
+      <wednesday hours="9:00-18:00"/>
+      <thursday  hours="9:00-18:00"/>
+      <friday    hours="9:00-18:00"/>
+      <holiday period="01/02/2009 - 31/10/2009"/>
+    </business-calendar>
+  </process-engine-context>
+
+</jbpm-configuration>


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.tx.hibernate.cfg.xml" />
+  <import resource="jbpm.jpdl.cfg.xml" />
+  <import resource="jbpm.identity.cfg.xml" />
+
+  <process-engine-context>
+    <object class="org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendar" />
+  </process-engine-context>
+
+</jbpm-configuration>


Property changes on: jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.hibernate.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.hibernate.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+  <session-factory>
+  
+     <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+     <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+     <property name="hibernate.connection.url">jdbc:hsqldb:mem:.</property>
+     <property name="hibernate.connection.username">sa</property>
+     <property name="hibernate.connection.password"></property>
+     <property name="hibernate.hbm2ddl.auto">create-drop</property>
+     <property name="hibernate.format_sql">true</property>
+     
+     <mapping resource="jbpm.repository.hbm.xml" />
+     <mapping resource="jbpm.execution.hbm.xml" />
+     <mapping resource="jbpm.history.hbm.xml" />
+     <mapping resource="jbpm.task.hbm.xml" />
+     <mapping resource="jbpm.identity.hbm.xml" />
+     
+  </session-factory>
+</hibernate-configuration>


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.hibernate.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.mail.properties
===================================================================
--- jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.mail.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.mail.properties	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,3 @@
+mail.smtp.host	localhost
+mail.smtp.port	2525
+mail.from		noreply at jbpm.org
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/jbpm.mail.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-cfg/target/test-classes/logging.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/target/test-classes/logging.properties	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINE
+# org.jbpm.pvm.internal.tx.level=FINE
+# org.jbpm.pvm.internal.wire.level=FINE
+# org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=INFO
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/logging.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.class
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/CustomBusinessCalendarCfgTest.class
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.tx.hibernate.cfg.xml" />
+  <import resource="jbpm.jpdl.cfg.xml" />
+  <import resource="jbpm.identity.cfg.xml" />
+
+  <process-engine-context>
+    <business-calendar>
+      <monday    hours="9:00-18:00"/>
+      <tuesday   hours="9:00-18:00"/>
+      <wednesday hours="9:00-18:00"/>
+      <thursday  hours="9:00-18:00"/>
+      <friday    hours="9:00-18:00"/>
+      <holiday period="01/02/2009 - 31/10/2009"/>
+    </business-calendar>
+  </process-engine-context>
+
+</jbpm-configuration>


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarcfg/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.class
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendar.class
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.class
===================================================================
(Binary files differ)


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/CustomBusinessCalendarImplTest.class
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml	                        (rev 0)
+++ jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+  <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.tx.hibernate.cfg.xml" />
+  <import resource="jbpm.jpdl.cfg.xml" />
+  <import resource="jbpm.identity.cfg.xml" />
+
+  <process-engine-context>
+    <object class="org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendar" />
+  </process-engine-context>
+
+</jbpm-configuration>


Property changes on: jbpm4/trunk/modules/test-cfg/target/test-classes/org/jbpm/test/custombusinesscalendarimpl/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   
   <!-- we need to remove the retry interceptor, so we cant use the default 

Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/test-db/pom.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -203,18 +203,6 @@
             </executions>
           </plugin>
 
-          <plugin>
-            <artifactId>maven-surefire-plugin</artifactId>
-            <configuration>
-              <failIfNoTests>false</failIfNoTests>
-              <trimStackTrace>false</trimStackTrace>
-              <excludes>
-                <!-- doesn't run for the moment. see https://jira.jboss.org/jira/browse/JBPM-2354 
-                <exclude>org/jbpm/test/reporting/SQLStmtTest.java</exclude>
-                -->
-              </excludes>
-            </configuration>
-          </plugin>
         </plugins>
       </build>
     </profile>

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/reporting/SQLStmtTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/reporting/SQLStmtTest.java	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/reporting/SQLStmtTest.java	2009-07-13 20:21:43 UTC (rev 5288)
@@ -21,6 +21,8 @@
  */
 
 import junit.framework.TestCase;
+
+import org.hibernate.cfg.Configuration;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -55,16 +57,14 @@
 
   protected void setUp() throws Exception
   {
-    InputStream in =
-        Thread.currentThread().getContextClassLoader()
-            .getResourceAsStream("jbpm.hibernate.cfg.xml");
+    // hibernate configuration is leveraged to parse the 
+    // properties as plain jdk dom parsing results in 
+    // in an exception when running without internet connection 
+    // when the hibernate dtd being retrieved from the url, 
+    Properties jdbcProps = new Configuration()
+      .configure("jbpm.hibernate.cfg.xml")
+      .getProperties();
 
-    if(null==in)
-      fail("Failed to read jbpm.hibernate.cfg.xml");
-
-    Document hibnCfg = parseTemplate(in);
-    Properties jdbcProps = getConnectionSettings(hibnCfg);
-
     // create connection
     Class.forName(jdbcProps.getProperty("hibernate.connection.driver_class"));
     this.conn = DriverManager.getConnection(
@@ -156,32 +156,6 @@
     return props;
   }
 
-  private Properties getConnectionSettings(Document doc)
-    {
-      List<Element> props = new ArrayList<Element>();
-      dfsElementSearch(props, doc.getDocumentElement(),
-          new Filter()
-          {
-            public boolean select(Element candidate)
-            {
-              return candidate.getNodeName().equals("property")
-                  && DOMUtils.getAttributeValue(candidate, "name").startsWith("hibernate.connection");
-            }
-          });
-
-      Properties connectionSettings = new Properties();
-      for(Element el : props)
-      {
-        connectionSettings.put(
-            DOMUtils.getAttributeValue(el, "name"),
-            el.getTextContent()
-        );
-      }
-
-      return connectionSettings;
-    }
-
-
   private Document parseTemplate(InputStream in)
       throws ParserConfigurationException, SAXException, IOException
   {

Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.hibernate.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />

Modified: jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/test-db/src/test/resources/org/jbpm/test/spring/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />
 

Modified: jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/test-load/src/test/resources/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.hibernate.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/master.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -9,6 +9,7 @@
   <!ENTITY ch06-Jpdl               SYSTEM "modules/ch06-Jpdl.xml">
   <!ENTITY ch07-Variables          SYSTEM "modules/ch07-Variables.xml">
   <!ENTITY ch08-Scripting          SYSTEM "modules/ch08-Scripting.xml">
+  <!ENTITY ch09-Configuration      SYSTEM "modules/ch09-Configuration.xml">
 ]>
 
 <book lang="en">
@@ -27,5 +28,6 @@
   &ch06-Jpdl;
   &ch07-Variables;
   &ch08-Scripting;
+  &ch09-Configuration;
 
 </book>
\ No newline at end of file

Copied: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml (from rev 5286, jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Identity.xml)
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml	                        (rev 0)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -0,0 +1,36 @@
+<chapter id="configuration">
+  <title>Configuration</title>
+
+  <section>
+    <title>Business calendar</title>
+    <para>To customize the business calendar configuration,
+    remove the import of the default business calendar configuration
+    and replace it with your customized calendar configuration. E.g.
+    </para>
+    <programlisting>&lt;jbpm-configuration&gt;
+    
+  &lt;import resource=&quot;jbpm.default.cfg.xml&quot; /&gt;
+  ...
+
+  &lt;process-engine-context&gt;
+    &lt;business-calendar&gt;
+      &lt;monday    hours=&quot;9:00-18:00&quot;/&gt;
+      &lt;tuesday   hours=&quot;9:00-18:00&quot;/&gt;
+      &lt;wednesday hours=&quot;9:00-18:00&quot;/&gt;
+      &lt;thursday  hours=&quot;9:00-18:00&quot;/&gt;
+      &lt;friday    hours=&quot;9:00-18:00&quot;/&gt;
+      &lt;holiday period=&quot;01/02/2009 - 31/10/2009&quot;/&gt;
+    &lt;/business-calendar&gt;
+  &lt;/process-engine-context&gt;
+
+&lt;/jbpm-configuration&gt;</programlisting>
+    
+  </section>
+  
+  <section>
+    <title>Email</title>
+    <para>TODO document supported config customization 
+    of the jbpm.mail.properties</para>
+  </section>  
+
+</chapter>


Property changes on: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Identity.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Identity.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Identity.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -1,38 +0,0 @@
-<chapter id="identity">
-  <title>Identity</title>
-  
-  <para>The default jBPM identity component is based on 
-  <ulink url="http://www.jboss.org/community/docs/DOC-13258">JBoss IDM</ulink>.  
-  Configuration is like this:
-  </para>
-  
-  <programlisting>&lt;jbpm-configuration xmlns=&quot;http://jbpm.org/xsd/cfg&quot;&gt;
-
-  <emphasis role="bold">&lt;process-engine-context&gt;</emphasis>
-    ...
-    &lt;identity-service /&gt;
-    ...
-  &lt;/process-engine-context&gt;
-
-  &lt;transaction-context&gt;
-    ...
-    <emphasis role="bold">&lt;identity-session realm=&quot;realm://jbpm-identity&quot; /&gt;</emphasis>
-  &lt;/transaction-context&gt;
-
-&lt;/jbpm-configuration&gt;</programlisting>
-
-  <para>To replace the identity component, keep the identity-service declaration, 
-  implement org.jbpm.session.IdentitySession and configure your identity session in 
-  the transaction context like this:
-  </para>
-
-  <programlisting>&lt;jbpm-configuration xmlns=&quot;http://jbpm.org/xsd/cfg&quot;&gt;
-  ...
-  &lt;transaction-context&gt;
-    ...
-    &lt;object class="your.package.YourIdentitySession" /&gt;
-  &lt;/transaction-context&gt;
-
-&lt;/jbpm-configuration&gt;</programlisting>
-
-</chapter>

Modified: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jboss.idm/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.jta.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.jboss.idm.cfg.xml" />

Modified: jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml	2009-07-12 19:44:46 UTC (rev 5287)
+++ jbpm4/trunk/qa/jbpm.cfg.jboss.testsuite/jbpm.identity/jbpm.cfg.xml	2009-07-13 20:21:43 UTC (rev 5288)
@@ -3,6 +3,7 @@
 <jbpm-configuration>
 
   <import resource="jbpm.default.cfg.xml" />
+  <import resource="jbpm.businesscalendar.cfg.xml" />
   <import resource="jbpm.tx.jta.cfg.xml" />
   <import resource="jbpm.jpdl.cfg.xml" />
   <import resource="jbpm.identity.cfg.xml" />




More information about the jbpm-commits mailing list