blob: 0b9a4ea797a80c7e129099d92ea578df0e16171a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* TimeServiceImpl.java */
import java.rmi.*;
import java.rmi.server.*;
import java.util.*;
public class TimeServiceImpl
extends UnicastRemoteObject
implements TimeService
{
public TimeServiceImpl()
throws RemoteException
{
}
public String getTime()
throws RemoteException
{
GregorianCalendar cal = new GregorianCalendar();
StringBuffer sb = new StringBuffer();
sb.append(cal.get(Calendar.HOUR_OF_DAY));
sb.append(":" + cal.get(Calendar.MINUTE));
sb.append(":" + cal.get(Calendar.SECOND));
return sb.toString();
}
public TimeStore storeTime(TimeStore store)
throws RemoteException
{
store.setTime(getTime());
return store;
}
}
|