home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
wsgatsam.zip
/
CalendarServiceBean.java
< prev
next >
Wrap
Text File
|
2003-02-24
|
2KB
|
78 lines
/**
* %wsgw_sample_start%
* Licensed Materials - Property of IBM
*
* (c) Copyright IBM Corp. 2001, 2002 All Rights Reserved.
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with
* IBM Corp.
* %wsgw_sample_end%
*/
package services.calendar.ejb;
import java.rmi.RemoteException;
import java.util.Properties;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.ejb.*;
public class CalendarServiceBean implements SessionBean
{
private javax.ejb.SessionContext mySessionCtx = null;
public void ejbActivate()
throws java.rmi.RemoteException
{}
public void ejbCreate()
throws javax.ejb.CreateException, java.rmi.RemoteException
{}
public void ejbPassivate()
throws java.rmi.RemoteException
{}
public void ejbRemove()
throws java.rmi.RemoteException
{}
public javax.ejb.SessionContext getSessionContext()
{
return mySessionCtx;
}
public void setSessionContext(javax.ejb.SessionContext ctx)
throws java.rmi.RemoteException
{
mySessionCtx = ctx;
}
public String dayOfTheWeek(int month, int date, int year)
throws java.rmi.RemoteException
{
GregorianCalendar calendar = new GregorianCalendar(year, month-1, date);
switch (calendar.get(Calendar.DAY_OF_WEEK))
{
case Calendar.SUNDAY:
return "Sunday";
case Calendar.MONDAY:
return "Monday";
case Calendar.TUESDAY:
return "Tuesday";
case Calendar.WEDNESDAY:
return "Wednesday";
case Calendar.THURSDAY:
return "Thursday";
case Calendar.FRIDAY:
return "Friday";
case Calendar.SATURDAY:
return "Saturday";
default:
return "Unknown";
}
}
}