001: /*****************************************************************************
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025:
026: * The Original Software is the CVS Client Library.
027: * The Initial Developer of the Original Software is Robert Greig.
028: * Portions created by Robert Greig are Copyright (C) 2000.
029: * All Rights Reserved.
030: *
031: * If you wish your version of this file to be governed by only the CDDL
032: * or only the GPL Version 2, indicate your decision by adding
033: * "[Contributor] elects to include this software in this distribution
034: * under the [CDDL or GPL Version 2] license." If you do not indicate a
035: * single choice of license, a recipient has the option to distribute
036: * your version of this file under either the CDDL, the GPL Version 2 or
037: * to extend the choice of license to its licensees as provided above.
038: * However, if you add GPL Version 2 code and therefore, elected the GPL
039: * Version 2 license, then the option applies only if the new code is
040: * made subject to such option by the copyright holder.
041:
042: * Contributor(s): Robert Greig.
043: *****************************************************************************/package org.netbeans.lib.cvsclient.response;
044:
045: import java.io.*;
046: import java.util.*;
047:
048: import org.netbeans.lib.cvsclient.admin.*;
049: import org.netbeans.lib.cvsclient.command.GlobalOptions;
050: import org.netbeans.lib.cvsclient.event.*;
051: import org.netbeans.lib.cvsclient.file.*;
052: import org.netbeans.lib.cvsclient.util.StringPattern;
053: import org.netbeans.lib.cvsclient.command.KeywordSubstitutionOptions;
054:
055: /**
056: * Services that are provided to response handlers.
057: * @author Robert Greig
058: */
059: public interface ResponseServices {
060: /**
061: * Set the modified date of the next file to be written. The next call
062: * to writeFile will use this date.
063: * @param modifiedDate the date the file should be marked as modified
064: */
065: void setNextFileDate(Date modifiedDate);
066:
067: /**
068: * Get the modified date of the next file to be written. This will also
069: * null any stored date so that future calls will not retrieve a date
070: * that was meant for a previous file.
071: * @return the date the next file should be marked as having been modified
072: * on.
073: */
074: Date getNextFileDate();
075:
076: /**
077: * Convert a <i>pathname</i> in the CVS sense (see 5.10 in the protocol
078: * document) into a local pathname for the file
079: * @param localDirectory the name of the local directory, relative to the
080: * directory in which the command was given
081: * @param repository the full repository name for the file
082: */
083: String convertPathname(String localDirectory, String repository);
084:
085: /**
086: * Create or update the administration files for a particular file
087: * This will create the CVS directory if necessary, and the
088: * Root and Repository files if necessary. It will also update
089: * the Entries file with the new entry
090: * @param localDirectory the local directory, relative to the directory
091: * in which the command was given, where the file in question lives
092: * @param entry the entry object for that file
093: * @throws IOException if there is an error writing the files
094: */
095: void updateAdminData(String localDirectory, String repositoryPath,
096: Entry entry) throws IOException;
097:
098: /**
099: * Set the Entry for the specified file
100: * @param f the file
101: * @param e the new entry
102: * @throws IOException if an error occurs writing the details
103: */
104: void setEntry(File f, Entry e) throws IOException;
105:
106: /**
107: * Remove the Entry for the specified file
108: * @param f the file whose entry is to be removed
109: * @throws IOException if an error occurs writing the Entries file
110: */
111: void removeEntry(File f) throws IOException;
112:
113: /**
114: * Remove the specified file from the local disk
115: * If the file does not exist, the operation does nothing.
116: *
117: * @param pathname the full path to the file to remove
118: * @throws IOException if an IO error occurs while removing the file
119: */
120: void removeLocalFile(String pathname) throws IOException;
121:
122: /**
123: * Remove the specified file from the local disk.
124: * @throws IOException if an IO error occurs while removing the file
125: */
126: void removeLocalFile(String localPath, String repositoryFileName)
127: throws IOException;
128:
129: /**
130: * Copy the local file
131: * @param pathname the full path to the file to coyp
132: * @param newname the new name of the file (not the full path)
133: * @throws IOException if an IO error occurs while copying the file
134: */
135: void copyLocalFile(String pathname, String newname)
136: throws IOException;
137:
138: /**
139: * Get the CVS event manager. This is generally called by response handlers
140: * that want to fire events.
141: * @return the eventManager
142: */
143: EventManager getEventManager();
144:
145: /**
146: * Obtain from the underlying implementation the file handler for
147: * handling uncompressed data.
148: * @return file handler for uncompressed data.
149: */
150: FileHandler getUncompressedFileHandler();
151:
152: /**
153: * Obtain the file handler for Gzip compressed data.
154: * @return file handler for Gzip compressed data.
155: */
156: FileHandler getGzipFileHandler();
157:
158: /**
159: * ReSet the filehandler for Gzip compressed data. Makes sure the
160: * requests for sending gzipped data are not sent..
161: */
162: void dontUseGzipFileHandler();
163:
164: /**
165: * This method is called when a response for the ValidRequests request
166: * is received.
167: * @param requests A List of requests that is valid for this CVS server
168: * separated by spaces.
169: */
170: void setValidRequests(String requests);
171:
172: /**
173: * This method is called by WrapperSendResponse for each wrapper setting sent
174: * back by the CVS server
175: * @param pattern A StringPattern indicating the pattern for which the
176: * wrapper applies
177: * @param option A KeywordSubstituionOption corresponding to the setting
178: */
179: void addWrapper(StringPattern pattern,
180: KeywordSubstitutionOptions option);
181:
182: /**
183: * Get the global options that are set to this client.
184: * Individual commands can get the global options via this method.
185: */
186: GlobalOptions getGlobalOptions();
187: }
|