alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */



package org.netbeans.modules.javacvs.commands;


import org.openide.util.NbBundle;
import java.io.*;
import java.util.*;
import java.beans.*;
import org.openide.filesystems.FileObject;
import org.netbeans.modules.javacvs.customizers.ImportParamInput;

import org.netbeans.modules.javacvs.*;
import org.netbeans.modules.javacvs.events.*;
import org.netbeans.modules.javacvs.commands.*;
import org.netbeans.lib.cvsclient.event.*;
import org.netbeans.lib.cvsclient.commandLine.GetOpt;
import org.netbeans.lib.cvsclient.command.export.*;
import org.netbeans.lib.cvsclient.command.DefaultFileInfoContainer;
import org.netbeans.lib.cvsclient.command.*;


/** this class implements the cvs import command.
 * @author mkleint
 */
public class CvsExport extends FileSystemCommand {
    
    ExportCommand command;
    
    private ExportImpl exportImpl;
    
    /**
     * The modules to checkout. These names are unexpanded and will be passed
     * to a module-expansion request.
     */
    private String[] modules;

    /**
     * Whether to update recursively.
     */
    protected boolean recursive = true;
    
    private boolean pruneDirectories;
    
    private KeywordSubstitutionOptions keywordSubstitutionOptions;

    /** Holds value of property exportByDate. */
    private String exportByDate;
    
    /** Holds value of property exportByRevision. */
    private String exportByRevision;
    
    /** Holds value of property exportDirectory. */
    private String exportDirectory;
    
    /** Holds value of property useHeadIfNotFound. */
    private boolean useHeadIfNotFound;        
    
    /** Creates new CvsImport instance.
     */    
    public CvsExport() {
        super();
        exportImpl = new ExportImpl();
    }
    
    /** Creates new CvsImport instance.
     */
    public CvsExport(ClientProvider fs) {
        super(fs);
        exportImpl = new ExportImpl();
    }
    
    public CvsCommand getImpl() {
        return exportImpl;
    }    
    
    public FsExport getExportImpl() {
        return exportImpl;
    }
    
    public String getName() {
        return NbBundle.getBundle(CvsExport.class).getString("CvsExport.name"); // NOI18N
    }
    
    protected Class getMainCvsCommand() {
        return ExportCommand.class;
    }

/** if no param input was set before staring the command, 
 * the default defined in this method is used
 */
    
    protected void initCommand(boolean commandIsRunning) {
        // here the the commands is initiated just right before running the command
        clearCommandList();
        command = new ExportCommand();
        setCommandArguments(command);
        toDoCommands.addElement(command);
        super.initCommand(commandIsRunning);
    }
    
    
    protected void finishedCommand() {
        // called when the communication with server ends and the command thread is about to end..
        // used for calling visualizer stuff..
        super.finishedCommand();
    }
    
    protected void executeFailed(Exception exc) {
        // do refresh.. refresh or recursive refresh, depending on getRecursive()
        // TODO needs some optimizing..
        super.executeFailed(exc);
    }
    
    
    /**
     * Called when file status information has been received
     */
    public void fileInfoGenerated(FileInfoEvent e) {
        super.fileInfoGenerated(e);
    }
    

    

    
    /** Returns the command's cvs switches in the follwoing format: [command's name] [switches].
     * 
Can be used for writing the Command to .cvsrc file where the default switches are stored. * Subclasses can override this to handle special cases like comit -m "multi-line-message" * * @return String consisting of command's name and arguments. */ public String getCvsrcEntry() { Command comm = loadCommand(getMainCvsCommand()); boolean ok = setCommandArguments(comm); if (ok) { return "export " + comm.getCVSArguments(); // NOI18N } return ""; // NOI18N } /** * Gets the value of the recursive option. * @return true if recursive, false if not */ public boolean isRecursive() { return recursive; } /** * Sets the value of the recursive option. * @param r true if the command should recurse, false otherwise */ public void setRecursive(boolean r) { recursive = r; } /** * Returns the keyword substitution option. */ public KeywordSubstitutionOptions getKeywordSubstitutionOptions() { return keywordSubstitutionOptions; } /** * Sets the keywords substitution option. */ public void setKeywordSubstitutionOptions(KeywordSubstitutionOptions keywordSubstitutionOptions) { this.keywordSubstitutionOptions = keywordSubstitutionOptions; } /** * Set whether to prune directories. * This is the -P option in the command-line CVS. */ public void setPruneDirectories(boolean pruneDirectories) { this.pruneDirectories = pruneDirectories; } /** * Get whether to prune directories. * @return true if directories should be removed if they contain no files, * false otherwise. */ public boolean isPruneDirectories() { return pruneDirectories; } /** * Set the modules to export. * @param theModules the names of the modules to export */ public void setModules(String[] modules) { this.modules = modules; } public String[] getModules() { return modules; } /** Getter for property exportByDate. * @return Value of property exportByDate. */ public String getExportByDate() { return this.exportByDate; } /** Setter for property exportByDate. * @param exportByDate New value of property exportByDate. */ public void setExportByDate(String exportByDate) { this.exportByDate = exportByDate; } /** Getter for property exportByRevision. * @return Value of property exportByRevision. */ public String getExportByRevision() { return this.exportByRevision; } /** Setter for property exportByRevision. * @param exportByRevision New value of property exportByRevision. */ public void setExportByRevision(String exportByRevision) { this.exportByRevision = exportByRevision; } /** Getter for property exportDirectory. * @return Value of property exportDirectory. */ public String getExportDirectory() { return this.exportDirectory; } /** Setter for property exportDirectory. * @param exportDirectory New value of property exportDirectory. */ public void setExportDirectory(String exportDirectory) { this.exportDirectory = exportDirectory; } /** Getter for property useHeadIfNotFound. * @return Value of property useHeadIfNotFound. */ public boolean isUseHeadIfNotFound() { return this.useHeadIfNotFound; } /** Setter for property useHeadIfNotFound. * @param useHeadIfNotFound New value of property useHeadIfNotFound. */ public void setUseHeadIfNotFound(boolean useHeadIfNotFound) { this.useHeadIfNotFound = useHeadIfNotFound; } public class ExportImpl extends FsExport implements FileSystemCommandImpl { public ExportImpl() { } public FileSystemCommand getOuterClassInstance() { return CvsExport.this; } /** Add a CommandDisplayerListener to the FilesystemCommand. *
All UI communication and display of output should be handled via the CommandDisplayerListeners. * * @param listener The listener to add. * */ public void addDisplayerListener(CommandDisplayerListener listener) { CvsExport.this.addDisplayerListener(listener); } /** Clones the instance of the command. * @return Returns the cloned object. * @throws CloneNotSupportedException if clone is not supported by subclasses, it throws CloneNotSupportedException */ public Object clone() throws CloneNotSupportedException { Object retValue; retValue = CvsExport.super.clone(); return retValue; } /** Starts the thread with the command - executes the run() method. */ public void startCommand() { CvsExport.this.startCommand(); } /** Removes a CommandDisplayerListener from the FilesystemCommand. * All the listeners are removed once the command ends. * * @param listener the listener to remove */ public void removeDisplayerListener(CommandDisplayerListener listener) { CvsExport.this.removeDisplayerListener(listener); } public void setFileObjects(FileObject[] fileObjects) { CvsExport.this.setFileObjects(fileObjects); } /** Add a CommandErrorListener to the CvsCommand. * * @param commErrListener The listener to add. * */ public void addCommandErrorListener(org.netbeans.modules.javacvs.events.CommandErrorListener commErrListener) { CvsExport.this.addCommandErrorListener(commErrListener); } /** Remove a CommandErrorListener to the CvsCommand. * * @param commErrListener The listener to remove. * */ public void removeCommandErrorListener(org.netbeans.modules.javacvs.events.CommandErrorListener commErrListener) { CvsExport.this.removeCommandErrorListener(commErrListener); } /** * Gets the value of the recursive option. * @return true if recursive, false if not */ public boolean isRecursive() { return CvsExport.this.isRecursive(); } /** * Sets the value of the recursive option. * @param r true if the command should recurse, false otherwise */ public void setRecursive(boolean r) { CvsExport.this.setRecursive(r); } /** * Returns the keyword substitution option. */ public KeywordSubstitutionOptions getKeywordSubstitutionOptions() { return CvsExport.this.getKeywordSubstitutionOptions(); } /** * Sets the keywords substitution option. */ public void setKeywordSubstitutionOptions(KeywordSubstitutionOptions keywordSubstitutionOptions) { CvsExport.this.setKeywordSubstitutionOptions(keywordSubstitutionOptions); } /** * Set whether to prune directories. * This is the -P option in the command-line CVS. */ public void setPruneDirectories(boolean pruneDirectories) { CvsExport.this.setPruneDirectories(pruneDirectories); } /** * Get whether to prune directories. * @return true if directories should be removed if they contain no files, * false otherwise. */ public boolean isPruneDirectories() { return CvsExport.this.isPruneDirectories(); } /** * Set the modules to export. * @param theModules the names of the modules to export */ public void setModules(String[] modules) { CvsExport.this.setModules(modules); } public String[] getModules() { return CvsExport.this.getModules(); } /** Getter for property exportByDate. * @return Value of property exportByDate. */ public String getExportByDate() { return CvsExport.this.getExportByDate(); } /** Setter for property exportByDate. * @param exportByDate New value of property exportByDate. */ public void setExportByDate(String exportByDate) { CvsExport.this.setExportByDate(exportByDate); } /** Getter for property exportByRevision. * @return Value of property exportByRevision. */ public String getExportByRevision() { return CvsExport.this.getExportByRevision(); } /** Setter for property exportByRevision. * @param exportByRevision New value of property exportByRevision. */ public void setExportByRevision(String exportByRevision) { CvsExport.this.setExportByRevision(exportByRevision); } /** Getter for property exportDirectory. * @return Value of property exportDirectory. */ public String getExportDirectory() { return CvsExport.this.getExportDirectory(); } /** Setter for property exportDirectory. * @param exportDirectory New value of property exportDirectory. */ public void setExportDirectory(String exportDirectory) { CvsExport.this.setExportDirectory(exportDirectory); } /** Getter for property useHeadIfNotFound. * @return Value of property useHeadIfNotFound. */ public boolean isUseHeadIfNotFound() { return CvsExport.this.isUseHeadIfNotFound(); } /** Setter for property useHeadIfNotFound. * @param useHeadIfNotFound New value of property useHeadIfNotFound. */ public void setUseHeadIfNotFound(boolean useHeadIfNotFound) { CvsExport.this.setUseHeadIfNotFound(useHeadIfNotFound); } public FsGlobalOptions getGlobalOptions() { FsGlobalOptions retValue; retValue = new FsGlobalOptionsImpl(CvsExport.this.getGlobalOptions()); return retValue; } } }
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.