例: デフォルトのスケジューラー・カレンダーの使用

任意の J2EE アプリケーションから SIMPLE カレンダーと CRON カレンダーを使用できます。

デフォルトのスケジューラー・カレンダーの使用には、 デフォルトの UserCalendarHome Enterprise JavaBeans (EJB) ホーム・オブジェクトの検索、UserCalendar Bean の作成、applyDelta() メソッドの呼び出しが含まれます。 applyDelta メソッド、 および SIMPLE カレンダーと CRON カレンダーの構文の詳細については、トピック UserCalendar インターフェースを参照してください。

例:

import java.util.Date;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import com.ibm.websphere.scheduler.UserCalendar;
import com.ibm.websphere.scheduler.UserCalendarHome;

// Create an initial context
InitialContext ctx = new InitialContext();

// Lookup and narrow the default UserCalendar home.
UserCalendarHome defaultCalHome=(UserCalendarHome)
		PortableRemoteObject.narrow(ctx.lookup(
      UserCalendarHome.DEFAULT_CALENDAR_JNDI_NAME), 
	   UserCalendarHome.class);

// Create the default UserCalendar instance.
UserCalendar defaultCal = defaultCalHome.create();

// Calculate a date using CRON based on the current
// date and time.  Return the next date that is 
// Saturday at 2AM
Date newDate = 
    defaultCal.applyDelta(new Date(), 
        "CRON", "0 0 2 ? * SAT");

トピックのタイプを示すアイコン 参照トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tsch_usingcalendar
ファイル名:tsch_usingcalendar.html