/******************************* Copyright notice ******************************* Copyright (C)2002 by Andrei Loskutov <loskutov@gmx.de>. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ********************************************************************************/ package adiag.connection; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import adiag.gui.App; import adiag.model.Version; /** * The "offline" connection to Perforce-Prozess, through the "old" log file * @author Andrei Loskutov */ public class FileLogConnector extends Connector { /** Instance of Reader for log file */ private BufferedReader in; /** * Construktor * @param app current GUI, for error feedback etc */ public FileLogConnector(App app) { super(app); } /** * close connector and all probably opened streams * @throws IOException if something goes wrong */ public void close() throws IOException { if(in != null){ in.close(); } } /** * read native P4 Log * @param apath initial paths for requested files/directories * @throws Exception if something goes wrong */ protected void readP4Out(String [] paths) throws Exception { if(paths == null || paths.length ==0){ return; } FileReader f = null; f = new FileReader(getLogFile()); if (f == null){ return; } BufferedReader in = new BufferedReader(f); LineReader in2 = new FileLogLineReader(in); // we are offline, also we can throw away all old shit init(); // we cannot use here "real" paths parameter, because we haven't // "real" P4 instance, also we must // get one not-"real" path from the first log line! String apath = in2.readLine(); // strip away conments if(apath!=null && apath.startsWith("info:")){ out.println(apath); apath = apath.substring(apath.indexOf(":") + 1).trim(); } else { if(apath != null && apath.startsWith("error:")){ Version v = getVersion(paths[0], 0, true); v.addDescriptionLine(apath); v.setReceived(true); } } parseP4FileLog(apath, in2); } } /** * Wrapper for the BufferedReader * @author Andy the Great */ class FileLogLineReader implements LineReader { BufferedReader reader; /** * Constructor. */ public FileLogLineReader(BufferedReader reader) { super(); this.reader = reader; } /** (non-Javadoc) * @see LineReader#readLine() */ public String readLine() throws IOException { if(reader != null){ return reader.readLine(); } else { return null; } } /** (non-Javadoc) * @see LineReader#close() */ public void close() throws IOException { if(reader != null){ reader.close(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 2735 | andrei_loskutov | sources are now included to binary distribution at http://andrei.gmxhome.de/perforce/index.html | ||
#4 | 2554 | andrei_loskutov |
#25.12.2002 23:29 Revision 1.3.0.4 beta 1) Some small refactoring 2) First integration with P4eclipse: properties etc, thanks Boris Pr�ssmann 5) Better integration to Eclipse: use Eclipse internal compare tool for diff. 6) Fix some minor bugs. #14.12.2002 23:15 Revision 1.3.0.3 beta 1) Fix endless loop bug if p4 path was not set. 2) Fix never getting focus bug after error message shown 3) Fix painting bug on JDK 1.4.1 (must be verified!!!) 4) Some small refactoring 5) Fix error handling. 6) Fix some minor bugs. |
||
#3 | 2552 | andrei_loskutov | 1.3.0.4 changes | ||
#2 | 2460 | andrei_loskutov |
1) Change configuration: always reed properties 2) Change password store to hex format/password field 3) Create standalone/not standalone state for new branchview eclipse wrapper 4) Refactor all main classes to remove cyclic package dependency 5) Add workaround to fix new JDK 1.4.1 Swing bugs on JScrollPane/JViewPort 6) Add dispose methods to panel/connector 7) Minor internal GUI fixes/refactorings |
||
#1 | 2222 | andrei_loskutov |
#13.10.2002 22:16 Revision 1.2.1 1) Documentation task is finished... Yes!!! 2) New feature: copy P4 depot path 3) Some small fixes to menu shortkeys belongs ctrl + c and ctrl + d 4) Clipboard fix because of JDK 1.2 - 1.3 bug 5) Smallest refactoring on some methods. 6) Html help updated |