1 22 package org.objectweb.petals.engine.clock.sdk; 23 24 import java.text.DateFormat ; 25 import java.text.SimpleDateFormat ; 26 import java.util.Date ; 27 import java.util.logging.Level ; 28 import java.util.logging.Logger ; 29 30 public class ClockImpl implements Clock { 31 32 private Logger logger; 33 34 public String time() { 35 logger.log(Level.INFO, 36 "The ClockImpl service is called to return current time"); 37 38 DateFormat formatter = new SimpleDateFormat ("MM/dd/yyyy HH:mm:ss"); 39 String en = "<timeResponse xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " 40 + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><timeReturn xsi:type=\"xsd:string\">"; 41 en += formatter.format(new Date (System.currentTimeMillis())); 42 en += "</timeReturn></timeResponse>"; 43 44 logger.log(Level.INFO, "The ClockImpl answer : " + en); 45 46 return en; 47 } 48 49 public ClockImpl(Logger logger) { 50 super(); 51 this.logger = logger; 52 } 53 54 } 55 | Popular Tags |