1 package org.columba.calendar.base; 19 20 import java.net.InetAddress ; 21 import java.net.UnknownHostException ; 22 import java.util.Calendar ; 23 24 30 public class VCalendarUIDGenerator { 31 32 public VCalendarUIDGenerator() { 33 super(); 34 } 35 36 41 public String newUID() { 42 String timestamp = Long.toString(Calendar.getInstance().getTimeInMillis()); 44 45 String hostname = null; 46 try { 47 hostname = InetAddress.getLocalHost().getHostName(); 48 } catch (UnknownHostException e) { 49 hostname = "localhost"; 50 } 51 52 StringBuffer result = new StringBuffer (); 53 54 result.append(timestamp); 55 result.append("@"); 56 result.append(hostname); 57 58 return result.toString(); 59 60 } 61 62 } 63 | Popular Tags |