KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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 org.eclipse.team.internal.ccvs.core.*;
15 import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
16 import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
17
18 /**
19  * Special visitor which handles added and removed files in a special way.
20  * Added resources are skipped. Deleted resources are sent as if they were not deleted.
21  */

22 class TagFileSender extends FileStructureVisitor {
23
24     public TagFileSender(Session session, LocalOption[] localOptions) {
25         super(session, localOptions, false, false);
26     }
27     
28     /**
29      * Override sendFile to provide custom handling of added and deleted resources.
30      * Added resources are skipped. Deleted resources are sent as if they were not deleted.
31      */

32     protected void sendFile(ICVSFile mFile) throws CVSException {
33         Policy.checkCanceled(monitor);
34         byte[] syncBytes = mFile.getSyncBytes();
35         if (syncBytes != null) {
36             // Send the parent folder if it hasn't been sent already
37
sendFolder(mFile.getParent());
38             // Send the file if appropriate
39
if (ResourceSyncInfo.isDeletion(syncBytes)) {
40                 // makes this resource sync undeleted
41
syncBytes = ResourceSyncInfo.convertFromDeletion(syncBytes);
42             }
43             if (!ResourceSyncInfo.isAddition(syncBytes)) {
44                 session.sendEntry(syncBytes, ResourceSyncInfo.getTimestampToServer(syncBytes, mFile.getTimeStamp()));
45                 session.sendIsModified(mFile, ResourceSyncInfo.isBinary(syncBytes), monitor);
46             }
47         }
48     }
49 }
50
Popular Tags