1 19 package org.netbeans.lib.cvsclient.request; 20 21 import java.io.*; 22 import java.net.*; 23 import java.text.*; 24 import java.util.*; 25 26 33 public class NotifyRequest extends Request { 34 36 private static final DateFormat DATE_FORMAT; 37 private static final String HOST_NAME; 38 39 static { 40 DATE_FORMAT = new SimpleDateFormat("EEE MMM dd hh:mm:ss yyyy z", Locale.US); 41 42 String hostName = ""; 44 try { 45 hostName = InetAddress.getLocalHost().getHostName(); 46 } 47 catch (Exception ex) { 48 ex.printStackTrace(); 49 } 50 HOST_NAME = hostName; 51 } 52 53 55 private final String request; 56 57 59 63 public NotifyRequest(File file, String command, String parameters) { 64 if (file == null) { 65 throw new IllegalArgumentException ("File must not be null!"); 66 } 67 68 StringBuffer buffer = new StringBuffer (); 69 buffer.append("Notify "); buffer.append(file.getName()); 71 buffer.append('\n'); 72 buffer.append(command); 73 buffer.append('\t'); 74 buffer.append(DATE_FORMAT.format(new Date())); 75 buffer.append('\t'); 76 buffer.append(HOST_NAME); 77 buffer.append('\t'); 78 buffer.append(file.getParent()); 79 buffer.append('\t'); 80 buffer.append(parameters); 81 buffer.append('\n'); 82 this.request = buffer.toString(); 83 } 84 85 87 public String getRequestString() { 88 return request; 89 } 90 91 public boolean isResponseExpected() { 92 return false; 93 } 94 } 95 | Popular Tags |