KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > core > client > ModTimeHandler


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.core.client;
12
13
14 import java.text.ParseException JavaDoc;
15
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.core.runtime.IStatus;
18 import org.eclipse.osgi.util.NLS;
19 import org.eclipse.team.internal.ccvs.core.*;
20 import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;
21
22 /**
23  * Handles a "Mod-time" response from the CVS server.
24  * <p>
25  * Suppose as a result of performing a command the CVS server responds
26  * as follows:<br>
27  * <pre>
28  * [...]
29  * Mod-time 18 Oct 2001 20:21:13 -0330\n
30  * [...]
31  * </pre>
32  * Then we parse and remember the date for use in subsequent
33  * file transfer responses such as Updated.
34  * </p>
35  */

36 class ModTimeHandler extends ResponseHandler {
37     public String JavaDoc getResponseID() {
38         return "Mod-time"; //$NON-NLS-1$
39
}
40
41     public void handle(Session session, String JavaDoc timeStamp,
42         IProgressMonitor monitor) throws CVSException {
43         try {
44             session.setModTime(CVSDateFormatter.serverStampToDate(timeStamp));
45         } catch (ParseException JavaDoc e) {
46             IStatus status = new CVSStatus(IStatus.ERROR,CVSStatus.ERROR,NLS.bind(CVSMessages.ModTimeHandler_invalidFormat, new String JavaDoc[] { timeStamp }), e, session.getLocalRoot());
47             throw new CVSException(status);
48         }
49     }
50 }
51
52
Popular Tags