RemoteFS seems to be more actively developed elsewhere: http://kenai.com/projects/nb-remotefs
authorJesse Glick <jglick@netbeans.org>
Fri, 30 Jul 2010 16:56:24 -0400
changeset 16361e462bc6db3c3
parent 16360 4f45369dbda2
child 16362 24e649cc4015
RemoteFS seems to be more actively developed elsewhere: http://kenai.com/projects/nb-remotefs
remotefs.ui/build.xml
remotefs.ui/manifest.mf
remotefs.ui/nbproject/project.properties
remotefs.ui/nbproject/project.xml
remotefs.ui/src/org/netbeans/modules/remotefs/ui/AddFTPSiteAction.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/Bundle.properties
remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerAction.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponent.form
remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponent.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponentSettings.xml
remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponentWstcref.xml
remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteVisualPanel1.form
remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteVisualPanel1.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteWizardAction.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteWizardPanel1.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/RootNode.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/SiteNode.java
remotefs.ui/src/org/netbeans/modules/remotefs/ui/layer.xml
remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/closedFolder-16x16.png
remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/entire-network-16x16.png
remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/globe-sextant-16x16.png
remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/openFolder-16x16.png
remotefs/build.xml
remotefs/manifest.mf
remotefs/nbproject/project.properties
remotefs/nbproject/project.xml
remotefs/src/org/netbeans/modules/remotefs/Bundle.properties
remotefs/src/org/netbeans/modules/remotefs/core/CleanCacheAction.java
remotefs/src/org/netbeans/modules/remotefs/core/ConnectAction.java
remotefs/src/org/netbeans/modules/remotefs/core/DownloadAllAction.java
remotefs/src/org/netbeans/modules/remotefs/core/LogInfo.java
remotefs/src/org/netbeans/modules/remotefs/core/ManagedRemoteFileSystem.java
remotefs/src/org/netbeans/modules/remotefs/core/RemoteClient.java
remotefs/src/org/netbeans/modules/remotefs/core/RemoteFile.java
remotefs/src/org/netbeans/modules/remotefs/core/RemoteFileAttributes.java
remotefs/src/org/netbeans/modules/remotefs/core/RemoteFileName.java
remotefs/src/org/netbeans/modules/remotefs/core/RemoteFileSystem.java
remotefs/src/org/netbeans/modules/remotefs/core/RemoteManager.java
remotefs/src/org/netbeans/modules/remotefs/core/RemoteOutputStream.java
remotefs/src/org/netbeans/modules/remotefs/core/SynchronizeAction.java
remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPClient.java
remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPException.java
remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPFileAttributes.java
remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPFileName.java
remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPLogInfo.java
remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPResponse.java
remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPDialogs.java
remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPFileSystem.java
remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPFileSystemBeanInfo.java
remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPSettings.java
remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPSettingsBeanInfo.java
remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPfsModule.java
remotefs/src/org/netbeans/modules/remotefs/ftpfs/PasswordEditor.java
remotefs/test/unit/src/org/netbeans/modules/remotefs/ftpclient/FTPClientTest.java
remotefs/test/unit/src/org/netbeans/modules/remotefs/testutils/MockFTPServer.java
     1.1 --- a/remotefs.ui/build.xml	Wed Jul 28 12:48:15 2010 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,5 +0,0 @@
     1.4 -<?xml version="1.0" encoding="UTF-8"?>
     1.5 -<project name="contrib/remotefs.ui" default="netbeans" basedir=".">
     1.6 -    <description>Builds, tests, and runs the project org.netbeans.modules.remotefs.ui</description>
     1.7 -    <import file="../../nbbuild/templates/projectized.xml"/>
     1.8 -</project>
     2.1 --- a/remotefs.ui/manifest.mf	Wed Jul 28 12:48:15 2010 -0400
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,6 +0,0 @@
     2.4 -Manifest-Version: 1.0
     2.5 -OpenIDE-Module: org.netbeans.modules.remotefs.ui
     2.6 -OpenIDE-Module-Layer: org/netbeans/modules/remotefs/ui/layer.xml
     2.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/remotefs/ui/Bundle.properties
     2.8 -OpenIDE-Module-Specification-Version: 1.0
     2.9 -
     3.1 --- a/remotefs.ui/nbproject/project.properties	Wed Jul 28 12:48:15 2010 -0400
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,3 +0,0 @@
     3.4 -javac.source=1.5
     3.5 -javac.compilerargs=-Xlint -Xlint:-serial
     3.6 -nbm.module.author=Dirk Estievenart
     4.1 --- a/remotefs.ui/nbproject/project.xml	Wed Jul 28 12:48:15 2010 -0400
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,101 +0,0 @@
     4.4 -<?xml version="1.0" encoding="UTF-8"?>
     4.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
     4.6 -    <type>org.netbeans.modules.apisupport.project</type>
     4.7 -    <configuration>
     4.8 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
     4.9 -            <code-name-base>org.netbeans.modules.remotefs.ui</code-name-base>
    4.10 -            <module-dependencies>
    4.11 -                <dependency>
    4.12 -                    <code-name-base>org.jdesktop.layout</code-name-base>
    4.13 -                    <build-prerequisite/>
    4.14 -                    <compile-dependency/>
    4.15 -                    <run-dependency>
    4.16 -                        <release-version>1</release-version>
    4.17 -                        <specification-version>1.4</specification-version>
    4.18 -                    </run-dependency>
    4.19 -                </dependency>
    4.20 -                <dependency>
    4.21 -                    <code-name-base>org.netbeans.modules.remotefs</code-name-base>
    4.22 -                    <build-prerequisite/>
    4.23 -                    <compile-dependency/>
    4.24 -                    <run-dependency>
    4.25 -                        <specification-version>1.1</specification-version>
    4.26 -                    </run-dependency>
    4.27 -                </dependency>
    4.28 -                <dependency>
    4.29 -                    <code-name-base>org.openide.actions</code-name-base>
    4.30 -                    <build-prerequisite/>
    4.31 -                    <compile-dependency/>
    4.32 -                    <run-dependency>
    4.33 -                        <specification-version>6.6.1.1</specification-version>
    4.34 -                    </run-dependency>
    4.35 -                </dependency>
    4.36 -                <dependency>
    4.37 -                    <code-name-base>org.openide.awt</code-name-base>
    4.38 -                    <build-prerequisite/>
    4.39 -                    <compile-dependency/>
    4.40 -                    <run-dependency>
    4.41 -                        <specification-version>6.11.0.1</specification-version>
    4.42 -                    </run-dependency>
    4.43 -                </dependency>
    4.44 -                <dependency>
    4.45 -                    <code-name-base>org.openide.dialogs</code-name-base>
    4.46 -                    <build-prerequisite/>
    4.47 -                    <compile-dependency/>
    4.48 -                    <run-dependency>
    4.49 -                        <specification-version>7.5</specification-version>
    4.50 -                    </run-dependency>
    4.51 -                </dependency>
    4.52 -                <dependency>
    4.53 -                    <code-name-base>org.openide.explorer</code-name-base>
    4.54 -                    <build-prerequisite/>
    4.55 -                    <compile-dependency/>
    4.56 -                    <run-dependency>
    4.57 -                        <specification-version>6.11</specification-version>
    4.58 -                    </run-dependency>
    4.59 -                </dependency>
    4.60 -                <dependency>
    4.61 -                    <code-name-base>org.openide.filesystems</code-name-base>
    4.62 -                    <build-prerequisite/>
    4.63 -                    <compile-dependency/>
    4.64 -                    <run-dependency>
    4.65 -                        <specification-version>7.19</specification-version>
    4.66 -                    </run-dependency>
    4.67 -                </dependency>
    4.68 -                <dependency>
    4.69 -                    <code-name-base>org.openide.loaders</code-name-base>
    4.70 -                    <build-prerequisite/>
    4.71 -                    <compile-dependency/>
    4.72 -                    <run-dependency>
    4.73 -                        <specification-version>6.7</specification-version>
    4.74 -                    </run-dependency>
    4.75 -                </dependency>
    4.76 -                <dependency>
    4.77 -                    <code-name-base>org.openide.nodes</code-name-base>
    4.78 -                    <build-prerequisite/>
    4.79 -                    <compile-dependency/>
    4.80 -                    <run-dependency>
    4.81 -                        <specification-version>7.2.0.1</specification-version>
    4.82 -                    </run-dependency>
    4.83 -                </dependency>
    4.84 -                <dependency>
    4.85 -                    <code-name-base>org.openide.util</code-name-base>
    4.86 -                    <build-prerequisite/>
    4.87 -                    <compile-dependency/>
    4.88 -                    <run-dependency>
    4.89 -                        <specification-version>7.9.0.1</specification-version>
    4.90 -                    </run-dependency>
    4.91 -                </dependency>
    4.92 -                <dependency>
    4.93 -                    <code-name-base>org.openide.windows</code-name-base>
    4.94 -                    <build-prerequisite/>
    4.95 -                    <compile-dependency/>
    4.96 -                    <run-dependency>
    4.97 -                        <specification-version>6.17</specification-version>
    4.98 -                    </run-dependency>
    4.99 -                </dependency>
   4.100 -            </module-dependencies>
   4.101 -            <public-packages/>
   4.102 -        </data>
   4.103 -    </configuration>
   4.104 -</project>
     5.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/AddFTPSiteAction.java	Wed Jul 28 12:48:15 2010 -0400
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,72 +0,0 @@
     5.4 -/*
     5.5 - * To change this template, choose Tools | Templates
     5.6 - * and open the template in the editor.
     5.7 - */
     5.8 -
     5.9 -package org.netbeans.modules.remotefs.ui;
    5.10 -
    5.11 -import org.openide.loaders.DataFolder;
    5.12 -import org.openide.nodes.Node;
    5.13 -import org.openide.util.HelpCtx;
    5.14 -import org.openide.util.NbBundle;
    5.15 -import org.openide.util.actions.CallableSystemAction;
    5.16 -import org.openide.util.actions.NodeAction;
    5.17 -
    5.18 -
    5.19 -public final class AddFTPSiteAction extends NodeAction{
    5.20 -
    5.21 -        DataFolder dataFolder;
    5.22 -        private static AddFTPSiteAction instance;
    5.23 -
    5.24 -        private AddFTPSiteAction() {
    5.25 -            putValue("noIconInMenu", Boolean.TRUE); // NOI18N
    5.26 -        }
    5.27 -
    5.28 -        public static NodeAction getInstance() {
    5.29 -            if (instance == null) {
    5.30 -                instance = new AddFTPSiteAction();
    5.31 -            }
    5.32 -            
    5.33 -            return instance;
    5.34 -        }
    5.35 -
    5.36 -        @Override
    5.37 -        protected boolean asynchronous() {
    5.38 -            return false;
    5.39 -        }
    5.40 -
    5.41 -        @Override
    5.42 -        protected void performAction(Node[] activatedNodes) {
    5.43 -            if (activatedNodes.length == 1 && activatedNodes[0] instanceof RootNode) {
    5.44 -                CallableSystemAction action = NewFTPSiteWizardAction.getInstance();
    5.45 -                action.performAction();
    5.46 -            }
    5.47 -        }
    5.48 -
    5.49 -        @Override
    5.50 -        protected boolean enable(Node[] arr) {
    5.51 -            if ((arr == null) || (arr.length == 0)) {
    5.52 -                return true;
    5.53 -            }
    5.54 -            if (arr.length == 1 && arr[0] instanceof RootNode) {
    5.55 -                return true;
    5.56 -            }
    5.57 -            return false;
    5.58 -        }
    5.59 -
    5.60 -        @Override
    5.61 -        public String getName() {
    5.62 -            return NbBundle.getMessage(AddFTPSiteAction.class, "ACT_AddFTPSite"); // NOI18N
    5.63 -        }
    5.64 -
    5.65 -        @Override
    5.66 -        public HelpCtx getHelpCtx() {
    5.67 -            return new HelpCtx(AddFTPSiteAction.class);
    5.68 -        }
    5.69 -
    5.70 -        @Override
    5.71 -        protected String iconResource() {
    5.72 -            return "lu/kaupthing/explorer/resources/globe-sextant-16x16.png";
    5.73 -        }
    5.74 -
    5.75 -}
     6.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/Bundle.properties	Wed Jul 28 12:48:15 2010 -0400
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,18 +0,0 @@
     6.4 -CTL_ExplorerAction=FTP Explorer
     6.5 -
     6.6 -CTL_ExplorerTopComponent=FTP Explorer
     6.7 -
     6.8 -HINT_ExplorerTopComponent=This is a Explorer window
     6.9 -
    6.10 -OpenIDE-Module-Display-Category=FTP
    6.11 -
    6.12 -OpenIDE-Module-Name=remotefs-ui
    6.13 -
    6.14 -FN_title=FTP Sites
    6.15 -
    6.16 -ACT_AddFTPSite=Add FTP site
    6.17 -
    6.18 -ACT_RemoveFTPSite=Delete FTP site
    6.19 -
    6.20 -OpenIDE-Module-Short-Description=UI for FTP FileSystem
    6.21 -
     7.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerAction.java	Wed Jul 28 12:48:15 2010 -0400
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,21 +0,0 @@
     7.4 -package org.netbeans.modules.remotefs.ui;
     7.5 -import java.awt.event.ActionEvent;
     7.6 -import javax.swing.AbstractAction;
     7.7 -import javax.swing.ImageIcon;
     7.8 -import org.openide.util.NbBundle;
     7.9 -import org.openide.util.Utilities;
    7.10 -import org.openide.windows.TopComponent;
    7.11 -/**
    7.12 - * Action which shows Explorer component.
    7.13 - */
    7.14 -public class ExplorerAction extends AbstractAction {
    7.15 -    public ExplorerAction() {
    7.16 -        super(NbBundle.getMessage(ExplorerAction.class, "CTL_ExplorerAction"));
    7.17 -        putValue(SMALL_ICON, new ImageIcon(Utilities.loadImage("org/netbeans/modules/remotefs/ui/resources/globe-sextant-16x16.png", true)));
    7.18 -    }
    7.19 -    public void actionPerformed(ActionEvent evt) {
    7.20 -        TopComponent win = ExplorerTopComponent.findInstance();
    7.21 -        win.open();
    7.22 -        win.requestActive();
    7.23 -    }
    7.24 -}
    7.25 \ No newline at end of file
     8.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponent.form	Wed Jul 28 12:48:15 2010 -0400
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,36 +0,0 @@
     8.4 -<?xml version="1.0" encoding="UTF-8" ?>
     8.5 -
     8.6 -<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     8.7 -  <AuxValues>
     8.8 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
     8.9 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
    8.10 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
    8.11 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
    8.12 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
    8.13 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
    8.14 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
    8.15 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
    8.16 -  </AuxValues>
    8.17 -
    8.18 -  <Layout>
    8.19 -    <DimensionLayout dim="0">
    8.20 -      <Group type="103" groupAlignment="0" attributes="0">
    8.21 -          <Component id="view" alignment="0" pref="400" max="32767" attributes="0"/>
    8.22 -      </Group>
    8.23 -    </DimensionLayout>
    8.24 -    <DimensionLayout dim="1">
    8.25 -      <Group type="103" groupAlignment="0" attributes="0">
    8.26 -          <Component id="view" alignment="0" pref="300" max="32767" attributes="0"/>
    8.27 -      </Group>
    8.28 -    </DimensionLayout>
    8.29 -  </Layout>
    8.30 -  <SubComponents>
    8.31 -    <Container class="javax.swing.JScrollPane" name="view">
    8.32 -      <AuxValues>
    8.33 -        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new BeanTreeView();"/>
    8.34 -      </AuxValues>
    8.35 -
    8.36 -      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
    8.37 -    </Container>
    8.38 -  </SubComponents>
    8.39 -</Form>
     9.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponent.java	Wed Jul 28 12:48:15 2010 -0400
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,239 +0,0 @@
     9.4 -package org.netbeans.modules.remotefs.ui;
     9.5 -
     9.6 -import java.io.FileInputStream;
     9.7 -import java.io.IOException;
     9.8 -import java.io.ObjectInputStream;
     9.9 -import java.io.Serializable;
    9.10 -import java.util.ArrayList;
    9.11 -import java.util.List;
    9.12 -import java.util.logging.Logger;
    9.13 -import javax.swing.Action;
    9.14 -import javax.swing.ActionMap;
    9.15 -import javax.swing.InputMap;
    9.16 -import javax.swing.JComponent;
    9.17 -import javax.swing.KeyStroke;
    9.18 -import javax.swing.text.DefaultEditorKit;
    9.19 -import org.netbeans.modules.remotefs.ftpclient.FTPLogInfo;
    9.20 -import org.netbeans.modules.remotefs.ftpfs.FTPFileSystem;
    9.21 -import org.openide.explorer.ExplorerManager;
    9.22 -import org.openide.explorer.ExplorerUtils;
    9.23 -import org.openide.explorer.view.BeanTreeView;
    9.24 -import org.openide.filesystems.FileObject;
    9.25 -import org.openide.filesystems.FileUtil;
    9.26 -import org.openide.loaders.DataObject;
    9.27 -import org.openide.loaders.DataObjectNotFoundException;
    9.28 -import org.openide.nodes.Node;
    9.29 -import org.openide.util.Exceptions;
    9.30 -import org.openide.util.NbBundle;
    9.31 -import org.openide.windows.TopComponent;
    9.32 -import org.openide.windows.WindowManager;
    9.33 -import org.openide.util.Utilities;
    9.34 -import org.openide.util.actions.SystemAction;
    9.35 -
    9.36 -/**
    9.37 - * Top component which displays something.
    9.38 - */
    9.39 -final class ExplorerTopComponent extends TopComponent implements ExplorerManager.Provider {
    9.40 -
    9.41 -    private static ExplorerTopComponent instance;
    9.42 -    /** path to the icon used by the component and its open action */
    9.43 -    static final String ICON_PATH = "org/netbeans/modules/remotefs/ui/resources/globe-sextant-16x16.png";
    9.44 -    private static final String PREFERRED_ID = "ExplorerTopComponent";
    9.45 -    private transient ExplorerManager manager;
    9.46 -    private Logger logger = Logger.getLogger(ExplorerTopComponent.class.getName());
    9.47 -
    9.48 -    private ExplorerTopComponent() {
    9.49 -        {
    9.50 -            try {
    9.51 -                ObjectInputStream is = null;
    9.52 -                initComponents();
    9.53 -                setName(NbBundle.getMessage(ExplorerTopComponent.class, "CTL_ExplorerTopComponent"));
    9.54 -                setToolTipText(NbBundle.getMessage(ExplorerTopComponent.class, "HINT_ExplorerTopComponent"));
    9.55 -                setIcon(Utilities.loadImage(ICON_PATH, true));
    9.56 -                this.manager = new ExplorerManager();
    9.57 -                DataObject find = DataObject.find(FileUtil.getConfigFile("FTPSites"));
    9.58 -                FileObject[] files = find.getPrimaryFile().getChildren();
    9.59 -                List<FTPLogInfo> siteInfos = new ArrayList<FTPLogInfo>();
    9.60 -                for (int i = 0; i < files.length; i++) {
    9.61 -                    try {
    9.62 -                        is = new ObjectInputStream(new FileInputStream(FileUtil.toFile(files[i])));
    9.63 -                        siteInfos.add((FTPLogInfo) is.readObject());
    9.64 -                    } catch (IOException ex) {
    9.65 -                        Exceptions.printStackTrace(ex);
    9.66 -                    } catch (ClassNotFoundException ex) {
    9.67 -                        Exceptions.printStackTrace(ex);
    9.68 -                    } finally {
    9.69 -                        if (is != null) {
    9.70 -                            try {
    9.71 -                                is.close();
    9.72 -                            } catch (IOException ex) {
    9.73 -                                Exceptions.printStackTrace(ex);
    9.74 -                            }
    9.75 -                        }
    9.76 -                    }
    9.77 -                }
    9.78 -                List<FTPFileSystem> sites = new ArrayList<FTPFileSystem>();
    9.79 -                for (FTPLogInfo info : siteInfos) {
    9.80 -                    sites.add(new FTPFileSystem(info));
    9.81 -                }
    9.82 -                Node root = new RootNode(sites);
    9.83 -                manager.setRootContext(root);
    9.84 -                ((BeanTreeView) view).setRootVisible(true);
    9.85 -                ((BeanTreeView) view).setDragSource(true);
    9.86 -                ActionMap map = getActionMap();
    9.87 -                map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager));
    9.88 -                map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager));
    9.89 -                map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager));
    9.90 -                map.put("delete", ExplorerUtils.actionDelete(manager, true)); // or false
    9.91 -                map.put("filesystem", getAction(org.openide.actions.FileSystemAction.class));
    9.92 -                InputMap keys = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    9.93 -                keys.put(KeyStroke.getKeyStroke("control C"), DefaultEditorKit.copyAction);
    9.94 -                keys.put(KeyStroke.getKeyStroke("control X"), DefaultEditorKit.cutAction);
    9.95 -                keys.put(KeyStroke.getKeyStroke("control V"), DefaultEditorKit.pasteAction);
    9.96 -                keys.put(KeyStroke.getKeyStroke("DELETE"), "delete");
    9.97 -
    9.98 -                associateLookup(ExplorerUtils.createLookup(manager, map));
    9.99 -            } catch (DataObjectNotFoundException ex) {
   9.100 -                Exceptions.printStackTrace(ex);
   9.101 -            }
   9.102 -        }
   9.103 -    }
   9.104 -
   9.105 -    private SystemAction getAction(Class clazz) {
   9.106 -        return (SystemAction) org.openide.util.SharedClassObject.findObject(clazz, true);
   9.107 -    }
   9.108 -
   9.109 -    /** This method is called from within the constructor to
   9.110 -     * initialize the form.
   9.111 -     * WARNING: Do NOT modify this code. The content of this method is
   9.112 -     * always regenerated by the Form Editor.
   9.113 -     */
   9.114 -
   9.115 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   9.116 -
   9.117 -    private void initComponents() {
   9.118 -
   9.119 -
   9.120 -
   9.121 -        view = new BeanTreeView();
   9.122 -
   9.123 -
   9.124 -
   9.125 -        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
   9.126 -
   9.127 -        this.setLayout(layout);
   9.128 -
   9.129 -        layout.setHorizontalGroup(
   9.130 -
   9.131 -            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   9.132 -
   9.133 -            .add(view, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
   9.134 -
   9.135 -        );
   9.136 -
   9.137 -        layout.setVerticalGroup(
   9.138 -
   9.139 -            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
   9.140 -
   9.141 -            .add(view, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
   9.142 -
   9.143 -        );
   9.144 -
   9.145 -    }// </editor-fold>//GEN-END:initComponents
   9.146 -
   9.147 -    // Variables declaration - do not modify//GEN-BEGIN:variables
   9.148 -
   9.149 -    private javax.swing.JScrollPane view;
   9.150 -
   9.151 -    // End of variables declaration//GEN-END:variables
   9.152 -    /**
   9.153 -     * Gets default instance. Do not use directly: reserved for *.settings files only,
   9.154 -     * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
   9.155 -     * To obtain the singleton instance, use {@link findInstance}.
   9.156 -     */
   9.157 -    public static synchronized ExplorerTopComponent getDefault() {
   9.158 -        if (instance == null) {
   9.159 -            instance = new ExplorerTopComponent();
   9.160 -        }
   9.161 -        return instance;
   9.162 -    }
   9.163 -
   9.164 -    /**
   9.165 -     * Obtain the ExplorerTopComponent instance. Never call {@link #getDefault} directly!
   9.166 -     */
   9.167 -    public static synchronized ExplorerTopComponent findInstance() {
   9.168 -        TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
   9.169 -        if (win == null) {
   9.170 -            Logger.getLogger(ExplorerTopComponent.class.getName()).warning("Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
   9.171 -            return getDefault();
   9.172 -        }
   9.173 -        if (win instanceof ExplorerTopComponent) {
   9.174 -            return (ExplorerTopComponent) win;
   9.175 -        }
   9.176 -        Logger.getLogger(ExplorerTopComponent.class.getName()).warning("There seem to be multiple components with the '" + PREFERRED_ID +
   9.177 -                "' ID. That is a potential source of errors and unexpected behavior.");
   9.178 -        return getDefault();
   9.179 -    }
   9.180 -
   9.181 -    public 
   9.182 -    @Override
   9.183 -    int getPersistenceType() {
   9.184 -        return TopComponent.PERSISTENCE_ALWAYS;
   9.185 -    }
   9.186 -
   9.187 -    public 
   9.188 -    @Override
   9.189 -    void componentOpened() {
   9.190 -        ExplorerUtils.activateActions(manager, true);
   9.191 -        view.requestFocusInWindow();
   9.192 -    }
   9.193 -
   9.194 -    @Override
   9.195 -    public void addNotify() {
   9.196 -        super.addNotify();
   9.197 -        ExplorerUtils.activateActions(manager, true);
   9.198 -    }
   9.199 -
   9.200 -    @Override
   9.201 -    public void removeNotify() {
   9.202 -        ExplorerUtils.activateActions(manager, false);
   9.203 -        super.removeNotify();
   9.204 -    }
   9.205 -
   9.206 -    public 
   9.207 -    @Override
   9.208 -    void componentClosed() {
   9.209 -        ExplorerUtils.activateActions(manager, false);
   9.210 -    }
   9.211 -
   9.212 -    /** replaces this in object stream */
   9.213 -    public 
   9.214 -    @Override
   9.215 -    Object writeReplace() {
   9.216 -        return new ResolvableHelper();
   9.217 -    }
   9.218 -
   9.219 -    protected 
   9.220 -    @Override
   9.221 -    String preferredID() {
   9.222 -        return PREFERRED_ID;
   9.223 -    }
   9.224 -
   9.225 -    @Override
   9.226 -    public Action[] getActions() {
   9.227 -        return super.getActions();
   9.228 -    }
   9.229 -
   9.230 -    public ExplorerManager getExplorerManager() {
   9.231 -        return manager;
   9.232 -    }
   9.233 -
   9.234 -    final static class ResolvableHelper implements Serializable {
   9.235 -
   9.236 -        private static final long serialVersionUID = 1L;
   9.237 -
   9.238 -        public Object readResolve() {
   9.239 -            return ExplorerTopComponent.getDefault();
   9.240 -        }
   9.241 -    }
   9.242 -}
    10.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponentSettings.xml	Wed Jul 28 12:48:15 2010 -0400
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,8 +0,0 @@
    10.4 -<?xml version="1.0" encoding="UTF-8"?>
    10.5 -<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
    10.6 -<settings version="1.0">
    10.7 -    <module name="org.netbeans.modules.remotefs.ui" spec="1.0"/>
    10.8 -    <instanceof class="org.openide.windows.TopComponent"/>
    10.9 -    <instanceof class="org.netbeans.modules.remotefs.ui.ExplorerTopComponent"/>
   10.10 -    <instance class="org.netbeans.modules.remotefs.ui.ExplorerTopComponent" method="getDefault"/>
   10.11 -</settings>
    11.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/ExplorerTopComponentWstcref.xml	Wed Jul 28 12:48:15 2010 -0400
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,7 +0,0 @@
    11.4 -<?xml version="1.0" encoding="UTF-8"?>
    11.5 -<!DOCTYPE tc-ref PUBLIC "-//NetBeans//DTD Top Component in Mode Properties 2.0//EN" "http://www.netbeans.org/dtds/tc-ref2_0.dtd">
    11.6 -<tc-ref version="2.0" >
    11.7 -    <module name="org.netbeans.modules.remotefs.ui" spec="1.0"/>
    11.8 -    <tc-id id="ExplorerTopComponent"/>
    11.9 -    <state opened="false"/>
   11.10 -</tc-ref>
    12.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteVisualPanel1.form	Wed Jul 28 12:48:15 2010 -0400
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,162 +0,0 @@
    12.4 -<?xml version="1.0" encoding="UTF-8" ?>
    12.5 -
    12.6 -<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    12.7 -  <Properties>
    12.8 -    <Property name="toolTipText" type="java.lang.String" value=""/>
    12.9 -  </Properties>
   12.10 -  <AuxValues>
   12.11 -    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
   12.12 -    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   12.13 -    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
   12.14 -    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
   12.15 -    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
   12.16 -    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   12.17 -    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   12.18 -    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   12.19 -  </AuxValues>
   12.20 -
   12.21 -  <Layout>
   12.22 -    <DimensionLayout dim="0">
   12.23 -      <Group type="103" groupAlignment="0" attributes="0">
   12.24 -          <Group type="102" alignment="0" attributes="0">
   12.25 -              <EmptySpace max="-2" attributes="0"/>
   12.26 -              <Group type="103" groupAlignment="0" attributes="0">
   12.27 -                  <Group type="102" attributes="0">
   12.28 -                      <Group type="103" groupAlignment="0" attributes="0">
   12.29 -                          <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
   12.30 -                          <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
   12.31 -                          <Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
   12.32 -                      </Group>
   12.33 -                      <EmptySpace max="-2" attributes="0"/>
   12.34 -                      <Group type="103" groupAlignment="1" attributes="0">
   12.35 -                          <Component id="nameField" alignment="0" pref="329" max="32767" attributes="0"/>
   12.36 -                          <Component id="serverField" alignment="0" pref="329" max="32767" attributes="0"/>
   12.37 -                          <Component id="userField" alignment="1" pref="329" max="32767" attributes="0"/>
   12.38 -                      </Group>
   12.39 -                  </Group>
   12.40 -                  <Group type="102" alignment="0" attributes="0">
   12.41 -                      <Group type="103" groupAlignment="0" attributes="0">
   12.42 -                          <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
   12.43 -                          <Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/>
   12.44 -                      </Group>
   12.45 -                      <EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
   12.46 -                      <Group type="103" groupAlignment="0" attributes="0">
   12.47 -                          <Component id="initFolderField" alignment="0" pref="329" max="32767" attributes="0"/>
   12.48 -                          <Component id="passwordField" alignment="0" pref="329" max="32767" attributes="0"/>
   12.49 -                      </Group>
   12.50 -                  </Group>
   12.51 -                  <Component id="jCheckBox1" alignment="0" min="-2" pref="205" max="-2" attributes="0"/>
   12.52 -              </Group>
   12.53 -              <EmptySpace max="-2" attributes="0"/>
   12.54 -          </Group>
   12.55 -      </Group>
   12.56 -    </DimensionLayout>
   12.57 -    <DimensionLayout dim="1">
   12.58 -      <Group type="103" groupAlignment="0" attributes="0">
   12.59 -          <Group type="102" alignment="0" attributes="0">
   12.60 -              <EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
   12.61 -              <Group type="103" groupAlignment="3" attributes="0">
   12.62 -                  <Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
   12.63 -                  <Component id="nameField" alignment="3" min="-2" max="-2" attributes="0"/>
   12.64 -              </Group>
   12.65 -              <EmptySpace type="unrelated" max="-2" attributes="0"/>
   12.66 -              <Group type="103" groupAlignment="3" attributes="0">
   12.67 -                  <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
   12.68 -                  <Component id="serverField" alignment="3" min="-2" max="-2" attributes="0"/>
   12.69 -              </Group>
   12.70 -              <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
   12.71 -              <Group type="103" groupAlignment="3" attributes="0">
   12.72 -                  <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
   12.73 -                  <Component id="userField" alignment="3" min="-2" max="-2" attributes="0"/>
   12.74 -              </Group>
   12.75 -              <EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
   12.76 -              <Group type="103" groupAlignment="3" attributes="0">
   12.77 -                  <Component id="passwordField" alignment="3" min="-2" max="-2" attributes="0"/>
   12.78 -                  <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
   12.79 -              </Group>
   12.80 -              <EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
   12.81 -              <Group type="103" groupAlignment="3" attributes="0">
   12.82 -                  <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
   12.83 -                  <Component id="initFolderField" alignment="3" min="-2" max="-2" attributes="0"/>
   12.84 -              </Group>
   12.85 -              <EmptySpace type="separate" max="-2" attributes="0"/>
   12.86 -              <Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
   12.87 -              <EmptySpace pref="81" max="32767" attributes="0"/>
   12.88 -          </Group>
   12.89 -      </Group>
   12.90 -    </DimensionLayout>
   12.91 -  </Layout>
   12.92 -  <SubComponents>
   12.93 -    <Component class="javax.swing.JLabel" name="jLabel1">
   12.94 -      <Properties>
   12.95 -        <Property name="text" type="java.lang.String" value="Server (IP or name):"/>
   12.96 -      </Properties>
   12.97 -    </Component>
   12.98 -    <Component class="javax.swing.JLabel" name="jLabel2">
   12.99 -      <Properties>
  12.100 -        <Property name="text" type="java.lang.String" value="Username:"/>
  12.101 -      </Properties>
  12.102 -    </Component>
  12.103 -    <Component class="javax.swing.JLabel" name="jLabel3">
  12.104 -      <Properties>
  12.105 -        <Property name="text" type="java.lang.String" value="Password:"/>
  12.106 -      </Properties>
  12.107 -    </Component>
  12.108 -    <Component class="javax.swing.JLabel" name="jLabel4">
  12.109 -      <Properties>
  12.110 -        <Property name="text" type="java.lang.String" value="Initial folder:"/>
  12.111 -      </Properties>
  12.112 -    </Component>
  12.113 -    <Component class="javax.swing.JPasswordField" name="passwordField">
  12.114 -      <Properties>
  12.115 -        <Property name="toolTipText" type="java.lang.String" value="if anonymous user, leave empty"/>
  12.116 -      </Properties>
  12.117 -      <Events>
  12.118 -        <EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="passwordFieldFocusLost"/>
  12.119 -        <EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="passwordFieldKeyReleased"/>
  12.120 -      </Events>
  12.121 -    </Component>
  12.122 -    <Component class="javax.swing.JTextField" name="serverField">
  12.123 -      <Events>
  12.124 -        <EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="serverFieldFocusLost"/>
  12.125 -        <EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="serverFieldKeyReleased"/>
  12.126 -      </Events>
  12.127 -    </Component>
  12.128 -    <Component class="javax.swing.JTextField" name="userField">
  12.129 -      <Properties>
  12.130 -        <Property name="text" type="java.lang.String" value="anonymous"/>
  12.131 -      </Properties>
  12.132 -      <Events>
  12.133 -        <EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="userFieldFocusLost"/>
  12.134 -        <EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="userFieldKeyReleased"/>
  12.135 -      </Events>
  12.136 -    </Component>
  12.137 -    <Component class="javax.swing.JTextField" name="initFolderField">
  12.138 -      <Properties>
  12.139 -        <Property name="toolTipText" type="java.lang.String" value="The folder you want to have a top directory"/>
  12.140 -      </Properties>
  12.141 -      <Events>
  12.142 -        <EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="initFolderFieldFocusLost"/>
  12.143 -        <EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="initFolderFieldKeyReleased"/>
  12.144 -      </Events>
  12.145 -    </Component>
  12.146 -    <Component class="javax.swing.JLabel" name="jLabel6">
  12.147 -      <Properties>
  12.148 -        <Property name="text" type="java.lang.String" value="Connection name: "/>
  12.149 -      </Properties>
  12.150 -    </Component>
  12.151 -    <Component class="javax.swing.JTextField" name="nameField">
  12.152 -      <Events>
  12.153 -        <EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="nameFieldFocusLost"/>
  12.154 -        <EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="nameFieldKeyReleased"/>
  12.155 -      </Events>
  12.156 -    </Component>
  12.157 -    <Component class="javax.swing.JCheckBox" name="jCheckBox1">
  12.158 -      <Properties>
  12.159 -        <Property name="selected" type="boolean" value="true"/>
  12.160 -        <Property name="text" type="java.lang.String" value="Passive Mode"/>
  12.161 -        <Property name="toolTipText" type="java.lang.String" value="When selected the FTP client connects in passive mode, otherwise in active mode."/>
  12.162 -      </Properties>
  12.163 -    </Component>
  12.164 -  </SubComponents>
  12.165 -</Form>
    13.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteVisualPanel1.java	Wed Jul 28 12:48:15 2010 -0400
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,326 +0,0 @@
    13.4 -package org.netbeans.modules.remotefs.ui;
    13.5 -
    13.6 -import java.awt.event.KeyEvent;
    13.7 -import javax.swing.JPanel;
    13.8 -
    13.9 -public final class NewFTPSiteVisualPanel1 extends JPanel {
   13.10 -
   13.11 -    public static final String SITE_NAME = "site_name";
   13.12 -    public static final String SITE_SERVER = "site_server";
   13.13 -    public static final String SITE_USER = "site_user";
   13.14 -    public static final String SITE_PWD = "site_pwd";
   13.15 -    public static final String SITE_INIT_FOLDER = "site_init_folder";
   13.16 -    public static final String SITE_PASSIVE_MODE = "site_passive_mode";
   13.17 -    private String siteName = "";
   13.18 -    private String siteServer = "";
   13.19 -    private String siteUser = "";
   13.20 -    private String sitePassword = "";
   13.21 -    private String siteInitFolder = "";
   13.22 -    
   13.23 -    public NewFTPSiteVisualPanel1() {
   13.24 -        initComponents();
   13.25 -    }
   13.26 -
   13.27 -    @Override
   13.28 -    public String getName() {
   13.29 -        return "Connection parameters";
   13.30 -    }
   13.31 -
   13.32 -//    private void setTestResult(boolean succes, String message) {
   13.33 -//        if (succes) {
   13.34 -//            jLabel5.setText("Test succesfull!");
   13.35 -//            jLabel5.setForeground(Color.GREEN);
   13.36 -//        } else {
   13.37 -//            jLabel5.setText("Test failed! " + message);
   13.38 -//            jLabel5.setForeground(Color.RED);
   13.39 -//        }
   13.40 -//    }
   13.41 -    /** This method is called from within the constructor to
   13.42 -     * initialize the form.
   13.43 -     * WARNING: Do NOT modify this code. The content of this method is
   13.44 -     * always regenerated by the Form Editor.
   13.45 -     */
   13.46 -
   13.47 -    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   13.48 -    private void initComponents() {
   13.49 -
   13.50 -        jLabel1 = new javax.swing.JLabel();
   13.51 -        jLabel2 = new javax.swing.JLabel();
   13.52 -        jLabel3 = new javax.swing.JLabel();
   13.53 -        jLabel4 = new javax.swing.JLabel();
   13.54 -        passwordField = new javax.swing.JPasswordField();
   13.55 -        serverField = new javax.swing.JTextField();
   13.56 -        userField = new javax.swing.JTextField();
   13.57 -        initFolderField = new javax.swing.JTextField();
   13.58 -        jLabel6 = new javax.swing.JLabel();
   13.59 -        nameField = new javax.swing.JTextField();
   13.60 -        jCheckBox1 = new javax.swing.JCheckBox();
   13.61 -
   13.62 -        setToolTipText("");
   13.63 -
   13.64 -        org.openide.awt.Mnemonics.setLocalizedText(jLabel1, "Server (IP or name):");
   13.65 -
   13.66 -        org.openide.awt.Mnemonics.setLocalizedText(jLabel2, "Username:");
   13.67 -
   13.68 -        org.openide.awt.Mnemonics.setLocalizedText(jLabel3, "Password:");
   13.69 -
   13.70 -        org.openide.awt.Mnemonics.setLocalizedText(jLabel4, "Initial folder:");
   13.71 -
   13.72 -        passwordField.setToolTipText("if anonymous user, leave empty");
   13.73 -        passwordField.addFocusListener(new java.awt.event.FocusAdapter() {
   13.74 -            public void focusLost(java.awt.event.FocusEvent evt) {
   13.75 -                passwordFieldFocusLost(evt);
   13.76 -            }
   13.77 -        });
   13.78 -        passwordField.addKeyListener(new java.awt.event.KeyAdapter() {
   13.79 -            public void keyReleased(java.awt.event.KeyEvent evt) {
   13.80 -                passwordFieldKeyReleased(evt);
   13.81 -            }
   13.82 -        });
   13.83 -
   13.84 -        serverField.addFocusListener(new java.awt.event.FocusAdapter() {
   13.85 -            public void focusLost(java.awt.event.FocusEvent evt) {
   13.86 -                serverFieldFocusLost(evt);
   13.87 -            }
   13.88 -        });
   13.89 -        serverField.addKeyListener(new java.awt.event.KeyAdapter() {
   13.90 -            public void keyReleased(java.awt.event.KeyEvent evt) {
   13.91 -                serverFieldKeyReleased(evt);
   13.92 -            }
   13.93 -        });
   13.94 -
   13.95 -        userField.setText("anonymous");
   13.96 -        userField.addFocusListener(new java.awt.event.FocusAdapter() {
   13.97 -            public void focusLost(java.awt.event.FocusEvent evt) {
   13.98 -                userFieldFocusLost(evt);
   13.99 -            }
  13.100 -        });
  13.101 -        userField.addKeyListener(new java.awt.event.KeyAdapter() {
  13.102 -            public void keyReleased(java.awt.event.KeyEvent evt) {
  13.103 -                userFieldKeyReleased(evt);
  13.104 -            }
  13.105 -        });
  13.106 -
  13.107 -        initFolderField.setToolTipText("The folder you want to have a top directory");
  13.108 -        initFolderField.addFocusListener(new java.awt.event.FocusAdapter() {
  13.109 -            public void focusLost(java.awt.event.FocusEvent evt) {
  13.110 -                initFolderFieldFocusLost(evt);
  13.111 -            }
  13.112 -        });
  13.113 -        initFolderField.addKeyListener(new java.awt.event.KeyAdapter() {
  13.114 -            public void keyReleased(java.awt.event.KeyEvent evt) {
  13.115 -                initFolderFieldKeyReleased(evt);
  13.116 -            }
  13.117 -        });
  13.118 -
  13.119 -        org.openide.awt.Mnemonics.setLocalizedText(jLabel6, "Connection name: ");
  13.120 -
  13.121 -        nameField.addFocusListener(new java.awt.event.FocusAdapter() {
  13.122 -            public void focusLost(java.awt.event.FocusEvent evt) {
  13.123 -                nameFieldFocusLost(evt);
  13.124 -            }
  13.125 -        });
  13.126 -        nameField.addKeyListener(new java.awt.event.KeyAdapter() {
  13.127 -            public void keyReleased(java.awt.event.KeyEvent evt) {
  13.128 -                nameFieldKeyReleased(evt);
  13.129 -            }
  13.130 -        });
  13.131 -
  13.132 -        jCheckBox1.setSelected(true);
  13.133 -        org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, "Passive Mode");
  13.134 -        jCheckBox1.setToolTipText("When selected the FTP client connects in passive mode, otherwise in active mode.");
  13.135 -
  13.136 -        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
  13.137 -        this.setLayout(layout);
  13.138 -        layout.setHorizontalGroup(
  13.139 -            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  13.140 -            .add(layout.createSequentialGroup()
  13.141 -                .addContainerGap()
  13.142 -                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  13.143 -                    .add(layout.createSequentialGroup()
  13.144 -                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  13.145 -                            .add(jLabel1)
  13.146 -                            .add(jLabel2)
  13.147 -                            .add(jLabel6))
  13.148 -                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
  13.149 -                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
  13.150 -                            .add(org.jdesktop.layout.GroupLayout.LEADING, nameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
  13.151 -                            .add(org.jdesktop.layout.GroupLayout.LEADING, serverField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
  13.152 -                            .add(userField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)))
  13.153 -                    .add(layout.createSequentialGroup()
  13.154 -                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  13.155 -                            .add(jLabel3)
  13.156 -                            .add(jLabel4))
  13.157 -                        .add(42, 42, 42)
  13.158 -                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  13.159 -                            .add(initFolderField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
  13.160 -                            .add(passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)))
  13.161 -                    .add(jCheckBox1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 205, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  13.162 -                .addContainerGap())
  13.163 -        );
  13.164 -        layout.setVerticalGroup(
  13.165 -            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
  13.166 -            .add(layout.createSequentialGroup()
  13.167 -                .add(7, 7, 7)
  13.168 -                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  13.169 -                    .add(jLabel6)
  13.170 -                    .add(nameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  13.171 -                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
  13.172 -                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  13.173 -                    .add(jLabel1)
  13.174 -                    .add(serverField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  13.175 -                .add(12, 12, 12)
  13.176 -                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  13.177 -                    .add(jLabel2)
  13.178 -                    .add(userField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  13.179 -                .add(13, 13, 13)
  13.180 -                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  13.181 -                    .add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
  13.182 -                    .add(jLabel3))
  13.183 -                .add(14, 14, 14)
  13.184 -                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
  13.185 -                    .add(jLabel4)
  13.186 -                    .add(initFolderField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
  13.187 -                .add(18, 18, 18)
  13.188 -                .add(jCheckBox1)
  13.189 -                .addContainerGap(81, Short.MAX_VALUE))
  13.190 -        );
  13.191 -    }// </editor-fold>//GEN-END:initComponents
  13.192 -
  13.193 -    private void setValue(String param, String text) {
  13.194 -        if (param.equals(SITE_INIT_FOLDER)) {
  13.195 -            setSiteInitFolder(text);
  13.196 -        } else if (param.equals(SITE_NAME)) {
  13.197 -            setSiteName(text);
  13.198 -        } else if (param.equals(SITE_USER)) {
  13.199 -            setSiteUser(text);
  13.200 -        } else if (param.equals(SITE_PWD)) {
  13.201 -            setSitePassword(text);
  13.202 -        } else if (param.equals(SITE_SERVER)) {
  13.203 -            setSiteServer(text);
  13.204 -        }
  13.205 -    }
  13.206 -
  13.207 -    private void nameFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nameFieldFocusLost
  13.208 -        setValue(SITE_NAME, nameField.getText());
  13.209 -    }//GEN-LAST:event_nameFieldFocusLost
  13.210 -
  13.211 -    private void serverFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_serverFieldFocusLost
  13.212 -        setValue(SITE_SERVER, serverField.getText());
  13.213 -    }//GEN-LAST:event_serverFieldFocusLost
  13.214 -
  13.215 -    private void userFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_userFieldFocusLost
  13.216 -        setValue(SITE_USER, userField.getText());
  13.217 -    }//GEN-LAST:event_userFieldFocusLost
  13.218 -
  13.219 -    private void passwordFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_passwordFieldFocusLost
  13.220 -        setValue(SITE_PWD, new String(passwordField.getPassword()));
  13.221 -    }//GEN-LAST:event_passwordFieldFocusLost
  13.222 -
  13.223 -    private void initFolderFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_initFolderFieldFocusLost
  13.224 -        setValue(SITE_INIT_FOLDER, initFolderField.getText());
  13.225 -    }//GEN-LAST:event_initFolderFieldFocusLost
  13.226 -
  13.227 -    private void initFolderFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_initFolderFieldKeyReleased
  13.228 -        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
  13.229 -            setValue(SITE_INIT_FOLDER, initFolderField.getText());
  13.230 -        }
  13.231 -    }//GEN-LAST:event_initFolderFieldKeyReleased
  13.232 -
  13.233 -    private void passwordFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordFieldKeyReleased
  13.234 -        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
  13.235 -            setValue(SITE_PWD, new String(passwordField.getPassword()));
  13.236 -        }
  13.237 -    }//GEN-LAST:event_passwordFieldKeyReleased
  13.238 -
  13.239 -    private void userFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_userFieldKeyReleased
  13.240 -        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
  13.241 -            setValue(SITE_USER, userField.getText());
  13.242 -        }
  13.243 -    }//GEN-LAST:event_userFieldKeyReleased
  13.244 -
  13.245 -    private void serverFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_serverFieldKeyReleased
  13.246 -        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
  13.247 -            setValue(SITE_SERVER, serverField.getText());
  13.248 -        }
  13.249 -    }//GEN-LAST:event_serverFieldKeyReleased
  13.250 -
  13.251 -    private void nameFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nameFieldKeyReleased
  13.252 -        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
  13.253 -            setValue(SITE_NAME, nameField.getText());
  13.254 -        }
  13.255 -    }//GEN-LAST:event_nameFieldKeyReleased
  13.256 -    // Variables declaration - do not modify//GEN-BEGIN:variables
  13.257 -    private javax.swing.JTextField initFolderField;
  13.258 -    private javax.swing.JCheckBox jCheckBox1;
  13.259 -    private javax.swing.JLabel jLabel1;
  13.260 -    private javax.swing.JLabel jLabel2;
  13.261 -    private javax.swing.JLabel jLabel3;
  13.262 -    private javax.swing.JLabel jLabel4;
  13.263 -    private javax.swing.JLabel jLabel6;
  13.264 -    private javax.swing.JTextField nameField;
  13.265 -    private javax.swing.JPasswordField passwordField;
  13.266 -    private javax.swing.JTextField serverField;
  13.267 -    private javax.swing.JTextField userField;
  13.268 -    // End of variables declaration//GEN-END:variables
  13.269 -    
  13.270 -    public String getSiteName() {
  13.271 -        if (siteName == null || "".equals(siteName)) {
  13.272 -            return "New FTP Site";
  13.273 -        }
  13.274 -        return siteName;
  13.275 -    }
  13.276 -
  13.277 -    public void setSiteName(String siteName) {
  13.278 -        if (siteName != null) {
  13.279 -            this.siteName = siteName;
  13.280 -        }
  13.281 -    }
  13.282 -
  13.283 -    public String getSiteServer() {
  13.284 -        return siteServer;
  13.285 -    }
  13.286 -
  13.287 -    public void setSiteServer(String siteServer) {
  13.288 -        if (siteServer != null) {
  13.289 -            this.siteServer = siteServer;
  13.290 -        }
  13.291 -    }
  13.292 -
  13.293 -    public String getSiteUser() {
  13.294 -        return siteUser;
  13.295 -    }
  13.296 -
  13.297 -    public void setSiteUser(String siteUser) {
  13.298 -        if (siteUser != null) {
  13.299 -            this.siteUser = siteUser;
  13.300 -        }
  13.301 -    }
  13.302 -
  13.303 -    public String getSitePassword() {
  13.304 -        return sitePassword;
  13.305 -    }
  13.306 -
  13.307 -    public void setSitePassword(String sitePassword) {
  13.308 -        if (sitePassword != null) {
  13.309 -            this.sitePassword = sitePassword;
  13.310 -        }
  13.311 -    }
  13.312 -
  13.313 -    public String getSiteInitFolder() {
  13.314 -        return siteInitFolder;
  13.315 -    }
  13.316 -
  13.317 -    public void setSiteInitFolder(String siteInitFolder) {
  13.318 -        if (siteInitFolder != null) {
  13.319 -           this.siteInitFolder = siteInitFolder;
  13.320 -        }
  13.321 -   }
  13.322 -    
  13.323 -    public boolean isPassiveMode(){
  13.324 -        return this.jCheckBox1.isSelected();
  13.325 -    }
  13.326 -}
  13.327 -
  13.328 -
  13.329 -
    14.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteWizardAction.java	Wed Jul 28 12:48:15 2010 -0400
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,133 +0,0 @@
    14.4 -package org.netbeans.modules.remotefs.ui;
    14.5 -import java.awt.Component;
    14.6 -import java.awt.Dialog;
    14.7 -import java.io.IOException;
    14.8 -import java.io.ObjectOutputStream;
    14.9 -import java.text.MessageFormat;
   14.10 -import java.util.Map;
   14.11 -import javax.swing.ImageIcon;
   14.12 -import javax.swing.JComponent;
   14.13 -import org.netbeans.modules.remotefs.ftpclient.FTPClient;
   14.14 -import org.netbeans.modules.remotefs.ftpclient.FTPLogInfo;
   14.15 -import org.netbeans.modules.remotefs.ftpfs.FTPFileSystem;
   14.16 -import org.openide.DialogDisplayer;
   14.17 -import org.openide.WizardDescriptor;
   14.18 -import org.openide.filesystems.FileLock;
   14.19 -import org.openide.filesystems.FileObject;
   14.20 -import org.openide.filesystems.FileUtil;
   14.21 -import org.openide.loaders.DataObject;
   14.22 -import org.openide.util.Exceptions;
   14.23 -import org.openide.util.HelpCtx;
   14.24 -import org.openide.util.Utilities;
   14.25 -import org.openide.util.actions.CallableSystemAction;
   14.26 -/**
   14.27 - * Action that launches a wizard to register a new FTP site in the Explorer window.
   14.28 - * 
   14.29 - */
   14.30 -public final class NewFTPSiteWizardAction extends CallableSystemAction {
   14.31 -    private WizardDescriptor.Panel[] panels;
   14.32 -    private static NewFTPSiteWizardAction instance;
   14.33 -    private NewFTPSiteWizardAction() {
   14.34 -        putValue(SMALL_ICON, new ImageIcon(Utilities.loadImage("org/netbeans/modules/remotefs/ui/resources/globe-sextant-16x16.png", true)));
   14.35 -    }
   14.36 -    public static CallableSystemAction getInstance() {
   14.37 -        if (instance == null) {
   14.38 -            instance = new NewFTPSiteWizardAction();
   14.39 -        }
   14.40 -        return instance;
   14.41 -    }
   14.42 -    public void performAction() {
   14.43 -        WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
   14.44 -        // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
   14.45 -        wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
   14.46 -        wizardDescriptor.setTitle("New FTP Site Wizard");
   14.47 -        Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
   14.48 -        dialog.setVisible(true);
   14.49 -        dialog.toFront();
   14.50 -        boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
   14.51 -        if (!cancelled) {
   14.52 -            //Validate 
   14.53 -            Map<String, Object> props = wizardDescriptor.getProperties();
   14.54 -            RootNode ftpx = Utilities.actionsGlobalContext().lookup(RootNode.class);
   14.55 -            if (ftpx != null) {
   14.56 -                FTPLogInfo info = new FTPLogInfo();
   14.57 -                info.setHost(props.get(NewFTPSiteVisualPanel1.SITE_SERVER).toString());
   14.58 -                info.setPort(FTPClient.DEFAULT_PORT);
   14.59 -                info.setUser(props.get(NewFTPSiteVisualPanel1.SITE_USER).toString());
   14.60 -                info.setPassword(props.get(NewFTPSiteVisualPanel1.SITE_PWD).toString());
   14.61 -                //info.setName(props.get(NewFTPSiteVisualPanel1.SITE_NAME).toString());
   14.62 -                info.setRootFolder(props.get(NewFTPSiteVisualPanel1.SITE_INIT_FOLDER).toString());
   14.63 -                info.setPassiveMode((Boolean)props.get(NewFTPSiteVisualPanel1.SITE_PASSIVE_MODE));
   14.64 -                final FTPFileSystem fs = new FTPFileSystem(info);
   14.65 -              //  Repository.getDefault().addFileSystem(fs);
   14.66 -                ((RootNode.RootNodeChildren)ftpx.getChildren()).add(fs);
   14.67 -                try {
   14.68 -                    DataObject find = DataObject.find(FileUtil.getConfigFile("FTPSites"));
   14.69 -                    FileObject fld = find.getPrimaryFile();
   14.70 -                    String baseName = info.getUser() + "@" + info.getHost();
   14.71 -                    FileObject writeTo = fld.createData(baseName, "ser");
   14.72 -                    FileLock lock = writeTo.lock();
   14.73 -                    try {
   14.74 -                        ObjectOutputStream str = new ObjectOutputStream(writeTo.getOutputStream(lock));
   14.75 -                        try {
   14.76 -                            str.writeObject(info);
   14.77 -                        } finally {
   14.78 -                            str.close();
   14.79 -                        }
   14.80 -                    } finally {
   14.81 -                        lock.releaseLock();
   14.82 -                    }
   14.83 -                } catch (IOException ioe) {
   14.84 -                    Exceptions.printStackTrace(ioe);
   14.85 -                }
   14.86 -            }
   14.87 -        }
   14.88 -    }
   14.89 -    /**
   14.90 -     * Initialize panels representing individual wizard's steps and sets
   14.91 -     * various properties for them influencing wizard appearance.
   14.92 -     */
   14.93 -    private WizardDescriptor.Panel[] getPanels() {
   14.94 -        if (panels == null) {
   14.95 -            panels = new WizardDescriptor.Panel[]{new NewFTPSiteWizardPanel1()};
   14.96 -            String[] steps = new String[panels.length];
   14.97 -            for (int i = 0; i < panels.length; i++) {
   14.98 -                Component c = panels[i].getComponent();
   14.99 -                // Default step name to component name of panel. Mainly useful
  14.100 -                // for getting the name of the target chooser to appear in the
  14.101 -                // list of steps.
  14.102 -                steps[i] = c.getName();
  14.103 -                if (c instanceof JComponent) { // assume Swing components
  14.104 -                    JComponent jc = (JComponent) c;
  14.105 -                    // Sets step number of a component
  14.106 -                    jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
  14.107 -                    // Sets steps names for a panel
  14.108 -                    jc.putClientProperty("WizardPanel_contentData", steps);
  14.109 -                    // Turn on subtitle creation on each step
  14.110 -                    jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
  14.111 -                    // Show steps on the left side with the image on the background
  14.112 -                    jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
  14.113 -                    // Turn on numbering of all steps
  14.114 -                    jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
  14.115 -                }
  14.116 -            }
  14.117 -        }
  14.118 -        return panels;
  14.119 -    }
  14.120 -    public String getName() {
  14.121 -        return "Start Sample Wizard";
  14.122 -    }
  14.123 -    
  14.124 -    @Override
  14.125 -    public String iconResource() {
  14.126 -        return null;
  14.127 -    }
  14.128 -    public HelpCtx getHelpCtx() {
  14.129 -        return HelpCtx.DEFAULT_HELP;
  14.130 -    }
  14.131 -    
  14.132 -    @Override
  14.133 -    protected boolean asynchronous() {
  14.134 -        return false;
  14.135 -    }
  14.136 -}
    15.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/NewFTPSiteWizardPanel1.java	Wed Jul 28 12:48:15 2010 -0400
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,78 +0,0 @@
    15.4 -package org.netbeans.modules.remotefs.ui;
    15.5 -import java.awt.Component;
    15.6 -import javax.swing.event.ChangeListener;
    15.7 -import org.openide.WizardDescriptor;
    15.8 -import org.openide.util.HelpCtx;
    15.9 -public class NewFTPSiteWizardPanel1 implements WizardDescriptor.Panel {
   15.10 -    /**
   15.11 -     * The visual component that displays this panel. If you need to access the
   15.12 -     * component from this class, just use getComponent().
   15.13 -     */
   15.14 -    private Component component;
   15.15 -    // Get the visual component for the panel. In this template, the component
   15.16 -    // is kept separate. This can be more efficient: if the wizard is created
   15.17 -    // but never displayed, or not all panels are displayed, it is better to
   15.18 -    // create only those which really need to be visible.
   15.19 -    public Component getComponent() {
   15.20 -        if (component == null) {
   15.21 -            component = new NewFTPSiteVisualPanel1();
   15.22 -        }
   15.23 -        return component;
   15.24 -    }
   15.25 -    public HelpCtx getHelp() {
   15.26 -        // Show no Help button for this panel:
   15.27 -        return HelpCtx.DEFAULT_HELP;
   15.28 -    // If you have context help:
   15.29 -        // return new HelpCtx(SampleWizardPanel1.class);
   15.30 -    }
   15.31 -    public boolean isValid() {
   15.32 -        // If it is always OK to press Next or Finish, then:
   15.33 -        return true;
   15.34 -    // If it depends on some condition (form filled out...), then:
   15.35 -        // return someCondition();
   15.36 -        // and when this condition changes (last form field filled in...) then:
   15.37 -        // fireChangeEvent();
   15.38 -        // and uncomment the complicated stuff below.
   15.39 -    }
   15.40 -    public final void addChangeListener(ChangeListener l) {
   15.41 -    }
   15.42 -    public final void removeChangeListener(ChangeListener l) {
   15.43 -    }
   15.44 -    /*
   15.45 -    private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
   15.46 -    public final void addChangeListener(ChangeListener l) {
   15.47 -        synchronized (listeners) {
   15.48 -            listeners.add(l);
   15.49 -        }
   15.50 -    }
   15.51 -    public final void removeChangeListener(ChangeListener l) {
   15.52 -        synchronized (listeners) {
   15.53 -            listeners.remove(l);
   15.54 -        }
   15.55 -    }
   15.56 -    protected final void fireChangeEvent() {
   15.57 -        Iterator<ChangeListener> it;
   15.58 -        synchronized (listeners) {
   15.59 -            it = new HashSet<ChangeListener>(listeners).iterator();
   15.60 -        }
   15.61 -        ChangeEvent ev = new ChangeEvent(this);
   15.62 -        while (it.hasNext()) {
   15.63 -            it.next().stateChanged(ev);
   15.64 -        }
   15.65 -    }
   15.66 -    */
   15.67 -    // You can use a settings object to keep track of state. Normally the
   15.68 -    // settings object will be the WizardDescriptor, so you can use
   15.69 -    // WizardDescriptor.getProperty & putProperty to store information entered
   15.70 -    // by the user.
   15.71 -    public void readSettings(Object settings) {
   15.72 -    }
   15.73 -    public void storeSettings(Object settings) {
   15.74 -        ((WizardDescriptor) settings).putProperty(NewFTPSiteVisualPanel1.SITE_NAME, ((NewFTPSiteVisualPanel1) component).getSiteName());
   15.75 -        ((WizardDescriptor) settings).putProperty(NewFTPSiteVisualPanel1.SITE_SERVER, ((NewFTPSiteVisualPanel1) component).getSiteServer());
   15.76 -        ((WizardDescriptor) settings).putProperty(NewFTPSiteVisualPanel1.SITE_USER, ((NewFTPSiteVisualPanel1) component).getSiteUser());
   15.77 -        ((WizardDescriptor) settings).putProperty(NewFTPSiteVisualPanel1.SITE_PWD, ((NewFTPSiteVisualPanel1) component).getSitePassword());
   15.78 -        ((WizardDescriptor) settings).putProperty(NewFTPSiteVisualPanel1.SITE_INIT_FOLDER, ((NewFTPSiteVisualPanel1) component).getSiteInitFolder());
   15.79 -        ((WizardDescriptor) settings).putProperty(NewFTPSiteVisualPanel1.SITE_PASSIVE_MODE, ((NewFTPSiteVisualPanel1) component).isPassiveMode());
   15.80 -    }
   15.81 -}
    16.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/RootNode.java	Wed Jul 28 12:48:15 2010 -0400
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,121 +0,0 @@
    16.4 -/*
    16.5 - * To change this template, choose Tools | Templates
    16.6 - * and open the template in the editor.
    16.7 - */
    16.8 -package org.netbeans.modules.remotefs.ui;
    16.9 -
   16.10 -import java.awt.Image;
   16.11 -import java.util.List;
   16.12 -import java.util.logging.Level;
   16.13 -import java.util.logging.Logger;
   16.14 -import javax.swing.Action;
   16.15 -import org.netbeans.modules.remotefs.ftpfs.FTPFileSystem;
   16.16 -import org.openide.filesystems.FileSystem;
   16.17 -import org.openide.filesystems.Repository;
   16.18 -import org.openide.filesystems.RepositoryEvent;
   16.19 -import org.openide.filesystems.RepositoryListener;
   16.20 -import org.openide.filesystems.RepositoryReorderedEvent;
   16.21 -import org.openide.loaders.DataFolder;
   16.22 -import org.openide.loaders.DataObjectNotFoundException;
   16.23 -import org.openide.nodes.AbstractNode;
   16.24 -import org.openide.nodes.Children;
   16.25 -import org.openide.nodes.Node;
   16.26 -import org.openide.util.Exceptions;
   16.27 -import org.openide.util.Utilities;
   16.28 -
   16.29 -public class RootNode extends AbstractNode {
   16.30 -
   16.31 -    private List<FTPFileSystem> ftpFileSystems;
   16.32 -    private static final Image ICON = Utilities.loadImage("org/netbeans/modules/remotefs/ui/resources/entire-network-16x16.png");
   16.33 -
   16.34 -    public RootNode(List<FTPFileSystem> sites) throws DataObjectNotFoundException {
   16.35 -        super(new RootNodeChildren(sites));
   16.36 -        this.ftpFileSystems = sites;
   16.37 -    }
   16.38 -
   16.39 -    @Override
   16.40 -    public boolean canCopy() {
   16.41 -        return false;
   16.42 -    }
   16.43 -
   16.44 -    @Override
   16.45 -    public Image getIcon(int type) {
   16.46 -        return ICON;
   16.47 -    }
   16.48 -
   16.49 -    @Override
   16.50 -    public Image getOpenedIcon(int type) {
   16.51 -        return getIcon(type);
   16.52 -    }
   16.53 -
   16.54 -    @Override
   16.55 -    public Action[] getActions(boolean context) {
   16.56 -        DataFolder df = getLookup().lookup(DataFolder.class);
   16.57 -        return new Action[]{AddFTPSiteAction.getInstance()};
   16.58 -    }
   16.59 -
   16.60 -    @Override
   16.61 -    public String getHtmlDisplayName() {
   16.62 -        return getName();
   16.63 -    }
   16.64 -
   16.65 -    @Override
   16.66 -    public String getName() {
   16.67 -        return "FTP Sites";
   16.68 -    }
   16.69 -
   16.70 -    public static class RootNodeChildren extends Children.Keys {
   16.71 -
   16.72 -        private List<FTPFileSystem> ftpFileSystems;
   16.73 -        private final transient Logger logger = Logger.getLogger(RootNodeChildren.class.getName());
   16.74 -
   16.75 -        private RootNodeChildren(List<FTPFileSystem> sites) {
   16.76 -            this.ftpFileSystems = sites;
   16.77 -            setKeys(sites.toArray(new FTPFileSystem[0]));
   16.78 -  /*          Repository.getDefault().addRepositoryListener(new RepositoryListener() {
   16.79 -
   16.80 -                        public void fileSystemAdded(RepositoryEvent ev) {
   16.81 -                            logger.log(Level.INFO, "FileSystem added!");
   16.82 -                            FileSystem newFs = ev.getFileSystem();
   16.83 -                            if (newFs instanceof FTPFileSystem) {
   16.84 -                                ftpFileSystems.add((FTPFileSystem)newFs);
   16.85 -                                setKeys(ftpFileSystems.toArray(new FTPFileSystem[0]));
   16.86 -                            }
   16.87 -                        }
   16.88 -
   16.89 -                        public void fileSystemRemoved(RepositoryEvent ev) {
   16.90 -                            logger.log(Level.INFO, "FileSystem removed!");
   16.91 -                            FileSystem newFs = ev.getFileSystem();
   16.92 -                            if (newFs instanceof FTPFileSystem) {
   16.93 -                                ftpFileSystems.remove((FTPFileSystem)newFs);
   16.94 -                                setKeys(ftpFileSystems.toArray(new FTPFileSystem[0]));
   16.95 -                            }
   16.96 -                        }
   16.97 -
   16.98 -                        public void fileSystemPoolReordered(RepositoryReorderedEvent ev) {
   16.99 -                        //ignore
  16.100 -                        }
  16.101 -                    });
  16.102 -   */     }
  16.103 -
  16.104 -        @Override
  16.105 -        protected Node[] createNodes(Object key) {
  16.106 -            try {
  16.107 -                return new Node[]{new SiteNode((FTPFileSystem) key)};
  16.108 -            } catch (DataObjectNotFoundException ex) {
  16.109 -                Exceptions.printStackTrace(ex);
  16.110 -                return new Node[]{};
  16.111 -            }
  16.112 -        }
  16.113 -
  16.114 -        public void add(FTPFileSystem fsToAdd) {
  16.115 -            ftpFileSystems.add(fsToAdd);
  16.116 -            this.setKeys(ftpFileSystems);
  16.117 -        }
  16.118 -        
  16.119 -        public void remove(FTPFileSystem fsToRemove) {
  16.120 -            ftpFileSystems.remove(fsToRemove);
  16.121 -            this.setKeys(ftpFileSystems);
  16.122 -        }
  16.123 -    }
  16.124 -}
    17.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/SiteNode.java	Wed Jul 28 12:48:15 2010 -0400
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,223 +0,0 @@
    17.4 -/*
    17.5 - * To change this template, choose Tools | Templates
    17.6 - * and open the template in the editor.
    17.7 - */
    17.8 -package org.netbeans.modules.remotefs.ui;
    17.9 -
   17.10 -import java.awt.Image;
   17.11 -import java.io.IOException;
   17.12 -import java.util.ArrayList;
   17.13 -import java.util.List;
   17.14 -import java.util.logging.Logger;
   17.15 -import javax.swing.Action;
   17.16 -import org.netbeans.modules.remotefs.core.ConnectAction;
   17.17 -import org.netbeans.modules.remotefs.ftpfs.FTPFileSystem;
   17.18 -import org.netbeans.modules.remotefs.ui.RootNode.RootNodeChildren;
   17.19 -import org.openide.filesystems.FileObject;
   17.20 -import org.openide.filesystems.FileUtil;
   17.21 -import org.openide.loaders.DataObject;
   17.22 -import org.openide.loaders.DataObjectNotFoundException;
   17.23 -import org.openide.nodes.FilterNode;
   17.24 -import org.openide.util.HelpCtx;
   17.25 -import org.openide.util.Utilities;
   17.26 -import org.openide.util.actions.SystemAction;
   17.27 -import org.openide.nodes.Node;
   17.28 -import org.openide.nodes.PropertySupport;
   17.29 -import org.openide.nodes.Sheet;
   17.30 -import org.openide.util.Exceptions;
   17.31 -import org.openide.util.actions.NodeAction;
   17.32 -
   17.33 -class SiteNode extends FilterNode {
   17.34 -
   17.35 -    private final FTPFileSystem site;
   17.36 -    private Logger logger = Logger.getLogger(SiteNode.class.getName());
   17.37 -
   17.38 -    public SiteNode(FTPFileSystem site) throws DataObjectNotFoundException {
   17.39 -        super(DataObject.find(site.getRoot()).getNodeDelegate());
   17.40 -        setValue("isReadonly", "false");
   17.41 -        this.site = site;
   17.42 -    }
   17.43 -
   17.44 -    @Override
   17.45 -    public Image getIcon(int type) {
   17.46 -        return Utilities.loadImage("org/netbeans/modules/remotefs/ui/resources/globe-sextant-16x16.png");
   17.47 -    }
   17.48 -
   17.49 -    @Override
   17.50 -    public Image getOpenedIcon(int type) {
   17.51 -        return getIcon(type);
   17.52 -    }
   17.53 -
   17.54 -    @Override
   17.55 -    public String getHtmlDisplayName() {
   17.56 -        return "<b><font color=\"00AA00\">" + getName() + "</font></b>";
   17.57 -    }
   17.58 -
   17.59 -    @Override
   17.60 -    public String getDisplayName() {
   17.61 -        return site.getDisplayName();
   17.62 -    }
   17.63 -
   17.64 -    @Override
   17.65 -    public String getName() {
   17.66 -        return site.getDisplayName();
   17.67 -    }
   17.68 -
   17.69 -    @Override
   17.70 -    public Action[] getActions(boolean context) {
   17.71 -//        &Find... $org.openide.actions.FindAction
   17.72 -//        &New $org.openide.actions.NewTemplateAction
   17.73 -//        Rename... $org.openide.actions.RenameAction
   17.74 -//        Cu&t $org.openide.actions.CutAction
   17.75 -//        &Copy $org.openide.actions.CopyAction
   17.76 -//        &Paste $org.openide.actions.PasteAction
   17.77 -//        &Delete $org.openide.actions.DeleteAction
   17.78 -//        Filesystem Action $org.openide.actions.FileSystemAction
   17.79 -//        Tools $org.openide.actions.ToolsAction
   17.80 -//        &Properties $org.openide.actions.PropertiesAction
   17.81 -
   17.82 -        Action[] actions = super.getActions(context);
   17.83 -        List<Action> newActions = new ArrayList<Action>();
   17.84 -        for (int i = 0; i < actions.length; i++) {
   17.85 -            if (actions[i] != null) {
   17.86 -                String clazz = actions[i].getClass().getName();
   17.87 -                if ("org.openide.actions.FileSystemAction".equals(clazz)) {
   17.88 -                    newActions.add(actions[i]);
   17.89 -                }
   17.90 -                if ("org.openide.actions.PropertiesAction".equals(clazz)) {
   17.91 -                    newActions.add(actions[i]);
   17.92 -                }
   17.93 -            }
   17.94 -        }
   17.95 -
   17.96 -        newActions.add(getAction(RemoveSiteAction.class));
   17.97 -        return newActions.toArray(new SystemAction[0]);
   17.98 -    }
   17.99 -
  17.100 -    private SystemAction getAction(Class clazz) {
  17.101 -        return (SystemAction) org.openide.util.SharedClassObject.findObject(clazz, true);
  17.102 -    }
  17.103 -
  17.104 -    @Override
  17.105 -    public Action getPreferredAction() {
  17.106 -        return getAction(ConnectAction.class);
  17.107 -    }
  17.108 -
  17.109 -    @Override
  17.110 -    public boolean canCopy() {
  17.111 -        return false;
  17.112 -    }
  17.113 -
  17.114 -    @Override
  17.115 -    public boolean canCut() {
  17.116 -        return false;
  17.117 -    }
  17.118 -
  17.119 -    @Override
  17.120 -    public boolean canDestroy() {
  17.121 -        return true;
  17.122 -    }
  17.123 -
  17.124 -    @Override
  17.125 -    public boolean canRename() {
  17.126 -        return false;
  17.127 -    }
  17.128 -
  17.129 -    @Override
  17.130 -    public void destroy() throws IOException {
  17.131 -        if (site != null) {
  17.132 -            site.setConnected(false);
  17.133 -            site.cleanCache(site.getRoot().getName());
  17.134 -            site.removeNotify();
  17.135 -        }                
  17.136 -        DataObject find = DataObject.find(FileUtil.getConfigFile("FTPSites"));
  17.137 -        FileObject[] files = find.getPrimaryFile().getChildren();
  17.138 -        for(int i = 0; i < files.length;i++){
  17.139 -            String lName = getName().substring(6);//strip off "ftp://" URL notation
  17.140 -            String fileName = files[i].getName();
  17.141 -            if(fileName.equals(lName)){
  17.142 -                files[i].delete();
  17.143 -            }
  17.144 -        }
  17.145 -        ((RootNodeChildren)this.getParentNode().getChildren()).remove(this.site);
  17.146 -        
  17.147 -        super.destroy();
  17.148 -
  17.149 -    }
  17.150 -
  17.151 -    public Node.Property[] getProperties() {
  17.152 -        Node.Property[] props = new Node.Property[5];
  17.153 -        try {
  17.154 -            props[0] = new PropertySupport.Reflection(site, String.class, "server");
  17.155 -            props[0].setName("Server name or IP");
  17.156 -            props[1] = new PropertySupport.Reflection(site, String.class, "username");
  17.157 -            props[1].setName("Username");
  17.158 -            props[2] = new PropertySupport.Reflection(site, String.class, "password");
  17.159 -            props[2].setName("Password");
  17.160 -            props[3] = new PropertySupport.Reflection(site, int.class, "port");
  17.161 -            props[3].setName("Port");
  17.162 -            props[4] = new PropertySupport.Reflection(site, String.class, "startdir");
  17.163 -            props[4].setName("Root folder");
  17.164 -//            Property prop6 = new PropertySupport.Reflection(site, File.class, "cache");
  17.165 -//            prop6.setName("cache folder");
  17.166 -        } catch (NoSuchMethodException ex) {
  17.167 -            Exceptions.printStackTrace(ex);
  17.168 -        }
  17.169 -        return props;
  17.170 -    }
  17.171 -
  17.172 -    @Override
  17.173 -    public Node.PropertySet[] getPropertySets() {
  17.174 -        Sheet.Set props = new Sheet.Set();
  17.175 -        props.setName("Basic Properties");
  17.176 -        props.put(getProperties());
  17.177 -        return new Node.PropertySet[]{props};
  17.178 -    }
  17.179 -
  17.180 -//    @Override
  17.181 -//    protected Sheet createSheet() {
  17.182 -//        Sheet result = super.createSheet();
  17.183 -//        Sheet.Set set = Sheet.createPropertiesSet();
  17.184 -//        Node.Property[] props = getProperties();
  17.185 -//        for (int i = 0; i < props.length; i++) {
  17.186 -//            set.put(props[i]);
  17.187 -//        }
  17.188 -//        result.put(set);
  17.189 -//        return result;
  17.190 -//    }
  17.191 -    public static class RemoveSiteAction extends NodeAction {
  17.192 -
  17.193 -        @Override
  17.194 -        protected void performAction(Node[] activatedNodes) {
  17.195 -            for (int i = 0; i < activatedNodes.length; i++) {
  17.196 -                if (activatedNodes[i] instanceof SiteNode) {
  17.197 -                    try {
  17.198 -                        activatedNodes[i].destroy();
  17.199 -                    } catch (IOException ex) {
  17.200 -                        Exceptions.printStackTrace(ex);
  17.201 -                    }
  17.202 -                }
  17.203 -            }
  17.204 -        }
  17.205 -
  17.206 -        @Override
  17.207 -        protected boolean enable(Node[] activatedNodes) {
  17.208 -            return true;
  17.209 -        }
  17.210 -
  17.211 -        @Override
  17.212 -        public String getName() {
  17.213 -            return "Delete site";
  17.214 -        }
  17.215 -
  17.216 -        @Override
  17.217 -        public HelpCtx getHelpCtx() {
  17.218 -            return new HelpCtx(RemoveSiteAction.class);
  17.219 -        }
  17.220 -
  17.221 -        @Override
  17.222 -        protected boolean asynchronous() {
  17.223 -            return false;
  17.224 -        }
  17.225 -    }
  17.226 -}
    18.1 --- a/remotefs.ui/src/org/netbeans/modules/remotefs/ui/layer.xml	Wed Jul 28 12:48:15 2010 -0400
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,32 +0,0 @@
    18.4 -<?xml version="1.0" encoding="UTF-8"?>
    18.5 -<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
    18.6 -<filesystem>
    18.7 -    <folder name="FTPSites"/>
    18.8 -    <folder name="Actions">
    18.9 -        <folder name="Window">
   18.10 -            <file name="org-netbeans-modules-remotefs-ui-ExplorerAction.instance"/>
   18.11 -        </folder>
   18.12 -    </folder>
   18.13 -    <folder name="Menu">
   18.14 -        <folder name="Window">
   18.15 -            <folder name="Other">
   18.16 -                <file name="ExplorerAction.shadow">
   18.17 -                    <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-modules-remotefs-ui-ExplorerAction.instance"/>
   18.18 -                    <attr name="position" intvalue="2003"/>
   18.19 -                </file>
   18.20 -            </folder>
   18.21 -        </folder>
   18.22 -    </folder>
   18.23 -    <folder name="Windows2">
   18.24 -        <folder name="Components">
   18.25 -            <file name="ExplorerTopComponent.settings" url="ExplorerTopComponentSettings.xml"/>
   18.26 -        </folder>
   18.27 -        <folder name="Modes">
   18.28 -            <folder name="explorer">
   18.29 -                <file name="ExplorerTopComponent.wstcref" url="ExplorerTopComponentWstcref.xml">
   18.30 -                    <attr name="position" intvalue="331"/>
   18.31 -                </file>
   18.32 -            </folder>
   18.33 -        </folder>
   18.34 -    </folder>
   18.35 -</filesystem>
    19.1 Binary file remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/closedFolder-16x16.png has changed
    20.1 Binary file remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/entire-network-16x16.png has changed
    21.1 Binary file remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/globe-sextant-16x16.png has changed
    22.1 Binary file remotefs.ui/src/org/netbeans/modules/remotefs/ui/resources/openFolder-16x16.png has changed
    23.1 --- a/remotefs/build.xml	Wed Jul 28 12:48:15 2010 -0400
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,8 +0,0 @@
    23.4 -<?xml version="1.0" encoding="UTF-8"?>
    23.5 -<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
    23.6 -<!-- for some information on what you could do (e.g. targets to override). -->
    23.7 -<!-- If you delete this file and reopen the project it will be recreated. -->
    23.8 -<project name="contrib/remotefs" default="netbeans" basedir=".">
    23.9 -    <description>Builds, tests, and runs the project org.netbeans.modules.remotefs.</description>
   23.10 -    <import file="../../nbbuild/templates/projectized.xml"/>
   23.11 -</project>
    24.1 --- a/remotefs/manifest.mf	Wed Jul 28 12:48:15 2010 -0400
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,4 +0,0 @@
    24.4 -Manifest-Version: 1.0
    24.5 -OpenIDE-Module: org.netbeans.modules.remotefs
    24.6 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/remotefs/Bundle.properties
    24.7 -OpenIDE-Module-Specification-Version: 1.1
    25.1 --- a/remotefs/nbproject/project.properties	Wed Jul 28 12:48:15 2010 -0400
    25.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.3 @@ -1,4 +0,0 @@
    25.4 -javac.source=1.5
    25.5 -javac.compilerargs=-Xlint -Xlint:-serial
    25.6 -is.autoload=true
    25.7 -
    26.1 --- a/remotefs/nbproject/project.xml	Wed Jul 28 12:48:15 2010 -0400
    26.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.3 @@ -1,80 +0,0 @@
    26.4 -<?xml version="1.0" encoding="UTF-8"?>
    26.5 -<project xmlns="http://www.netbeans.org/ns/project/1">
    26.6 -    <type>org.netbeans.modules.apisupport.project</type>
    26.7 -    <configuration>
    26.8 -        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
    26.9 -            <code-name-base>org.netbeans.modules.remotefs</code-name-base>
   26.10 -            <module-dependencies>
   26.11 -                <dependency>
   26.12 -                    <code-name-base>org.openide.dialogs</code-name-base>
   26.13 -                    <build-prerequisite/>
   26.14 -                    <compile-dependency/>
   26.15 -                    <run-dependency>
   26.16 -                        <specification-version>7.6</specification-version>
   26.17 -                    </run-dependency>
   26.18 -                </dependency>
   26.19 -                <dependency>
   26.20 -                    <code-name-base>org.openide.explorer</code-name-base>
   26.21 -                    <build-prerequisite/>
   26.22 -                    <compile-dependency/>
   26.23 -                    <run-dependency>
   26.24 -                        <specification-version>6.13</specification-version>
   26.25 -                    </run-dependency>
   26.26 -                </dependency>
   26.27 -                <dependency>
   26.28 -                    <code-name-base>org.openide.filesystems</code-name-base>
   26.29 -                    <build-prerequisite/>
   26.30 -                    <compile-dependency/>
   26.31 -                    <run-dependency>
   26.32 -                        <specification-version>7.4</specification-version>
   26.33 -                    </run-dependency>
   26.34 -                </dependency>
   26.35 -                <dependency>
   26.36 -                    <code-name-base>org.openide.loaders</code-name-base>
   26.37 -                    <build-prerequisite/>
   26.38 -                    <compile-dependency/>
   26.39 -                    <run-dependency>
   26.40 -                        <specification-version>6.8</specification-version>
   26.41 -                    </run-dependency>
   26.42 -                </dependency>
   26.43 -                <dependency>
   26.44 -                    <code-name-base>org.openide.modules</code-name-base>
   26.45 -                    <build-prerequisite/>
   26.46 -                    <compile-dependency/>
   26.47 -                    <run-dependency>
   26.48 -                        <specification-version>7.4</specification-version>
   26.49 -                    </run-dependency>
   26.50 -                </dependency>
   26.51 -                <dependency>
   26.52 -                    <code-name-base>org.openide.nodes</code-name-base>
   26.53 -                    <build-prerequisite/>
   26.54 -                    <compile-dependency/>
   26.55 -                    <run-dependency>
   26.56 -                        <specification-version>7.3</specification-version>
   26.57 -                    </run-dependency>
   26.58 -                </dependency>
   26.59 -                <dependency>
   26.60 -                    <code-name-base>org.openide.options</code-name-base>
   26.61 -                    <build-prerequisite/>
   26.62 -                    <compile-dependency/>
   26.63 -                    <run-dependency>
   26.64 -                        <specification-version>6.8</specification-version>
   26.65 -                    </run-dependency>
   26.66 -                </dependency>
   26.67 -                <dependency>
   26.68 -                    <code-name-base>org.openide.util</code-name-base>
   26.69 -                    <build-prerequisite/>
   26.70 -                    <compile-dependency/>
   26.71 -                    <run-dependency>
   26.72 -                        <specification-version>7.11</specification-version>
   26.73 -                    </run-dependency>
   26.74 -                </dependency>
   26.75 -            </module-dependencies>
   26.76 -            <public-packages>
   26.77 -                <package>org.netbeans.modules.remotefs.core</package>
   26.78 -                <package>org.netbeans.modules.remotefs.ftpclient</package>
   26.79 -                <package>org.netbeans.modules.remotefs.ftpfs</package>
   26.80 -            </public-packages>
   26.81 -        </data>
   26.82 -    </configuration>
   26.83 -</project>
    27.1 --- a/remotefs/src/org/netbeans/modules/remotefs/Bundle.properties	Wed Jul 28 12:48:15 2010 -0400
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,3 +0,0 @@
    27.4 -OpenIDE-Module-Display-Category=Infrastructure
    27.5 -OpenIDE-Module-Name=Remote FTP FileSystem
    27.6 -OpenIDE-Module-Short-Description=Allows direct access to FTP servers
    28.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/CleanCacheAction.java	Wed Jul 28 12:48:15 2010 -0400
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,100 +0,0 @@
    28.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    28.5 -/*
    28.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    28.7 -/*
    28.8 -/* The contents of this file are subject to the terms of either the GNU
    28.9 -/* General Public License Version 2 only ("GPL") or the Common
   28.10 -/* Development and Distribution License("CDDL") (collectively, the
   28.11 -/* "License"). You may not use this file except in compliance with the
   28.12 -/* License. You can obtain a copy of the License at
   28.13 -/* http://www.netbeans.org/cddl-gplv2.html
   28.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   28.15 -/* specific language governing permissions and limitations under the
   28.16 -/* License.  When distributing the software, include this License Header
   28.17 -/* Notice in each file and include the License file at
   28.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   28.19 -/* particular file as subject to the "Classpath" exception as provided
   28.20 -/* by Sun in the GPL Version 2 section of the License file that
   28.21 -/* accompanied this code. If applicable, add the following below the
   28.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   28.23 -/* your own identifying information:
   28.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   28.25 -/*
   28.26 -/* Contributor(s):
   28.27 - *
   28.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   28.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   28.30 - * Copyright (C) 2000. All Rights Reserved.
   28.31 -/*
   28.32 -/* If you wish your version of this file to be governed by only the CDDL
   28.33 -/* or only the GPL Version 2, indicate your decision by adding
   28.34 -/* "[Contributor] elects to include this software in this distribution
   28.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   28.36 -/* single choice of license, a recipient has the option to distribute
   28.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   28.38 -/* to extend the choice of license to its licensees as provided above.
   28.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   28.40 -/* Version 2 license, then the option applies only if the new code is
   28.41 -/* made subject to such option by the copyright holder.
   28.42 - *
   28.43 - * Contributor(s): Libor Martinek.
   28.44 - */
   28.45 -
   28.46 -  package org.netbeans.modules.remotefs.core;
   28.47 -
   28.48 - import org.openide.filesystems.FileObject;
   28.49 - import org.openide.filesystems.FileStateInvalidException;
   28.50 - import org.openide.filesystems.FileSystem;
   28.51 -  import org.openide.loaders.DataFolder;
   28.52 -  import org.openide.nodes.Node;
   28.53 - import org.openide.util.Exceptions;
   28.54 -  import org.openide.util.HelpCtx;
   28.55 - import org.openide.util.actions.CookieAction;
   28.56 -  
   28.57 -  /** Action for cleaning cache.
   28.58 -  *
   28.59 -  * @author Libor Martinek
   28.60 -  */
   28.61 -  public class CleanCacheAction extends CookieAction {
   28.62 - 
   28.63 -    static final long serialVersionUID = -3753767019886770140L;
   28.64 -      
   28.65 -    /** @return DataFolder class */
   28.66 -     protected Class[] cookieClasses() {
   28.67 -         return new Class[]{DataFolder.class};
   28.68 -    }
   28.69 -  
   28.70 -     protected void performAction(Node[] nodes) {
   28.71 -      for (int i = 0; i < nodes.length; i++) {
   28.72 -             DataFolder df = nodes[i].getCookie(DataFolder.class);
   28.73 -        if (df != null) {
   28.74 -                 FileObject fo = df.getPrimaryFile();
   28.75 -          try {
   28.76 -             FileSystem fs = fo.getFileSystem();
   28.77 -                     if (fs instanceof RemoteFileSystem) {
   28.78 -                         ((RemoteFileSystem) fs).cleanCache(fo.getPath());
   28.79 -          }
   28.80 -                 } catch (FileStateInvalidException e) {
   28.81 -                     Exceptions.printStackTrace(e);
   28.82 -          }
   28.83 -        }
   28.84 -      }
   28.85 -    }
   28.86 -  
   28.87 -     protected int mode() {
   28.88 -      return MODE_ALL;
   28.89 -    }
   28.90 -  
   28.91 -     public String getName() {
   28.92 -      return "Clean Cache";
   28.93 -    }
   28.94 -  
   28.95 -     public HelpCtx getHelpCtx() {
   28.96 -      return HelpCtx.DEFAULT_HELP;
   28.97 -    }
   28.98 -  
   28.99 -     @Override
  28.100 -     protected boolean asynchronous() {
  28.101 -         return false;
  28.102 -  }
  28.103 - }
    29.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/ConnectAction.java	Wed Jul 28 12:48:15 2010 -0400
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,118 +0,0 @@
    29.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    29.5 -/*
    29.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    29.7 -/*
    29.8 -/* The contents of this file are subject to the terms of either the GNU
    29.9 -/* General Public License Version 2 only ("GPL") or the Common
   29.10 -/* Development and Distribution License("CDDL") (collectively, the
   29.11 -/* "License"). You may not use this file except in compliance with the
   29.12 -/* License. You can obtain a copy of the License at
   29.13 -/* http://www.netbeans.org/cddl-gplv2.html
   29.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   29.15 -/* specific language governing permissions and limitations under the
   29.16 -/* License.  When distributing the software, include this License Header
   29.17 -/* Notice in each file and include the License file at
   29.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   29.19 -/* particular file as subject to the "Classpath" exception as provided
   29.20 -/* by Sun in the GPL Version 2 section of the License file that
   29.21 -/* accompanied this code. If applicable, add the following below the
   29.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   29.23 -/* your own identifying information:
   29.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   29.25 -/*
   29.26 -/* Contributor(s):
   29.27 - *
   29.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   29.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   29.30 - * Copyright (C) 2000. All Rights Reserved.
   29.31 -/*
   29.32 -/* If you wish your version of this file to be governed by only the CDDL
   29.33 -/* or only the GPL Version 2, indicate your decision by adding
   29.34 -/* "[Contributor] elects to include this software in this distribution
   29.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   29.36 -/* single choice of license, a recipient has the option to distribute
   29.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   29.38 -/* to extend the choice of license to its licensees as provided above.
   29.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   29.40 -/* Version 2 license, then the option applies only if the new code is
   29.41 -/* made subject to such option by the copyright holder.
   29.42 - *
   29.43 - * Contributor(s): Libor Martinek.
   29.44 - */
   29.45 -package org.netbeans.modules.remotefs.core;
   29.46 -
   29.47 -import org.openide.filesystems.FileObject;
   29.48 -import org.openide.filesystems.FileStateInvalidException;
   29.49 -import org.openide.filesystems.FileSystem;
   29.50 -import org.openide.loaders.DataFolder;
   29.51 -import org.openide.nodes.Node;
   29.52 -import org.openide.util.Exceptions;
   29.53 -import org.openide.util.HelpCtx;
   29.54 -import org.openide.util.actions.NodeAction;
   29.55 -
   29.56 -/** Action for connect/disconnect filesystem.
   29.57 - *
   29.58 - * @author Libor Martinek
   29.59 - */
   29.60 -public class ConnectAction extends NodeAction {
   29.61 -
   29.62 -    static final long serialVersionUID = -7910677883191530621L;
   29.63 -    private RemoteFileSystem fs = null;
   29.64 -
   29.65 -    /**
   29.66 -     * @param nodes 
   29.67 -     * @return DataFolder class */
   29.68 -//  protected Class[] cookieClasses () {
   29.69 -//    return new Class[] { DataFolder.class };
   29.70 -//  }
   29.71 -    protected boolean enable(Node[] nodes) {
   29.72 -        if (nodes == null|| nodes.length == 0) {
   29.73 -            return false;
   29.74 -        }
   29.75 -        DataFolder df = nodes[0].getCookie(DataFolder.class);
   29.76 -        if (df != null && nodes.length == 1) {
   29.77 -            FileObject fo = df.getPrimaryFile();
   29.78 -            return (fo.isRoot());
   29.79 -        }
   29.80 -        return false;
   29.81 -    }
   29.82 -
   29.83 -    protected void performAction(Node[] nodes) {
   29.84 -        DataFolder df = nodes[0].getCookie(DataFolder.class);
   29.85 -        if (df != null) {
   29.86 -            FileObject fo = df.getPrimaryFile();
   29.87 -            try {
   29.88 -                FileSystem tmp = fo.getFileSystem();
   29.89 -                if (tmp instanceof RemoteFileSystem) {
   29.90 -                    ((RemoteFileSystem) tmp).connectOnBackground(!((RemoteFileSystem) tmp).isConnected());
   29.91 -                }
   29.92 -            } catch (FileStateInvalidException e) {
   29.93 -                Exceptions.printStackTrace(e);
   29.94 -            }
   29.95 -        }
   29.96 -    }
   29.97 -
   29.98 -    protected void setFS(RemoteFileSystem fs) {
   29.99 -        this.fs = fs;
  29.100 -    }
  29.101 -
  29.102 -    public String getName() {
  29.103 -        if (fs == null) {
  29.104 -            return "Connect/Disconnect";
  29.105 -        }
  29.106 -        if (fs.isConnected()) {
  29.107 -            return "Go Offline";
  29.108 -        } else {
  29.109 -            return "Go Online";
  29.110 -        }
  29.111 -    }
  29.112 -
  29.113 -    public HelpCtx getHelpCtx() {
  29.114 -        return HelpCtx.DEFAULT_HELP;
  29.115 -    }
  29.116 -
  29.117 -    @Override
  29.118 -    protected boolean asynchronous() {
  29.119 -        return false;
  29.120 -    }
  29.121 -}
    30.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/DownloadAllAction.java	Wed Jul 28 12:48:15 2010 -0400
    30.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.3 @@ -1,103 +0,0 @@
    30.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    30.5 -/*
    30.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    30.7 -/*
    30.8 -/* The contents of this file are subject to the terms of either the GNU
    30.9 -/* General Public License Version 2 only ("GPL") or the Common
   30.10 -/* Development and Distribution License("CDDL") (collectively, the
   30.11 -/* "License"). You may not use this file except in compliance with the
   30.12 -/* License. You can obtain a copy of the License at
   30.13 -/* http://www.netbeans.org/cddl-gplv2.html
   30.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   30.15 -/* specific language governing permissions and limitations under the
   30.16 -/* License.  When distributing the software, include this License Header
   30.17 -/* Notice in each file and include the License file at
   30.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   30.19 -/* particular file as subject to the "Classpath" exception as provided
   30.20 -/* by Sun in the GPL Version 2 section of the License file that
   30.21 -/* accompanied this code. If applicable, add the following below the
   30.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   30.23 -/* your own identifying information:
   30.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   30.25 -/*
   30.26 -/* Contributor(s):
   30.27 - *
   30.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   30.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   30.30 - * Copyright (C) 2000. All Rights Reserved.
   30.31 -/*
   30.32 -/* If you wish your version of this file to be governed by only the CDDL
   30.33 -/* or only the GPL Version 2, indicate your decision by adding
   30.34 -/* "[Contributor] elects to include this software in this distribution
   30.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   30.36 -/* single choice of license, a recipient has the option to distribute
   30.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   30.38 -/* to extend the choice of license to its licensees as provided above.
   30.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   30.40 -/* Version 2 license, then the option applies only if the new code is
   30.41 -/* made subject to such option by the copyright holder.
   30.42 - *
   30.43 - * Contributor(s): Libor Martinek.
   30.44 - */
   30.45 -
   30.46 -  package org.netbeans.modules.remotefs.core;
   30.47 -  
   30.48 - import org.openide.filesystems.FileObject;
   30.49 - import org.openide.filesystems.FileStateInvalidException;
   30.50 - import org.openide.filesystems.FileSystem;
   30.51 -  import org.openide.loaders.DataFolder;
   30.52 -  import org.openide.nodes.Node;
   30.53 - import org.openide.util.Exceptions;
   30.54 -  import org.openide.util.HelpCtx;
   30.55 - import org.openide.util.actions.CookieAction;
   30.56 -  
   30.57 -  /** Action for downloading all files.
   30.58 -  *
   30.59 -  * @author Libor Martinek
   30.60 -  */
   30.61 -  public class DownloadAllAction extends CookieAction {
   30.62 - 
   30.63 -   static final long serialVersionUID = 8041760481719982503L;
   30.64 - 
   30.65 -    /** @return DataFolder class */
   30.66 - 
   30.67 -     
   30.68 -     protected Class[] cookieClasses() {
   30.69 -         return new Class[]{DataFolder.class};
   30.70 -         
   30.71 -    }
   30.72 -  
   30.73 -     protected void performAction(Node[] nodes) {
   30.74 -      for (int i = 0; i < nodes.length; i++) {
   30.75 -             DataFolder df = nodes[i].getCookie(DataFolder.class);
   30.76 -        if (df != null) {
   30.77 -                 FileObject fo = df.getPrimaryFile();
   30.78 -          try {
   30.79 -             FileSystem fs = fo.getFileSystem();
   30.80 -                     if (fs instanceof RemoteFileSystem) {
   30.81 -                         ((RemoteFileSystem) fs).downloadAll(fo.getPath());
   30.82 -          }
   30.83 -                 } catch (FileStateInvalidException e) {
   30.84 -                     Exceptions.printStackTrace(e);
   30.85 -          }
   30.86 -        }
   30.87 -      }
   30.88 -    }
   30.89 -  
   30.90 -     protected int mode() {
   30.91 -      return MODE_ALL;
   30.92 -    }
   30.93 -  
   30.94 -     public String getName() {
   30.95 -      return "Download All";
   30.96 -    }
   30.97 -  
   30.98 -     public HelpCtx getHelpCtx() {
   30.99 -      return HelpCtx.DEFAULT_HELP;
  30.100 -    }
  30.101 -  
  30.102 -     @Override
  30.103 -     protected boolean asynchronous() {
  30.104 -         return false;
  30.105 -  }
  30.106 - }
    31.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/LogInfo.java	Wed Jul 28 12:48:15 2010 -0400
    31.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.3 @@ -1,58 +0,0 @@
    31.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    31.5 -/*
    31.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    31.7 -/*
    31.8 -/* The contents of this file are subject to the terms of either the GNU
    31.9 -/* General Public License Version 2 only ("GPL") or the Common
   31.10 -/* Development and Distribution License("CDDL") (collectively, the
   31.11 -/* "License"). You may not use this file except in compliance with the
   31.12 -/* License. You can obtain a copy of the License at
   31.13 -/* http://www.netbeans.org/cddl-gplv2.html
   31.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   31.15 -/* specific language governing permissions and limitations under the
   31.16 -/* License.  When distributing the software, include this License Header
   31.17 -/* Notice in each file and include the License file at
   31.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   31.19 -/* particular file as subject to the "Classpath" exception as provided
   31.20 -/* by Sun in the GPL Version 2 section of the License file that
   31.21 -/* accompanied this code. If applicable, add the following below the
   31.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   31.23 -/* your own identifying information:
   31.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   31.25 -/*
   31.26 -/* Contributor(s):
   31.27 - *
   31.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   31.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   31.30 - * Copyright (C) 2000. All Rights Reserved.
   31.31 -/*
   31.32 -/* If you wish your version of this file to be governed by only the CDDL
   31.33 -/* or only the GPL Version 2, indicate your decision by adding
   31.34 -/* "[Contributor] elects to include this software in this distribution
   31.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   31.36 -/* single choice of license, a recipient has the option to distribute
   31.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   31.38 -/* to extend the choice of license to its licensees as provided above.
   31.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   31.40 -/* Version 2 license, then the option applies only if the new code is
   31.41 -/* made subject to such option by the copyright holder.
   31.42 - *
   31.43 - * Contributor(s): Libor Martinek.
   31.44 - */
   31.45 -
   31.46 -package org.netbeans.modules.remotefs.core;
   31.47 -
   31.48 -/** Interface for storing login information. Usually username, pasword, etc.
   31.49 - *
   31.50 - * @author  Libor Martinek
   31.51 - * @version 1.0
   31.52 - */
   31.53 -public interface LogInfo extends java.io.Serializable{
   31.54 -
   31.55 -    /** Return human redable description of this LogInfo
   31.56 -     * @return 
   31.57 -     */
   31.58 -  public String displayName();
   31.59 -
   31.60 -
   31.61 -}
   31.62 \ No newline at end of file
    32.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/ManagedRemoteFileSystem.java	Wed Jul 28 12:48:15 2010 -0400
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,170 +0,0 @@
    32.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    32.5 -/*
    32.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    32.7 -/*
    32.8 -/* The contents of this file are subject to the terms of either the GNU
    32.9 -/* General Public License Version 2 only ("GPL") or the Common
   32.10 -/* Development and Distribution License("CDDL") (collectively, the
   32.11 -/* "License"). You may not use this file except in compliance with the
   32.12 -/* License. You can obtain a copy of the License at
   32.13 -/* http://www.netbeans.org/cddl-gplv2.html
   32.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   32.15 -/* specific language governing permissions and limitations under the
   32.16 -/* License.  When distributing the software, include this License Header
   32.17 -/* Notice in each file and include the License file at
   32.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   32.19 -/* particular file as subject to the "Classpath" exception as provided
   32.20 -/* by Sun in the GPL Version 2 section of the License file that
   32.21 -/* accompanied this code. If applicable, add the following below the
   32.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   32.23 -/* your own identifying information:
   32.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   32.25 -/*
   32.26 -/* Contributor(s):
   32.27 - *
   32.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   32.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   32.30 - * Copyright (C) 2000. All Rights Reserved.
   32.31 -/*
   32.32 -/* If you wish your version of this file to be governed by only the CDDL
   32.33 -/* or only the GPL Version 2, indicate your decision by adding
   32.34 -/* "[Contributor] elects to include this software in this distribution
   32.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   32.36 -/* single choice of license, a recipient has the option to distribute
   32.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   32.38 -/* to extend the choice of license to its licensees as provided above.
   32.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   32.40 -/* Version 2 license, then the option applies only if the new code is
   32.41 -/* made subject to such option by the copyright holder.
   32.42 - *
   32.43 - * Contributor(s): Libor Martinek.
   32.44 - */
   32.45 -
   32.46 -package org.netbeans.modules.remotefs.core;
   32.47 -
   32.48 -import java.io.IOException;
   32.49 -import org.openide.filesystems.FileStatusEvent;
   32.50 -import org.openide.filesystems.FileSystemCapability;
   32.51 -
   32.52 -/** Managed Remote FIleSystem class
   32.53 - * @author Libor Martinek
   32.54 - * @version 1.0
   32.55 - */
   32.56 -public abstract class ManagedRemoteFileSystem extends RemoteFileSystem 
   32.57 -      implements RemoteManager.RemoteOwner, RemoteFile.Notify {
   32.58 -  static final long serialVersionUID = 5983095716602271792L;
   32.59 -  private static final boolean DEBUG = true;
   32.60 -  
   32.61 -  /** RemoteManager */
   32.62 -  protected transient RemoteManager manager = null;
   32.63 -  
   32.64 -  /** Constructor.
   32.65 -  */
   32.66 -  public ManagedRemoteFileSystem() {
   32.67 -    super();
   32.68 -  }
   32.69 - 
   32.70 -  /** Constructor. Allows user to provide own capabilities
   32.71 -  * for this file system.
   32.72 -  * @param cap capabilities for this file system
   32.73 -  */
   32.74 -  public ManagedRemoteFileSystem(FileSystemCapability cap) {
   32.75 -    this ();
   32.76 -    setCapability (cap);
   32.77 -  }
   32.78 -
   32.79 -    @Override
   32.80 -  protected void removeClient() {
   32.81 -    if (manager != null) {
   32.82 -      manager.remove(this);
   32.83 -      manager = null;
   32.84 -    }
   32.85 -    client = null;
   32.86 -    rootFile = null;
   32.87 -  }
   32.88 - 
   32.89 -  /** Test whether filesystem is connected to server.
   32.90 -   * @return Value of property connected.
   32.91 -   */
   32.92 -    @Override
   32.93 -  public boolean isConnected() {
   32.94 -    if (manager==null)  return false;
   32.95 -    return manager.getClient().isConnected();
   32.96 -  }
   32.97 -  
   32.98 -  /** Connect to or diconnect from server.
   32.99 -   * @param connected New value of property connected.
  32.100 -   */
  32.101 -  public void setConnected(boolean connected) {
  32.102 -    // is new state different?
  32.103 -    //System.out.println("ManagedRemoteFileSystem.setConnected");
  32.104 -    if (isConnected() == connected) {
  32.105 -            return;
  32.106 -        } 
  32.107 -    if (!connected) {  // will be disconnected
  32.108 -           // exists other filesystem with same server
  32.109 -           if (manager.moreOwners()) {
  32.110 -                  switch (disconnectDialog(loginfo.displayName())) {
  32.111 -                    case 0:   removeClient();
  32.112 -                              break;
  32.113 -                    case 1:   manager.getClient().disconnect(); 
  32.114 -                              //TODO: notify other FS
  32.115 -                              break;
  32.116 -                    case 2:   return;
  32.117 -                  }
  32.118 -           }      
  32.119 -           else manager.getClient().disconnect();
  32.120 -        }    
  32.121 -    else {
  32.122 -       try { 
  32.123 -            if (manager == null) {
  32.124 -               manager = RemoteManager.getRemoteManager(this, cachedir,loginfo);
  32.125 -               client = manager.getClient();
  32.126 -               rootFile = null;
  32.127 -               if (manager == null) {
  32.128 -                  return;
  32.129 -               }
  32.130 -           }
  32.131 -           if (!isConnected()) {   
  32.132 -               if (manager.moreOwners()) {
  32.133 -                  if (connectDialog(loginfo.displayName())) {
  32.134 -                          manager.getClient().connect();
  32.135 -                          //TODO: notify other FS?
  32.136 -                  }        
  32.137 -                  else { removeClient();
  32.138 -                         return;
  32.139 -                         //TODO: or try to get ftproot if it's possible even when diconnected
  32.140 -                  }      
  32.141 -               }
  32.142 -               else manager.getClient().connect();
  32.143 -           }
  32.144 -           if (rootFile == null || (rootFile != null && !rootFile.getName().getFullName().equals(startdir))) {
  32.145 -                rootFile = manager.getRoot(startdir);
  32.146 -                if (rootFile == null) {
  32.147 -                      startdirNotFound(startdir,loginfo.displayName());
  32.148 -                      startdir = "/";
  32.149 -                      rootFile = manager.getRoot();
  32.150 -                }      
  32.151 -           }
  32.152 -       }
  32.153 -       catch(IOException e) {
  32.154 -        if (connected && manager!=null) manager.getClient().close(); 
  32.155 -        errorConnect(e.toString());
  32.156 -       }
  32.157 -       synchronize("/");
  32.158 -    }  
  32.159 -    fireFileStatusChanged(new FileStatusEvent(this,getRoot(),true,true));
  32.160 -    //refreshRoot();
  32.161 -    //try { org.openide.loaders.DataObject.find(super.getRoot()).getNodeDelegate().setDisplayName(getDisplayName()); }
  32.162 -    //catch (org.openide.loaders.DataObjectNotFoundException e) {}
  32.163 -    firePropertyChange("connected", null, isConnected() ? Boolean.TRUE : Boolean.FALSE);
  32.164 -    //firePropertyChange(PROP_SYSTEM_NAME, "", getSystemName());
  32.165 -  }
  32.166 -  
  32.167 -  /** Informs user that also another filesystem is connected to the same server. */
  32.168 -  protected abstract int disconnectDialog(String server);
  32.169 -  
  32.170 -  /** Informs user that also another filesystem is disconnected from the same server. */
  32.171 -  protected abstract boolean connectDialog(String server);
  32.172 -  
  32.173 -} 
  32.174 \ No newline at end of file
    33.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/RemoteClient.java	Wed Jul 28 12:48:15 2010 -0400
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,123 +0,0 @@
    33.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    33.5 -/*
    33.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    33.7 -/*
    33.8 -/* The contents of this file are subject to the terms of either the GNU
    33.9 -/* General Public License Version 2 only ("GPL") or the Common
   33.10 -/* Development and Distribution License("CDDL") (collectively, the
   33.11 -/* "License"). You may not use this file except in compliance with the
   33.12 -/* License. You can obtain a copy of the License at
   33.13 -/* http://www.netbeans.org/cddl-gplv2.html
   33.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   33.15 -/* specific language governing permissions and limitations under the
   33.16 -/* License.  When distributing the software, include this License Header
   33.17 -/* Notice in each file and include the License file at
   33.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   33.19 -/* particular file as subject to the "Classpath" exception as provided
   33.20 -/* by Sun in the GPL Version 2 section of the License file that
   33.21 -/* accompanied this code. If applicable, add the following below the
   33.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   33.23 -/* your own identifying information:
   33.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   33.25 -/*
   33.26 -/* Contributor(s):
   33.27 - *
   33.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   33.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   33.30 - * Copyright (C) 2000. All Rights Reserved.
   33.31 -/*
   33.32 -/* If you wish your version of this file to be governed by only the CDDL
   33.33 -/* or only the GPL Version 2, indicate your decision by adding
   33.34 -/* "[Contributor] elects to include this software in this distribution
   33.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   33.36 -/* single choice of license, a recipient has the option to distribute
   33.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   33.38 -/* to extend the choice of license to its licensees as provided above.
   33.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   33.40 -/* Version 2 license, then the option applies only if the new code is
   33.41 -/* made subject to such option by the copyright holder.
   33.42 - *
   33.43 - * Contributor(s): Libor Martinek.
   33.44 - */
   33.45 -
   33.46 -package org.netbeans.modules.remotefs.core;
   33.47 -
   33.48 -import java.io.IOException;
   33.49 -import java.io.File;
   33.50 -
   33.51 -/** Remote Client. Interface which all new clients must implement.
   33.52 - *
   33.53 - * @author  Libor Martinek
   33.54 - * @version 1.0
   33.55 - */
   33.56 -public interface RemoteClient {
   33.57 -
   33.58 -  //public void setLogInfo(LogInfo loginfo);
   33.59 -
   33.60 -  /** Returns file name object of the root.
   33.61 -  * @return  FileName of the root */
   33.62 -  public RemoteFileName getRoot();
   33.63 -
   33.64 -  /** Connect to server.
   33.65 -  * @throws IOException  */
   33.66 -  public void connect () throws IOException ;
   33.67 -  
   33.68 -  /** Test whether client is connected to server.
   33.69 -  * @return true in case that client is connected to server */  
   33.70 -  public boolean isConnected();
   33.71 -
   33.72 -  /** Compare this information.
   33.73 -   * @param loginfo login information to compare
   33.74 -   * @return 0 if login information are equal;
   33.75 -   *         1 if login information refer to the same resource but can't be uses to login;
   33.76 -   *           (e.g. server and username is same but password is different)
   33.77 -   *        -1 if login information are different
   33.78 -   */
   33.79 -  public int compare(LogInfo loginfo);
   33.80 -  
   33.81 -  /** Get file from server.
   33.82 -   * @param what file on host to receive
   33.83 -   * @param where new file to create
   33.84 -   * @throws IOException  */
   33.85 -  public  void get(RemoteFileName what, File where) throws IOException ;
   33.86 -
   33.87 -  /** Put file to server.
   33.88 -   * @param what file to send
   33.89 -   * @param where where to file send
   33.90 -   * @throws IOException  */
   33.91 -  public void put(File what, RemoteFileName where) throws IOException ;
   33.92 - 
   33.93 -  /** Return list of files in directory
   33.94 -   * @param directory 
   33.95 -   * @throws IOException 
   33.96 -   * @return  directory to list*/
   33.97 -  public RemoteFileAttributes[] list(RemoteFileName directory) throws IOException ;
   33.98 -  
   33.99 -  /** Rename file 
  33.100 -   * @param oldname 
  33.101 -   * @param newname 
  33.102 -   * @throws IOException 
  33.103 -   */
  33.104 -  public void rename(RemoteFileName oldname, String newname) throws IOException ;
  33.105 -
  33.106 -  /** Delete directory
  33.107 -   * @param name what file to delete
  33.108 -   * @throws IOException  */
  33.109 -  public void delete(RemoteFileName name) throws IOException ;
  33.110 - 
  33.111 -  /** Make directory
  33.112 -   * @param name of the new directory
  33.113 -   * @throws IOException  */
  33.114 -  public void mkdir(RemoteFileName name) throws IOException ;
  33.115 -  
  33.116 -  /** Remove directory
  33.117 -   * @param name of the directory to remove
  33.118 -   * @throws IOException  */
  33.119 -  public void rmdir(RemoteFileName name) throws IOException ;
  33.120 -  
  33.121 -  /** Log out from server and close connection */
  33.122 -  public void disconnect() ;
  33.123 -    
  33.124 -  /** Immediately close connection with server */
  33.125 -  public void close();
  33.126 -}
  33.127 \ No newline at end of file
    34.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/RemoteFile.java	Wed Jul 28 12:48:15 2010 -0400
    34.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.3 @@ -1,1157 +0,0 @@
    34.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    34.5 -/*
    34.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    34.7 -/*
    34.8 -/* The contents of this file are subject to the terms of either the GNU
    34.9 -/* General Public License Version 2 only ("GPL") or the Common
   34.10 -/* Development and Distribution License("CDDL") (collectively, the
   34.11 -/* "License"). You may not use this file except in compliance with the
   34.12 -/* License. You can obtain a copy of the License at
   34.13 -/* http://www.netbeans.org/cddl-gplv2.html
   34.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   34.15 -/* specific language governing permissions and limitations under the
   34.16 -/* License.  When distributing the software, include this License Header
   34.17 -/* Notice in each file and include the License file at
   34.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   34.19 -/* particular file as subject to the "Classpath" exception as provided
   34.20 -/* by Sun in the GPL Version 2 section of the License file that
   34.21 -/* accompanied this code. If applicable, add the following below the
   34.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   34.23 -/* your own identifying information:
   34.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   34.25 -/*
   34.26 -/* Contributor(s):
   34.27 - *
   34.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   34.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   34.30 - * Copyright (C) 2000. All Rights Reserved.
   34.31 -/*
   34.32 -/* If you wish your version of this file to be governed by only the CDDL
   34.33 -/* or only the GPL Version 2, indicate your decision by adding
   34.34 -/* "[Contributor] elects to include this software in this distribution
   34.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   34.36 -/* single choice of license, a recipient has the option to distribute
   34.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   34.38 -/* to extend the choice of license to its licensees as provided above.
   34.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   34.40 -/* Version 2 license, then the option applies only if the new code is
   34.41 -/* made subject to such option by the copyright holder.
   34.42 - *
   34.43 - * Contributor(s): Libor Martinek.
   34.44 - */
   34.45 -package org.netbeans.modules.remotefs.core;
   34.46 -
   34.47 -import java.io.File;
   34.48 -import java.io.FileInputStream;
   34.49 -import java.io.FileNotFoundException;
   34.50 -import java.io.IOException;
   34.51 -import java.io.InputStream;
   34.52 -import java.io.OutputStream;
   34.53 -import java.util.Date;
   34.54 -import java.util.HashMap;
   34.55 -import java.util.HashSet;
   34.56 -import java.util.Iterator;
   34.57 -import java.util.Set;
   34.58 -import java.util.StringTokenizer;
   34.59 -import java.util.Vector;
   34.60 -
   34.61 -/** Object that represent FTP file with cache.
   34.62 - * @author Libor Martinek
   34.63 - * @version 1.0
   34.64 - */
   34.65 -public class RemoteFile {
   34.66 -
   34.67 -    private static final boolean DEBUG = true;
   34.68 -    /** Parent RemoteFile object */
   34.69 -    private RemoteFile parent;
   34.70 -    /** Client  */
   34.71 -    private RemoteClient client;
   34.72 -    /** Notify  */
   34.73 -    private Notify notify;
   34.74 -    /** File attributes  */
   34.75 -    private RemoteFileAttributes attrib;
   34.76 -    /** File in cache for local storing */
   34.77 -    protected File file;
   34.78 -    /** Array of children */
   34.79 -    private RemoteFile[] children = new RemoteFile[0];
   34.80 -    private Vector childrenvector = new Vector();
   34.81 -    private RequestProcessor rp;
   34.82 -    /** Path separator */
   34.83 -    private static final String PATH_SEP = "/";
   34.84 -    private int status;
   34.85 -    private static final int NOT_CACHED = 0;
   34.86 -    private static final int CACHED = 1;
   34.87 -    private static final int OPEN = 2;
   34.88 -    private static final int CHANGED = 3;
   34.89 -    private boolean onserver;
   34.90 -    private long cachelastmodified;
   34.91 -    private boolean childrenchanged = false;
   34.92 -    private boolean nextnochildren = false;
   34.93 -
   34.94 -    //***************************************************************************
   34.95 -    /** Creates new RemoteFile
   34.96 -     * @param parent parent FTP file, null for root file
   34.97 -     * @param notify 
   34.98 -     * @param client 
   34.99 -     * @param rp
  34.100 -     * @param onserver 
  34.101 -     * @param file 
  34.102 -     * @param attrib attributes of the file
  34.103 -     * @throws java.io.IOException 
  34.104 -     */
  34.105 -    protected RemoteFile(RemoteFileAttributes attrib, RemoteFile parent, RemoteClient client,
  34.106 -                          Notify notify, RequestProcessor rp, File file, boolean onserver) throws IOException {
  34.107 -        this.attrib = attrib;
  34.108 -        this.parent = parent;
  34.109 -        this.client = client;
  34.110 -        this.notify = notify;
  34.111 -        this.file = file;
  34.112 -        this.onserver = onserver;
  34.113 -        this.rp = rp;
  34.114 -
  34.115 -        //System.out.println("RemoteFile.RemoteFile: name="+attrib.getName()+" dir="+attrib.isDirectory()+" cache="+file.getPath());
  34.116 -
  34.117 -        // Directory of File?
  34.118 -        if (attrib.isDirectory()) {
  34.119 -            status = NOT_CACHED;
  34.120 -            if (client.isConnected()) {
  34.121 -                if (!onserver) {
  34.122 -                    // directory doesn't exist on server. Create new.
  34.123 -                    client.mkdir(getName());
  34.124 -                //System.out.println("RemoteFile: creating dir "+getPath()+" on server");
  34.125 -                }
  34.126 -                // TODO: better upload dir to server, using goOnline
  34.127 -                // upload  contents of directory to server. 
  34.128 -                // onserver is false so no unneeded list from server will be retrieved.
  34.129 -            /*String list[] = file.list();
  34.130 -                if (file.exists() && list != null && list.length > 0)
  34.131 -                getChildren();
  34.132 -                 */
  34.133 -                this.onserver = true;
  34.134 -            }
  34.135 -            if (!file.exists()) {
  34.136 -                // directory doesn't exist in cache. Create new.
  34.137 -                file.mkdirs();
  34.138 -                //System.out.println("RemoteFile: creating dir "+file.getPath()+" in cache");
  34.139 -                if (!onserver) // New created directory doesn't contain children
  34.140 -                {
  34.141 -                    status = CACHED;
  34.142 -                } else // Directory exist on server but isn't cached
  34.143 -                {
  34.144 -                    status = NOT_CACHED;
  34.145 -                }
  34.146 -            }
  34.147 -        } // File
  34.148 -        else {
  34.149 -            if (!file.exists()) { // if file doesn't exist in cache..
  34.150 -                if (onserver) {
  34.151 -                    status = NOT_CACHED;
  34.152 -                } // ..but exists on server
  34.153 -                else {
  34.154 -                    status = CACHED;
  34.155 -                } // ..and also doesn't exist on server
  34.156 -                cachelastmodified = file.lastModified();
  34.157 -            } else {  // file exist in cache
  34.158 -                status = CACHED;
  34.159 -                cachelastmodified = file.lastModified();
  34.160 -                int which;
  34.161 -                if (!onserver) {
  34.162 -                    which = 0;
  34.163 -                } // file on server doesn't exist yet
  34.164 -                else {
  34.165 -                    if ((attrib.getSize() == 0 && file.length() == 0) ||
  34.166 -                            (attrib.getSize() == file.length() && attrib.getDate().getTime() == file.lastModified())) {
  34.167 -                        which = -1;
  34.168 -                    } // both files are equal
  34.169 -                    else {
  34.170 -                        which = notify.notifyWhichFile(getName().getFullName(), attrib.getDate(), attrib.getSize(), new Date(file.lastModified()),
  34.171 -                                file.length());
  34.172 -                    }
  34.173 -                }
  34.174 -                if (which == 0) {  // file in cache is the right one
  34.175 -                    status = CHANGED;
  34.176 -                    cachelastmodified = file.lastModified();
  34.177 -                    save();
  34.178 -                //System.out.println("RemoteFile: saving "+getPath()+" to server");
  34.179 -                } else if (which == 1) {  // file on server is the right one
  34.180 -                    file.delete();
  34.181 -                    status = NOT_CACHED;
  34.182 -                    if (notify.isDownloadServerChangedFile()) {
  34.183 -                        load();
  34.184 -                    //System.out.println("RemoteFile: loading "+getPath()+" from server");
  34.185 -                    }
  34.186 -                }
  34.187 -            }
  34.188 -        }
  34.189 -    }
  34.190 -
  34.191 -    //***************************************************************************
  34.192 -    /** Creates new root
  34.193 -     * @param client
  34.194 -     * @param notify 
  34.195 -     * @param rp 
  34.196 -     * @param file 
  34.197 -     * @throws java.io.IOException 
  34.198 -     */
  34.199 -    public RemoteFile(RemoteClient client, Notify notify, RequestProcessor rp, File file) throws IOException {
  34.200 -        this(new RemoteFileAttributes(client.getRoot(), true), (RemoteFile) null, client, notify, rp, file, true);
  34.201 -    }
  34.202 -
  34.203 -    //***************************************************************************
  34.204 -    /** Get root */
  34.205 -    /*  public RemoteFile getRoot(String startdir) throws IOException {
  34.206 -    if (startdir == null || startdir.equals("/") || startdir.equals("")) 
  34.207 -    return this;  // default root
  34.208 -    // parent directory of startdir
  34.209 -    String parentdir = "/";
  34.210 -    // relative name of startdir
  34.211 -    String dir = startdir;
  34.212 -    int lastslash = startdir.lastIndexOf('/');
  34.213 -    if (lastslash == 0) 
  34.214 -    dir = startdir.substring(1);
  34.215 -    if (lastslash > 0) {
  34.216 -    parentdir = startdir.substring(0,lastslash);
  34.217 -    dir = startdir.substring(lastslash+1);
  34.218 -    }
  34.219 -    // get list of parent directory
  34.220 -    RemoteFileAttributes attrs[] = client.list(parentdir);
  34.221 -    boolean found = false;
  34.222 -    if (attrs != null && attrs.length > 0) 
  34.223 -    // found relative startdir in list of parent directory
  34.224 -    for (int i=0; i<attrs.length; i++) {
  34.225 -    if (attrs[i].getName().getName().equals(dir)) {  // found
  34.226 -    RemoteFile remoteFile = this;
  34.227 -    RemoteFile newfile = null;
  34.228 -    StringTokenizer st = new StringTokenizer(startdir,"/");
  34.229 -    // create all RemoteFile above found startdir RemoteFile
  34.230 -    while (st.hasMoreTokens()) {
  34.231 -    String name = st.nextToken();
  34.232 -    newfile = new RemoteFile(new RemoteFileAttributes(remoteFile.getName().createNew(name),true),remoteFile,client, notify,rp,new File(remoteFile.file,name),true);
  34.233 -    remoteFile.children = new RemoteFile[1];
  34.234 -    remoteFile.children[0] = newfile;
  34.235 -    remoteFile = newfile;
  34.236 -    }
  34.237 -    return remoteFile;
  34.238 -    }
  34.239 -    }   
  34.240 -    return null;    
  34.241 -    }
  34.242 -     */
  34.243 -    //***************************************************************************
  34.244 -    /** Returns whole path 
  34.245 -     * @return path of this file
  34.246 -     */
  34.247 -    /*  public String getPath() {
  34.248 -    if (isRoot()) return PATH_SEP;
  34.249 -    else return getDirPath()+getName();
  34.250 -    }    
  34.251 -     */
  34.252 -    //***************************************************************************
  34.253 -    /** Returns path of the parent ending with slash.
  34.254 -     * @return path of the parent ending with slash
  34.255 -     */
  34.256 -    /*  public String getDirPath() {
  34.257 -    if (isRoot()) return PATH_SEP;
  34.258 -    else return parent.getPath()+(parent.isRoot()?"":PATH_SEP);
  34.259 -    }    
  34.260 -     */
  34.261 -    /***************************************************************************
  34.262 -    /** Get all children of this object
  34.263 -     * @return array of children
  34.264 -     */
  34.265 -    public synchronized RemoteFile[] getChildren() {
  34.266 -        childrenchanged = false;
  34.267 -        if (nextnochildren) {
  34.268 -            nextnochildren = false;
  34.269 -            return children;
  34.270 -        }
  34.271 -        rp.post(new Runnable() {
  34.272 -
  34.273 -            public void run() {
  34.274 -                try {
  34.275 -                    getChildrenBlock();
  34.276 -                } catch (IOException e) {
  34.277 -                    notify.notifyException(e);
  34.278 -                }
  34.279 -                if (childrenchanged) {
  34.280 -                    nextnochildren = true;
  34.281 -                    notify.fileChanged(getName().getFullName());
  34.282 -                }
  34.283 -            }
  34.284 -        });
  34.285 -        return children;
  34.286 -    }
  34.287 -
  34.288 -    //***************************************************************************
  34.289 -    /** Get all children of this object
  34.290 -     * @return array of children
  34.291 -     * @throws java.io.IOException 
  34.292 -     */
  34.293 -    public synchronized RemoteFile[] getChildrenBlock() throws IOException {
  34.294 -        //System.out.println("RemoteFile.getChildren: path="+getPath());
  34.295 -        if (children == null) {
  34.296 -            ;
  34.297 -        } //TODO: 
  34.298 -
  34.299 -        status = CACHED; // TODO: here or at the end?
  34.300 -        // construct HashMap of existing children list
  34.301 -        Set childrenset = null;
  34.302 -        HashMap childrenmap = null;
  34.303 -        if (children == null) {
  34.304 -            childrenset = new HashSet();
  34.305 -        } else {
  34.306 -            childrenmap = new HashMap();
  34.307 -            for (int i = 0; i < children.length; i++) {
  34.308 -                if (children[i] != null) {
  34.309 -                    childrenmap.put(children[i].getName().getName(), children[i]);
  34.310 -                }
  34.311 -            }
  34.312 -            // gets set of children names
  34.313 -            childrenset = childrenmap.keySet();
  34.314 -        }
  34.315 -        //System.out.println("RemoteFile.getChildren: childrenset="+childrenset);
  34.316 -
  34.317 -        // construct HashMap from list got from server
  34.318 -        HashMap servermap = new HashMap();
  34.319 -        Set serverset;
  34.320 -        //TODO: refresh x always
  34.321 -        if (notify.isRefreshServer() && onserver && client.isConnected()) {
  34.322 -            RemoteFileAttributes RemoteFiles[] = client.list(getName());
  34.323 -            if (RemoteFiles != null) {
  34.324 -                for (int i = 0; i < RemoteFiles.length; i++) {
  34.325 -                    if (RemoteFiles[i] != null) {
  34.326 -                        servermap.put(RemoteFiles[i].getName().getName(), RemoteFiles[i]);
  34.327 -                    }
  34.328 -                }
  34.329 -            }
  34.330 -            // gets set of RemoteFiles names
  34.331 -            serverset = servermap.keySet();
  34.332 -        } else {
  34.333 -            serverset = new HashSet();
  34.334 -        }
  34.335 -        //System.out.println("RemoteFile.getChildren: serverset="+serverset);
  34.336 -
  34.337 -        // construct HashSet of list of files in cache
  34.338 -        HashSet cacheset = new HashSet();
  34.339 -        if (notify.isScanCache()) {
  34.340 -            String cache[] = file.list();
  34.341 -            if (cache != null) {
  34.342 -                for (int i = 0; i < cache.length; i++) {
  34.343 -                    cacheset.add(cache[i]);
  34.344 -                }
  34.345 -            }
  34.346 -        }
  34.347 -        //System.out.println("RemoteFile.getChildren: cacheset="+cacheset);
  34.348 -
  34.349 -        // construct set 6
  34.350 -        if (!childrenset.containsAll(cacheset) && !serverset.containsAll(cacheset)) {
  34.351 -            // construct set of not known (new) files in cache
  34.352 -            Set set6 = new HashSet(cacheset);
  34.353 -            // exclude known files (set 4,1)
  34.354 -            set6.removeAll(childrenset);
  34.355 -            // exclude files on server (set 2)
  34.356 -            set6.removeAll(serverset);
  34.357 -            //System.out.println("RemoteFile.getChildren: set6="+set6);
  34.358 -            if (!set6.isEmpty()) {
  34.359 -                Iterator it = set6.iterator();
  34.360 -                while (it.hasNext()) {
  34.361 -                    String name = (String) (it.next());
  34.362 -                    RemoteFileAttributes at = new RemoteFileAttributes(getName().createNew(name), new File(file, name).isDirectory());
  34.363 -                    childrenvector.addElement(new RemoteFile(at, this, client, notify, rp, new File(file, name), false));
  34.364 -                    childrenchanged = true;
  34.365 -                }
  34.366 -            }
  34.367 -        }
  34.368 -
  34.369 -
  34.370 -        //prepare to set 1+3
  34.371 -        Set set1_3 = new HashSet(serverset);
  34.372 -
  34.373 -        // construct set 2+7
  34.374 -        if (!childrenset.containsAll(serverset)) {
  34.375 -            // construct set of not known (new) files on server
  34.376 -            Set set2_7 = new HashSet(serverset);
  34.377 -            // exclude known files (set 1,3)
  34.378 -            set2_7.removeAll(childrenset);
  34.379 -            //System.out.println("RemoteFile.getChildren: set2_7="+set2_7);
  34.380 -            if (!set2_7.isEmpty()) {
  34.381 -                Iterator it = set2_7.iterator();
  34.382 -                while (it.hasNext()) {
  34.383 -                    RemoteFileAttributes at = (RemoteFileAttributes) (servermap.get(it.next()));
  34.384 -                    childrenvector.addElement(new RemoteFile(at, this, client, notify, rp, new File(file, at.getName().getName()), true));
  34.385 -                    childrenchanged = true;
  34.386 -                }
  34.387 -
  34.388 -                // construct set 1+3
  34.389 -                // exclude set 2+7
  34.390 -                set1_3.removeAll(set2_7);
  34.391 -
  34.392 -            }
  34.393 -        }
  34.394 -
  34.395 -        //System.out.println("RemoteFile.getChildren: set1_3="+set1_3);
  34.396 -        Iterator it = set1_3.iterator();
  34.397 -        while (it.hasNext()) {
  34.398 -            RemoteFileAttributes at = (RemoteFileAttributes) (servermap.get(it.next()));
  34.399 -            ((RemoteFile) (childrenmap.get(at.getName().getName()))).refresh(at);
  34.400 -        }
  34.401 -
  34.402 -        // construct set 4+5
  34.403 -        if (!serverset.containsAll(childrenset)) {
  34.404 -            // construct set of not children without file in server
  34.405 -            Set set4_5 = new HashSet(childrenset);
  34.406 -            // exclude file on server
  34.407 -            set4_5.removeAll(serverset);
  34.408 -            //System.out.println("RemoteFile.getChildren: set5_5="+set4_5);
  34.409 -            if (!set4_5.isEmpty()) {
  34.410 -                Iterator iter = set4_5.iterator();
  34.411 -                while (iter.hasNext()) {
  34.412 -                    String name = (String) (iter.next());
  34.413 -                    RemoteFile f = ((RemoteFile) (childrenmap.get(name)));
  34.414 -                    if (!onserver) {
  34.415 -                        // set onserver = false if parent (this) file has also onserver==false;
  34.416 -                        f.onserver = false;
  34.417 -                        if (f.status != NOT_CACHED && f.file.exists()) // ???
  34.418 -                        {
  34.419 -                            f.status = CHANGED;
  34.420 -                        }
  34.421 -                    }
  34.422 -                    f.refresh(new RemoteFileAttributes(f.getName(), isDirectory()));
  34.423 -                }
  34.424 -            }
  34.425 -        }
  34.426 -
  34.427 -        //System.out.println("RemoteFile.getChildren: childrenvector="+childrenvector);
  34.428 -        children = (RemoteFile[]) (childrenvector.toArray(children));
  34.429 -        return children;
  34.430 -    }
  34.431 -
  34.432 -    //***************************************************************************
  34.433 -    /** Get file attributes for one file. If it doesn't work, disable alwaysRefresh
  34.434 -     * @return
  34.435 -     * @throws java.io.IOException 
  34.436 -     */
  34.437 -    protected RemoteFileAttributes getFileAttributes() throws IOException {
  34.438 -        //if (!notify.isAlwaysRefresh()) return null;
  34.439 -        //System.out.println("RemoteFile.getFileAttributes: path="+getPath());
  34.440 -        //TODO:
  34.441 -        RemoteFileAttributes at[];
  34.442 -        at = client.list(getName());
  34.443 -        if (at == null || at.length == 0) {
  34.444 -            if (!onserver) {
  34.445 -                return null;
  34.446 -            }
  34.447 -            //System.out.println("TESTING alwaysRefresh");
  34.448 -            at = client.list(getParent().getName());
  34.449 -            if (at != null) {
  34.450 -                for (int i = 0; i < at.length; i++) {
  34.451 -                    if (at[i].getName().getName().equals(attrib.getName().getName())) {
  34.452 -                        notify.setAlwaysRefresh(false);
  34.453 -                        //System.out.println("TEST: alwaysRefresh not supported. Disabling.");
  34.454 -                        return null;
  34.455 -                    }
  34.456 -                }
  34.457 -            }
  34.458 -            //System.out.println("TEST: test failed.");
  34.459 -            return null;
  34.460 -        }
  34.461 -        return at[0];
  34.462 -    }
  34.463 -
  34.464 -    //***************************************************************************
  34.465 -    protected void refresh() throws IOException {
  34.466 -        refresh(null);
  34.467 -    }
  34.468 -
  34.469 -    //***************************************************************************
  34.470 -    protected synchronized void refresh(RemoteFileAttributes at) throws IOException {
  34.471 -        //System.out.println("RemoteFile.refresh: path="+getPath()+" attr:"+(at!=null));
  34.472 -        if (isDirectory()) {
  34.473 -            //getChildren();  ???
  34.474 -
  34.475 -            // directory in cache was deleted, if doesn't exist (directory in cache must always exist)
  34.476 -            boolean cachedeleted = !file.exists();
  34.477 -            // directory in server was deleetd if client is connected, onserver==true and at is unexpectly Epoch */
  34.478 -            boolean serverdeleted = (client.isConnected() && onserver == true && at != null &&
  34.479 -                    at.getDate().getTime() == 0 && at.getSize() == 0);
  34.480 -
  34.481 -            // is dir in server was deleted, repair onserver property
  34.482 -            if (serverdeleted) {
  34.483 -                onserver = false;
  34.484 -            }
  34.485 -            // if dir was delete in server and in cache, delete it item from parent
  34.486 -            if (cachedeleted && serverdeleted) {
  34.487 -                parent.deleteChild(this);
  34.488 -                return;
  34.489 -            }
  34.490 -            // directory deleted only in cache
  34.491 -            if (cachedeleted && !serverdeleted) {
  34.492 -                // if parent also doesnt' exist refresh it
  34.493 -                if (!parent.file.exists()) {
  34.494 -                    //TODO: ???
  34.495 -                    parent.refresh();
  34.496 -                } else {
  34.497 -                    if (notify.notifyCacheExtDelete(getName().getFullName(), true)) {
  34.498 -                        deleteFile();
  34.499 -                        parent.deleteChild(this);
  34.500 -                    } else {
  34.501 -                        synchronize();
  34.502 -                    //file.mkdirs();
  34.503 -                    //status = NOT_CACHED; 
  34.504 -                    //TODO: pro cely podadresar
  34.505 -                    }
  34.506 -                }
  34.507 -            }
  34.508 -            // directory deleted only from server
  34.509 -            if (!cachedeleted && serverdeleted) {
  34.510 -                String list[] = file.list();
  34.511 -                // if directory in cache is empty, delete RemoteFile
  34.512 -                if (list == null || list.length == 0) {
  34.513 -                    //TODO: better delete
  34.514 -                    deleteFile();
  34.515 -                    parent.deleteChild(this);
  34.516 -                } else {
  34.517 -                    if (notify.notifyServerExtDelete(getName().getFullName(), true)) {
  34.518 -                        //TODO: better delete
  34.519 -                        deleteFile();
  34.520 -                        parent.deleteChild(this);
  34.521 -                    } else {
  34.522 -                        synchronize();
  34.523 -                    }
  34.524 -                }
  34.525 -            }
  34.526 -
  34.527 -        } else {
  34.528 -            //System.out.println("RemoteFile.refresh: serverlast="+attrib.getDate().toString());
  34.529 -            //if (at!=null) System.out.println("RemoteFile.refresh: serverreal="+at.getDate().toString()+" onserver="+onserver);
  34.530 -
  34.531 -            boolean serverchanged = false;
  34.532 -            RemoteFileAttributes newattr = null;
  34.533 -            if (notify.isRefreshServer() && client.isConnected()) {
  34.534 -                if (at == null && notify.isAlwaysRefresh()) {
  34.535 -                    newattr = getFileAttributes();
  34.536 -                } else {
  34.537 -                    newattr = at;
  34.538 -                }
  34.539 -                if (newattr != null) {
  34.540 -                    // if onserver==true but newattr says that file exist on server
  34.541 -                    if (!onserver && !(newattr.getDate().getTime() == 0 && newattr.getSize() == 0)) {
  34.542 -                        onserver = true;
  34.543 -                        serverchanged = true;
  34.544 -                    } else {
  34.545 -                        if (onserver) {
  34.546 -                            // date of this file isn't yet known
  34.547 -                            if (attrib.getSize() == newattr.getSize() && attrib.getDate().getTime() == 0) {
  34.548 -                                attrib.setDate(newattr.getDate());
  34.549 -                            }
  34.550 -                            // if both files are empty
  34.551 -                            if (attrib.getSize() == 0 && newattr.getSize() == 0) {
  34.552 -                                serverchanged = false;
  34.553 -                            } else // if size or date differ
  34.554 -                            if (attrib.getSize() != newattr.getSize() || !attrib.getDate().equals(newattr.getDate())) {
  34.555 -                                serverchanged = true;
  34.556 -                            }
  34.557 -                        }
  34.558 -                    }
  34.559 -                }
  34.560 -            }
  34.561 -
  34.562 -            boolean cachechanged = false;
  34.563 -
  34.564 -            if (status == NOT_CACHED && (!file.exists() || (file.exists() && file.length() == 0))) // if file realy doesn't exist
  34.565 -            {
  34.566 -                cachechanged = false;
  34.567 -            } else if (file.lastModified() != cachelastmodified) {
  34.568 -                // if lastmodified date was changed
  34.569 -                cachechanged = true;
  34.570 -            /*
  34.571 -            System.out.println("RemoteFile.refresh: cachelast="+new Date(cachelastmodified).toString());
  34.572 -            System.out.println("RemoteFile.refresh: cachereal="+new Date(file.lastModified()).toString());
  34.573 -            System.out.println("RemoteFile.refresh: cacheexists:"+file.exists()+" status:"+status);
  34.574 -             */
  34.575 -            }
  34.576 -
  34.577 -            // file in cache was deleted if change was detected, status isn't NOT_CACHED, but file doesn't exist
  34.578 -            boolean cachedeleted = cachechanged && !file.exists() && status != NOT_CACHED;
  34.579 -            // file in server was deleted if date is Epoch but onserver==true
  34.580 -            boolean serverdeleted = (onserver == true && newattr != null &&
  34.581 -                    newattr.getDate().getTime() == 0 && newattr.getSize() == 0);
  34.582 -
  34.583 -            // repair onserver flag
  34.584 -            if (serverdeleted) {
  34.585 -                onserver = false;
  34.586 -            }
  34.587 -
  34.588 -            if (cachedeleted && serverdeleted) {
  34.589 -                parent.deleteChild(this);
  34.590 -                return;
  34.591 -            }
  34.592 -            if (cachedeleted && !serverdeleted) {
  34.593 -                status = NOT_CACHED;
  34.594 -                cachelastmodified = 0;
  34.595 -                if (notify.notifyCacheExtDelete(getName().getFullName(), false)) {
  34.596 -                    deleteFile();
  34.597 -                    parent.deleteChild(this);
  34.598 -                }
  34.599 -                cachechanged = false;
  34.600 -            }
  34.601 -            if (!cachedeleted && serverdeleted) {
  34.602 -                if (status == NOT_CACHED) {
  34.603 -                    deleteFile();
  34.604 -                    parent.deleteChild(this);
  34.605 -                    return;
  34.606 -                }
  34.607 -                if (status == CACHED) {
  34.608 -                    status = CHANGED;
  34.609 -                }
  34.610 -                if (notify.notifyServerExtDelete(getName().getFullName(), false)) {
  34.611 -                    deleteFile();
  34.612 -                    parent.deleteChild(this);
  34.613 -                    return;
  34.614 -                } else {
  34.615 -                    save();
  34.616 -                    serverchanged = false;
  34.617 -                }
  34.618 -            }
  34.619 -
  34.620 -            // no modification
  34.621 -            if (!serverchanged && !cachechanged) {
  34.622 -                return;
  34.623 -            }
  34.624 -            // change only in cache
  34.625 -            if (cachechanged && !serverchanged) {
  34.626 -                cachelastmodified = file.lastModified();
  34.627 -                if (status != OPEN) {
  34.628 -                    status = CHANGED;
  34.629 -                    //System.out.println("RemoteFile.refresh: file "+getPath()+" in cache has changed. Saving");
  34.630 -                    save(); //TODO: save on background
  34.631 -                }
  34.632 -            }
  34.633 -
  34.634 -            //change only on server
  34.635 -            if (serverchanged && !cachechanged) {
  34.636 -                switch (status) {
  34.637 -                    case NOT_CACHED:
  34.638 -                        attrib = newattr;
  34.639 -                        break;
  34.640 -                    case CACHED:
  34.641 -                        if (notify.notifyServerChanged(getName().getFullName(), newattr.getDate(), newattr.getSize(), new Date(file.lastModified()),
  34.642 -                                file.length())) {
  34.643 -                            attrib = newattr;
  34.644 -                            status = NOT_CACHED;
  34.645 -                            file.delete();
  34.646 -                            if (notify.isDownloadServerChangedFile()) {
  34.647 -                                load();
  34.648 -                            }
  34.649 -                        } else {
  34.650 -                            status = CHANGED;
  34.651 -                            save();
  34.652 -                        }
  34.653 -                        break;
  34.654 -                    case OPEN:
  34.655 -                    case CHANGED:
  34.656 -                        if (serverchanged && cachechanged) {
  34.657 -                            int which = notify.notifyBothFilesChanged(getName().getFullName(), newattr.getDate(), newattr.getSize(),
  34.658 -                                    new Date(file.lastModified()), file.length());
  34.659 -                            if (which == 0) {
  34.660 -                                cachelastmodified = file.lastModified();
  34.661 -                                status = CHANGED;
  34.662 -                                save();
  34.663 -                            } else {
  34.664 -                                attrib = newattr;
  34.665 -                                status = NOT_CACHED;
  34.666 -                                file.delete();
  34.667 -                                if (notify.isDownloadServerChangedFile()) {
  34.668 -                                    load();
  34.669 -                                }
  34.670 -                            }
  34.671 -                        }
  34.672 -                        break;
  34.673 -                }
  34.674 -            }
  34.675 -            //change both on server and in cache
  34.676 -            if (serverchanged && cachechanged) {
  34.677 -                int which = notify.notifyBothFilesChanged(getName().getFullName(), newattr.getDate(), newattr.getSize(), new Date(file.lastModified()),
  34.678 -                        file.length());
  34.679 -                if (which == 0) {
  34.680 -                    cachelastmodified = file.lastModified();
  34.681 -                    status = CHANGED;
  34.682 -                    save();
  34.683 -                } else {
  34.684 -                    attrib = newattr;
  34.685 -                    status = NOT_CACHED;
  34.686 -                    file.delete();
  34.687 -                    if (notify.isDownloadServerChangedFile()) {
  34.688 -                        load();
  34.689 -                    }
  34.690 -                }
  34.691 -            }
  34.692 -        }
  34.693 -
  34.694 -
  34.695 -    }
  34.696 -
  34.697 -    //***************************************************************************
  34.698 -    /** Synchronize this directory and all subdirectories with server.
  34.699 -     * @throws java.io.IOException 
  34.700 -     */
  34.701 -    public void synchronize() throws IOException {
  34.702 -        //if (!client.isConnected()) return; // TODO: realy exit?, no!
  34.703 -        if (isDirectory()) {
  34.704 -            // Directory 
  34.705 -            // if directory doesn't exist, create new
  34.706 -            if (!file.exists()) {
  34.707 -                status = NOT_CACHED;
  34.708 -                file.mkdirs();
  34.709 -            }
  34.710 -            // if directory doesn't exist on server, create new
  34.711 -            if (client.isConnected() && !onserver) {
  34.712 -                client.mkdir(getName());
  34.713 -            }
  34.714 -            // TODO: realy always getchildren? , or only on CACHED?
  34.715 -            String list[] = null;
  34.716 -            if (file.exists()) {
  34.717 -                list = file.list();
  34.718 -            }
  34.719 -            //System.out.println("RemoteFile.refreshAll: file="+file.getPath()+" length="+list.length);
  34.720 -            // if directory isn't empty
  34.721 -            if (list != null && list.length > 0) {
  34.722 -                getChildrenBlock();
  34.723 -            }
  34.724 -            for (int i = 0; i < children.length; i++) {
  34.725 -                if (children[i] != null) {
  34.726 -                    children[i].synchronize();
  34.727 -                }
  34.728 -            }
  34.729 -            onserver = true;
  34.730 -        } // File
  34.731 -        else {
  34.732 -            // refresh();  // Not necessary because refresh is called in getChildren, 
  34.733 -            // but in this case first call of uploadAll must be perform on directory
  34.734 -            if (!file.exists()) {
  34.735 -                status = NOT_CACHED;
  34.736 -            }
  34.737 -            if (client.isConnected() && status == CHANGED) {
  34.738 -                save();
  34.739 -            }
  34.740 -        }
  34.741 -
  34.742 -
  34.743 -    }
  34.744 -
  34.745 -    //***************************************************************************
  34.746 -    /** Download all files in this directory and all subdirectories from server.
  34.747 -     * @throws java.io.IOException 
  34.748 -     */
  34.749 -    public void downloadAll() throws IOException {
  34.750 -        if (!client.isConnected()) {
  34.751 -            return;
  34.752 -        }
  34.753 -        if (isDirectory()) {
  34.754 -            if (!file.exists()) {
  34.755 -                status = NOT_CACHED;
  34.756 -                file.mkdirs();
  34.757 -            }
  34.758 -            getChildren();
  34.759 -            for (int i = 0; i < children.length; i++) {
  34.760 -                if (children[i] != null) {
  34.761 -                    children[i].downloadAll();
  34.762 -                }
  34.763 -            }
  34.764 -        } else {
  34.765 -            if (status == NOT_CACHED) {
  34.766 -                load();
  34.767 -            }
  34.768 -        }
  34.769 -    }
  34.770 -
  34.771 -    //***************************************************************************
  34.772 -    /** Delete all files in cache for this directory and all subdirectories.
  34.773 -     * @throws java.io.IOException 
  34.774 -     */
  34.775 -    public void cleanCache() throws IOException {
  34.776 -        if (isDirectory()) {
  34.777 -            for (int i = 0; i < children.length; i++) {
  34.778 -                if (children[i] != null) {
  34.779 -                    children[i].cleanCache();
  34.780 -                }
  34.781 -            }
  34.782 -        } else {
  34.783 -            if (status == CACHED && file.exists()) {
  34.784 -                status = NOT_CACHED;
  34.785 -                file.delete();
  34.786 -                cachelastmodified = 0;
  34.787 -            }
  34.788 -        }
  34.789 -    }
  34.790 -
  34.791 -    //***************************************************************************
  34.792 -    /** Get all children.
  34.793 -     * @return array of String of children
  34.794 -     * @throws java.io.IOException 
  34.795 -     */
  34.796 -    public String[] getStringChildren() throws IOException {
  34.797 -        getChildren();
  34.798 -        String s[] = new String[children.length];
  34.799 -        for (int i = 0; i < children.length; i++) {
  34.800 -            if (children[i] != null) {
  34.801 -                s[i] = children[i].getName().getName();
  34.802 -            }
  34.803 -        }
  34.804 -        return s;
  34.805 -    }
  34.806 -
  34.807 -    //***************************************************************************
  34.808 -    /** Get child specified by the name.
  34.809 -     * @param name name of the child
  34.810 -     * @return found child, or null
  34.811 -     * @throws java.io.IOException 
  34.812 -     */
  34.813 -    public RemoteFile getChild(String name) throws IOException {
  34.814 -        //System.out.println("RemoteFile.getChild: path="+getPath());
  34.815 -        getChildren(); // TODO: get only one file, no all dir
  34.816 -        return getExistingChild(name);
  34.817 -    }
  34.818 -
  34.819 -    //***************************************************************************
  34.820 -    public RemoteFile getExistingChild(String name) throws IOException {
  34.821 -        //System.out.println("RemoteFile.getExistingChild: path="+getPath());
  34.822 -        for (int i = 0; i < children.length; i++) {
  34.823 -            if (children[i] != null && children[i].getName().getName().equals(name)) {
  34.824 -                return children[i];
  34.825 -            }
  34.826 -        }
  34.827 -        return null;
  34.828 -    }
  34.829 -
  34.830 -    //***************************************************************************
  34.831 -    /** Find the file specified by the name in this directory and all subdirectories. 
  34.832 -     * @param name
  34.833 -     * @return
  34.834 -     * @throws java.io.IOException 
  34.835 -     */
  34.836 -    public RemoteFile find(String name) throws IOException {
  34.837 -        //System.out.println("RemoteFile.find: path="+getPath()+"  name="+name);
  34.838 -        RemoteFile RemoteFile = this, newfile;
  34.839 -        StringTokenizer st = new StringTokenizer(name, "/");
  34.840 -        while (st.hasMoreTokens()) {
  34.841 -            String next = st.nextToken();
  34.842 -            newfile = RemoteFile.getExistingChild(next);
  34.843 -            if (newfile == null) {
  34.844 -                newfile = RemoteFile.getChild(next);
  34.845 -            }
  34.846 -            RemoteFile = newfile;
  34.847 -            if (RemoteFile == null) {
  34.848 -                break;
  34.849 -            }
  34.850 -        }
  34.851 -        return RemoteFile;
  34.852 -    }
  34.853 -
  34.854 -    //***************************************************************************
  34.855 -    /** Return parent object.
  34.856 -     * @return parent object, null if this is root
  34.857 -     */
  34.858 -    public RemoteFile getParent() {
  34.859 -        return parent;
  34.860 -    }
  34.861 -
  34.862 -    //***************************************************************************
  34.863 -    /** Test whether this file is directory
  34.864 -     * @return true if directory, false otherwise
  34.865 -     */
  34.866 -    public boolean isDirectory() {
  34.867 -        return attrib.isDirectory();
  34.868 -    }
  34.869 -
  34.870 -    //***************************************************************************
  34.871 -    /**  Test whether this file is root.
  34.872 -     * @return true if root
  34.873 -     */
  34.874 -    public boolean isRoot() {
  34.875 -        return parent == null;
  34.876 -    }
  34.877 -
  34.878 -    //***************************************************************************
  34.879 -    /** Returns name of this file.
  34.880 -     * @return name
  34.881 -     */
  34.882 -    public RemoteFileName getName() {
  34.883 -        return attrib.getName();
  34.884 -    }
  34.885 -
  34.886 -    //***************************************************************************
  34.887 -    /** Load file from server to cache.
  34.888 -     * @throws IOException
  34.889 -     */
  34.890 -    protected void load() throws IOException {
  34.891 -        //System.out.println("RemoteFile.load: path="+getPath());
  34.892 -        if (!client.isConnected()) {
  34.893 -            return;
  34.894 -        }
  34.895 -        if (isDirectory()) {
  34.896 -            return;
  34.897 -        } else {
  34.898 -            if (onserver) {
  34.899 -                //System.out.println("Downloading "+getPath()+" from server");
  34.900 -                client.get(getName(), file);
  34.901 -                file.setLastModified(cachelastmodified = attrib.getDate().getTime());
  34.902 -            }
  34.903 -            status = CACHED;
  34.904 -        }
  34.905 -    }
  34.906 -
  34.907 -    //***************************************************************************
  34.908 -    /** Save file from cache to server.
  34.909 -     * @throws IOException
  34.910 -     */
  34.911 -    protected void save() throws IOException {
  34.912 -        //System.out.println("RemoteFile.save: path="+getPath());
  34.913 -        if (isDirectory()) {
  34.914 -        // TODO: ???
  34.915 -        } else if (status == CHANGED || status == OPEN) {
  34.916 -            status = CHANGED;
  34.917 -            if (!client.isConnected()) {
  34.918 -                return;
  34.919 -            }
  34.920 -            //System.out.println("Uploading "+getPath()+" to server");
  34.921 -            client.put(file, getName());
  34.922 -            cachelastmodified = file.lastModified();
  34.923 -            attrib.setSize(file.length());
  34.924 -            RemoteFileAttributes rfa = getFileAttributes();
  34.925 -            if (rfa != null) {
  34.926 -                attrib.setDate(rfa.getDate());
  34.927 -                file.setLastModified(rfa.getDate().getTime());
  34.928 -                cachelastmodified = rfa.getDate().getTime();
  34.929 -            } else {
  34.930 -                attrib.setDate(new Date(0));
  34.931 -            } // TODO: get time from server? 
  34.932 -            status = CACHED;
  34.933 -            onserver = true;
  34.934 -        //System.out.println("RemoteFile.save: end. path="+getPath());
  34.935 -        }
  34.936 -    }
  34.937 -
  34.938 -    //***************************************************************************
  34.939 -    /** Get InputStream
  34.940 -     * @throws IOException
  34.941 -     * @return ImputStream of the file
  34.942 -     */
  34.943 -    public InputStream getInputStream() throws IOException {
  34.944 -        if (isDirectory()) {
  34.945 -            throw new FileNotFoundException("Can't get inputstream from directory " + file.getPath());
  34.946 -        }
  34.947 -        refresh();
  34.948 -        if (status == NOT_CACHED) {
  34.949 -            load();
  34.950 -        }
  34.951 -        if (!file.exists()) {
  34.952 -            return null;
  34.953 -        } //file.createNewFile();
  34.954 -        return new FileInputStream(file);
  34.955 -    }
  34.956 -
  34.957 -    //***************************************************************************
  34.958 -    /** Returns OutputStream
  34.959 -     * @throws IOException
  34.960 -     * @return OutputStream of the file
  34.961 -     */
  34.962 -    public OutputStream getOutputStream() throws IOException {
  34.963 -        //System.out.println("RemoteFile.getOutputStream: file="+getPath());
  34.964 -        if (isDirectory()) {
  34.965 -            throw new IOException("Can't get outputstream from directory " + file.getPath());
  34.966 -        }
  34.967 -        refresh();
  34.968 -        status = OPEN;
  34.969 -        return new RemoteOutputStream(this);
  34.970 -    }
  34.971 -
  34.972 -    //*************************************************************************** 
  34.973 -    /** Get the size of the file
  34.974 -     * @return size
  34.975 -     * @throws java.io.IOException 
  34.976 -     */
  34.977 -    public long getSize() throws IOException {
  34.978 -        //TODO: if size isn't known
  34.979 -        refresh();
  34.980 -        if (status == CHANGED) {
  34.981 -            return file.length();
  34.982 -        }
  34.983 -        return attrib.getSize();
  34.984 -    }
  34.985 -
  34.986 -    //***************************************************************************
  34.987 -    /** Test whether the file is only for reading
  34.988 -     * @return readonly flag
  34.989 -     */
  34.990 -    public boolean isReadOnly() {
  34.991 -        //TODO
  34.992 -        return false;
  34.993 -    }
  34.994 -
  34.995 -    //***************************************************************************
  34.996 -    /** Return date of last modification
  34.997 -     * @return last modification date
  34.998 -     * @throws java.io.IOException 
  34.999 -     */
 34.1000 -    public Date lastModified() throws IOException {
 34.1001 -        //TODO: if data isn't known
 34.1002 -        refresh();
 34.1003 -        if (status != NOT_CACHED) {
 34.1004 -            return new Date(cachelastmodified);
 34.1005 -        } else {
 34.1006 -            return attrib.getDate();
 34.1007 -        }
 34.1008 -    }
 34.1009 -
 34.1010 -    //***************************************************************************
 34.1011 -    /** Delete only this file, no entry in parent file.
 34.1012 -     * @throws IOException
 34.1013 -     */
 34.1014 -    protected void deleteFile() throws IOException {
 34.1015 -        if (isDirectory()) {
 34.1016 -            if (status == NOT_CACHED) {
 34.1017 -                getChildren();
 34.1018 -            }
 34.1019 -            for (int i = 0; i < children.length; i++) {
 34.1020 -                // if this file doesn't exist on server, set correct onserver also for child
 34.1021 -                if (!onserver) {
 34.1022 -                    children[i].onserver = false;
 34.1023 -                }
 34.1024 -                if (children[i] != null) {
 34.1025 -                    children[i].deleteFile();
 34.1026 -                }
 34.1027 -            }
 34.1028 -            children = new RemoteFile[0];
 34.1029 -            childrenchanged = true;
 34.1030 -            childrenvector.removeAllElements();
 34.1031 -            if (onserver && client.isConnected()) {
 34.1032 -                client.rmdir(getName());
 34.1033 -            }
 34.1034 -        } else if (onserver && client.isConnected()) {
 34.1035 -            client.delete(getName());
 34.1036 -        }
 34.1037 -        if (file.exists()) {
 34.1038 -            file.delete();
 34.1039 -        }
 34.1040 -    }
 34.1041 -
 34.1042 -    //***************************************************************************
 34.1043 -    /** Delete this file object
 34.1044 -     * @throws IOException
 34.1045 -     */
 34.1046 -    public void delete() throws IOException {
 34.1047 -        refresh();
 34.1048 -        deleteFile();
 34.1049 -        parent.deleteChild(this);
 34.1050 -    }
 34.1051 -
 34.1052 -    //***************************************************************************
 34.1053 -    /** Delete entry of the specified child
 34.1054 -     * @param child fileobject of the child to delete
 34.1055 -     */
 34.1056 -    protected void deleteChild(RemoteFile child) {
 34.1057 -        childrenvector.removeElement(child);
 34.1058 -        children = (RemoteFile[]) (childrenvector.toArray(children));
 34.1059 -        childrenchanged = true;
 34.1060 -    }
 34.1061 -
 34.1062 -    //***************************************************************************
 34.1063 -    /** Rename the file
 34.1064 -     * @param name new name
 34.1065 -     * @throws IOException
 34.1066 -     */
 34.1067 -    public void rename(String name) throws IOException {
 34.1068 -        if (isRoot()) {
 34.1069 -            throw new IOException("Cannot rename root of filesystem");
 34.1070 -        }
 34.1071 -        if (parent.getChild(name) != null) {
 34.1072 -            throw new IOException("File " + getName().getFullName() + PATH_SEP + name + " already exists");
 34.1073 -        }
 34.1074 -
 34.1075 -        if (client.isConnected()) {
 34.1076 -            client.rename(getName(), name);
 34.1077 -        } else {
 34.1078 -            onserver = false;
 34.1079 -        } // TODO: ???
 34.1080 -        attrib.getName().setName(name);
 34.1081 -        File tmp = new File(file.getParentFile(), name);
 34.1082 -        file.renameTo(tmp);
 34.1083 -        file = tmp;
 34.1084 -    }
 34.1085 -
 34.1086 -    //***************************************************************************
 34.1087 -    /** Create new data file object
 34.1088 -     * @param name name of the new data file
 34.1089 -     * @throws IOException
 34.1090 -     * @return created data file
 34.1091 -     */
 34.1092 -    public RemoteFile createData(String name) throws IOException {
 34.1093 -        // get child to test whether already exists
 34.1094 -        if (getChild(name) != null) {
 34.1095 -            throw new IOException("File " + getName().getFullName() + PATH_SEP + name + " already exists");
 34.1096 -        }
 34.1097 -        return createFile(new RemoteFileAttributes(getName().createNew(name), false), false);
 34.1098 -    }
 34.1099 -
 34.1100 -    //*************************************************************************** 
 34.1101 -    /** Create new folder
 34.1102 -     * @param name name of the new folder
 34.1103 -     * @throws IOException
 34.1104 -     * @return created folder
 34.1105 -     */
 34.1106 -    public RemoteFile createFolder(String name) throws IOException {
 34.1107 -        // get child to test whether already exists
 34.1108 -        if (getChild(name) != null) {
 34.1109 -            throw new IOException("Folder " + getName().getFullName() + PATH_SEP + name + " already exists");
 34.1110 -        }
 34.1111 -        return createFile(new RemoteFileAttributes(getName().createNew(name), true), false);
 34.1112 -    }
 34.1113 -
 34.1114 -    //***************************************************************************   
 34.1115 -    /** Create new file 
 34.1116 -     * @param a attributes of the new file
 34.1117 -     * @return created file
 34.1118 -     */
 34.1119 -    private RemoteFile createFile(RemoteFileAttributes a, boolean onserver) throws IOException {
 34.1120 -        RemoteFile newfile = new RemoteFile(a, this, client, notify, rp, new File(file, a.getName().getName()), onserver);
 34.1121 -        childrenvector.addElement(newfile);
 34.1122 -        childrenchanged = true;
 34.1123 -        children = (RemoteFile[]) (childrenvector.toArray(children));
 34.1124 -        return newfile;
 34.1125 -    }
 34.1126 -
 34.1127 -    //*************************************************************************** 
 34.1128 -    interface Notify {
 34.1129 -
 34.1130 -        public boolean isRefreshServer();
 34.1131 -
 34.1132 -        public boolean isScanCache();
 34.1133 -
 34.1134 -        public boolean isAlwaysRefresh();
 34.1135 -
 34.1136 -        public void setAlwaysRefresh(boolean alwaysRefresh);
 34.1137 -
 34.1138 -        public int notifyWhichFile(String path, Date file1, long size1, Date file2, long size2);
 34.1139 -
 34.1140 -        public int notifyBothFilesChanged(String path, Date file1, long size1, Date file2, long size2);
 34.1141 -
 34.1142 -        public boolean isDownloadServerChangedFile();
 34.1143 -
 34.1144 -        public boolean notifyServerChanged(String path, Date file1, long size1, Date file2, long size2);
 34.1145 -
 34.1146 -        public boolean notifyCacheExtDelete(String path, boolean isDir);
 34.1147 -
 34.1148 -        public boolean notifyServerExtDelete(String path, boolean isDir);
 34.1149 -
 34.1150 -        public void fileChanged(String path);
 34.1151 -
 34.1152 -        public void notifyException(Exception e);
 34.1153 -    }
 34.1154 -
 34.1155 -    //*************************************************************************** 
 34.1156 -    interface RequestProcessor {
 34.1157 -
 34.1158 -        public void post(Runnable run);
 34.1159 -    }
 34.1160 -}
    35.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/RemoteFileAttributes.java	Wed Jul 28 12:48:15 2010 -0400
    35.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.3 @@ -1,115 +0,0 @@
    35.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    35.5 -/*
    35.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    35.7 -/*
    35.8 -/* The contents of this file are subject to the terms of either the GNU
    35.9 -/* General Public License Version 2 only ("GPL") or the Common
   35.10 -/* Development and Distribution License("CDDL") (collectively, the
   35.11 -/* "License"). You may not use this file except in compliance with the
   35.12 -/* License. You can obtain a copy of the License at
   35.13 -/* http://www.netbeans.org/cddl-gplv2.html
   35.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   35.15 -/* specific language governing permissions and limitations under the
   35.16 -/* License.  When distributing the software, include this License Header
   35.17 -/* Notice in each file and include the License file at
   35.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   35.19 -/* particular file as subject to the "Classpath" exception as provided
   35.20 -/* by Sun in the GPL Version 2 section of the License file that
   35.21 -/* accompanied this code. If applicable, add the following below the
   35.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   35.23 -/* your own identifying information:
   35.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   35.25 -/*
   35.26 -/* Contributor(s):
   35.27 - *
   35.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   35.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   35.30 - * Copyright (C) 2000. All Rights Reserved.
   35.31 -/*
   35.32 -/* If you wish your version of this file to be governed by only the CDDL
   35.33 -/* or only the GPL Version 2, indicate your decision by adding
   35.34 -/* "[Contributor] elects to include this software in this distribution
   35.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   35.36 -/* single choice of license, a recipient has the option to distribute
   35.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   35.38 -/* to extend the choice of license to its licensees as provided above.
   35.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   35.40 -/* Version 2 license, then the option applies only if the new code is
   35.41 -/* made subject to such option by the copyright holder.
   35.42 - *
   35.43 - * Contributor(s): Libor Martinek.
   35.44 - */
   35.45 -
   35.46 -package org.netbeans.modules.remotefs.core;
   35.47 -
   35.48 -import java.util.Date;
   35.49 -
   35.50 -
   35.51 -/** Remote File attributes. Class for storing attributes for files from remote server.
   35.52 - *
   35.53 - * @author  Libor Martinek
   35.54 - * @version 1.0
   35.55 - */
   35.56 -public class RemoteFileAttributes   {
   35.57 -
   35.58 -    private RemoteFileName name = null;
   35.59 -    private boolean isdirectory = true;
   35.60 -    private long size = 0;
   35.61 -    private java.util.Date date = new java.util.Date(0);
   35.62 -
   35.63 -    /** Creates new RemoteFileAttributes
   35.64 -     * @param name name
   35.65 -     * @param isdirectory whether it's directory
   35.66 -     * @param size size of file
   35.67 -     * @param date last modification date */
   35.68 -    public RemoteFileAttributes(RemoteFileName name, boolean isdirectory, long size, java.util.Date date) {
   35.69 -        this.name=name;
   35.70 -        this.isdirectory=isdirectory;
   35.71 -        this.size=size;
   35.72 -        this.date=date;
   35.73 -    }
   35.74 -   
   35.75 -    /** Creates empty RemoteFileAttributes */
   35.76 -    public RemoteFileAttributes() {
   35.77 -    }
   35.78 -    
   35.79 -    /** Creates RemoteFileAttributes specified with name and isdirectory flag
   35.80 -     * @param name name
   35.81 -     * @param isdirectory whether it's directory */
   35.82 -    public RemoteFileAttributes(RemoteFileName name, boolean isdirectory) {
   35.83 -    	this.name = name;
   35.84 -        this.isdirectory = isdirectory;
   35.85 -    }	
   35.86 -    
   35.87 -    /** Set name of file
   35.88 -     * @param name name */
   35.89 -    public void setName(RemoteFileName name) { this.name=name;  }
   35.90 -    
   35.91 -    /** Set whether it is directory
   35.92 -     * @param dir true if it's directory */
   35.93 -    public void setIsDirectory(boolean dir) {  this.isdirectory=dir;   }
   35.94 -    
   35.95 -    /** Set size of file
   35.96 -     * @param size size of file */
   35.97 -    public void setSize(long size) {  this.size=size;}
   35.98 -    
   35.99 -    /** Set date of last modification
  35.100 -     * @param date set last modification date */
  35.101 -    public void setDate(Date date) {  this.date=date; }
  35.102 -    
  35.103 -    /** Tet name of file
  35.104 -     * @return  name*/
  35.105 -    public RemoteFileName getName() { return name; }
  35.106 -    
  35.107 -    /** Test whether it is directory
  35.108 -      * @return true if it is directory */
  35.109 -    public boolean isDirectory() { return isdirectory; }
  35.110 -    
  35.111 -    /** Get size of file
  35.112 -     * @return  size*/
  35.113 -    public long getSize() { return size; }
  35.114 - 
  35.115 -    /** Get date of last modification
  35.116 -     * @return  last modification date*/
  35.117 -    public Date getDate() { return date; }
  35.118 -}
  35.119 \ No newline at end of file
    36.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/RemoteFileName.java	Wed Jul 28 12:48:15 2010 -0400
    36.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.3 @@ -1,69 +0,0 @@
    36.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    36.5 -/*
    36.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    36.7 -/*
    36.8 -/* The contents of this file are subject to the terms of either the GNU
    36.9 -/* General Public License Version 2 only ("GPL") or the Common
   36.10 -/* Development and Distribution License("CDDL") (collectively, the
   36.11 -/* "License"). You may not use this file except in compliance with the
   36.12 -/* License. You can obtain a copy of the License at
   36.13 -/* http://www.netbeans.org/cddl-gplv2.html
   36.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   36.15 -/* specific language governing permissions and limitations under the
   36.16 -/* License.  When distributing the software, include this License Header
   36.17 -/* Notice in each file and include the License file at
   36.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   36.19 -/* particular file as subject to the "Classpath" exception as provided
   36.20 -/* by Sun in the GPL Version 2 section of the License file that
   36.21 -/* accompanied this code. If applicable, add the following below the
   36.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   36.23 -/* your own identifying information:
   36.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   36.25 -/*
   36.26 -/* Contributor(s):
   36.27 - *
   36.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   36.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   36.30 - * Copyright (C) 2000. All Rights Reserved.
   36.31 -/*
   36.32 -/* If you wish your version of this file to be governed by only the CDDL
   36.33 -/* or only the GPL Version 2, indicate your decision by adding
   36.34 -/* "[Contributor] elects to include this software in this distribution
   36.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   36.36 -/* single choice of license, a recipient has the option to distribute
   36.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   36.38 -/* to extend the choice of license to its licensees as provided above.
   36.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   36.40 -/* Version 2 license, then the option applies only if the new code is
   36.41 -/* made subject to such option by the copyright holder.
   36.42 - *
   36.43 - * Contributor(s): Libor Martinek.
   36.44 - */
   36.45 -
   36.46 -package org.netbeans.modules.remotefs.core;
   36.47 -
   36.48 -/** Object that is used in RemoteClient for identifing file name.
   36.49 - *
   36.50 - * @author  lmartinek
   36.51 - * @version
   36.52 - */
   36.53 -public interface RemoteFileName {
   36.54 -
   36.55 -    /** Get the name. Only last name is returned, not whole path
   36.56 -     * @return  name of this object */
   36.57 -    public abstract String getName();
   36.58 -
   36.59 -    /** Set new name. Used for renaming. Only name is chnaged, path remains.
   36.60 -     * @param newname  new name */
   36.61 -    public abstract void setName(String newname);
   36.62 -
   36.63 -    /** Get full name (with whole path).
   36.64 -     * @return  full name*/
   36.65 -    public abstract String getFullName();
   36.66 -    
   36.67 -    /** Create new name object under this name object.
   36.68 -     * @param name name of new name object
   36.69 -     * @return created name object */
   36.70 -    public abstract RemoteFileName createNew(String name);
   36.71 -    
   36.72 -}
    37.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/RemoteFileSystem.java	Wed Jul 28 12:48:15 2010 -0400
    37.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.3 @@ -1,636 +0,0 @@
    37.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    37.5 -/*
    37.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    37.7 -/*
    37.8 -/* The contents of this file are subject to the terms of either the GNU
    37.9 -/* General Public License Version 2 only ("GPL") or the Common
   37.10 -/* Development and Distribution License("CDDL") (collectively, the
   37.11 -/* "License"). You may not use this file except in compliance with the
   37.12 -/* License. You can obtain a copy of the License at
   37.13 -/* http://www.netbeans.org/cddl-gplv2.html
   37.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   37.15 -/* specific language governing permissions and limitations under the
   37.16 -/* License.  When distributing the software, include this License Header
   37.17 -/* Notice in each file and include the License file at
   37.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   37.19 -/* particular file as subject to the "Classpath" exception as provided
   37.20 -/* by Sun in the GPL Version 2 section of the License file that
   37.21 -/* accompanied this code. If applicable, add the following below the
   37.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   37.23 -/* your own identifying information:
   37.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   37.25 -/*
   37.26 -/* Contributor(s):
   37.27 - *
   37.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   37.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   37.30 - * Copyright (C) 2000. All Rights Reserved.
   37.31 -/*
   37.32 -/* If you wish your version of this file to be governed by only the CDDL
   37.33 -/* or only the GPL Version 2, indicate your decision by adding
   37.34 -/* "[Contributor] elects to include this software in this distribution
   37.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   37.36 -/* single choice of license, a recipient has the option to distribute
   37.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   37.38 -/* to extend the choice of license to its licensees as provided above.
   37.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   37.40 -/* Version 2 license, then the option applies only if the new code is
   37.41 -/* made subject to such option by the copyright holder.
   37.42 - *
   37.43 - * Contributor(s): Libor Martinek.
   37.44 - */
   37.45 -package org.netbeans.modules.remotefs.core;
   37.46 -
   37.47 -import java.io.File;
   37.48 -import java.io.FileNotFoundException;
   37.49 -import java.io.IOException;
   37.50 -import java.io.InputStream;
   37.51 -import java.io.OutputStream;
   37.52 -import org.openide.filesystems.AbstractFileSystem;
   37.53 -import org.openide.filesystems.DefaultAttributes;
   37.54 -import org.openide.filesystems.FileStatusEvent;
   37.55 -import org.openide.util.Exceptions;
   37.56 -import org.openide.util.RequestProcessor;
   37.57 -import org.openide.util.actions.SystemAction;
   37.58 -
   37.59 -/** Remote FileSystem class
   37.60 - * @author Libor Martinek
   37.61 - * @version 1.0
   37.62 - */
   37.63 -public abstract class RemoteFileSystem extends AbstractFileSystem
   37.64 -        implements AbstractFileSystem.List, AbstractFileSystem.Info, AbstractFileSystem.Change,
   37.65 -                   RemoteFile.Notify, RemoteFile.RequestProcessor {
   37.66 -
   37.67 -    static final long serialVersionUID = 5562503683369874863L;
   37.68 -    private static final boolean DEBUG = true;
   37.69 -    /** remote client */
   37.70 -    protected transient RemoteClient client;
   37.71 -    /** root file */
   37.72 -    protected transient RemoteFile rootFile;
   37.73 -    /** Root of cache directory */
   37.74 -    protected File cachedir = null;
   37.75 -    /** Server start directory */
   37.76 -    protected String startdir = "/";
   37.77 -    /** Login information */
   37.78 -    protected LogInfo loginfo;
   37.79 -    /** is read only */
   37.80 -    protected boolean readOnly;
   37.81 -    /** Request processor */
   37.82 -    protected transient RequestProcessor requestproc;
   37.83 -
   37.84 -    /** Constructor.
   37.85 -     */
   37.86 -    public RemoteFileSystem() {
   37.87 -        info = this;
   37.88 -        change = this;
   37.89 -        DefaultAttributes a = new DefaultAttributes(info, change, this);
   37.90 -        attr = a;
   37.91 -        list = a;
   37.92 - }
   37.93 -
   37.94 -
   37.95 -
   37.96 -    /** Return system action for this filesystem
   37.97 -     * @return actions */
   37.98 -    @Override
   37.99 -    public SystemAction[] getActions() {
  37.100 -        SystemAction actions[] = super.getActions();
  37.101 -        SystemAction newactions[] = new SystemAction[actions.length + 4];
  37.102 -        for (int i = 0; i < actions.length; i++) {
  37.103 -            newactions[i] = actions[i];
  37.104 -        }
  37.105 -        newactions[actions.length] = getAction(SynchronizeAction.class);
  37.106 -        newactions[actions.length + 1] = getAction(DownloadAllAction.class);
  37.107 -        newactions[actions.length + 2] = getAction(CleanCacheAction.class);
  37.108 -        newactions[actions.length + 3] = getAction(ConnectAction.class);
  37.109 -        ((ConnectAction) newactions[actions.length + 3]).setFS(this);
  37.110 -        return newactions;
  37.111 -    }
  37.112 -
  37.113 -    private SystemAction getAction(Class clazz) {
  37.114 -        return (SystemAction) org.openide.util.SharedClassObject.findObject(clazz, true);
  37.115 -    }
  37.116 -
  37.117 -    protected void removeClient() {
  37.118 -        if (client != null) {
  37.119 -            client.close();
  37.120 -            client = null;
  37.121 -        }
  37.122 -        rootFile = null;
  37.123 -    }
  37.124 -
  37.125 -    /** Connect to server on background 
  37.126 -     * @param b true for connecting, false for disconnecting */
  37.127 -    public void connectOnBackground(final boolean b) {
  37.128 -        post(new java.lang.Runnable() {
  37.129 -
  37.130 -            public void run() {
  37.131 -                setConnected(b);
  37.132 -                getRoot().refresh();
  37.133 -            }
  37.134 -        });
  37.135 -    }
  37.136 -
  37.137 -    /** Whether filesystem is connected to server.
  37.138 -     * @return true if fs is connected to server
  37.139 -     */
  37.140 -    public boolean isConnected() {
  37.141 -        if (client == null) {
  37.142 -            return false;
  37.143 -        }
  37.144 -        return client.isConnected();
  37.145 -    }
  37.146 -
  37.147 -    /** Connect to or disconnect from server.
  37.148 -     * @param connected true for connecting, false for disconnecting
  37.149 -     */
  37.150 -    public void setConnected(boolean connected) {
  37.151 -        // is new state different?
  37.152 -        if (isConnected() == connected) {
  37.153 -            return;
  37.154 -        }
  37.155 -        if (!connected) {  // will be disconnected
  37.156 -            client.disconnect();
  37.157 -        } else {
  37.158 -            try {
  37.159 -                if (client == null || (client != null && client.compare(loginfo) != 0)) {
  37.160 -                    client = createClient(loginfo, cachedir);
  37.161 -                    rootFile = null;
  37.162 -                }
  37.163 -                client.connect();
  37.164 -                if (rootFile == null) {
  37.165 -                    RemoteFile root = createRootFile(client, cachedir);
  37.166 -                    rootFile = root.find(startdir);
  37.167 -                    if (rootFile == null) {
  37.168 -                        startdirNotFound(startdir, loginfo.displayName());
  37.169 -                        startdir = "/";
  37.170 -                        rootFile = root;
  37.171 -                    }
  37.172 -                }
  37.173 -            } catch (IOException e) {
  37.174 -                if (connected && client != null) {
  37.175 -                    client.close();
  37.176 -                }
  37.177 -                errorConnect(e.toString());
  37.178 -            }
  37.179 -            synchronize("/");
  37.180 -        }
  37.181 -        fireFileStatusChanged(new FileStatusEvent(this, getRoot(), true, true));
  37.182 -        //refreshRoot();
  37.183 -        //try { org.openide.loaders.DataObject.find(super.getRoot()).getNodeDelegate().setDisplayName(getDisplayName()); }
  37.184 -        //catch (org.openide.loaders.DataObjectNotFoundException e) {}
  37.185 -        firePropertyChange("connected", null, isConnected() ? Boolean.TRUE : Boolean.FALSE);
  37.186 -    //firePropertyChange(PROP_SYSTEM_NAME, "", getSystemName());
  37.187 -    }
  37.188 -
  37.189 -    /** Create new client
  37.190 -     * @param loginfo
  37.191 -     * @param cache
  37.192 -     * @throws IOException
  37.193 -     * @return  */
  37.194 -    public abstract RemoteClient createClient(LogInfo loginfo, File cache) throws IOException;
  37.195 -
  37.196 -    /** Create new root file
  37.197 -     * @param client
  37.198 -     * @param cache
  37.199 -     * @throws IOException
  37.200 -     * @return  */
  37.201 -    public RemoteFile createRootFile(RemoteClient client, File cache) throws IOException {
  37.202 -        return new RemoteFile(client, this, this, cache);
  37.203 -    }
  37.204 -
  37.205 -    /** Set whether the file system should be read only.
  37.206 -     * @param flag true if it should
  37.207 -     */
  37.208 -    public void setReadOnly(boolean flag) {
  37.209 -        if (flag != readOnly) {
  37.210 -            readOnly = flag;
  37.211 -            firePropertyChange(PROP_READ_ONLY, !flag ? Boolean.TRUE : Boolean.FALSE, flag ? Boolean.TRUE : Boolean.FALSE);
  37.212 -        }
  37.213 -    }
  37.214 -
  37.215 -    /* Test whether file system is read only.
  37.216 -     * @return true if file system is read only
  37.217 -     */
  37.218 -    public boolean isReadOnly() {
  37.219 -        return readOnly;
  37.220 -    }
  37.221 -
  37.222 -    /** Prepare environment by adding the root directory of the file system to the class path.
  37.223 -     * @param environment the environment to add to
  37.224 -     */
  37.225 -//    @Override
  37.226 -//    public void prepareEnvironment(org.openide.filesystems.FileSystem.Environment environment) {
  37.227 -//        environment.addClassPath(cachedir.toString());
  37.228 -//    }
  37.229 -
  37.230 -    /** Test whether filesystem is ready to write. If no, throws exception
  37.231 -     * @throws IOException if fs isn't ready to write */
  37.232 -    protected abstract void isReadyToModify() throws IOException;
  37.233 -
  37.234 -    /** Test whether filesystem is ready to read. If no, throws exception
  37.235 -     * @throws IOException if fs isn't ready to read */
  37.236 -    protected abstract void isReadyToRead() throws IOException;
  37.237 -
  37.238 -    /** Test whether filesystem is ready.
  37.239 -     * @return true, if fs is ready  */
  37.240 -    protected abstract boolean isReady();
  37.241 -
  37.242 -    /** Get the RemoteFile for entered name
  37.243 -     * @param name of searching file
  37.244 -     * @return found RemoteFile
  37.245 -     * @throws java.io.IOException 
  37.246 -     */
  37.247 -    protected RemoteFile getRemoteFile(String name) throws IOException {
  37.248 -        RemoteFile ftpfile = rootFile.find(name);
  37.249 -        // hack: if attributes file is not found, create new
  37.250 -        if (ftpfile == null && (name.endsWith(DefaultAttributes.ATTR_NAME_EXT) || name.endsWith(".nbattrs"))) {
  37.251 -            createData(name);
  37.252 -            ftpfile = rootFile.find(name);
  37.253 -        }
  37.254 -        return ftpfile;
  37.255 -    }
  37.256 -
  37.257 -    /** Synchronize specified directory
  37.258 -     * @param name name of directory to synchronize */
  37.259 -    public void synchronize(String name) {
  37.260 -        if (!isReady()) {
  37.261 -            return;
  37.262 -        }
  37.263 -        try {
  37.264 -            final RemoteFile f = getRemoteFile(name);
  37.265 -            if (f != null) {
  37.266 -                post(new Runnable() {
  37.267 -
  37.268 -                    public void run() {
  37.269 -                        try {
  37.270 -                            f.synchronize();
  37.271 -                        } catch (IOException e) {
  37.272 -                            Exceptions.printStackTrace(e);
  37.273 -                        }
  37.274 -                    }
  37.275 -                });
  37.276 -            }
  37.277 -        //else System.out.println("RemoteFileSystem.refreshAll: ftpfile "+name+" NOT FOUND");
  37.278 -        } catch (IOException e) {
  37.279 -            //if (DEBUG) e.printStackTrace(); 
  37.280 -            Exceptions.printStackTrace(e);
  37.281 -        }
  37.282 -    }
  37.283 -
  37.284 -    /** Download whole directory with subdirectories to cache.
  37.285 -     * @param name name of directory to download1 */
  37.286 -    public void downloadAll(String name) {
  37.287 -        if (!isReady()) {
  37.288 -            return;
  37.289 -        }
  37.290 -        try {
  37.291 -            final RemoteFile f = getRemoteFile(name);
  37.292 -            if (f != null) {
  37.293 -                post(new Runnable() {
  37.294 -
  37.295 -                    public void run() {
  37.296 -                        try {
  37.297 -                            f.downloadAll();
  37.298 -                        } catch (IOException e) {
  37.299 -                            Exceptions.printStackTrace(e);
  37.300 -                        }
  37.301 -                    }
  37.302 -                });
  37.303 -            }
  37.304 -        //else System.out.println("FTPFileSystem.downloadAll: ftpfile "+name+" NOT FOUND");
  37.305 -        } catch (IOException e) {
  37.306 -            //if (DEBUG) e.printStackTrace(); 
  37.307 -            Exceptions.printStackTrace(e);
  37.308 -        }
  37.309 -    }
  37.310 -
  37.311 -    /** Clean cache. Remove all files from cache.
  37.312 -     * @param name name of directory to clean */
  37.313 -    public void cleanCache(String name) {
  37.314 -        if (!isReady()) {
  37.315 -            return;
  37.316 -        }
  37.317 -        try {
  37.318 -            RemoteFile f = getRemoteFile(name);
  37.319 -            if (f != null) {
  37.320 -                f.cleanCache();
  37.321 -            }
  37.322 -        //else System.out.println("FTPFileSystem.cleanCache: ftpfile "+name+" NOT FOUND");
  37.323 -        } catch (IOException e) {
  37.324 -            //if (DEBUG) e.printStackTrace(); 
  37.325 -            Exceptions.printStackTrace(e);
  37.326 -        }
  37.327 -    }
  37.328 -
  37.329 -    //
  37.330 -    // List
  37.331 -    //
  37.332 -
  37.333 -    /* Scans children for given name
  37.334 -     * @param name
  37.335 -     * @return
  37.336 -     */
  37.337 -    public String[] children(String name) {
  37.338 -        //System.out.println("*** FTPFileSystem.children: name="+name);
  37.339 -        String[] seznam = new String[0];
  37.340 -        if (!isReady()) {
  37.341 -            return seznam;
  37.342 -        }
  37.343 -        try {
  37.344 -            RemoteFile f = getRemoteFile(name);
  37.345 -            if (f != null) {
  37.346 -                if (f.isDirectory()) {
  37.347 -                    seznam = f.getStringChildren();
  37.348 -                }
  37.349 -            }
  37.350 -        //else System.out.println("FTPFileSystem.children: ftpfile "+name+" NOT FOUND");
  37.351 -        } catch (IOException e) {
  37.352 -            Exceptions.printStackTrace(e);
  37.353 -        }
  37.354 -        return seznam;
  37.355 -    }
  37.356 -
  37.357 -    //
  37.358 -    // Change
  37.359 -    //
  37.360 -
  37.361 -    /* Creates new folder named name.
  37.362 -     * @param name name of folder
  37.363 -     * @throws IOException if operation fails
  37.364 -     */
  37.365 -    public void createFolder(String name) throws java.io.IOException {
  37.366 -        //System.out.println("*** FTPFileSystem.createFolder: name="+name);
  37.367 -        isReadyToModify();
  37.368 -        RemoteFile f = null;
  37.369 -        String relname = null;
  37.370 -        int lastslash = name.lastIndexOf("/");
  37.371 -        if (lastslash == -1) {
  37.372 -            relname = name;
  37.373 -            f = rootFile;
  37.374 -        } else {
  37.375 -            relname = name.substring(lastslash + 1);
  37.376 -            f = rootFile.find(name.substring(0, lastslash));
  37.377 -        }
  37.378 -        if (f != null) {
  37.379 -            f.createFolder(relname);
  37.380 -        }
  37.381 -    //else System.out.println("FTPFileSystem.createFolder: parent of ftpfile "+name+" NOT FOUND");
  37.382 -    }
  37.383 -
  37.384 -    /** Creates new folder and all necessary subfolders
  37.385 -     * @param name
  37.386 -     * @throws IOException
  37.387 -     */
  37.388 -    public void createData(String name) throws IOException {
  37.389 -        //System.out.println("*** FTPFileSystem.createData: name="+name);
  37.390 -        isReadyToModify();
  37.391 -        RemoteFile f = null;
  37.392 -        String relname = null;
  37.393 -        int lastslash = name.lastIndexOf("/");
  37.394 -        if (lastslash == -1) {
  37.395 -            relname = name;
  37.396 -            f = rootFile;
  37.397 -        } else {
  37.398 -            relname = name.substring(lastslash + 1);
  37.399 -            f = rootFile.find(name.substring(0, lastslash));
  37.400 -        }
  37.401 -        if (f != null) {
  37.402 -            f.createData(relname);
  37.403 -        }
  37.404 -    //else System.out.println("FTPFileSystem.createData: parent of ftpfile "+name+" NOT FOUND");
  37.405 -    }
  37.406 -
  37.407 -    /* Renames a file.
  37.408 -     * @param oldName old name of the file
  37.409 -     * @param newName new name of the file
  37.410 -     * @throws IOException
  37.411 -     */
  37.412 -    public void rename(String oldName, String newName) throws IOException {
  37.413 -        //System.out.println("*** FTPFileSystem.rename: oldname="+oldName+" newname="+newName);
  37.414 -        isReadyToModify();
  37.415 -        RemoteFile of = getRemoteFile(oldName);
  37.416 -        if (of != null) {
  37.417 -            String name = null;
  37.418 -            String oname = oldName, nname = newName;
  37.419 -            if (!oldName.startsWith("/")) {
  37.420 -                oname = "/" + oldName;
  37.421 -            }
  37.422 -            if (!newName.startsWith("/")) {
  37.423 -                nname = "/" + newName;
  37.424 -            }
  37.425 -            int slash1 = oname.lastIndexOf('/');
  37.426 -            int slash2 = nname.lastIndexOf('/');
  37.427 -            if (slash1 != slash2 || !oname.substring(0, slash1).equals(nname.substring(0, slash2))) {
  37.428 -                IOException e = new IOException("Can't rename !!!!!!");
  37.429 -                e.printStackTrace();
  37.430 -                throw e;
  37.431 -            }
  37.432 -            if (slash2 == -1) {
  37.433 -                name = newName;
  37.434 -            } else {
  37.435 -                name = nname.substring(slash2 + 1);
  37.436 -            }
  37.437 -            of.rename(name);
  37.438 -        }
  37.439 -    //else System.out.println("FTPFileSystem.rename: ftpfile "+oldName+" NOT FOUND");
  37.440 -    }
  37.441 -
  37.442 -    /* Delete the file. 
  37.443 -     *
  37.444 -     * @param name name of file
  37.445 -     * @throws IOException if the file could not be deleted
  37.446 -     */
  37.447 -    public void delete(String name) throws IOException {
  37.448 -        //System.out.println("*** FTPFileSystem.delete: name="+name);
  37.449 -        isReadyToModify();
  37.450 -        RemoteFile file = getRemoteFile(name);
  37.451 -        if (file != null) {
  37.452 -            file.delete();
  37.453 -        }
  37.454 -    // else System.out.println("FTPFileSystem.delete: ftpfile "+name+" NOT FOUND");
  37.455 -    }
  37.456 -
  37.457 -    //
  37.458 -    // Info
  37.459 -    //
  37.460 -
  37.461 -    /*
  37.462 -     * Get last modification time.
  37.463 -     * @param name the file to test
  37.464 -     * @return the date
  37.465 -     */
  37.466 -    public java.util.Date lastModified(String name) {
  37.467 -        //System.out.println("*** FTPFileSystem.lastModified: name="+name);
  37.468 -        java.util.Date date = new java.util.Date(0);
  37.469 -        if (!isReady()) {
  37.470 -            return date;
  37.471 -        }
  37.472 -        try {
  37.473 -            RemoteFile f = getRemoteFile(name);
  37.474 -            if (f != null) {
  37.475 -                date = f.lastModified();
  37.476 -            }
  37.477 -        // else System.out.println("FTPFileSystem.lastModified: ftpfile "+name+" NOT FOUND");
  37.478 -        } catch (IOException e) {
  37.479 -            Exceptions.printStackTrace(e);
  37.480 -        }
  37.481 -        return date;
  37.482 -    }
  37.483 -
  37.484 -    /* Test if the file is folder or contains data.
  37.485 -     * @param name name of the file
  37.486 -     * @return true if the file is folder, false otherwise
  37.487 -     */
  37.488 -    public boolean folder(String name) {
  37.489 -        //System.out.println("*** FTPFileSystem.folder: name="+name);
  37.490 -        if (!isReady()) {
  37.491 -            return true;
  37.492 -        }
  37.493 -        try {
  37.494 -            RemoteFile f = getRemoteFile(name);
  37.495 -            if (f != null) {
  37.496 -                return f.isDirectory();
  37.497 -            }
  37.498 -        //else System.out.println("FTPFileSystem.folder: ftpfile "+name+" NOT FOUND");
  37.499 -        } catch (IOException e) {
  37.500 -            Exceptions.printStackTrace(e);
  37.501 -        }
  37.502 -        return true;
  37.503 -    }
  37.504 -
  37.505 -    /* Test whether this file can be written to or not.
  37.506 -     * @param name the file to test
  37.507 -     * @return true if file is read-only
  37.508 -     */
  37.509 -    public boolean readOnly(String name) {
  37.510 -        //System.out.println("*** FTPFileSystem.readOnly: name="+name);
  37.511 -        if (!isReady()) {
  37.512 -            return false;
  37.513 -        }
  37.514 -        try {
  37.515 -            RemoteFile f = getRemoteFile(name);
  37.516 -            if (f != null) {
  37.517 -                return f.isReadOnly();
  37.518 -            }
  37.519 -        //else System.out.println("FTPFileSystem.readOnly: ftpfile "+name+" NOT FOUND");
  37.520 -        } catch (IOException e) {
  37.521 -            Exceptions.printStackTrace(e);
  37.522 -        }
  37.523 -        return false;
  37.524 -    }
  37.525 -
  37.526 -    /** Get the MIME type of the file.
  37.527 -     * Uses {@link FileUtil#getMIMEType}.
  37.528 -     *
  37.529 -     * @param name the file to test
  37.530 -     * @return the MIME type textual representation, e.g. <code>"text/plain"</code>
  37.531 -     */
  37.532 -    public String mimeType(String name) {
  37.533 -        return null;
  37.534 -    }
  37.535 -
  37.536 -
  37.537 -    /** Get the size of the file.
  37.538 -     *
  37.539 -     * @param name the file to test
  37.540 -     * @return the size of the file in bytes or zero if the file does not contain data (does not
  37.541 -     *  exist or is a folder).
  37.542 -     */
  37.543 -    public long size(String name) {
  37.544 -        //System.out.println("*** FTPFileSystem.size: name="+name);
  37.545 -        if (!isReady()) {
  37.546 -            return 0;
  37.547 -        }
  37.548 -        try {
  37.549 -            RemoteFile f = getRemoteFile(name);
  37.550 -            if (f != null) {
  37.551 -                return f.getSize();
  37.552 -            }
  37.553 -        //else System.out.println("FTPFileSystem.size: ftpfile "+name+" NOT FOUND");
  37.554 -        } catch (IOException e) {
  37.555 -            Exceptions.printStackTrace(e);
  37.556 -        }
  37.557 -        return 0;
  37.558 -    }
  37.559 -
  37.560 -    /** Get input stream.
  37.561 -     *
  37.562 -     * @param name the file to test
  37.563 -     * @return an input stream to read the contents of this file
  37.564 -     * @exception FileNotFoundException if the file does not exists or is invalid
  37.565 -     */
  37.566 -    public InputStream inputStream(String name) throws java.io.FileNotFoundException {
  37.567 -        //System.out.println("*** FTPFileSystem.inputStream: name"+name);
  37.568 -        InputStream is = null;
  37.569 -        try {
  37.570 -            isReadyToRead();
  37.571 -            RemoteFile f = getRemoteFile(name);
  37.572 -            if (f != null) {
  37.573 -                is = f.getInputStream();
  37.574 -            }
  37.575 -        //else System.out.println("FTPFileSystem.inputStream: ftpfile "+name+" NOT FOUND");
  37.576 -        } catch (IOException e) {
  37.577 -            throw new FileNotFoundException(e.toString());
  37.578 -        }
  37.579 -        return is;
  37.580 -    }
  37.581 -
  37.582 -    /** Get output stream.
  37.583 -     *
  37.584 -     * @param name the file to test
  37.585 -     * @return output stream to overwrite the contents of this file
  37.586 -     * @exception IOException if an error occures (the file is invalid, etc.)
  37.587 -     */
  37.588 -    public OutputStream outputStream(String name) throws java.io.IOException {
  37.589 -        //System.out.println("*** FTPFileSystem.outputStream: name="+name);
  37.590 -        isReadyToModify();
  37.591 -        RemoteFile f = getRemoteFile(name);
  37.592 -        if (f != null) {
  37.593 -            return f.getOutputStream();
  37.594 -        }
  37.595 -        //else System.out.println("FTPFileSystem.outputStream: ftpfile "+name+" NOT FOUND");
  37.596 -        return null;
  37.597 -    }
  37.598 -
  37.599 -    /** Does nothing to lock the file.
  37.600 -     * @param name name of the file
  37.601 -     * @throws IOException
  37.602 -     */
  37.603 -    public void lock(String name) throws IOException {
  37.604 -    //System.out.println("*** FTPFileSystem.lock: name="+name);
  37.605 -    }
  37.606 -
  37.607 -    /** Does nothing to unlock the file.
  37.608 -     *
  37.609 -     * @param name name of the file
  37.610 -     */
  37.611 -    public void unlock(String name) {
  37.612 -    //System.out.println("*** FTPFileSystem.unlock: name="+name);
  37.613 -    }
  37.614 -
  37.615 -    /** Does nothing to mark the file as unimportant.
  37.616 -     *
  37.617 -     * @param name the file to mark
  37.618 -     */
  37.619 -    public void markUnimportant(String name) {
  37.620 -    }
  37.621 -
  37.622 -    /** Informs user that startdir was not found on server.
  37.623 -     * @param startdir 
  37.624 -     * @param server  */
  37.625 -    protected abstract void startdirNotFound(String startdir, String server);
  37.626 -
  37.627 -    /** Informs user that some error occurs during connecting.
  37.628 -     * @param error  */
  37.629 -    protected abstract void errorConnect(String error);
  37.630 -
  37.631 -    /** Run in Request Processor.
  37.632 -     * @param run  */
  37.633 -    public void post(Runnable run) {
  37.634 -        if (requestproc == null) {
  37.635 -            requestproc = new RequestProcessor("Remote Filesystem Request Processor for " + loginfo.displayName());
  37.636 -        }
  37.637 -        requestproc.post(run);
  37.638 -    }
  37.639 -} 
    38.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/RemoteManager.java	Wed Jul 28 12:48:15 2010 -0400
    38.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.3 @@ -1,195 +0,0 @@
    38.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    38.5 -/*
    38.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    38.7 -/*
    38.8 -/* The contents of this file are subject to the terms of either the GNU
    38.9 -/* General Public License Version 2 only ("GPL") or the Common
   38.10 -/* Development and Distribution License("CDDL") (collectively, the
   38.11 -/* "License"). You may not use this file except in compliance with the
   38.12 -/* License. You can obtain a copy of the License at
   38.13 -/* http://www.netbeans.org/cddl-gplv2.html
   38.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   38.15 -/* specific language governing permissions and limitations under the
   38.16 -/* License.  When distributing the software, include this License Header
   38.17 -/* Notice in each file and include the License file at
   38.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   38.19 -/* particular file as subject to the "Classpath" exception as provided
   38.20 -/* by Sun in the GPL Version 2 section of the License file that
   38.21 -/* accompanied this code. If applicable, add the following below the
   38.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   38.23 -/* your own identifying information:
   38.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   38.25 -/*
   38.26 -/* Contributor(s):
   38.27 - *
   38.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   38.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   38.30 - * Copyright (C) 2000. All Rights Reserved.
   38.31 -/*
   38.32 -/* If you wish your version of this file to be governed by only the CDDL
   38.33 -/* or only the GPL Version 2, indicate your decision by adding
   38.34 -/* "[Contributor] elects to include this software in this distribution
   38.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   38.36 -/* single choice of license, a recipient has the option to distribute
   38.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   38.38 -/* to extend the choice of license to its licensees as provided above.
   38.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   38.40 -/* Version 2 license, then the option applies only if the new code is
   38.41 -/* made subject to such option by the copyright holder.
   38.42 - *
   38.43 - * Contributor(s): Libor Martinek.
   38.44 - */
   38.45 -
   38.46 -package org.netbeans.modules.remotefs.core;
   38.47 -
   38.48 -import java.util.*;
   38.49 -import java.io.*;
   38.50 -
   38.51 -/** RemoteManger holds static table of created managers, client,
   38.52 - * cache file and  root file.
   38.53 - *
   38.54 - * @author  Libor Martinek
   38.55 - * @version 1.0
   38.56 - */
   38.57 -public final class RemoteManager  {
   38.58 -
   38.59 -  /** List of created FTPManagers */
   38.60 -  private static Vector managers = new Vector();
   38.61 -  /** List of Objects that own this FTPManager */
   38.62 -  private Vector owners = new Vector();
   38.63 -  /** Cache directory */
   38.64 -  private File cacheroot = null;
   38.65 -  /** Root directory */
   38.66 -  private RemoteFile root = null;
   38.67 -  
   38.68 -  private RemoteClient client;
   38.69 -  
   38.70 -  /** Creates new FTPManager.
   38.71 -   * @param owner object that uses this manager
   38.72 -   * @param loginfo log info
   38.73 -   * @param cache cache file
   38.74 - * @throws IOException  */
   38.75 -  protected RemoteManager(RemoteOwner owner, LogInfo loginfo, File cache) throws IOException {
   38.76 -    owners.addElement(owner);
   38.77 -    cacheroot = cache;
   38.78 -    if (!cacheroot.exists()) cacheroot.mkdirs();
   38.79 -    client = owner.createClient(loginfo,cache);
   38.80 -    //client.setLogInfo(loginfo);
   38.81 -    //root = RemoteFile.createRoot(this,cache);
   38.82 -  }
   38.83 -  
   38.84 -  /** Search for usable manager and if none is found, create new.
   38.85 -   * @return RemoteManager object
   38.86 -   * @param loginfo log info
   38.87 -   * @param owner object that uses this manager
   38.88 -   * @param cache cache file
   38.89 - * @throws IOException  */
   38.90 -  public static RemoteManager getRemoteManager(RemoteOwner owner,File cache,LogInfo loginfo)  throws IOException  {
   38.91 -    boolean managerexist = false;
   38.92 -    RemoteManager manager = null;
   38.93 -      // find existing manager
   38.94 -      Enumeration en = managers.elements();
   38.95 -      while (en.hasMoreElements()) {
   38.96 -        manager = (RemoteManager)(en.nextElement());
   38.97 -        int compareresult = manager.getClient().compare(loginfo);
   38.98 -        if (compareresult == 0)  {
   38.99 -          // same
  38.100 -          managerexist = true;
  38.101 -          // cache must be equal
  38.102 -          if (!cache.equals(manager.cacheroot))
  38.103 -             if (!owner.notifyIncorrectCache(manager.cacheroot))
  38.104 -               return null;
  38.105 -          break;
  38.106 -        }
  38.107 -        else if (compareresult > 0) {
  38.108 -          // same except password
  38.109 -          owner.notifyIncorrectPassword();
  38.110 -          return null;
  38.111 -        }
  38.112 -      }
  38.113 -      if (!managerexist) {  // manager not found
  38.114 -        //RemoteFile f = RemoteFile.createRoot(manager,cache);
  38.115 -        manager = new RemoteManager(owner,loginfo,cache); 
  38.116 -        managers.addElement(manager);
  38.117 -      }
  38.118 -      else
  38.119 -        manager.owners.addElement(owner);
  38.120 -      return manager;
  38.121 -  }
  38.122 -  
  38.123 -  /** Return RemoteClient
  38.124 - * @return  RemoteClient object*/
  38.125 -  public RemoteClient getClient() {
  38.126 -    return client; 
  38.127 -  }
  38.128 -  
  38.129 -  /** Remove owner from list and  if last owner is removed, disconnect from ftp server.
  38.130 -   * @param owner owner to remove
  38.131 -   */
  38.132 -  public final void remove(RemoteOwner owner) {
  38.133 -    // remove owner from list
  38.134 -    owners.removeElement(owner);
  38.135 -    // if it was last owner, diconnect
  38.136 -    if (owners.isEmpty()) {
  38.137 -      if (getClient().isConnected()) getClient().disconnect();
  38.138 -      managers.removeElement(this);
  38.139 -    }
  38.140 -  }
  38.141 -
  38.142 -  /** Has this manager more than one owner?
  38.143 -   * @return true if manager has more than one owner
  38.144 -   */
  38.145 -  public final boolean moreOwners() {
  38.146 -    return (owners.size() > 1);
  38.147 -
  38.148 -  }
  38.149 -  
  38.150 -  /** Get root.
  38.151 -   * @return root file
  38.152 -   * @throws IOException  */
  38.153 -  public RemoteFile getRoot() throws IOException {
  38.154 -    if (root == null) root = ((RemoteOwner)(owners.firstElement())).createRootFile(getClient(),cacheroot);
  38.155 -    return root;
  38.156 -  }
  38.157 -  
  38.158 -  /** Get root with specified start directory.
  38.159 -   * @param startdir
  38.160 -   * @throws IOException
  38.161 -   * @return root file
  38.162 -   */
  38.163 -  public RemoteFile getRoot(String startdir) throws IOException {
  38.164 -    RemoteFile f = getRoot().find(startdir);
  38.165 -    return f;
  38.166 -  }
  38.167 -  
  38.168 -
  38.169 -  //************************************************************************************
  38.170 -  /** Interface that owner of RemoteManager must implement. */
  38.171 -  public interface RemoteOwner {
  38.172 -  
  38.173 -    /** Create new client with this log info and cache
  38.174 -     * @param loginfo
  38.175 -     * @param cache
  38.176 -     * @throws IOException
  38.177 -     * @return  created Client */      
  38.178 -    public RemoteClient createClient(LogInfo loginfo, File cache) throws IOException ;
  38.179 -    
  38.180 -    /** Create new root file 
  38.181 -     * @param client
  38.182 -     * @param cache
  38.183 -     * @throws IOException
  38.184 -     * @return  */    
  38.185 -    public RemoteFile createRootFile(RemoteClient client, File cache) throws IOException ;
  38.186 -  
  38.187 -    /** Notify user that incorrect password was entered
  38.188 -     */
  38.189 -    public void notifyIncorrectPassword() ;
  38.190 -    
  38.191 -    /** Notify user that another cache that existing was entered
  38.192 -     * @param newcache
  38.193 -     * @return  */    
  38.194 -    public boolean notifyIncorrectCache(java.io.File newcache);
  38.195 -
  38.196 -  }
  38.197 -
  38.198 -}
    39.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/RemoteOutputStream.java	Wed Jul 28 12:48:15 2010 -0400
    39.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.3 @@ -1,70 +0,0 @@
    39.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    39.5 -/*
    39.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    39.7 -/*
    39.8 -/* The contents of this file are subject to the terms of either the GNU
    39.9 -/* General Public License Version 2 only ("GPL") or the Common
   39.10 -/* Development and Distribution License("CDDL") (collectively, the
   39.11 -/* "License"). You may not use this file except in compliance with the
   39.12 -/* License. You can obtain a copy of the License at
   39.13 -/* http://www.netbeans.org/cddl-gplv2.html
   39.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   39.15 -/* specific language governing permissions and limitations under the
   39.16 -/* License.  When distributing the software, include this License Header
   39.17 -/* Notice in each file and include the License file at
   39.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   39.19 -/* particular file as subject to the "Classpath" exception as provided
   39.20 -/* by Sun in the GPL Version 2 section of the License file that
   39.21 -/* accompanied this code. If applicable, add the following below the
   39.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   39.23 -/* your own identifying information:
   39.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   39.25 -/*
   39.26 -/* Contributor(s):
   39.27 - *
   39.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   39.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   39.30 - * Copyright (C) 2000. All Rights Reserved.
   39.31 -/*
   39.32 -/* If you wish your version of this file to be governed by only the CDDL
   39.33 -/* or only the GPL Version 2, indicate your decision by adding
   39.34 -/* "[Contributor] elects to include this software in this distribution
   39.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   39.36 -/* single choice of license, a recipient has the option to distribute
   39.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   39.38 -/* to extend the choice of license to its licensees as provided above.
   39.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   39.40 -/* Version 2 license, then the option applies only if the new code is
   39.41 -/* made subject to such option by the copyright holder.
   39.42 - *
   39.43 - * Contributor(s): Libor Martinek.
   39.44 - */
   39.45 -
   39.46 -package org.netbeans.modules.remotefs.core;
   39.47 -
   39.48 -/** RemoteOutputStream that subclasses FileOutputStream and overwrites close() method to notify FTPFile.
   39.49 - *
   39.50 - * @author  Libor Martinek
   39.51 - * @version 1.0
   39.52 - */
   39.53 -public class RemoteOutputStream extends java.io.FileOutputStream {
   39.54 -     private RemoteFile file;
   39.55 -
   39.56 -     /** Creates new FTPOutputStream.
   39.57 -     * @param file FTPFile
   39.58 -     * @throws IOException
   39.59 -     */
   39.60 -    public RemoteOutputStream(RemoteFile file) throws java.io.IOException {
   39.61 -      super(file.file);
   39.62 -      this.file = file;
   39.63 -    }
   39.64 -     
   39.65 -     /** Close the stream and notify FTPFile.
   39.66 -     * @throws IOException
   39.67 -     */
   39.68 -    public void close() throws java.io.IOException {
   39.69 -      super.close();
   39.70 -      file.save();
   39.71 -    }
   39.72 -     
   39.73 -} 
   39.74 \ No newline at end of file
    40.1 --- a/remotefs/src/org/netbeans/modules/remotefs/core/SynchronizeAction.java	Wed Jul 28 12:48:15 2010 -0400
    40.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.3 @@ -1,102 +0,0 @@
    40.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    40.5 -/*
    40.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    40.7 -/*
    40.8 -/* The contents of this file are subject to the terms of either the GNU
    40.9 -/* General Public License Version 2 only ("GPL") or the Common
   40.10 -/* Development and Distribution License("CDDL") (collectively, the
   40.11 -/* "License"). You may not use this file except in compliance with the
   40.12 -/* License. You can obtain a copy of the License at
   40.13 -/* http://www.netbeans.org/cddl-gplv2.html
   40.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   40.15 -/* specific language governing permissions and limitations under the
   40.16 -/* License.  When distributing the software, include this License Header
   40.17 -/* Notice in each file and include the License file at
   40.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   40.19 -/* particular file as subject to the "Classpath" exception as provided
   40.20 -/* by Sun in the GPL Version 2 section of the License file that
   40.21 -/* accompanied this code. If applicable, add the following below the
   40.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   40.23 -/* your own identifying information:
   40.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   40.25 -/*
   40.26 -/* Contributor(s):
   40.27 - *
   40.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   40.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   40.30 - * Copyright (C) 2000. All Rights Reserved.
   40.31 -/*
   40.32 -/* If you wish your version of this file to be governed by only the CDDL
   40.33 -/* or only the GPL Version 2, indicate your decision by adding
   40.34 -/* "[Contributor] elects to include this software in this distribution
   40.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   40.36 -/* single choice of license, a recipient has the option to distribute
   40.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   40.38 -/* to extend the choice of license to its licensees as provided above.
   40.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   40.40 -/* Version 2 license, then the option applies only if the new code is
   40.41 -/* made subject to such option by the copyright holder.
   40.42 - *
   40.43 - * Contributor(s): Libor Martinek.
   40.44 - */
   40.45 -
   40.46 -package org.netbeans.modules.remotefs.core;
   40.47 -
   40.48 -import org.openide.filesystems.FileObject;
   40.49 -import org.openide.filesystems.FileStateInvalidException;
   40.50 -import org.openide.filesystems.FileSystem;
   40.51 -import org.openide.loaders.DataFolder;
   40.52 -import org.openide.util.actions.CookieAction;
   40.53 -import org.openide.nodes.Node;
   40.54 -import org.openide.util.Exceptions;
   40.55 -import org.openide.util.HelpCtx;
   40.56 -
   40.57 -/** Action for synchronizing filesystem.
   40.58 -*
   40.59 -* @author Libor Martinek
   40.60 -*/
   40.61 -public class SynchronizeAction extends CookieAction {
   40.62 -  static final long serialVersionUID = -1912609165828070616L;  
   40.63 -    
   40.64 -  /** @return DataFolder class */
   40.65 -  protected Class[] cookieClasses () {
   40.66 -    return new Class[] { DataFolder.class };
   40.67 -  }
   40.68 -
   40.69 -  protected void performAction (Node[] nodes)  {
   40.70 -    for (int i = 0; i < nodes.length; i++) {
   40.71 -      DataFolder df = nodes[i].getCookie(DataFolder.class);
   40.72 -      if (df != null) {
   40.73 -        FileObject fo = df.getPrimaryFile ();
   40.74 -        try {
   40.75 -           FileSystem fs = fo.getFileSystem();
   40.76 -           if (fs instanceof RemoteFileSystem) {
   40.77 -                        ((RemoteFileSystem) fs).synchronize(fo.getPath());
   40.78 -                    }
   40.79 -        }
   40.80 -        catch (FileStateInvalidException e) { 
   40.81 -          Exceptions.printStackTrace(e);
   40.82 -        }
   40.83 -      }
   40.84 -    }
   40.85 -  }
   40.86 -
   40.87 -  protected int mode () {
   40.88 -    return MODE_ALL;
   40.89 -  }
   40.90 -
   40.91 -  public String getName () {
   40.92 -    return "Synchronize";
   40.93 -  }
   40.94 -
   40.95 -  public HelpCtx getHelpCtx () {
   40.96 -    return HelpCtx.DEFAULT_HELP;
   40.97 -  }
   40.98 -
   40.99 -    @Override
  40.100 -    protected boolean asynchronous() {
  40.101 -        return false;
  40.102 -    }
  40.103 -
  40.104 -  
  40.105 -}
    41.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPClient.java	Wed Jul 28 12:48:15 2010 -0400
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,941 +0,0 @@
    41.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    41.5 -/*
    41.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    41.7 -/*
    41.8 -/* The contents of this file are subject to the terms of either the GNU
    41.9 -/* General Public License Version 2 only ("GPL") or the Common
   41.10 -/* Development and Distribution License("CDDL") (collectively, the
   41.11 -/* "License"). You may not use this file except in compliance with the
   41.12 -/* License. You can obtain a copy of the License at
   41.13 -/* http://www.netbeans.org/cddl-gplv2.html
   41.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   41.15 -/* specific language governing permissions and limitations under the
   41.16 -/* License.  When distributing the software, include this License Header
   41.17 -/* Notice in each file and include the License file at
   41.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   41.19 -/* particular file as subject to the "Classpath" exception as provided
   41.20 -/* by Sun in the GPL Version 2 section of the License file that
   41.21 -/* accompanied this code. If applicable, add the following below the
   41.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   41.23 -/* your own identifying information:
   41.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   41.25 -/*
   41.26 -/* Contributor(s):
   41.27 - *
   41.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   41.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   41.30 - * Copyright (C) 2000. All Rights Reserved.
   41.31 -/*
   41.32 -/* If you wish your version of this file to be governed by only the CDDL
   41.33 -/* or only the GPL Version 2, indicate your decision by adding
   41.34 -/* "[Contributor] elects to include this software in this distribution
   41.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   41.36 -/* single choice of license, a recipient has the option to distribute
   41.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   41.38 -/* to extend the choice of license to its licensees as provided above.
   41.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   41.40 -/* Version 2 license, then the option applies only if the new code is
   41.41 -/* made subject to such option by the copyright holder.
   41.42 - *
   41.43 - * Contributor(s): Libor Martinek.
   41.44 - */
   41.45 -package org.netbeans.modules.remotefs.ftpclient;
   41.46 -
   41.47 -import java.io.BufferedReader;
   41.48 -import java.io.File;
   41.49 -import java.io.FileInputStream;
   41.50 -import java.io.FileOutputStream;
   41.51 -import java.io.IOException;
   41.52 -import java.io.InputStream;
   41.53 -import java.io.InputStreamReader;
   41.54 -import java.io.OutputStream;
   41.55 -import java.io.PrintWriter;
   41.56 -import java.net.InetAddress;
   41.57 -import java.net.ServerSocket;
   41.58 -import java.net.Socket;
   41.59 -import java.net.SocketException;
   41.60 -import java.util.StringTokenizer;
   41.61 -import java.util.logging.Level;
   41.62 -import java.util.logging.Logger;
   41.63 -import org.netbeans.modules.remotefs.core.RemoteClient;
   41.64 -import org.netbeans.modules.remotefs.core.LogInfo;
   41.65 -import org.netbeans.modules.remotefs.core.RemoteFileAttributes;
   41.66 -import org.netbeans.modules.remotefs.core.RemoteFileName;
   41.67 -
   41.68 -/**  This class connects to FTP server.
   41.69 - *
   41.70 - * @author  Libor Martinek
   41.71 - * @version 1.0
   41.72 - */
   41.73 -public class FTPClient implements RemoteClient {
   41.74 -
   41.75 -    /** An empty array of File attributes. */
   41.76 -    private static final FTPFileAttributes[] EMPTY_LIST = new FTPFileAttributes[0];
   41.77 -    /** Control connection stream */
   41.78 -    private BufferedReader in;
   41.79 -    /** Control connection stream */
   41.80 -    private PrintWriter out;
   41.81 -    /** Log stream */
   41.82 -    private PrintWriter log = null;
   41.83 -    /** Socket */
   41.84 -    private Socket socket;
   41.85 -    /** Server socket for data connection */
   41.86 -    private ServerSocket serversocket;
   41.87 -    /** FTP Response */
   41.88 -    private FTPResponse response;
   41.89 -    /** Host name */
   41.90 -    private String host;
   41.91 -    /** Port number */
   41.92 -    private int port;
   41.93 -    /** User name */
   41.94 -    private String user;
   41.95 -    /** Password */
   41.96 -    private String password;
   41.97 -    /** Type of serer system */
   41.98 -    private String serversystem = null;
   41.99 -    /** Is connected to server? */
  41.100 -    private boolean connected = false;
  41.101 -    /** Object used during reconnection */
  41.102 -    private Reconnect reconn = null;
  41.103 -    /** Type of data transfer mode */
  41.104 -    private boolean passiveMode = false;
  41.105 -    /** Default FTP port number */
  41.106 -    public final static int DEFAULT_PORT = 21;
  41.107 -    /** Size of buffer */
  41.108 -    private final static int BUFFER = 1024;
  41.109 -    /** Timeout */
  41.110 -    private final static int TIMEOUT = 60000;
  41.111 -    private String startdir = "/";
  41.112 -
  41.113 -    /** Create new FTPClient with this login information
  41.114 -     * @param loginfo
  41.115 -     */
  41.116 -    public FTPClient(FTPLogInfo loginfo) {
  41.117 -        this.host = loginfo.getHost();
  41.118 -        this.port = loginfo.getPort();
  41.119 -        this.user = loginfo.getUser();
  41.120 -        this.password = loginfo.getPassword();
  41.121 -        this.startdir = loginfo.getRootFolder();
  41.122 -        setPassiveMode(loginfo.isPassiveMode());
  41.123 -    }
  41.124 -
  41.125 -    //***************************************************************************
  41.126 -    /** Compare this login information.
  41.127 -     * @return 0 if login informations are equal;
  41.128 -     *         1 if login informations refer to the same resource but can't be uses to login;
  41.129 -     *        -1 if login informations are different
  41.130 -     * @param loginfo
  41.131 -     */
  41.132 -    public int compare(LogInfo loginfo) {
  41.133 -        if (!(loginfo instanceof FTPLogInfo)) {
  41.134 -            return -1;
  41.135 -        }
  41.136 -        if (host.equals(((FTPLogInfo) loginfo).getHost()) && port == ((FTPLogInfo) loginfo).getPort() && user.equals(((FTPLogInfo) loginfo).getUser())) {
  41.137 -            if (password.equals(((FTPLogInfo) loginfo).getPassword())) {
  41.138 -                return 0;
  41.139 -            } else {
  41.140 -                return 1;
  41.141 -            }
  41.142 -        } else {
  41.143 -            return -1;
  41.144 -        }
  41.145 -    }
  41.146 -
  41.147 -    //***************************************************************************
  41.148 -    /** Interface for notify of reconnection. */
  41.149 -    public interface Reconnect {
  41.150 -
  41.151 -        /**
  41.152 -         * @param mess message with reason of closed connection
  41.153 -         * @return whether connection should be restored
  41.154 -         */
  41.155 -        public boolean notifyReconnect(String mess);
  41.156 -    }
  41.157 -
  41.158 -    //***************************************************************************
  41.159 -    /** Sets reconnect object
  41.160 -     * @param ro reconnect object
  41.161 -     */
  41.162 -    public void setReconnect(Reconnect ro) {
  41.163 -        reconn = ro;
  41.164 -    }
  41.165 -
  41.166 -
  41.167 -   //***************************************************************************
  41.168 -    /** Whether passive mode is set.
  41.169 -     * @return Value of property passiveMode.
  41.170 -     */
  41.171 -    public boolean isPassiveMode() {
  41.172 -        return passiveMode;
  41.173 -    }
  41.174 -
  41.175 -    //***************************************************************************
  41.176 -    /** Set the passive mode.
  41.177 -     * @param passiveMode New value of property passiveMode.
  41.178 -     */
  41.179 -    public void setPassiveMode(boolean passiveMode) {
  41.180 -        this.passiveMode = passiveMode;
  41.181 -    }
  41.182 -
  41.183 -    //***************************************************************************
  41.184 -    /** Gets last respond from server
  41.185 -     * @return last response
  41.186 -     */
  41.187 -    protected FTPResponse getResponse() {
  41.188 -        return response;
  41.189 -    }
  41.190 -
  41.191 -    //***************************************************************************
  41.192 -    /** Read response from server
  41.193 -     * @throws IOException if any error occured
  41.194 -     */
  41.195 -    protected void setResponse() throws IOException {
  41.196 -        response = new FTPResponse(in);
  41.197 -        response.writeLog(log);
  41.198 -    }
  41.199 -
  41.200 -    //***************************************************************************
  41.201 -    /** Test whether server system is Unix type
  41.202 -     * @return true in case of unix system
  41.203 -     */
  41.204 -    protected boolean isUnixType() {
  41.205 -        if (serversystem != null) {
  41.206 -            return serversystem.toUpperCase().startsWith("UNIX");
  41.207 -        }
  41.208 -        return false;
  41.209 -    }
  41.210 -
  41.211 -    //***************************************************************************
  41.212 -    /** Get server root filename
  41.213 -     * @return root */
  41.214 -    public RemoteFileName getRoot() {
  41.215 -        return FTPFileName.getRoot();
  41.216 -    }
  41.217 -
  41.218 -    //***************************************************************************
  41.219 -    /** Connects to host
  41.220 -     * @throws IOException if any error occured
  41.221 -     */
  41.222 -    public synchronized void connect() throws IOException {
  41.223 -        socket = new Socket(host, port);
  41.224 -        socket.setSoTimeout(TIMEOUT);
  41.225 -        in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  41.226 -        out = new PrintWriter(socket.getOutputStream());
  41.227 -        // read response
  41.228 -        setResponse();
  41.229 -        // wait until service is ready
  41.230 -        while (getResponse().isPositivePreliminary()) {
  41.231 -            setResponse();
  41.232 -        }
  41.233 -        // is ready for new user?
  41.234 -        if (!getResponse().isPositiveCompletion()) {
  41.235 -            throw new FTPException(getResponse());
  41.236 -        }
  41.237 -
  41.238 -        login();
  41.239 -        binary();
  41.240 -    }
  41.241 -
  41.242 -    //***************************************************************************
  41.243 -    /** Reconnect
  41.244 -     * @throws IOException
  41.245 -     */
  41.246 -    public void reconnect() throws IOException {
  41.247 -        close();
  41.248 -        connect();
  41.249 -    }
  41.250 -
  41.251 -    //***************************************************************************
  41.252 -    /** Sends command through control connection to host
  41.253 -     * @param command command to send
  41.254 -     * @throws IOException
  41.255 -     */
  41.256 -    protected synchronized void sendCommand(String command) throws IOException {
  41.257 -        out.println(command);
  41.258 -        out.flush();
  41.259 -        if (command.toLowerCase().startsWith("pass")) {
  41.260 -            Logger.getLogger(this.getClass().getName()).log(Level.FINE,"PASS *****");
  41.261 -        } else {
  41.262 -            Logger.getLogger(this.getClass().getName()).log(Level.FINE,command);
  41.263 -        }
  41.264 -        // read response
  41.265 -        setResponse();
  41.266 -    }
  41.267 -
  41.268 -    //***************************************************************************
  41.269 -    /** Sends command and check response for PositiveCompletion reply. In case of other reply, FTPException is thrown
  41.270 -     * @param command command
  41.271 -     * @param retry  whether command should be repeated in case of lost connection
  41.272 -     * @throws IOException
  41.273 -     */
  41.274 -    protected synchronized void processSimpleCommand(String command, boolean retry) throws IOException {
  41.275 -        processSimpleCommand(command, FTPResponse.POSITIVE_COMPLETION, retry);
  41.276 -    }
  41.277 -
  41.278 -    //***************************************************************************
  41.279 -    /** Sends command and check response for required reply
  41.280 -     * @reply acceptable reply (first digit); if other reply is returned, FTPException is thrown
  41.281 -     * @param command command
  41.282 -     * @param reply expected reply
  41.283 -     * @param retry whether command should be repeated in case of lost connection
  41.284 -     * @throws IOException
  41.285 -     */
  41.286 -    protected synchronized void processSimpleCommand(String command, int reply, boolean retry) throws IOException {
  41.287 -        try {
  41.288 -            sendCommand(command);
  41.289 -            if (getResponse().getFirstDigit() != reply) {
  41.290 -                throw new FTPException(getResponse());
  41.291 -            }
  41.292 -        } catch (IOException e) {
  41.293 -            if (retry && reconn != null && connLostException(e)) {
  41.294 -                if (reconn.notifyReconnect(e.toString())) {
  41.295 -                    reconnect();
  41.296 -                    processSimpleCommand(command, reply, false);
  41.297 -                } else {
  41.298 -                    return;
  41.299 -                }
  41.300 -            } else {
  41.301 -                throw e;
  41.302 -            }
  41.303 -        }
  41.304 -    }
  41.305 -
  41.306 -    //***************************************************************************
  41.307 -    /** Test whether the exception means that connection was lost. 
  41.308 -     */
  41.309 -    private boolean connLostException(IOException e) {
  41.310 -        boolean lost = (e instanceof SocketException || (e instanceof FTPException && ((FTPException) e).getResponse().getCode() == 421));
  41.311 -        if (lost) {
  41.312 -            connected = false;
  41.313 -        }
  41.314 -        return lost;
  41.315 -    }
  41.316 -
  41.317 -    //***************************************************************************
  41.318 -    /** Login to server
  41.319 -     * @throws IOException
  41.320 -     */
  41.321 -    protected synchronized void login() throws IOException {
  41.322 -        // send USER command
  41.323 -        sendCommand("USER " + user);
  41.324 -        if (getResponse().isPositiveCompletion()) {
  41.325 -            return;
  41.326 -        } // password isn't required
  41.327 -        // is password expected?
  41.328 -        if (!getResponse().isPositiveIntermediate()) {
  41.329 -            throw new FTPException(getResponse());
  41.330 -        }
  41.331 -        processSimpleCommand("PASS " + password, false);
  41.332 -        connected = true;
  41.333 -//        processSimpleCommand("CWD " + startdir, false);
  41.334 -        // find out server system
  41.335 -        processSimpleCommand("SYST", false);
  41.336 -        if (getResponse().getResponse().length() >= 5) {
  41.337 -            serversystem = getResponse().getResponse().substring(4);
  41.338 -        }
  41.339 -    }
  41.340 -
  41.341 -    //***************************************************************************
  41.342 -    /** Test whether client is connected to server
  41.343 -     * @return true if client is connected to server
  41.344 -     */
  41.345 -    public boolean isConnected() {
  41.346 -        return connected;
  41.347 -    }
  41.348 -
  41.349 -    //***************************************************************************
  41.350 -    /** Opens data connection and send command 
  41.351 -     * @param command command to send
  41.352 -     * @throws IOException
  41.353 -     * @return created data socket
  41.354 -     */
  41.355 -    protected synchronized Socket openData(String command) throws IOException {
  41.356 -        // use passive or active mode acording to passiveMode property
  41.357 -        if (isPassiveMode()) {
  41.358 -            return openDataPassive(command);
  41.359 -        } else {
  41.360 -            return openDataActive(command);
  41.361 -        }
  41.362 -    }
  41.363 -
  41.364 -    //***************************************************************************
  41.365 -    /** Opens data connection and send command
  41.366 -     * @param command command to send
  41.367 -     * @throws IOException
  41.368 -     * @return created data socket
  41.369 -     */
  41.370 -    protected synchronized Socket openDataActive(String command) throws IOException {
  41.371 -        // create server socket
  41.372 -        serversocket = new ServerSocket(0);
  41.373 -        // find out the port where server listen
  41.374 -        int lPort = serversocket.getLocalPort();
  41.375 -        // prepare parameter for PORT command
  41.376 -        String param = InetAddress.getLocalHost().getHostAddress().replace('.', ',') + "," + (lPort / 256) + "," + (lPort % 256);
  41.377 -        // send port command
  41.378 -        processSimpleCommand("PORT " + param, false);
  41.379 -        // send desired command
  41.380 -        processSimpleCommand(command, FTPResponse.POSITIVE_PRELIMINARY, false);
  41.381 -        //listen for a connection
  41.382 -        Socket datasocket = serversocket.accept();
  41.383 -        return datasocket;
  41.384 -    }
  41.385 -
  41.386 -    //***************************************************************************
  41.387 -    /** Opens data connection and send command
  41.388 -     * @param command command to send
  41.389 -     * @throws IOException
  41.390 -     * @return created data socket
  41.391 -     */
  41.392 -    protected synchronized Socket openDataPassive(String command) throws IOException {
  41.393 -        // send PASSIVE command
  41.394 -        processSimpleCommand("PASV", false);
  41.395 -        // get response
  41.396 -        String resp = getResponse().getResponse();
  41.397 -        // get host and port from response
  41.398 -        String lHost = "";
  41.399 -        int lPort = 0;
  41.400 -        boolean success = false;
  41.401 -        if (getResponse().getCode() == 227) {
  41.402 -            // host and port are commonly in bar
  41.403 -            int openbar = resp.indexOf('(');
  41.404 -            int closebar = resp.indexOf(')');
  41.405 -            if (openbar > 3 && closebar > 3 && openbar < closebar) {
  41.406 -                // hostport = host and port separared by commas
  41.407 -                String hostport = resp.substring(openbar + 1, closebar);
  41.408 -                StringTokenizer st = new StringTokenizer(hostport, ",");
  41.409 -                if (st.countTokens() == 6) {
  41.410 -                    // get host
  41.411 -                    for (int i = 0; i < 4; i++) {
  41.412 -                        lHost = lHost + st.nextToken() + (i < 3 ? "." : "");
  41.413 -                    }
  41.414 -                    // count port
  41.415 -                    try {
  41.416 -                        lPort = Integer.parseInt(st.nextToken()) * 256 + Integer.parseInt(st.nextToken());
  41.417 -                        success = true;
  41.418 -                    } // reading wasn't successful
  41.419 -                    catch (NumberFormatException e) {
  41.420 -                        success = false;
  41.421 -                    }
  41.422 -                }
  41.423 -            }
  41.424 -        }
  41.425 -        // readinf host and port not successful
  41.426 -        if (!success) {
  41.427 -            throw new IOException("Can't recognize PASV command response. Use active mode.\n" + response);
  41.428 -        }
  41.429 -        // create new socket
  41.430 -        Socket datasocket = new Socket(lHost, lPort);
  41.431 -        // set timeout
  41.432 -        datasocket.setSoTimeout(TIMEOUT);
  41.433 -        // send desired command
  41.434 -        processSimpleCommand(command, FTPResponse.POSITIVE_PRELIMINARY, false);
  41.435 -        return datasocket;
  41.436 -    }
  41.437 -
  41.438 -    //***************************************************************************
  41.439 -    /** Close data connection
  41.440 -     * @param datasocket data socket to close
  41.441 -     * @throws IOException
  41.442 -     */
  41.443 -    protected void closeData(Socket datasocket) throws IOException {
  41.444 -        while (getResponse().isPositivePreliminary()) {
  41.445 -            setResponse();
  41.446 -        }
  41.447 -        if (!getResponse().isPositiveCompletion()) {
  41.448 -            throw new FTPException(getResponse());
  41.449 -        }
  41.450 -        // close all
  41.451 -        datasocket.close();
  41.452 -        if (serversocket != null) {
  41.453 -            serversocket.close();
  41.454 -        }
  41.455 -    }
  41.456 -
  41.457 -    //***************************************************************************
  41.458 -    /** Get file from server.
  41.459 -     * @param what
  41.460 -     * @param where
  41.461 -     * @throws IOException
  41.462 -     */
  41.463 -    public synchronized void get(RemoteFileName what, File where) throws IOException {
  41.464 -        int count = 0;
  41.465 -        while (count++ < 2) {
  41.466 -            try {
  41.467 -                // open data connection
  41.468 -                Socket datasocket = openData("RETR " + ((FTPFileName) what).getFullName());
  41.469 -                // open streams
  41.470 -                InputStream datain = datasocket.getInputStream();
  41.471 -                OutputStream fileout = new FileOutputStream(where);
  41.472 -
  41.473 -                // copy data
  41.474 -                byte[] buffer = new byte[BUFFER];
  41.475 -                int len;
  41.476 -                while ((len = datain.read(buffer)) != -1) {
  41.477 -                    fileout.write(buffer, 0, len);
  41.478 -                }
  41.479 -                // close stream
  41.480 -                datain.close();
  41.481 -                fileout.close();
  41.482 -                // close data stream
  41.483 -                closeData(datasocket);
  41.484 -                break;
  41.485 -            } catch (IOException se) {
  41.486 -                if (reconn != null && count < 2 && connLostException(se)) {
  41.487 -                    if (reconn.notifyReconnect(se.toString())) {
  41.488 -                        reconnect();
  41.489 -                    } else {
  41.490 -                        return;
  41.491 -                    }
  41.492 -                } else {
  41.493 -                    throw se;
  41.494 -                }
  41.495 -            }
  41.496 -        }
  41.497 -    }
  41.498 -
  41.499 -    //***************************************************************************
  41.500 -    /** Put file to server
  41.501 -     * @param what
  41.502 -     * @param where
  41.503 -     * @throws IOException
  41.504 -     */
  41.505 -    public synchronized void put(File what, RemoteFileName where) throws IOException {
  41.506 -        int count = 0;
  41.507 -        while (count++ < 2) {
  41.508 -            try {
  41.509 -                // open data connection
  41.510 -                Socket datasocket = openData("STOR " + ((FTPFileName) where).getFullName());
  41.511 -                // open streams
  41.512 -                InputStream filein = new FileInputStream(what);
  41.513 -                OutputStream dataout = datasocket.getOutputStream();
  41.514 -
  41.515 -                // copy data
  41.516 -                byte[] buffer = new byte[BUFFER];
  41.517 -                int len;
  41.518 -                while ((len = filein.read(buffer)) != -1) {
  41.519 -                    dataout.write(buffer, 0, len);
  41.520 -                }
  41.521 -                // close streams
  41.522 -                dataout.close();
  41.523 -                filein.close();
  41.524 -                // close data
  41.525 -                closeData(datasocket);
  41.526 -                break;
  41.527 -            } catch (IOException se) {
  41.528 -                if (reconn != null && count < 2 && connLostException(se)) {
  41.529 -                    if (reconn.notifyReconnect(se.toString())) {
  41.530 -                        reconnect();
  41.531 -                    } else {
  41.532 -                        return;
  41.533 -                    }
  41.534 -                } else {
  41.535 -                    throw se;
  41.536 -                }
  41.537 -            }
  41.538 -        }
  41.539 -    }
  41.540 -
  41.541 -    //***************************************************************************
  41.542 -    /** Get file list of directory
  41.543 -     */
  41.544 -    /*
  41.545 -    private synchronized String[] dir(String directory) throws IOException {
  41.546 -    StringBuffer sbuffer = new StringBuffer();
  41.547 -    int count = 0;
  41.548 -    while (count++ < 2) {
  41.549 -    try { 
  41.550 -    // open data connection
  41.551 -    Socket datasocket = openData(directory==null?"NLST":"NLST "+directory);
  41.552 -    // open stream
  41.553 -    InputStreamReader datain = new InputStreamReader(datasocket.getInputStream());
  41.554 -    // read list
  41.555 -    char[] buffer = new char[BUFFER];
  41.556 -    int len;
  41.557 -    while ((len = datain.read(buffer)) != -1) {
  41.558 -    sbuffer.append(buffer, 0, len);
  41.559 -    }
  41.560 -    // close stream
  41.561 -    datain.close();
  41.562 -    // close data connection
  41.563 -    closeData(datasocket);  	
  41.564 -    break;
  41.565 -    }
  41.566 -    catch (IOException se) {
  41.567 -    if (reconn!=null && count < 2 && connLostException(se))
  41.568 -    if (reconn.notifyReconnect(se.toString())) reconnect();
  41.569 -    else return new String[0];
  41.570 -    else throw se;
  41.571 -    }  
  41.572 -    }
  41.573 -    // convert string tokenizer to array of strings
  41.574 -    StringTokenizer stoken = new StringTokenizer(sbuffer.toString(),"\r\n");
  41.575 -    String list[] = new String[stoken.countTokens()];
  41.576 -    int counttoken=0;
  41.577 -    while (stoken.hasMoreTokens()) 
  41.578 -    list[counttoken++]=stoken.nextToken();
  41.579 -    return list;
  41.580 -    }	
  41.581 -     */
  41.582 -    //***************************************************************************
  41.583 -  /* Parse list obtained from server for file attributes
  41.584 -     */
  41.585 -    private FTPFileAttributes[] parseList(StringTokenizer stoken, String name) {
  41.586 -        //TODO - soft links, /dev dir, dir with spaces
  41.587 -        StringTokenizer line;
  41.588 -        FTPFileAttributes attrib[] = null;
  41.589 -        FTPFileAttributes at = null;
  41.590 -        String word;
  41.591 -        boolean skip = false;
  41.592 -        boolean error = false;
  41.593 -        int count = 0;
  41.594 -        int col;
  41.595 -        String month = null;
  41.596 -        int day = 0;
  41.597 -        while (stoken.hasMoreTokens()) {
  41.598 -            String tmp;
  41.599 -            line = new StringTokenizer(tmp = stoken.nextToken());
  41.600 -            col = 0;
  41.601 -            at = new FTPFileAttributes();
  41.602 -            while (line.hasMoreTokens()) {
  41.603 -                word = line.nextToken();
  41.604 -                switch (col) {
  41.605 -                    case 0:
  41.606 -                        if (count == 0) {
  41.607 -                            if (word.equals("total")) {
  41.608 -                                skip = true;
  41.609 -                                break;
  41.610 -                            }
  41.611 -                        }
  41.612 -                        if (word.startsWith("d")) {
  41.613 -                            at.setIsDirectory(true);
  41.614 -                        } else if (word.startsWith("-")) {
  41.615 -                            at.setIsDirectory(false);
  41.616 -                        } else {
  41.617 -                            skip = true;
  41.618 -                        }
  41.619 -                        at.setRights(word.substring(1));
  41.620 -                        break;
  41.621 -                    case 1:
  41.622 -                        try {
  41.623 -                            at.setLinks(Integer.parseInt(word));
  41.624 -                        } catch (NumberFormatException e) {
  41.625 -                            error = true;
  41.626 -                        }
  41.627 -                        break;
  41.628 -                    case 2:
  41.629 -                        at.setUser(word);
  41.630 -                        break;
  41.631 -                    case 3:
  41.632 -                        at.setGroup(word);
  41.633 -                        break;
  41.634 -                    case 4:
  41.635 -                        try {
  41.636 -                            at.setSize(Integer.parseInt(word));
  41.637 -                        } catch (NumberFormatException e) {
  41.638 -                            error = true;
  41.639 -                        }
  41.640 -                        break;
  41.641 -                    case 5:
  41.642 -                        month = word;
  41.643 -                        break;
  41.644 -                    case 6:
  41.645 -                        try {
  41.646 -                            day = Integer.parseInt(word);
  41.647 -                        } catch (NumberFormatException e) {
  41.648 -                            error = true;
  41.649 -                        }
  41.650 -                        if (day < 1 || day > 31) {
  41.651 -                            error = true;
  41.652 -                        }
  41.653 -                        break;
  41.654 -                    case 7:
  41.655 -                        if (!at.setDate(month, day, word)) {
  41.656 -                            error = true;
  41.657 -                        }
  41.658 -                        break;
  41.659 -                    case 8:
  41.660 -                        at.setName(new FTPFileName(name, word));
  41.661 -                        if ((word.equals(".") || word.equals("..")) && count <= 2) {
  41.662 -                            skip = true;
  41.663 -                        }
  41.664 -                        break;
  41.665 -
  41.666 -                }
  41.667 -                if (skip || error) {
  41.668 -                    break;
  41.669 -                }
  41.670 -                col++;
  41.671 -            }
  41.672 -            if (skip || error) {
  41.673 -                if (error) {
  41.674 -                    System.out.println("NOT RECOGNIZED: " + tmp);
  41.675 -                }
  41.676 -                skip = false;
  41.677 -                error = false;
  41.678 -            } else {
  41.679 -                if (attrib == null) {
  41.680 -                    attrib = new FTPFileAttributes[stoken.countTokens() + 1];
  41.681 -                }
  41.682 -                attrib[count] = at;
  41.683 -                count++;
  41.684 -            }
  41.685 -        }
  41.686 -        if (attrib == null) {
  41.687 -//      quick workaround - this method should not return null
  41.688 -//      if (!anyerror)
  41.689 -            attrib = EMPTY_LIST;
  41.690 -        }
  41.691 -        return attrib;
  41.692 -    }
  41.693 -
  41.694 -    /** List Parser interface 
  41.695 -     * @deprecated never used
  41.696 -     */
  41.697 -    @Deprecated
  41.698 -    public interface ListParser {
  41.699 -
  41.700 -        /** Parsers list
  41.701 -         * @param list
  41.702 -         * @return
  41.703 -         */
  41.704 -        @Deprecated
  41.705 -        public RemoteFileAttributes parseList(StringTokenizer list);
  41.706 -    }
  41.707 -
  41.708 -    /** Add list parser
  41.709 -     * @param parser
  41.710 -     */
  41.711 -    @Deprecated
  41.712 -    public void addParser(ListParser parser) {
  41.713 -        
  41.714 -    }
  41.715 -
  41.716 -    /** Add list parser for specified type
  41.717 -     * @param type
  41.718 -     * @param parser
  41.719 -     */
  41.720 -    @Deprecated
  41.721 -    public void addParser(String type, ListParser parser) {
  41.722 -        
  41.723 -    }
  41.724 -
  41.725 -    /** Remove list parser
  41.726 -     * @param parser
  41.727 -     * @return
  41.728 -     */
  41.729 -    @Deprecated
  41.730 -    public boolean removeParser(ListParser parser) {
  41.731 -        return false;
  41.732 -    }
  41.733 -
  41.734 -    /** Remove all list parsers */
  41.735 -    @Deprecated
  41.736 -    public void removeAllParsers() {
  41.737 -    }
  41.738 -
  41.739 -    //***************************************************************************
  41.740 -    /** Return list of files in directory
  41.741 -     * @param directory
  41.742 -     * @throws IOException
  41.743 -     * @return
  41.744 -     */
  41.745 -    public synchronized RemoteFileAttributes[] list(RemoteFileName directory) throws IOException {
  41.746 -        StringBuffer sbuffer = new StringBuffer();
  41.747 -        int count = 0;
  41.748 -        if (!isConnected()) {
  41.749 -            return new RemoteFileAttributes[0];
  41.750 -        }
  41.751 -        while (count++ < 2) {
  41.752 -            try {
  41.753 -                Socket datasocket = openData(directory == null ? "LIST" : "LIST " + ((FTPFileName) directory).getFullName());
  41.754 -                // open stream
  41.755 -                InputStreamReader datain = new InputStreamReader(datasocket.getInputStream());
  41.756 -
  41.757 -                char[] buffer = new char[BUFFER];
  41.758 -                int len;
  41.759 -                while ((len = datain.read(buffer)) != -1) {
  41.760 -                    sbuffer.append(buffer, 0, len);
  41.761 -                }
  41.762 -                datain.close();
  41.763 -                closeData(datasocket);
  41.764 -                break;
  41.765 -            } catch (IOException se) {
  41.766 -                if (reconn != null && count < 2 && connLostException(se)) {
  41.767 -                    if (reconn.notifyReconnect(se.toString())) {
  41.768 -                        reconnect();
  41.769 -                    } else {
  41.770 -                        return new RemoteFileAttributes[0];
  41.771 -                    }
  41.772 -                } else {
  41.773 -                    throw se;
  41.774 -                }
  41.775 -            }
  41.776 -        }
  41.777 -        StringTokenizer stoken = new StringTokenizer(sbuffer.toString(), "\r\n");
  41.778 -        return parseList(stoken, ((FTPFileName) directory).getFullName());
  41.779 -    }
  41.780 -
  41.781 -    //***************************************************************************
  41.782 -    /** Rename file
  41.783 -     * @param from
  41.784 -     * @param to
  41.785 -     * @throws IOException
  41.786 -     */
  41.787 -    public synchronized void rename(RemoteFileName from, String to) throws IOException {
  41.788 -        FTPFileName newname = new FTPFileName(((FTPFileName) from).getDirectory(), to);
  41.789 -        int count = 0;
  41.790 -        while (count++ < 2) {
  41.791 -            try {
  41.792 -                processSimpleCommand("RNFR " + from.getFullName(), 3, false);
  41.793 -                processSimpleCommand("RNTO " + newname.getFullName(), 2, false);
  41.794 -                break;
  41.795 -            } catch (IOException se) {
  41.796 -                if (reconn != null && count < 2 && connLostException(se)) {
  41.797 -                    if (reconn.notifyReconnect(se.toString())) {
  41.798 -                        reconnect();
  41.799 -                    } else {
  41.800 -                        return;
  41.801 -                    }
  41.802 -                } else {
  41.803 -                    throw se;
  41.804 -                }
  41.805 -            }
  41.806 -        }
  41.807 -    }
  41.808 -
  41.809 -    //***************************************************************************
  41.810 -    /** Delete directory
  41.811 -     * @param path
  41.812 -     * @throws IOException
  41.813 -     */
  41.814 -    public void delete(RemoteFileName path) throws IOException {
  41.815 -        processSimpleCommand("DELE " + ((FTPFileName) path).getFullName(), true);
  41.816 -    }
  41.817 -
  41.818 -    //***************************************************************************
  41.819 -    /** Make directory
  41.820 -     * @param name
  41.821 -     * @throws IOException
  41.822 -     */
  41.823 -    public void mkdir(RemoteFileName name) throws IOException {
  41.824 -        processSimpleCommand("MKD " + name.getFullName(), true);
  41.825 -    }
  41.826 -
  41.827 -    //***************************************************************************
  41.828 -    /** Remove directory
  41.829 -     * @param path
  41.830 -     * @throws IOException
  41.831 -     */
  41.832 -    public void rmdir(RemoteFileName path) throws IOException {
  41.833 -        processSimpleCommand("RMD " + ((FTPFileName) path).getFullName(), true);
  41.834 -    }
  41.835 -
  41.836 -    //***************************************************************************
  41.837 -    /** Print working directory
  41.838 -     * @throws IOException
  41.839 -     */
  41.840 -    public void pwd() throws IOException {
  41.841 -        processSimpleCommand("PWD", true);
  41.842 -    }
  41.843 -
  41.844 -    //***************************************************************************
  41.845 -    /** Change working directory
  41.846 -     * @param path
  41.847 -     * @throws IOException
  41.848 -     */
  41.849 -    public void cwd(String path) throws IOException {
  41.850 -        processSimpleCommand("CWD " + path, true);
  41.851 -    }
  41.852 -
  41.853 -    //***************************************************************************
  41.854 -    /** Test what system server runs on
  41.855 -     * @throws IOException
  41.856 -     */
  41.857 -    public void system() throws IOException {
  41.858 -        processSimpleCommand("SYST", true);
  41.859 -    }
  41.860 -
  41.861 -    /***************************************************************************
  41.862 -    /** Set ascii mode
  41.863 -     * @throws IOException
  41.864 -     */
  41.865 -    public void ascii() throws IOException {
  41.866 -        processSimpleCommand("TYPE A", true);
  41.867 -    }
  41.868 -
  41.869 -    //***************************************************************************
  41.870 -    /** Set binary mode
  41.871 -     * @throws IOException
  41.872 -     */
  41.873 -    public void binary() throws IOException {
  41.874 -        processSimpleCommand("TYPE I", true);
  41.875 -    }
  41.876 -
  41.877 -    //***************************************************************************
  41.878 -    /** Disconnect from server */
  41.879 -    public synchronized void disconnect() {
  41.880 -        try {
  41.881 -            sendCommand("QUIT");
  41.882 -        } catch (IOException e) {
  41.883 -        }
  41.884 -        close();
  41.885 -    }
  41.886 -
  41.887 -    //***************************************************************************
  41.888 -    /** Close connection with server */
  41.889 -    public synchronized void close() {
  41.890 -        //System.out.println("Closing connection to server "+host);
  41.891 -        try {
  41.892 -            connected = false;
  41.893 -            if (in != null) {
  41.894 -                in.close();
  41.895 -                in = null;
  41.896 -            }
  41.897 -            if (out != null) {
  41.898 -                out.close();
  41.899 -                out = null;
  41.900 -            }
  41.901 -            if (socket != null) {
  41.902 -                socket.close();
  41.903 -                socket = null;
  41.904 -            }
  41.905 -        } catch (IOException e) {
  41.906 -        }
  41.907 -    }
  41.908 -/* ###########################################################################   
  41.909 -    DEPRECATED METHODS
  41.910 -  ########################################################################### */
  41.911 - //***************************************************************************
  41.912 -    /** Sets Log to PrintWriter
  41.913 -     * @deprecated : Java Logger is used instead
  41.914 -     * @param log
  41.915 -     * 
  41.916 -     */
  41.917 -    @Deprecated
  41.918 -    public void setLog(PrintWriter log) {
  41.919 -       
  41.920 -    }
  41.921 -
  41.922 -    //***************************************************************************
  41.923 -    /** Sets Log to OutputStream
  41.924 -     * @deprecated : Java Logger is used instead
  41.925 -     * @param log
  41.926 -     */
  41.927 -    @Deprecated
  41.928 -    public void setLog(OutputStream log) {
  41.929 -        
  41.930 -    }
  41.931 -
  41.932 -    //***************************************************************************
  41.933 -    /** Sets Log to FileDescriptor. In this case, log outputstream is automatically set during connecting
  41.934 -     * @deprecated : Java Logger is used instead
  41.935 -     * @param logfile 
  41.936 -     * @throws IOException  
  41.937 -     */
  41.938 -    @Deprecated
  41.939 -    public void setLog(File logfile) throws IOException {
  41.940 -       
  41.941 -    }
  41.942 -
  41.943 - 
  41.944 -}
    42.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPException.java	Wed Jul 28 12:48:15 2010 -0400
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,68 +0,0 @@
    42.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    42.5 -/*
    42.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    42.7 -/*
    42.8 -/* The contents of this file are subject to the terms of either the GNU
    42.9 -/* General Public License Version 2 only ("GPL") or the Common
   42.10 -/* Development and Distribution License("CDDL") (collectively, the
   42.11 -/* "License"). You may not use this file except in compliance with the
   42.12 -/* License. You can obtain a copy of the License at
   42.13 -/* http://www.netbeans.org/cddl-gplv2.html
   42.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   42.15 -/* specific language governing permissions and limitations under the
   42.16 -/* License.  When distributing the software, include this License Header
   42.17 -/* Notice in each file and include the License file at
   42.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   42.19 -/* particular file as subject to the "Classpath" exception as provided
   42.20 -/* by Sun in the GPL Version 2 section of the License file that
   42.21 -/* accompanied this code. If applicable, add the following below the
   42.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   42.23 -/* your own identifying information:
   42.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   42.25 -/*
   42.26 -/* Contributor(s):
   42.27 - *
   42.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   42.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   42.30 - * Copyright (C) 2000. All Rights Reserved.
   42.31 -/*
   42.32 -/* If you wish your version of this file to be governed by only the CDDL
   42.33 -/* or only the GPL Version 2, indicate your decision by adding
   42.34 -/* "[Contributor] elects to include this software in this distribution
   42.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   42.36 -/* single choice of license, a recipient has the option to distribute
   42.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   42.38 -/* to extend the choice of license to its licensees as provided above.
   42.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   42.40 -/* Version 2 license, then the option applies only if the new code is
   42.41 -/* made subject to such option by the copyright holder.
   42.42 - *
   42.43 - * Contributor(s): Libor Martinek.
   42.44 - */
   42.45 -
   42.46 -package org.netbeans.modules.remotefs.ftpclient;
   42.47 -
   42.48 -/** FTPException
   42.49 - * @author Libor Martinek
   42.50 - * @version 1.0
   42.51 - */
   42.52 -public class FTPException extends java.io.IOException {
   42.53 -  static final long serialVersionUID = 4008993924766308326L;
   42.54 -  private FTPResponse response;
   42.55 -
   42.56 -  /** Creates new FTPException
   42.57 -   * @param response FTPResponse object
   42.58 -   */
   42.59 -  public FTPException(FTPResponse response) {
   42.60 -    super(response.toString());
   42.61 -    this.response=response;
   42.62 -  }
   42.63 -
   42.64 -  /** Returns FTPResponse of this exception
   42.65 -   * @return FTPResponse
   42.66 -   */
   42.67 -  public FTPResponse getResponse() {
   42.68 -    return response;
   42.69 -  }
   42.70 -  
   42.71 -}
   42.72 \ No newline at end of file
    43.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPFileAttributes.java	Wed Jul 28 12:48:15 2010 -0400
    43.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.3 @@ -1,172 +0,0 @@
    43.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    43.5 -/*
    43.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    43.7 -/*
    43.8 -/* The contents of this file are subject to the terms of either the GNU
    43.9 -/* General Public License Version 2 only ("GPL") or the Common
   43.10 -/* Development and Distribution License("CDDL") (collectively, the
   43.11 -/* "License"). You may not use this file except in compliance with the
   43.12 -/* License. You can obtain a copy of the License at
   43.13 -/* http://www.netbeans.org/cddl-gplv2.html
   43.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   43.15 -/* specific language governing permissions and limitations under the
   43.16 -/* License.  When distributing the software, include this License Header
   43.17 -/* Notice in each file and include the License file at
   43.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   43.19 -/* particular file as subject to the "Classpath" exception as provided
   43.20 -/* by Sun in the GPL Version 2 section of the License file that
   43.21 -/* accompanied this code. If applicable, add the following below the
   43.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   43.23 -/* your own identifying information:
   43.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   43.25 -/*
   43.26 -/* Contributor(s):
   43.27 - *
   43.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   43.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   43.30 - * Copyright (C) 2000. All Rights Reserved.
   43.31 -/*
   43.32 -/* If you wish your version of this file to be governed by only the CDDL
   43.33 -/* or only the GPL Version 2, indicate your decision by adding
   43.34 -/* "[Contributor] elects to include this software in this distribution
   43.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   43.36 -/* single choice of license, a recipient has the option to distribute
   43.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   43.38 -/* to extend the choice of license to its licensees as provided above.
   43.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   43.40 -/* Version 2 license, then the option applies only if the new code is
   43.41 -/* made subject to such option by the copyright holder.
   43.42 - *
   43.43 - * Contributor(s): Libor Martinek.
   43.44 - */
   43.45 -
   43.46 -package org.netbeans.modules.remotefs.ftpclient;
   43.47 -
   43.48 -import java.util.*;
   43.49 -import org.netbeans.modules.remotefs.core.RemoteFileAttributes;
   43.50 -
   43.51 -
   43.52 -/** Class for storing file attributes.
   43.53 - *
   43.54 - * @author  Libor Martinek
   43.55 - * @version 1.0
   43.56 - */
   43.57 -public class FTPFileAttributes extends RemoteFileAttributes  {
   43.58 -
   43.59 -    private String rights = null;
   43.60 -    private int links = 0;
   43.61 -    private String user = null;
   43.62 -    private String group = null;
   43.63 -
   43.64 -    /** Create new FTPFileAttributes */
   43.65 -    public FTPFileAttributes(FTPFileName name,boolean isdirectory,String rights,int links,
   43.66 -                            String user,String group,long size,java.util.Date date) {
   43.67 -        super(name, isdirectory, size, date);
   43.68 -        this.rights=rights;
   43.69 -        this.links=links;
   43.70 -        this.user=user;
   43.71 -        this.group=group;
   43.72 -    }
   43.73 -    
   43.74 -    /** Create new FTPFileAttributes */
   43.75 -    public FTPFileAttributes(FTPFileName name,boolean isdirectory,long size,java.util.Date date) {
   43.76 -        super(name,isdirectory,size,date);
   43.77 -    }
   43.78 -   
   43.79 -    /** Create empty FTPFileAttributes */
   43.80 -    public FTPFileAttributes() {
   43.81 -       super();
   43.82 -    }
   43.83 -    
   43.84 -    /** Create FTPFileAttributes only with name and isdirectory flag */
   43.85 -    public FTPFileAttributes(FTPFileName name, boolean isdirectory) {
   43.86 -    	super(name,isdirectory);
   43.87 -    }	
   43.88 -    
   43.89 -    /** Set rights string */
   43.90 -    public void setRights(String rights) {  this.rights=rights; }
   43.91 -    /** Set number of links */
   43.92 -    public void setLinks(int links) { this.links=links;}
   43.93 -    /** Set user name */
   43.94 -    public void setUser(String user ) {  this.user=user;}
   43.95 -    /** Set group name */
   43.96 -    public void setGroup(String group) { this.group=group;}
   43.97 -    
   43.98 -    /** Get rights string */
   43.99 -    public String getRights() { return rights; }
  43.100 -    /** Get number of links */
  43.101 -    public int getLinks() { return links; }
  43.102 -    /** Get user name */
  43.103 -    public String getUser() { return user; }
  43.104 -    /** Get group name */
  43.105 -    public String getGroup() { return group; }
  43.106 -    
  43.107 -    //*****************************************************************
  43.108 -    /** Set date in format got from FTP server
  43.109 -     * @param month first three letter from month
  43.110 -     * @param day number of day
  43.111 -     * @param timeoryear year or time
  43.112 -     * @return true if format of date is correct
  43.113 -     */
  43.114 -    public boolean setDate(String month, int day, String timeoryear) {
  43.115 -	    int nmonth = 0;
  43.116 -	    
  43.117 -	    if (month.equalsIgnoreCase("JAN")) nmonth = 1;
  43.118 -	    else if (month.equalsIgnoreCase("FEB")) nmonth = 2;
  43.119 -	    else if (month.equalsIgnoreCase("MAR")) nmonth = 3;
  43.120 -	    else if (month.equalsIgnoreCase("APR")) nmonth = 4;
  43.121 -	    else if (month.equalsIgnoreCase("MAY")) nmonth = 5;
  43.122 -	    else if (month.equalsIgnoreCase("JUN")) nmonth = 6;
  43.123 -	    else if (month.equalsIgnoreCase("JUL")) nmonth = 7;
  43.124 -	    else if (month.equalsIgnoreCase("AUG")) nmonth = 8;
  43.125 -	    else if (month.equalsIgnoreCase("SEP")) nmonth = 9;
  43.126 -	    else if (month.equalsIgnoreCase("OCT")) nmonth = 10;
  43.127 -	    else if (month.equalsIgnoreCase("NOV")) nmonth = 11;
  43.128 -	    else if (month.equalsIgnoreCase("DEC")) nmonth = 12;
  43.129 -            // [PENDING] temporary workaround for localized filesystems
  43.130 -            // nevertheless, the solution may be very difficult.
  43.131 -            else nmonth = 1;
  43.132 -	    nmonth--;
  43.133 -	    
  43.134 -	    Calendar cal = Calendar.getInstance();
  43.135 -	    Date date = cal.getTime();
  43.136 -	    int curryear = cal.get(Calendar.YEAR);
  43.137 -	    cal.clear();
  43.138 -	    
  43.139 -	    int colon = timeoryear.indexOf(':');
  43.140 -	    if (colon == -1) {
  43.141 -	        int nyear=0;
  43.142 -	        try {  nyear=Integer.parseInt(timeoryear); }
  43.143 -	        catch (NumberFormatException e) { return false; }
  43.144 -	        cal.set(nyear,nmonth,day,0,0,0);
  43.145 -	    }    
  43.146 -	    else  {
  43.147 -	      StringTokenizer stime = new StringTokenizer(timeoryear,":");
  43.148 -	      String hour="0", min="0", sec="0";
  43.149 -	      int nhour=0, nmin=0, nsec=0;
  43.150 -	      if (stime.hasMoreTokens())  hour=stime.nextToken();
  43.151 -	      if (stime.hasMoreTokens())  min=stime.nextToken();
  43.152 -	      if (stime.hasMoreTokens())  sec=stime.nextToken();
  43.153 -	      try {
  43.154 -	        nhour=Integer.parseInt(hour);
  43.155 -	        nmin=Integer.parseInt(min);
  43.156 -	        nsec=Integer.parseInt(sec);
  43.157 -	      }
  43.158 -	      catch (NumberFormatException e) {
  43.159 -	         //nhour=0; nmin=0; nsec=0;
  43.160 -                 return false;
  43.161 -	      }
  43.162 -	      cal.set(Calendar.HOUR,nhour);
  43.163 -	      cal.set(Calendar.MINUTE,nmin);
  43.164 -	      cal.set(Calendar.SECOND,nsec);
  43.165 -	      cal.set(Calendar.YEAR,curryear);
  43.166 -	      cal.set(Calendar.MONTH,nmonth);
  43.167 -	      cal.set(Calendar.DAY_OF_MONTH,day);
  43.168 -	      if (date.compareTo(cal.getTime()) < 0 ) cal.set(Calendar.YEAR,curryear-1);
  43.169 -	    }  
  43.170 -	    date = cal.getTime();
  43.171 -	    this.setDate(date); 
  43.172 -            return true;
  43.173 -    }  
  43.174 - 
  43.175 -}
  43.176 \ No newline at end of file
    44.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPFileName.java	Wed Jul 28 12:48:15 2010 -0400
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,102 +0,0 @@
    44.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    44.5 -/*
    44.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    44.7 -/*
    44.8 -/* The contents of this file are subject to the terms of either the GNU
    44.9 -/* General Public License Version 2 only ("GPL") or the Common
   44.10 -/* Development and Distribution License("CDDL") (collectively, the
   44.11 -/* "License"). You may not use this file except in compliance with the
   44.12 -/* License. You can obtain a copy of the License at
   44.13 -/* http://www.netbeans.org/cddl-gplv2.html
   44.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   44.15 -/* specific language governing permissions and limitations under the
   44.16 -/* License.  When distributing the software, include this License Header
   44.17 -/* Notice in each file and include the License file at
   44.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   44.19 -/* particular file as subject to the "Classpath" exception as provided
   44.20 -/* by Sun in the GPL Version 2 section of the License file that
   44.21 -/* accompanied this code. If applicable, add the following below the
   44.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   44.23 -/* your own identifying information:
   44.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   44.25 -/*
   44.26 -/* Contributor(s):
   44.27 - *
   44.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   44.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   44.30 - * Copyright (C) 2000. All Rights Reserved.
   44.31 -/*
   44.32 -/* If you wish your version of this file to be governed by only the CDDL
   44.33 -/* or only the GPL Version 2, indicate your decision by adding
   44.34 -/* "[Contributor] elects to include this software in this distribution
   44.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   44.36 -/* single choice of license, a recipient has the option to distribute
   44.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   44.38 -/* to extend the choice of license to its licensees as provided above.
   44.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   44.40 -/* Version 2 license, then the option applies only if the new code is
   44.41 -/* made subject to such option by the copyright holder.
   44.42 - *
   44.43 - * Contributor(s): Libor Martinek.
   44.44 - */
   44.45 -
   44.46 -package org.netbeans.modules.remotefs.ftpclient;
   44.47 -
   44.48 -import org.netbeans.modules.remotefs.core.RemoteFileName;
   44.49 -
   44.50 -/**
   44.51 - *
   44.52 - * @author  lmartinek
   44.53 - * @version
   44.54 - */
   44.55 -public class FTPFileName implements RemoteFileName {
   44.56 -
   44.57 -    private String name;
   44.58 -    private String directory;
   44.59 -
   44.60 -    /** Creates new FTPFileName
   44.61 -     * @param directory
   44.62 -     * @param name  */
   44.63 -    protected FTPFileName(String directory, String name) {
   44.64 -        this.name = name;
   44.65 -        this.directory = directory;
   44.66 -    }
   44.67 -
   44.68 -    /** Get the name. Only last name is returned, not whole path
   44.69 -     * @return  name of this object */
   44.70 -    public String getName() {
   44.71 -        return name;
   44.72 -    }
   44.73 -    
   44.74 -    /** Set new name. Used for renaming. Only name is chnaged, path remains.
   44.75 -     * @param newname  new name */
   44.76 -    public void setName(String newname) {
   44.77 -        name = newname;
   44.78 -    }
   44.79 -    
   44.80 -    /** Get full name (with whole path).
   44.81 -     * @return  full name*/
   44.82 -    public String getFullName() {
   44.83 -        return (directory.equals("/")?"":directory) + (name.equals("/")?"":"/")  +name;
   44.84 -    }
   44.85 -    
   44.86 -    /** Get directory of this filename
   44.87 -     * @return directory of this filename */    
   44.88 -    protected String getDirectory() {
   44.89 -        return directory;   
   44.90 -    }
   44.91 -
   44.92 -    /** Create new name object under this name object.
   44.93 -     * @param name name of new name object
   44.94 -     * @return created name object */ 
   44.95 -    public RemoteFileName createNew(String name) { 
   44.96 -        return new FTPFileName(getFullName(),name);
   44.97 -    }
   44.98 -    
   44.99 -    /** Get root
  44.100 -     * @return root */    
  44.101 -    public static RemoteFileName getRoot() {
  44.102 -        return new FTPFileName("","/");
  44.103 -    }
  44.104 -    
  44.105 -}
    45.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPLogInfo.java	Wed Jul 28 12:48:15 2010 -0400
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,159 +0,0 @@
    45.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    45.5 -/*
    45.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    45.7 -/*
    45.8 -/* The contents of this file are subject to the terms of either the GNU
    45.9 -/* General Public License Version 2 only ("GPL") or the Common
   45.10 -/* Development and Distribution License("CDDL") (collectively, the
   45.11 -/* "License"). You may not use this file except in compliance with the
   45.12 -/* License. You can obtain a copy of the License at
   45.13 -/* http://www.netbeans.org/cddl-gplv2.html
   45.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   45.15 -/* specific language governing permissions and limitations under the
   45.16 -/* License.  When distributing the software, include this License Header
   45.17 -/* Notice in each file and include the License file at
   45.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   45.19 -/* particular file as subject to the "Classpath" exception as provided
   45.20 -/* by Sun in the GPL Version 2 section of the License file that
   45.21 -/* accompanied this code. If applicable, add the following below the
   45.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   45.23 -/* your own identifying information:
   45.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   45.25 -/*
   45.26 -/* Contributor(s):
   45.27 - *
   45.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   45.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   45.30 - * Copyright (C) 2000. All Rights Reserved.
   45.31 -/*
   45.32 -/* If you wish your version of this file to be governed by only the CDDL
   45.33 -/* or only the GPL Version 2, indicate your decision by adding
   45.34 -/* "[Contributor] elects to include this software in this distribution
   45.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   45.36 -/* single choice of license, a recipient has the option to distribute
   45.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   45.38 -/* to extend the choice of license to its licensees as provided above.
   45.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   45.40 -/* Version 2 license, then the option applies only if the new code is
   45.41 -/* made subject to such option by the copyright holder.
   45.42 - *
   45.43 - * Contributor(s): Libor Martinek.
   45.44 - */
   45.45 -package org.netbeans.modules.remotefs.ftpclient;
   45.46 -
   45.47 -import org.netbeans.modules.remotefs.core.LogInfo;
   45.48 -
   45.49 -/** FTPLogInfo stores login information
   45.50 - *
   45.51 - * @author  Libor Martinek
   45.52 - * @version 1.0
   45.53 - */
   45.54 -public class FTPLogInfo implements LogInfo {
   45.55 -
   45.56 -    static final long serialVersionUID = 4795532037339960289L;
   45.57 -    /** Host name */
   45.58 -    private String host = "localhost";
   45.59 -    /** Port number */
   45.60 -    private int port = FTPClient.DEFAULT_PORT;
   45.61 -    /** User name */
   45.62 -    private String user = "anonymous";
   45.63 -    /** Password */
   45.64 -    private String password = "forteuser@";
   45.65 -    private String rootFolder = "/";
   45.66 -    private boolean passiveMode = false;
   45.67 -
   45.68 -    /** Create empty LogInfo */
   45.69 -    public FTPLogInfo() {
   45.70 -    }
   45.71 -
   45.72 -    /** Create LogInfo
   45.73 -     * @param host
   45.74 -     * @param port
   45.75 -     * @param user
   45.76 -     * @param password 
   45.77 -     */
   45.78 -    public FTPLogInfo(String host, int port, String user, String password) {
   45.79 -        this.host = host;
   45.80 -        this.port = port;
   45.81 -        this.user = user;
   45.82 -        this.password = password;
   45.83 -    }
   45.84 -
   45.85 -    /** Set host name
   45.86 -     * @param host 
   45.87 -     */
   45.88 -    public void setHost(String host) {
   45.89 -        this.host = host;
   45.90 -    }
   45.91 -
   45.92 -    public void setPassiveMode(boolean aBoolean) {
   45.93 -        this.passiveMode = aBoolean;
   45.94 -    }
   45.95 -
   45.96 -    public boolean isPassiveMode() {
   45.97 -        return this.passiveMode;
   45.98 -    }
   45.99 -
  45.100 -    /** Set port number
  45.101 -     * @param port 
  45.102 -     */
  45.103 -    public void setPort(int port) {
  45.104 -        this.port = port;
  45.105 -    }
  45.106 -
  45.107 -    /** Set user name
  45.108 -     * @param user 
  45.109 -     */
  45.110 -    public void setUser(String user) {
  45.111 -        this.user = user;
  45.112 -    }
  45.113 -
  45.114 -    /** Set password
  45.115 -     * @param password 
  45.116 -     */
  45.117 -    public void setPassword(String password) {
  45.118 -        this.password = password;
  45.119 -    }
  45.120 -
  45.121 -    /** Get host name
  45.122 -     * @return 
  45.123 -     */
  45.124 -    public String getHost() {
  45.125 -        return host;
  45.126 -    }
  45.127 -
  45.128 -    /** Get port number
  45.129 -     * @return 
  45.130 -     */
  45.131 -    public int getPort() {
  45.132 -        return port;
  45.133 -    }
  45.134 -
  45.135 -    /** Get user name
  45.136 -     * @return 
  45.137 -     */
  45.138 -    public String getUser() {
  45.139 -        return user;
  45.140 -    }
  45.141 -
  45.142 -    /** Get password
  45.143 -     * @return 
  45.144 -     */
  45.145 -    public String getPassword() {
  45.146 -        return password;
  45.147 -    }
  45.148 -
  45.149 -    /** Return human redable description of this LogInfo */
  45.150 -    public String displayName() {
  45.151 -        return "ftp://" + ((user != null && user.equalsIgnoreCase("anonymous")) ? "" : user + "@") +
  45.152 -                host + ((port == FTPClient.DEFAULT_PORT) ? "" : (":" + String.valueOf(port)));
  45.153 -    }
  45.154 -
  45.155 -    public String getRootFolder() {
  45.156 -        return rootFolder;
  45.157 -    }
  45.158 -
  45.159 -    public void setRootFolder(String rootFolder) {
  45.160 -        this.rootFolder = rootFolder;
  45.161 -    }
  45.162 -}
    46.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpclient/FTPResponse.java	Wed Jul 28 12:48:15 2010 -0400
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,185 +0,0 @@
    46.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    46.5 -/*
    46.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    46.7 -/*
    46.8 -/* The contents of this file are subject to the terms of either the GNU
    46.9 -/* General Public License Version 2 only ("GPL") or the Common
   46.10 -/* Development and Distribution License("CDDL") (collectively, the
   46.11 -/* "License"). You may not use this file except in compliance with the
   46.12 -/* License. You can obtain a copy of the License at
   46.13 -/* http://www.netbeans.org/cddl-gplv2.html
   46.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   46.15 -/* specific language governing permissions and limitations under the
   46.16 -/* License.  When distributing the software, include this License Header
   46.17 -/* Notice in each file and include the License file at
   46.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   46.19 -/* particular file as subject to the "Classpath" exception as provided
   46.20 -/* by Sun in the GPL Version 2 section of the License file that
   46.21 -/* accompanied this code. If applicable, add the following below the
   46.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   46.23 -/* your own identifying information:
   46.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   46.25 -/*
   46.26 -/* Contributor(s):
   46.27 - *
   46.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   46.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   46.30 - * Copyright (C) 2000. All Rights Reserved.
   46.31 -/*
   46.32 -/* If you wish your version of this file to be governed by only the CDDL
   46.33 -/* or only the GPL Version 2, indicate your decision by adding
   46.34 -/* "[Contributor] elects to include this software in this distribution
   46.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   46.36 -/* single choice of license, a recipient has the option to distribute
   46.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   46.38 -/* to extend the choice of license to its licensees as provided above.
   46.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   46.40 -/* Version 2 license, then the option applies only if the new code is
   46.41 -/* made subject to such option by the copyright holder.
   46.42 - *
   46.43 - * Contributor(s): Libor Martinek.
   46.44 - */
   46.45 -package org.netbeans.modules.remotefs.ftpclient;
   46.46 -
   46.47 -import java.io.*;
   46.48 -
   46.49 -/** FTP Response class that reads and stores response from FTP server.
   46.50 - *
   46.51 - * @author  Libor Martinek
   46.52 - * @version 1.0
   46.53 - */
   46.54 -public class FTPResponse extends Object {
   46.55 -
   46.56 -    /** FTP Response digit code. */
   46.57 -    private int code;
   46.58 -    /** Text message */
   46.59 -    private String response;
   46.60 -    /** Positive Preliminary response */
   46.61 -    public static final int POSITIVE_PRELIMINARY = 1;
   46.62 -    /** Positive Completion resposne */
   46.63 -    public static final int POSITIVE_COMPLETION = 2;
   46.64 -    /** Positive Intermediate response */
   46.65 -    public static final int POSITIVE_INTERMEDIATE = 3;
   46.66 -    /** Treansient Negative Completion response */
   46.67 -    public static final int TRANSIENT_NEGATIVE_COMPLETION = 4;
   46.68 -    /** Permanent Negative Completion */
   46.69 -    public static final int PERMANENT_NEGATIVE_COMPLETION = 5;
   46.70 -
   46.71 -    /** Creates new FTPResponse and reads response from server.
   46.72 -     * @param in BufferedReader to read response from
   46.73 -     * @throws IOException
   46.74 -     */
   46.75 -    public FTPResponse(BufferedReader in) throws IOException {
   46.76 -        String line = in.readLine();
   46.77 -        // Get digit code
   46.78 -        String stringcode = null;
   46.79 -        if (line != null) {
   46.80 -            stringcode = line.substring(0, 3);
   46.81 -        }
   46.82 -        try {
   46.83 -            code = Integer.parseInt(stringcode);
   46.84 -        } catch (NumberFormatException e) {
   46.85 -            code = 0;
   46.86 -        }
   46.87 -        // Get Response
   46.88 -        if (line.length() >= 4 && line.charAt(3) == '-') {
   46.89 -            StringBuffer multiline = new StringBuffer();
   46.90 -            multiline.append(line);
   46.91 -            do {
   46.92 -                line = in.readLine();
   46.93 -                multiline.append("\n");
   46.94 -                multiline.append(line);
   46.95 -            } while (!line.startsWith(stringcode) || line.startsWith(stringcode + "-"));
   46.96 -            response = multiline.toString();
   46.97 -        } else {
   46.98 -            response = line;
   46.99 -        }
  46.100 -    }
  46.101 -
  46.102 -    /** Writes response from FT server to Log stream
  46.103 -     * @param log
  46.104 -     */
  46.105 -    protected void writeLog(PrintWriter log) {
  46.106 -        if (log != null) {
  46.107 -            log.println(response);
  46.108 -            log.flush();
  46.109 -        }
  46.110 -    }
  46.111 -
  46.112 -    /** Returns response.
  46.113 -     * @return String response
  46.114 -     */
  46.115 -    public String getResponse() {
  46.116 -        return response;
  46.117 -    }
  46.118 -
  46.119 -    /** Returns response
  46.120 -     * @return String response
  46.121 -     */
  46.122 -    public String toString() {
  46.123 -        return response;
  46.124 -    }
  46.125 -
  46.126 -    /** Returns code of response.
  46.127 -     * @return code
  46.128 -     */
  46.129 -    public int getCode() {
  46.130 -        return code;
  46.131 -    }
  46.132 -
  46.133 -    /** Returns first digit of response code.
  46.134 -     * @return first digit of code
  46.135 -     */
  46.136 -    public int getFirstDigit() {
  46.137 -        return getCode() / 100;
  46.138 -    }
  46.139 -
  46.140 -    /** Returns second digit of response code.
  46.141 -     * @return second digit of code
  46.142 -     */
  46.143 -    public int getSecondDigit() {
  46.144 -        return (getCode() % 100) / 10;
  46.145 -    }
  46.146 -
  46.147 -    /** Returns third digit of response code.
  46.148 -     * @return third digit of code
  46.149 -     */
  46.150 -    public int getThirdDigit() {
  46.151 -        return getCode() % 10;
  46.152 -    }
  46.153 -
  46.154 -    /** Test whether this response is Positive Preliminary.
  46.155 -     * @return
  46.156 -     */
  46.157 -    public boolean isPositivePreliminary() {
  46.158 -        return getFirstDigit() == POSITIVE_PRELIMINARY;
  46.159 -    }
  46.160 -
  46.161 -    /** Test whether this response is Positive Completion.
  46.162 -     * @return
  46.163 -     */
  46.164 -    public boolean isPositiveCompletion() {
  46.165 -        return getFirstDigit() == POSITIVE_COMPLETION;
  46.166 -    }
  46.167 -
  46.168 -    /** Test whether this response is Positive Intermediate.
  46.169 -     * @return
  46.170 -     */
  46.171 -    public boolean isPositiveIntermediate() {
  46.172 -        return getFirstDigit() == POSITIVE_INTERMEDIATE;
  46.173 -    }
  46.174 -
  46.175 -    /** Test whether this response is Transient Negative Completion.
  46.176 -     * @return
  46.177 -     */
  46.178 -    public boolean isTransientNegativeCompletion() {
  46.179 -        return getFirstDigit() == TRANSIENT_NEGATIVE_COMPLETION;
  46.180 -    }
  46.181 -
  46.182 -    /** Test whether this response is Permament Negative Completion.
  46.183 -     * @return 
  46.184 -     */
  46.185 -    public boolean isPermanentNegativeCompletion() {
  46.186 -        return getFirstDigit() == PERMANENT_NEGATIVE_COMPLETION;
  46.187 -    }
  46.188 -}
    47.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPDialogs.java	Wed Jul 28 12:48:15 2010 -0400
    47.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    47.3 @@ -1,121 +0,0 @@
    47.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    47.5 -/*
    47.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    47.7 -/*
    47.8 -/* The contents of this file are subject to the terms of either the GNU
    47.9 -/* General Public License Version 2 only ("GPL") or the Common
   47.10 -/* Development and Distribution License("CDDL") (collectively, the
   47.11 -/* "License"). You may not use this file except in compliance with the
   47.12 -/* License. You can obtain a copy of the License at
   47.13 -/* http://www.netbeans.org/cddl-gplv2.html
   47.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   47.15 -/* specific language governing permissions and limitations under the
   47.16 -/* License.  When distributing the software, include this License Header
   47.17 -/* Notice in each file and include the License file at
   47.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   47.19 -/* particular file as subject to the "Classpath" exception as provided
   47.20 -/* by Sun in the GPL Version 2 section of the License file that
   47.21 -/* accompanied this code. If applicable, add the following below the
   47.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   47.23 -/* your own identifying information:
   47.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   47.25 -/*
   47.26 -/* Contributor(s):
   47.27 - *
   47.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   47.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   47.30 - * Copyright (C) 2000. All Rights Reserved.
   47.31 -/*
   47.32 -/* If you wish your version of this file to be governed by only the CDDL
   47.33 -/* or only the GPL Version 2, indicate your decision by adding
   47.34 -/* "[Contributor] elects to include this software in this distribution
   47.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   47.36 -/* single choice of license, a recipient has the option to distribute
   47.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   47.38 -/* to extend the choice of license to its licensees as provided above.
   47.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   47.40 -/* Version 2 license, then the option applies only if the new code is
   47.41 -/* made subject to such option by the copyright holder.
   47.42 - *
   47.43 - * Contributor(s): Libor Martinek.
   47.44 - */
   47.45 -
   47.46 -package org.netbeans.modules.remotefs.ftpfs;
   47.47 -
   47.48 -import org.openide.DialogDisplayer;
   47.49 -import org.openide.NotifyDescriptor;
   47.50 -
   47.51 -/** Dialogs.
   47.52 - *
   47.53 - * @author  Libor Martinek
   47.54 - * @version 1.0
   47.55 - */
   47.56 -public class FTPDialogs extends Object {
   47.57 -
   47.58 -  /** Creates new FTPDialogs */
   47.59 -  public FTPDialogs() {
   47.60 -  }
   47.61 -
   47.62 -  public static int disconnect(String server) {
   47.63 -        Object ops[] = new String[3];
   47.64 -        ops[0] = "Yes";
   47.65 -        ops[1] = "Yes to all";
   47.66 -        ops[2] = "No";
   47.67 -        Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(
   47.68 -           "Another filesystem is also connected to server "+server+".\n"+
   47.69 -           "Do you realy want to diconnect from server?\n"+
   47.70 -           "If you say "+ops[0]+", only this fileystem will be disconnected, but you will not be able to work offline\n"+
   47.71 -           "If you say "+ops[1]+", all filesystem will be disconneected and you will be able to work offline",
   47.72 -           "Question",NotifyDescriptor.YES_NO_OPTION ,NotifyDescriptor.QUESTION_MESSAGE,ops, ops[2]));
   47.73 -        if (obj == ops[0]) return 0;
   47.74 -        if (obj == ops[1]) return 1;
   47.75 -        if (obj == ops[2]) return 2;
   47.76 -        return 2;
   47.77 -  }
   47.78 -  
   47.79 -  public static boolean connect(String server) {
   47.80 -       Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(
   47.81 -         "Another filesystem is now disconnected from server "+server+".\n"+
   47.82 -         "Do you realy want to connect to server?\n"+
   47.83 -         "If you say Yes, all other filesystems will be connected too.",
   47.84 -         "Question",NotifyDescriptor.YES_NO_OPTION ,NotifyDescriptor.QUESTION_MESSAGE,null, NotifyDescriptor.YES_OPTION));
   47.85 -       if (obj == NotifyDescriptor.YES_OPTION) 
   47.86 -         return true;
   47.87 -       else 
   47.88 -         return false;
   47.89 -  }
   47.90 -  
   47.91 -  public static void startdirNotFound(String startdir, String server) {
   47.92 -      Object ops[] = { "OK" }; 
   47.93 -      DialogDisplayer.getDefault().notify(new NotifyDescriptor(
   47.94 -         "Starting directory "+startdir+" doesn't exist on server "+server+
   47.95 -         ".\nRoot directory will be used instead.",
   47.96 -         "Startdir invalid",NotifyDescriptor.DEFAULT_OPTION ,NotifyDescriptor.INFORMATION_MESSAGE,ops, null));
   47.97 -  }
   47.98 -  
   47.99 -  public static void errorConnect(String error) {
  47.100 -    String ops[] =  {"OK"};
  47.101 -    DialogDisplayer.getDefault().notify(new NotifyDescriptor("Error during connecting to FTP server:\n"+
  47.102 -          error+"\nSet correct parameters and try to connect again.","Error",NotifyDescriptor.DEFAULT_OPTION ,NotifyDescriptor.ERROR_MESSAGE,ops, null));
  47.103 -  }   
  47.104 -
  47.105 -  public static void incorrectPassword(String server) {
  47.106 -    Object ops[] = { "OK" }; 
  47.107 -    DialogDisplayer.getDefault().notify(new NotifyDescriptor(
  47.108 -       "Another filesystem is also connected to server "+server+" with the same username,\n"+
  47.109 -       "but with other password. Set correct password and try to connect again.",
  47.110 -       "Invalid password",NotifyDescriptor.DEFAULT_OPTION ,NotifyDescriptor.ERROR_MESSAGE,ops, null));
  47.111 -  }
  47.112 -  
  47.113 -  public static boolean incorrectCache(String oldcache, String newcache, String server) {
  47.114 -     Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(
  47.115 -         "You set the cache to "+oldcache+", but another filesystem is also"+
  47.116 -         "connected\nto server "+server+" with existing cache "+newcache+"\n"+
  47.117 -         "You have to use this existing cache. Do you agree?\n"+
  47.118 -         "If you say No, you will not be connected to server",
  47.119 -         "Question",NotifyDescriptor.YES_NO_OPTION ,NotifyDescriptor.QUESTION_MESSAGE,null, NotifyDescriptor.YES_OPTION));
  47.120 -     return (obj == NotifyDescriptor.YES_OPTION); 
  47.121 -  }
  47.122 -  
  47.123 -
  47.124 -}
  47.125 \ No newline at end of file
    48.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPFileSystem.java	Wed Jul 28 12:48:15 2010 -0400
    48.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.3 @@ -1,557 +0,0 @@
    48.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    48.5 -/*
    48.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    48.7 -/*
    48.8 -/* The contents of this file are subject to the terms of either the GNU
    48.9 -/* General Public License Version 2 only ("GPL") or the Common
   48.10 -/* Development and Distribution License("CDDL") (collectively, the
   48.11 -/* "License"). You may not use this file except in compliance with the
   48.12 -/* License. You can obtain a copy of the License at
   48.13 -/* http://www.netbeans.org/cddl-gplv2.html
   48.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   48.15 -/* specific language governing permissions and limitations under the
   48.16 -/* License.  When distributing the software, include this License Header
   48.17 -/* Notice in each file and include the License file at
   48.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   48.19 -/* particular file as subject to the "Classpath" exception as provided
   48.20 -/* by Sun in the GPL Version 2 section of the License file that
   48.21 -/* accompanied this code. If applicable, add the following below the
   48.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   48.23 -/* your own identifying information:
   48.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   48.25 -/*
   48.26 -/* Contributor(s):
   48.27 - *
   48.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   48.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   48.30 - * Copyright (C) 2000. All Rights Reserved.
   48.31 -/*
   48.32 -/* If you wish your version of this file to be governed by only the CDDL
   48.33 -/* or only the GPL Version 2, indicate your decision by adding
   48.34 -/* "[Contributor] elects to include this software in this distribution
   48.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   48.36 -/* single choice of license, a recipient has the option to distribute
   48.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   48.38 -/* to extend the choice of license to its licensees as provided above.
   48.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   48.40 -/* Version 2 license, then the option applies only if the new code is
   48.41 -/* made subject to such option by the copyright holder.
   48.42 - *
   48.43 - * Contributor(s): Libor Martinek.
   48.44 - */
   48.45 -package org.netbeans.modules.remotefs.ftpfs;
   48.46 -
   48.47 -import java.beans.PropertyChangeEvent;
   48.48 -import java.beans.PropertyChangeListener;
   48.49 -import java.beans.PropertyVetoException;
   48.50 -import java.io.File;
   48.51 -import java.io.IOException;
   48.52 -import java.util.Date;
   48.53 -import org.netbeans.modules.remotefs.core.LogInfo;
   48.54 -import org.netbeans.modules.remotefs.core.RemoteClient;
   48.55 -import org.netbeans.modules.remotefs.core.RemoteFileSystem;
   48.56 -import org.netbeans.modules.remotefs.ftpclient.FTPClient;
   48.57 -import org.netbeans.modules.remotefs.ftpclient.FTPLogInfo;
   48.58 -import org.openide.DialogDisplayer;
   48.59 -import org.openide.NotifyDescriptor;
   48.60 -import org.openide.filesystems.FileObject;
   48.61 -import org.openide.filesystems.FileUtil;
   48.62 -import org.openide.options.SystemOption;
   48.63 -import org.openide.util.Exceptions;
   48.64 -
   48.65 -/** FTP FIleSystem class
   48.66 - * @author Libor Martinek
   48.67 - * @version 1.0
   48.68 - */
   48.69 -public class FTPFileSystem extends RemoteFileSystem implements FTPClient.Reconnect {
   48.70 -
   48.71 -    static final long serialVersionUID = -981665601872580022L;
   48.72 -    private static final boolean DEBUG = true;
   48.73 -    /** Name of temporary directoty (if user doesn't entry own one) */
   48.74 -    private static final String FTPWORK;
   48.75 -    /** Whether user already entered cache directory. */
   48.76 -    private boolean enteredcachedir = false;
   48.77 -    /** Global FTP FileSystem settings */
   48.78 -    private FTPSettings ftpsettings = SystemOption.findObject(FTPSettings.class, true);
   48.79 -    static final String CACHE_FOLDER_NAME = "ftpcache";
   48.80 -
   48.81 -    static {
   48.82 -        /* BUGFIX for issue #123552
   48.83 -         * We need a default cache dir. 
   48.84 -         * The default is "ftpcache" in the filesystem's root. Must be created if it doesn't exist.
   48.85 -         */
   48.86 -        FileObject fr = FileUtil.getConfigRoot();
   48.87 -        FileObject fo = fr.getFileObject(CACHE_FOLDER_NAME);
   48.88 -        if (fo == null) {
   48.89 -            try {
   48.90 -                fo = fr.createFolder(CACHE_FOLDER_NAME);
   48.91 -            } catch (IOException e) {
   48.92 -                throw new RuntimeException(e);
   48.93 -            }
   48.94 -        }
   48.95 -        FTPWORK = fo.getName();
   48.96 -    }
   48.97 -
   48.98 -    /** 
   48.99 -     * Constructor.
  48.100 -     */
  48.101 -    public FTPFileSystem() {
  48.102 -        this(new FTPLogInfo());
  48.103 -    }
  48.104 -
  48.105 -    /**
  48.106 -     * Constructor.
  48.107 -     * @param info
  48.108 -     */
  48.109 -    public FTPFileSystem(FTPLogInfo info) {
  48.110 -        super();
  48.111 -        loginfo = info;
  48.112 -        setRefreshTime(getFTPSettings().getRefreshTime());
  48.113 -        startdir = info.getRootFolder();
  48.114 -        cachedir = new File(getDefaultCache());
  48.115 -        getFTPSettings().addPropertyChangeListener(new PropertyChangeListener() {
  48.116 -
  48.117 -            public void propertyChange(PropertyChangeEvent event) {
  48.118 -                ftpSettingsChanged(event);
  48.119 -            }
  48.120 -        });
  48.121 -    }
  48.122 -
  48.123 -    /** Called when FTPSettings changed
  48.124 -     * @param event 
  48.125 -     */
  48.126 -    protected void ftpSettingsChanged(PropertyChangeEvent event) {
  48.127 -        // bugfix #18714, according to the general contract of PropertyChangeEvent, 
  48.128 -        // property name may be null if multiple properties have been changed.
  48.129 -        if (event.getPropertyName() == null) {
  48.130 -            return;
  48.131 -        }
  48.132 -        if (event.getPropertyName().equals(FTPSettings.PROP_PASSIVE_MODE)) {
  48.133 -            if (client != null) {
  48.134 -                ((FTPClient) client).setPassiveMode(((Boolean) (event.getNewValue())).booleanValue());
  48.135 -            }
  48.136 -        }
  48.137 -        if (event.getPropertyName().equals(FTPSettings.PROP_REFRESH_TIME)) {
  48.138 -            setRefreshTime(((Integer) (event.getNewValue())).intValue());
  48.139 -        }
  48.140 -    }
  48.141 -
  48.142 -    /** Get FTPSettings object
  48.143 -     * @return 
  48.144 -     */
  48.145 -    protected FTPSettings getFTPSettings() {
  48.146 -        if (ftpsettings == null) {
  48.147 -            System.out.println("FTPSETTTNGS NULL");
  48.148 -            ftpsettings = SystemOption.findObject(FTPSettings.class, true);
  48.149 -        }
  48.150 -        return ftpsettings;
  48.151 -    }
  48.152 -
  48.153 -    /**
  48.154 -     * @return
  48.155 -     */
  48.156 -    private String computeSystemName() {
  48.157 -        //System.out.println("FTPFileSystem.prepareSystemName");
  48.158 -        return loginfo.displayName();// + ((startdir != null && startdir.startsWith("/")) ? "" : "/") + startdir;
  48.159 -    }
  48.160 -
  48.161 -    private String getDefaultCache() {
  48.162 -        return FTPWORK + File.separator + ((FTPLogInfo) loginfo).getHost() + ((((FTPLogInfo) loginfo).getPort() == FTPClient.DEFAULT_PORT) ? "" : ("_" + String.valueOf(((FTPLogInfo) loginfo).getPort()))) + "_" + ((FTPLogInfo) loginfo).getUser();
  48.163 -    }
  48.164 -
  48.165 -    //****************************************************************************
  48.166 -    /** Set cache directory
  48.167 -     * @param r 
  48.168 -     * @throws java.beans.PropertyVetoException 
  48.169 -     * @exception IOException
  48.170 -     */
  48.171 -    public void setCache(File r) throws PropertyVetoException, IOException {
  48.172 -        if (r == null) {
  48.173 -            throw new IOException("Cache root directory can't be null");
  48.174 -        }
  48.175 -        if (!r.exists()) {
  48.176 -            if (!r.mkdirs()) {
  48.177 -                throw new IOException("Cache root directory can't be created");
  48.178 -            }
  48.179 -        } else if (!r.isDirectory()) {
  48.180 -            throw new IOException("Cache root is not director");
  48.181 -        }
  48.182 -        if (!r.canWrite() || !r.canRead()) {
  48.183 -            throw new IOException("Can't read from or write to cache directory");
  48.184 -        }
  48.185 -        cachedir = r;
  48.186 -        enteredcachedir = true;
  48.187 -        firePropertyChange("cache", null, cachedir); // NOI18N
  48.188 -    }
  48.189 -
  48.190 -    /** Get the cache directory.
  48.191 -     * @return root directory
  48.192 -     */
  48.193 -    public File getCache() {
  48.194 -        return cachedir;
  48.195 -    }
  48.196 -
  48.197 -    /** Get server name.
  48.198 -     * @return Value of property server.
  48.199 -     */
  48.200 -    public String getServer() {
  48.201 -        return ((FTPLogInfo) loginfo).getHost();
  48.202 -    }
  48.203 -
  48.204 -    /** Set server name.
  48.205 -     * @param server New value of property server.
  48.206 -     * @throws PropertyVetoException
  48.207 -     */
  48.208 -    public void setServer(String server) throws java.beans.PropertyVetoException {
  48.209 -        ((FTPLogInfo) loginfo).setHost(server);
  48.210 -        propChanged();
  48.211 -    }
  48.212 -
  48.213 -    /** Get the number of port.
  48.214 -     * @return Value of property port.
  48.215 -     */
  48.216 -    public int getPort() {
  48.217 -        return ((FTPLogInfo) loginfo).getPort();
  48.218 -    }
  48.219 -
  48.220 -    /** Set port number.
  48.221 -     * @param port New value of property port.
  48.222 -     * @throws PropertyVetoException
  48.223 -     */
  48.224 -    public void setPort(int port) throws java.beans.PropertyVetoException {
  48.225 -        ((FTPLogInfo) loginfo).setPort(port);
  48.226 -        propChanged();
  48.227 -    }
  48.228 -
  48.229 -    /** Get user name.
  48.230 -     * @return Value of property username.
  48.231 -     */
  48.232 -    public String getUsername() {
  48.233 -        return ((FTPLogInfo) loginfo).getUser();
  48.234 -    }
  48.235 -
  48.236 -    /** Set user name.
  48.237 -     * @param username New value of property username.
  48.238 -     * @throws java.beans.PropertyVetoException 
  48.239 -     */
  48.240 -    public void setUsername(String username) throws PropertyVetoException {
  48.241 -        ((FTPLogInfo) loginfo).setUser(username);
  48.242 -        propChanged();
  48.243 -    }
  48.244 -
  48.245 -    /** Get password.
  48.246 -     * @return Value of property password.
  48.247 -     */
  48.248 -    public String getPassword() {
  48.249 -        return ((FTPLogInfo) loginfo).getPassword();
  48.250 -    }
  48.251 -
  48.252 -    /** Set password.
  48.253 -     * @param password
  48.254 -     * @throws java.beans.PropertyVetoException 
  48.255 -     */
  48.256 -    public void setPassword(String password) throws PropertyVetoException {
  48.257 -        ((FTPLogInfo) loginfo).setPassword(password);
  48.258 -        propChanged();
  48.259 -    }
  48.260 -
  48.261 -    /** Get starting directory.
  48.262 -     * @return Value of property startdir.
  48.263 -     */
  48.264 -    public String getStartdir() {
  48.265 -        return startdir;
  48.266 -    }
  48.267 -
  48.268 -    /** Set starting directory.
  48.269 -     * @param startdir New value of property startdir.
  48.270 -     */
  48.271 -    public void setStartdir(String startdir) {
  48.272 -        String newstartdir = startdir;
  48.273 -        if (startdir == null || startdir.equals("/") || startdir.equals("")) {
  48.274 -            newstartdir = "/";
  48.275 -        } else {
  48.276 -            if (!startdir.startsWith("/")) {
  48.277 -                newstartdir = "/" + startdir;
  48.278 -            }
  48.279 -            if (newstartdir.endsWith("/")) {
  48.280 -                newstartdir = newstartdir.substring(0, newstartdir.length() - 1);
  48.281 -            }
  48.282 -        }
  48.283 -        this.startdir = newstartdir;
  48.284 -        removeClient();
  48.285 -    }
  48.286 -
  48.287 -    /** Called when some parameter was changed. If connection is established, it must be reconnected. */
  48.288 -    private void propChanged() throws PropertyVetoException {
  48.289 -        if (!enteredcachedir) {
  48.290 -            cachedir = new File(getDefaultCache());
  48.291 -        }
  48.292 -        removeClient();
  48.293 -        if (isConnected()) {
  48.294 -            connectOnBackground(true);
  48.295 -        /*        post(new java.lang.Runnable() {
  48.296 -        public void run() {
  48.297 -        setConnected(true);  
  48.298 -        getRoot().refresh();
  48.299 -        }
  48.300 -        }
  48.301 -        );
  48.302 -         */
  48.303 -        }
  48.304 -    }
  48.305 -
  48.306 -    /** Creates FTPClient and sets its parameters
  48.307 -     * @throws java.io.IOException 
  48.308 -     */
  48.309 -    public RemoteClient createClient(LogInfo loginfo, File cache) throws IOException {
  48.310 -        if (!cachedir.exists()) {
  48.311 -            cachedir.mkdirs();
  48.312 -        }
  48.313 -        File logfile = new File(cachedir.getPath() + ".log");
  48.314 -        //RandomAccessFile logfile = new RandomAccessFile(cachedir.getPath()+".log","rw");
  48.315 -        //logfile.seek(logfile.length());
  48.316 -        FTPClient lClient = new FTPClient((FTPLogInfo) loginfo);
  48.317 -        lClient.setLog(logfile);
  48.318 -        lClient.setReconnect(this);
  48.319 -        lClient.setPassiveMode(getFTPSettings().isPassiveMode());
  48.320 -        return lClient;
  48.321 -    }
  48.322 -
  48.323 -    /** Human presentable name 
  48.324 -     * @return
  48.325 -     */
  48.326 -    public String getDisplayName() {
  48.327 -        return computeSystemName();
  48.328 -    }
  48.329 -
  48.330 -    /** Test whether filesystem is ready to write. If no, throws exception
  48.331 -     * @throws java.io.IOException 
  48.332 -     */
  48.333 -    protected void isReadyToModify() throws IOException {
  48.334 -        if (client == null || rootFile == null) {
  48.335 -            throw new IOException("Connection to server " + getServer() + " isn't established");
  48.336 -        }
  48.337 -        if (!isConnected() && !isOfflineChanges()) {
  48.338 -            throw new IOException("Modification in offline mode are not allowed");
  48.339 -        }
  48.340 -    }
  48.341 -
  48.342 -    /** Test whether filesystem is ready to read. If no, throws exception
  48.343 -     * @throws java.io.IOException 
  48.344 -     */
  48.345 -    protected void isReadyToRead() throws IOException {
  48.346 -        if (client == null || rootFile == null) {
  48.347 -            throw new IOException("Connection to server " + getServer() + " isn't established");
  48.348 -        }
  48.349 -    }
  48.350 -
  48.351 -    /** Test whether filesystem is ready. */
  48.352 -    protected boolean isReady() {
  48.353 -        if (client == null || rootFile == null) {
  48.354 -            return false;
  48.355 -        } else {
  48.356 -            return true;
  48.357 -        }
  48.358 -    }
  48.359 -
  48.360 -    protected int disconnectDialog(String server) {
  48.361 -        return FTPDialogs.disconnect(server);
  48.362 -    }
  48.363 -
  48.364 -    protected boolean connectDialog(String server) {
  48.365 -        return FTPDialogs.connect(server);
  48.366 -    }
  48.367 -
  48.368 -    protected void startdirNotFound(String startdir, String server) {
  48.369 -        FTPDialogs.startdirNotFound(startdir, server);
  48.370 -    }
  48.371 -
  48.372 -    protected void errorConnect(String error) {
  48.373 -        FTPDialogs.errorConnect(error);
  48.374 -    }
  48.375 -
  48.376 -    public void notifyIncorrectPassword() {
  48.377 -        FTPDialogs.incorrectPassword(getServer());
  48.378 -    }
  48.379 -
  48.380 -    public boolean notifyIncorrectCache(java.io.File newcache) {
  48.381 -        return FTPDialogs.incorrectCache(getCache().getPath(), newcache.getPath(), getServer());
  48.382 -    }
  48.383 -
  48.384 -    public boolean notifyReconnect(String mess) {
  48.385 -        Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor("Connection to server " + getServer() + " lost: " + mess + "\nReconnect?",
  48.386 -                "Question", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, null));
  48.387 -        if (obj == NotifyDescriptor.YES_OPTION) {
  48.388 -            return true;
  48.389 -        } else {
  48.390 -            return false;
  48.391 -        }
  48.392 -    }
  48.393 -
  48.394 -    public int notifyWhichFile(String path, Date file1, long size1, Date file2, long size2) {
  48.395 -        int which = file1.before(file2) ? 0 : 1;
  48.396 -        if (!getFTPSettings().isAskWhichFile()) {
  48.397 -            return which;
  48.398 -        }
  48.399 -        Object ops[] = new String[2];
  48.400 -        ops[0] = "From Cache";
  48.401 -        ops[1] = "From FTPServer";
  48.402 -        javax.swing.JPanel panel = new javax.swing.JPanel(new java.awt.BorderLayout());
  48.403 -        javax.swing.JPanel textpanel = new javax.swing.JPanel(new java.awt.GridLayout(0, 1));
  48.404 -        textpanel.add(new javax.swing.JLabel("Both files in FTP server and in cache exist."));
  48.405 -        textpanel.add(new javax.swing.JLabel(computeSystemName().substring(0, computeSystemName().length() - 1) + path + ", size " + size1 + " bytes, last modified " + file1.toString()));
  48.406 -        textpanel.add(new javax.swing.JLabel(getCache().getPath() + path.replace('/', File.separatorChar) + ", size " + size2 + " bytes, last modified " + file2.toString()));
  48.407 -        textpanel.add(new javax.swing.JLabel("File in " + (which == 0 ? "cache" : "FTP server") + " seems to be newer. Which one do you want to use?"));
  48.408 -        textpanel.add(new javax.swing.JLabel("Attention: second one will be deleted."));
  48.409 -        panel.add(textpanel, java.awt.BorderLayout.NORTH);
  48.410 -        javax.swing.JCheckBox chbox = new javax.swing.JCheckBox("Don't ask again. Always use newer file");
  48.411 -        chbox.setSelected(false);
  48.412 -        panel.add(chbox);
  48.413 -        Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(panel,
  48.414 -                "Question", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, ops, ops[which]));
  48.415 -        if (chbox.isSelected()) {
  48.416 -            getFTPSettings().setAskWhichFile(false);
  48.417 -        }
  48.418 -        if (obj == ops[0]) {
  48.419 -            return 0;
  48.420 -        } else {
  48.421 -            return 1;
  48.422 -        }
  48.423 -    }
  48.424 -
  48.425 -    public int notifyBothFilesChanged(String path, Date file1, long size1, Date file2, long size2) {
  48.426 -        Object ops[] = new String[2];
  48.427 -        ops[0] = "From Cache";
  48.428 -        ops[1] = "From FTPServer";
  48.429 -        int which = file1.before(file2) ? 0 : 1;
  48.430 -        //TODO: better message (branch, merge ...)
  48.431 -        Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(
  48.432 -                "Both files in FTP server and in cache were modified. It means that two diffrent version of this file exist.\n" +
  48.433 -                computeSystemName().substring(0, computeSystemName().length() - 1) + path + ", size " + size1 + " bytes, last modified " + file1.toString() + "\n" +
  48.434 -                getCache().getPath() + path.replace('/', File.separatorChar) + ", size " + size2 + " bytes, last modified " + file2.toString() + "\n" +
  48.435 -                "File in " + (which == 0 ? "cache" : "FTP server") + " seems to be newer. Which one do you want to use?\n" +
  48.436 -                "Attention: second one will be deleted!",
  48.437 -                "Files changed", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.WARNING_MESSAGE, ops, ops[which]));
  48.438 -        if (obj == ops[0]) {
  48.439 -            return 0;
  48.440 -        } else {
  48.441 -            return 1;
  48.442 -        }
  48.443 -    }
  48.444 -
  48.445 -    public boolean isRefreshServer() {
  48.446 -        return getFTPSettings().isRefreshServer();
  48.447 -    }
  48.448 -
  48.449 -    public boolean isScanCache() {
  48.450 -        return getFTPSettings().isScanCache();
  48.451 -    }
  48.452 -
  48.453 -    public boolean isAlwaysRefresh() {
  48.454 -        return getFTPSettings().isRefreshAlways();
  48.455 -    }
  48.456 -
  48.457 -    public void setAlwaysRefresh(boolean alwaysRefresh) {
  48.458 -        getFTPSettings().setRefreshAlways(alwaysRefresh);
  48.459 -    }
  48.460 -
  48.461 -    public boolean isDownloadServerChangedFile() {
  48.462 -        return getFTPSettings().isDownloadServerChangedFile();
  48.463 -    }
  48.464 -
  48.465 -    public boolean isOfflineChanges() {
  48.466 -        return getFTPSettings().isOfflineChanges();
  48.467 -    }
  48.468 -
  48.469 -    public boolean notifyServerChanged(String path, Date file1, long size1, Date file2, long size2) {
  48.470 -        if (!getFTPSettings().isAskServerChangedFile()) {
  48.471 -            return true;
  48.472 -        } // I agree
  48.473 -        javax.swing.JPanel panel = new javax.swing.JPanel(new java.awt.BorderLayout());
  48.474 -        javax.swing.JPanel textpanel = new javax.swing.JPanel(new java.awt.GridLayout(0, 1));
  48.475 -        textpanel.add(new javax.swing.JLabel("I detected that the file in FTP server has been changed."));
  48.476 -        textpanel.add(new javax.swing.JLabel(computeSystemName().substring(0, computeSystemName().length() - 1) + path + ", size " + size1 + " bytes, last modified " + file1.toString()));
  48.477 -        textpanel.add(new javax.swing.JLabel(getCache().getPath().replace('/', File.separatorChar) + path + ", size " + size2 + " bytes, last modified " + file2.toString()));
  48.478 -        textpanel.add(new javax.swing.JLabel("I will use this new file from server and delete the file in cache. Do you agree?"));
  48.479 -        textpanel.add(new javax.swing.JLabel("If you say No, the file from cache will be upload to server over changed one."));
  48.480 -        panel.add(textpanel, java.awt.BorderLayout.NORTH);
  48.481 -        javax.swing.JCheckBox chbox = new javax.swing.JCheckBox("Don't ask again. Always use new file from server");
  48.482 -        chbox.setSelected(false);
  48.483 -        panel.add(chbox);
  48.484 -        Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(panel,
  48.485 -                "Question", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.YES_OPTION));
  48.486 -        if (chbox.isSelected()) {
  48.487 -            getFTPSettings().setAskServerChangedFile(false);
  48.488 -        }
  48.489 -        if (obj == NotifyDescriptor.YES_OPTION) {
  48.490 -            return true;
  48.491 -        } else {
  48.492 -            return false;
  48.493 -        }
  48.494 -    }
  48.495 -
  48.496 -    public boolean notifyCacheExtDelete(String path, boolean isDir) {
  48.497 -        if (!getFTPSettings().isAskCacheExternalDelete()) {
  48.498 -            return getFTPSettings().isCacheExternalDelete();
  48.499 -        }
  48.500 -        Object ops[] = new String[4];
  48.501 -        ops[0] = "Yes";
  48.502 -        ops[1] = "No";
  48.503 -        ops[2] = "Yes for All";
  48.504 -        ops[3] = "No for All";
  48.505 -        Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(
  48.506 -                (isDir ? "The directory " + path + " in cache was delete externally.\nDo you want to the delete directory and all the subdirectories also from server?\n" : "The file " + path + " in cache was delete externaly.\nDo you want to delete the file also from server?\n"),
  48.507 -                "External deletion", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, ops, ops[1]));
  48.508 -        if (obj == ops[2]) {
  48.509 -            getFTPSettings().setAskCacheExternalDelete(false);
  48.510 -            getFTPSettings().setCacheExternalDelete(true);
  48.511 -        }
  48.512 -        if (obj == ops[3]) {
  48.513 -            getFTPSettings().setAskCacheExternalDelete(false);
  48.514 -            getFTPSettings().setCacheExternalDelete(false);
  48.515 -        }
  48.516 -        if (obj == ops[0] || obj == ops[2]) {
  48.517 -            return true;
  48.518 -        } else {
  48.519 -            return false;
  48.520 -        }
  48.521 -    }
  48.522 -
  48.523 -    public boolean notifyServerExtDelete(String path, boolean isDir) {
  48.524 -        if (!getFTPSettings().isAskServerExternalDelete()) {
  48.525 -            return getFTPSettings().isServerExternalDelete();
  48.526 -        }
  48.527 -        Object ops[] = new String[4];
  48.528 -        ops[0] = "Yes";
  48.529 -        ops[1] = "No";
  48.530 -        ops[2] = "Yes for All";
  48.531 -        ops[3] = "No for All";
  48.532 -        Object obj = DialogDisplayer.getDefault().notify(new NotifyDescriptor(
  48.533 -                (isDir ? "The directory " + path + " on server was delete externally.\nDo you want to delete the directory and all the subdirectories also from cache?\n" : "The file " + path + " on server was delete externally.\nDo you want to delete the file also from cache?\n"),
  48.534 -                "External deletion", NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.QUESTION_MESSAGE, ops, ops[1]));
  48.535 -        if (obj == ops[2]) {
  48.536 -            getFTPSettings().setAskServerExternalDelete(false);
  48.537 -            getFTPSettings().setServerExternalDelete(true);
  48.538 -        }
  48.539 -        if (obj == ops[3]) {
  48.540 -            getFTPSettings().setAskServerExternalDelete(false);
  48.541 -            getFTPSettings().setServerExternalDelete(false);
  48.542 -        }
  48.543 -        if (obj == ops[0] || obj == ops[2]) {
  48.544 -            return true;
  48.545 -        } else {
  48.546 -            return false;
  48.547 -        }
  48.548 -    }
  48.549 -
  48.550 -    public void fileChanged(String path) {
  48.551 -        FileObject fo = findResource(path);
  48.552 -        if (fo != null) {
  48.553 -            fo.refresh();
  48.554 -        }
  48.555 -    }
  48.556 -
  48.557 -    public void notifyException(Exception e) {
  48.558 -        Exceptions.printStackTrace(e);
  48.559 -    }
  48.560 -} 
    49.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPFileSystemBeanInfo.java	Wed Jul 28 12:48:15 2010 -0400
    49.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.3 @@ -1,243 +0,0 @@
    49.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    49.5 -/*
    49.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    49.7 -/*
    49.8 -/* The contents of this file are subject to the terms of either the GNU
    49.9 -/* General Public License Version 2 only ("GPL") or the Common
   49.10 -/* Development and Distribution License("CDDL") (collectively, the
   49.11 -/* "License"). You may not use this file except in compliance with the
   49.12 -/* License. You can obtain a copy of the License at
   49.13 -/* http://www.netbeans.org/cddl-gplv2.html
   49.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   49.15 -/* specific language governing permissions and limitations under the
   49.16 -/* License.  When distributing the software, include this License Header
   49.17 -/* Notice in each file and include the License file at
   49.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   49.19 -/* particular file as subject to the "Classpath" exception as provided
   49.20 -/* by Sun in the GPL Version 2 section of the License file that
   49.21 -/* accompanied this code. If applicable, add the following below the
   49.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   49.23 -/* your own identifying information:
   49.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   49.25 -/*
   49.26 -/* Contributor(s):
   49.27 - *
   49.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   49.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   49.30 - * Copyright (C) 2000. All Rights Reserved.
   49.31 -/*
   49.32 -/* If you wish your version of this file to be governed by only the CDDL
   49.33 -/* or only the GPL Version 2, indicate your decision by adding
   49.34 -/* "[Contributor] elects to include this software in this distribution
   49.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   49.36 -/* single choice of license, a recipient has the option to distribute
   49.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   49.38 -/* to extend the choice of license to its licensees as provided above.
   49.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   49.40 -/* Version 2 license, then the option applies only if the new code is
   49.41 -/* made subject to such option by the copyright holder.
   49.42 - *
   49.43 - * Contributor(s): Libor Martinek.
   49.44 - */
   49.45 -
   49.46 -package org.netbeans.modules.remotefs.ftpfs;
   49.47 -
   49.48 -import java.beans.*;
   49.49 -
   49.50 -/** FTPFileSystemBeanInfo.
   49.51 - *
   49.52 - * @author  Libor Martinek
   49.53 - * @version 1.0
   49.54 - */
   49.55 -public class FTPFileSystemBeanInfo extends SimpleBeanInfo {
   49.56 -
   49.57 -  // Property identifiers //GEN-FIRST:Properties
   49.58 -  private static final int PROPERTY_valid = 0;
   49.59 -  private static final int PROPERTY_connected = 1;
   49.60 -  private static final int PROPERTY_server = 2;
   49.61 -  private static final int PROPERTY_cache = 3;
   49.62 -  private static final int PROPERTY_startdir = 4;
   49.63 -  private static final int PROPERTY_password = 5;
   49.64 -  private static final int PROPERTY_hidden = 6;
   49.65 -  private static final int PROPERTY_port = 7;
   49.66 -  private static final int PROPERTY_username = 8;
   49.67 -  private static final int PROPERTY_readOnly = 9;
   49.68 -
   49.69 -  // Property array 
   49.70 -  private static PropertyDescriptor[] properties = new PropertyDescriptor[10];
   49.71 -
   49.72 -  static {
   49.73 -    try {
   49.74 -      properties[PROPERTY_valid] = new PropertyDescriptor ( "valid", FTPFileSystem.class, "isValid", null );
   49.75 -      properties[PROPERTY_valid].setExpert ( true );
   49.76 -      properties[PROPERTY_connected] = new PropertyDescriptor ( "connected", FTPFileSystem.class, "isConnected", "setConnected" );
   49.77 -      properties[PROPERTY_connected].setExpert ( true );
   49.78 -      properties[PROPERTY_connected].setDisplayName ( "Connected" );
   49.79 -      properties[PROPERTY_connected].setShortDescription ( "Connected" );
   49.80 -      properties[PROPERTY_server] = new PropertyDescriptor ( "server", FTPFileSystem.class, "getServer", "setServer" );
   49.81 -      properties[PROPERTY_server].setPreferred ( true );
   49.82 -      properties[PROPERTY_server].setDisplayName ( "Server" );
   49.83 -      properties[PROPERTY_server].setShortDescription ( "FTP Server Name" );
   49.84 -      properties[PROPERTY_cache] = new PropertyDescriptor ( "cache", FTPFileSystem.class, "getCache", "setCache" );
   49.85 -      properties[PROPERTY_cache].setExpert ( true );
   49.86 -      properties[PROPERTY_cache].setDisplayName ( "Cache" );
   49.87 -      properties[PROPERTY_cache].setShortDescription ( "Cache to store work files" );
   49.88 -      properties[PROPERTY_startdir] = new PropertyDescriptor ( "startdir", FTPFileSystem.class, "getStartdir", "setStartdir" );
   49.89 -      properties[PROPERTY_startdir].setPreferred ( true );
   49.90 -      properties[PROPERTY_startdir].setDisplayName ( "Start directory" );
   49.91 -      properties[PROPERTY_startdir].setShortDescription ( "Start directory in FTP server" );
   49.92 -      properties[PROPERTY_password] = new PropertyDescriptor ( "password", FTPFileSystem.class, "getPassword", "setPassword" );
   49.93 -      properties[PROPERTY_password].setPreferred ( true );
   49.94 -      properties[PROPERTY_password].setDisplayName ( "Password" );
   49.95 -      properties[PROPERTY_password].setShortDescription ( "Password" );
   49.96 -      properties[PROPERTY_password].setPropertyEditorClass ( PasswordEditor.class );
   49.97 -      properties[PROPERTY_hidden] = new PropertyDescriptor ( "hidden", FTPFileSystem.class, "isHidden", "setHidden" );
   49.98 -      properties[PROPERTY_hidden].setExpert ( true );
   49.99 -      properties[PROPERTY_port] = new PropertyDescriptor ( "port", FTPFileSystem.class, "getPort", "setPort" );
  49.100 -      properties[PROPERTY_port].setDisplayName ( "Port" );
  49.101 -      properties[PROPERTY_port].setShortDescription ( "FTP Server Port" );
  49.102 -      properties[PROPERTY_username] = new PropertyDescriptor ( "username", FTPFileSystem.class, "getUsername", "setUsername" );
  49.103 -      properties[PROPERTY_username].setPreferred ( true );
  49.104 -      properties[PROPERTY_username].setDisplayName ( "User Name" );
  49.105 -      properties[PROPERTY_username].setShortDescription ( "User Name" );
  49.106 -      properties[PROPERTY_readOnly] = new PropertyDescriptor ( "readOnly", FTPFileSystem.class, "isReadOnly", "setReadOnly" );
  49.107 -    }
  49.108 -    catch( IntrospectionException e) {}//GEN-HEADEREND:Properties
  49.109 -  
  49.110 -  // Here you can add code for customizing the properties array.  
  49.111 -
  49.112 -}//GEN-LAST:Properties
  49.113 -
  49.114 -  // EventSet identifiers//GEN-FIRST:Events
  49.115 -
  49.116 -  // EventSet array
  49.117 -  private static EventSetDescriptor[] eventSets = new EventSetDescriptor[0];
  49.118 -//GEN-HEADEREND:Events
  49.119 -
  49.120 -  // Here you can add code for customizing the event sets array.  
  49.121 -
  49.122 -  //GEN-LAST:Events
  49.123 -
  49.124 -  private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef
  49.125 -  private static java.awt.Image iconColor32 = null;
  49.126 -  private static java.awt.Image iconMono16 = null;
  49.127 -  private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef
  49.128 -  private static String iconNameC16 = null;//GEN-BEGIN:Icons
  49.129 -  private static String iconNameC32 = null;
  49.130 -  private static String iconNameM16 = null;
  49.131 -  private static String iconNameM32 = null;//GEN-END:Icons
  49.132 -                                                 
  49.133 -  private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
  49.134 -  private static int defaultEventIndex = -1;//GEN-END:Idx
  49.135 -
  49.136 -
  49.137 -  /**
  49.138 -   * Gets the beans <code>PropertyDescriptor</code>s.
  49.139 -   * 
  49.140 -   * @return An array of PropertyDescriptors describing the editable
  49.141 -   * properties supported by this bean.  May return null if the
  49.142 -   * information should be obtained by automatic analysis.
  49.143 -   * <p>
  49.144 -   * If a property is indexed, then its entry in the result array will
  49.145 -   * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
  49.146 -   * A client of getPropertyDescriptors can use "instanceof" to check
  49.147 -   * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
  49.148 -   */
  49.149 -  public PropertyDescriptor[] getPropertyDescriptors() {
  49.150 -    return properties;
  49.151 -  }
  49.152 -
  49.153 -  /**
  49.154 -   * Gets the beans <code>EventSetDescriptor</code>s.
  49.155 -   * 
  49.156 -   * @return  An array of EventSetDescriptors describing the kinds of 
  49.157 -   * events fired by this bean.  May return null if the information
  49.158 -   * should be obtained by automatic analysis.
  49.159 -   */
  49.160 -  public EventSetDescriptor[] getEventSetDescriptors() {
  49.161 -    return eventSets;
  49.162 -  }
  49.163 -
  49.164 -  /**
  49.165 -   * A bean may have a "default" property that is the property that will
  49.166 -   * mostly commonly be initially chosen for update by human's who are 
  49.167 -   * customizing the bean.
  49.168 -   * @return  Index of default property in the PropertyDescriptor array
  49.169 -   * 		returned by getPropertyDescriptors.
  49.170 -   * <P>	Returns -1 if there is no default property.
  49.171 -   */
  49.172 -  public int getDefaultPropertyIndex() {
  49.173 -    return defaultPropertyIndex;
  49.174 -  }
  49.175 -
  49.176 -  /**
  49.177 -   * A bean may have a "default" event that is the event that will
  49.178 -   * mostly commonly be used by human's when using the bean. 
  49.179 -   * @return Index of default event in the EventSetDescriptor array
  49.180 -   *		returned by getEventSetDescriptors.
  49.181 -   * <P>	Returns -1 if there is no default event.
  49.182 -   */
  49.183 -  public int getDefaultEventIndex() {
  49.184 -    return defaultPropertyIndex;
  49.185 -  }
  49.186 -
  49.187 -  /**
  49.188 -   * This method returns an image object that can be used to
  49.189 -   * represent the bean in toolboxes, toolbars, etc.   Icon images
  49.190 -   * will typically be GIFs, but may in future include other formats.
  49.191 -   * <p>
  49.192 -   * Beans aren't required to provide icons and may return null from
  49.193 -   * this method.
  49.194 -   * <p>
  49.195 -   * There are four possible flavors of icons (16x16 color,
  49.196 -   * 32x32 color, 16x16 mono, 32x32 mono).  If a bean choses to only
  49.197 -   * support a single icon we recommend supporting 16x16 color.
  49.198 -   * <p>
  49.199 -   * We recommend that icons have a "transparent" background
  49.200 -   * so they can be rendered onto an existing background.
  49.201 -   *
  49.202 -   * @param  iconKind  The kind of icon requested.  This should be
  49.203 -   *    one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, 
  49.204 -   *    ICON_MONO_16x16, or ICON_MONO_32x32.
  49.205 -   * @return  An image object representing the requested icon.  May
  49.206 -   *    return null if no suitable icon is available.
  49.207 -   */
  49.208 -  public java.awt.Image getIcon(int iconKind) {
  49.209 -    switch ( iconKind ) {
  49.210 -      case ICON_COLOR_16x16:
  49.211 -        if ( iconNameC16 == null )
  49.212 -          return null;
  49.213 -        else {
  49.214 -          if( iconColor16 == null )
  49.215 -            iconColor16 = loadImage( iconNameC16 );
  49.216 -          return iconColor16;
  49.217 -          }
  49.218 -      case ICON_COLOR_32x32:
  49.219 -        if ( iconNameC32 == null )
  49.220 -          return null;
  49.221 -        else {
  49.222 -          if( iconColor32 == null )
  49.223 -            iconColor32 = loadImage( iconNameC32 );
  49.224 -          return iconColor32;
  49.225 -          }
  49.226 -      case ICON_MONO_16x16:
  49.227 -        if ( iconNameM16 == null )
  49.228 -          return null;
  49.229 -        else {
  49.230 -          if( iconMono16 == null )
  49.231 -            iconMono16 = loadImage( iconNameM16 );
  49.232 -          return iconMono16;
  49.233 -          }
  49.234 -      case ICON_MONO_32x32:
  49.235 -        if ( iconNameM32 == null )
  49.236 -          return null;
  49.237 -        else {
  49.238 -          if( iconNameM32 == null )
  49.239 -            iconMono32 = loadImage( iconNameM32 );
  49.240 -          return iconMono32;
  49.241 -          }
  49.242 -    }
  49.243 -    return null;
  49.244 -  }
  49.245 -
  49.246 -}
    50.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPSettings.java	Wed Jul 28 12:48:15 2010 -0400
    50.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.3 @@ -1,253 +0,0 @@
    50.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    50.5 -/*
    50.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    50.7 -/*
    50.8 -/* The contents of this file are subject to the terms of either the GNU
    50.9 -/* General Public License Version 2 only ("GPL") or the Common
   50.10 -/* Development and Distribution License("CDDL") (collectively, the
   50.11 -/* "License"). You may not use this file except in compliance with the
   50.12 -/* License. You can obtain a copy of the License at
   50.13 -/* http://www.netbeans.org/cddl-gplv2.html
   50.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   50.15 -/* specific language governing permissions and limitations under the
   50.16 -/* License.  When distributing the software, include this License Header
   50.17 -/* Notice in each file and include the License file at
   50.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   50.19 -/* particular file as subject to the "Classpath" exception as provided
   50.20 -/* by Sun in the GPL Version 2 section of the License file that
   50.21 -/* accompanied this code. If applicable, add the following below the
   50.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   50.23 -/* your own identifying information:
   50.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   50.25 -/*
   50.26 -/* Contributor(s):
   50.27 - *
   50.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   50.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   50.30 - * Copyright (C) 2000. All Rights Reserved.
   50.31 -/*
   50.32 -/* If you wish your version of this file to be governed by only the CDDL
   50.33 -/* or only the GPL Version 2, indicate your decision by adding
   50.34 -/* "[Contributor] elects to include this software in this distribution
   50.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   50.36 -/* single choice of license, a recipient has the option to distribute
   50.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   50.38 -/* to extend the choice of license to its licensees as provided above.
   50.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   50.40 -/* Version 2 license, then the option applies only if the new code is
   50.41 -/* made subject to such option by the copyright holder.
   50.42 - *
   50.43 - * Contributor(s): Libor Martinek.
   50.44 - */
   50.45 -
   50.46 -package org.netbeans.modules.remotefs.ftpfs;
   50.47 -
   50.48 -/** Global FTPFileSystem settings
   50.49 - *
   50.50 - * @author  Libor Martinek
   50.51 - * @version 1.0
   50.52 - */
   50.53 -public class FTPSettings extends org.openide.options.SystemOption {
   50.54 -  static final long serialVersionUID = 6880742148617337695L;
   50.55 -
   50.56 -  public static final String PROP_REFRESH_TIME = "refreshtime";
   50.57 -  public static final String PROP_PASSIVE_MODE = "passivemode";
   50.58 -
   50.59 -  /** Holds value of property refreshTime. */
   50.60 -  private static int refreshTime = 60000;
   50.61 -  /** Holds value of property refreshServer. */
   50.62 -  private static boolean refreshServer = true;
   50.63 -  /** Holds value of property scanCache. */
   50.64 -  private static boolean scanCache = true;
   50.65 -  /** Holds value of property offlineChanges. */
   50.66 -  private static boolean offlineChanges = true;
   50.67 -  /** Holds value of property downloadServerChangedFile. */
   50.68 -  private static boolean downloadServerChangedFile = true;
   50.69 -  /** Holds value of property refreshAlways. */
   50.70 -  private static boolean refreshAlways = false;
   50.71 -  /** Holds value of property askServerChangedFile. */
   50.72 -  private static boolean askServerChangedFile = true;
   50.73 -  /** Holds value of property askWhichFile. */
   50.74 -  private static boolean askWhichFile = true;
   50.75 -  /** Holds value of property passiveMode. */
   50.76 -  private static boolean passiveMode = false;
   50.77 -  /** Holds value of property askCacheExternalDelete. */
   50.78 -  private static boolean askCacheExternalDelete = true;
   50.79 -  /** Holds value of property cacheExternalDelete. */
   50.80 -  private static boolean cacheExternalDelete = false;
   50.81 -  /** Holds value of property askServerExternalDelete. */
   50.82 -  private static boolean askServerExternalDelete = true;
   50.83 -  /** Holds value of property serverExternalDelete. */
   50.84 -  private static boolean serverExternalDelete = false;
   50.85 -  /** Creates new FTPSettings */
   50.86 -  public FTPSettings() {
   50.87 -  }
   50.88 -  
   50.89 -  /** Returns display name of the settings
   50.90 -   * @return display name
   50.91 -   */
   50.92 -  public String displayName() {
   50.93 -    return "FTP FileSystem";
   50.94 -  }
   50.95 -  /** Getter for property refreshTime.
   50.96 -   * @return Value of property refreshTime.
   50.97 -   */
   50.98 -  public int getRefreshTime() {
   50.99 -    return refreshTime;
  50.100 -  }
  50.101 -  /** Setter for property refreshTime.
  50.102 -   * @param refreshTime New value of property refreshTime.
  50.103 -   */
  50.104 -  public void setRefreshTime(int refreshTime) {
  50.105 -    int old = FTPSettings.refreshTime;
  50.106 -    FTPSettings.refreshTime = refreshTime;
  50.107 -    firePropertyChange(PROP_REFRESH_TIME,new Integer(old),new Integer(FTPSettings.refreshTime));
  50.108 -  }
  50.109 -  /** Getter for property refreshServer.
  50.110 -   * @return Value of property refreshServer.
  50.111 -   */
  50.112 -  public boolean isRefreshServer() {
  50.113 -    return refreshServer;
  50.114 -  }
  50.115 -  /** Setter for property refreshServer.
  50.116 -   * @param refreshServer New value of property refreshServer.
  50.117 -   */
  50.118 -  public void setRefreshServer(boolean refreshServer) {
  50.119 -    FTPSettings.refreshServer = refreshServer;
  50.120 -  }
  50.121 -  /** Getter for property scanCache.
  50.122 -   * @return Value of property scanCache.
  50.123 -   */
  50.124 -  public boolean isScanCache() {
  50.125 -    return scanCache;
  50.126 -  }
  50.127 -  /** Setter for property scanCache.
  50.128 -   * @param scanCache New value of property scanCache.
  50.129 -   */
  50.130 -  public void setScanCache(boolean scanCache) {
  50.131 -    FTPSettings.scanCache = scanCache;
  50.132 -  }
  50.133 -  /** Getter for property offlineChanges.
  50.134 -   * @return Value of property offlineChanges.
  50.135 -   */
  50.136 -  public boolean isOfflineChanges() {
  50.137 -    return offlineChanges;
  50.138 -  }
  50.139 -  /** Setter for property offlineChanges.
  50.140 -   * @param offlineChanges New value of property offlineChanges.
  50.141 -   */
  50.142 -  public void setOfflineChanges(boolean offlineChanges) {
  50.143 -    FTPSettings.offlineChanges = offlineChanges;
  50.144 -  }
  50.145 -  /** Getter for property downloadServerChangedFile.
  50.146 -   * @return Value of property downloadServerChangedFile.
  50.147 -   */
  50.148 -  public boolean isDownloadServerChangedFile() {
  50.149 -    return downloadServerChangedFile;
  50.150 -  }
  50.151 -  /** Setter for property downloadServerChangedFile.
  50.152 -   * @param downloadServerChangedFile New value of property downloadServerChangedFile.
  50.153 -   */
  50.154 -  public void setDownloadServerChangedFile(boolean downloadServerChangedFile) {
  50.155 -    FTPSettings.downloadServerChangedFile = downloadServerChangedFile;
  50.156 -  }
  50.157 -  /** Getter for property refreshAlways.
  50.158 -   * @return Value of property refreshAlways.
  50.159 -   */
  50.160 -  public boolean isRefreshAlways() {
  50.161 -    return refreshAlways;
  50.162 -  }
  50.163 -  /** Setter for property refreshAlways.
  50.164 -   * @param refreshAlways New value of property refreshAlways.
  50.165 -   */
  50.166 -  public void setRefreshAlways(boolean refreshAlways) {
  50.167 -    FTPSettings.refreshAlways = refreshAlways;
  50.168 -  }
  50.169 -  /** Getter for property askServerChangedFile.
  50.170 -   * @return Value of property askServerChangedFile.
  50.171 -   */
  50.172 -  public boolean isAskServerChangedFile() {
  50.173 -    return askServerChangedFile;
  50.174 -  }
  50.175 -  /** Setter for property askServerChangedFile.
  50.176 -   * @param askServerChangedFile New value of property askServerChangedFile.
  50.177 -   */
  50.178 -  public void setAskServerChangedFile(boolean askServerChangedFile) {
  50.179 -    FTPSettings.askServerChangedFile = askServerChangedFile;
  50.180 -  }
  50.181 -  /** Getter for property askWhichFile.
  50.182 -   * @return Value of property askWhichFile.
  50.183 -   */
  50.184 -  public boolean isAskWhichFile() {
  50.185 -    return askWhichFile;
  50.186 -  }
  50.187 -  /** Setter for property askWhichFile.
  50.188 -   * @param askWhichFile New value of property askWhichFile.
  50.189 -   */
  50.190 -  public void setAskWhichFile(boolean askWhichFile) {
  50.191 -    FTPSettings.askWhichFile = askWhichFile;
  50.192 -  }
  50.193 -  /** Getter for property passiveMode.
  50.194 -   * @return Value of property passiveMode.
  50.195 -   */
  50.196 -  public boolean isPassiveMode() {
  50.197 -    return passiveMode;
  50.198 -  }
  50.199 -  /** Setter for property passiveMode.
  50.200 -   * @param passiveMode New value of property passiveMode.
  50.201 -   */
  50.202 -  public void setPassiveMode(boolean passiveMode) {
  50.203 -    boolean old = FTPSettings.passiveMode;
  50.204 -    FTPSettings.passiveMode = passiveMode;
  50.205 -    firePropertyChange(PROP_PASSIVE_MODE,old ? Boolean.TRUE : Boolean.FALSE,FTPSettings.passiveMode ? Boolean.TRUE : Boolean.FALSE);
  50.206 -  }
  50.207 -  /** Getter for property askCacheExternalDelete.
  50.208 -   * @return Value of property askCacheExternalDelete.
  50.209 -   */
  50.210 -  public boolean isAskCacheExternalDelete() {
  50.211 -    return askCacheExternalDelete;
  50.212 -  }
  50.213 -  /** Setter for property askCacheExternalDelete.
  50.214 -   * @param askCacheExternalDelete New value of property askCacheExternalDelete.
  50.215 -   */
  50.216 -  public void setAskCacheExternalDelete(boolean askCacheExternalDelete) {
  50.217 -    FTPSettings.askCacheExternalDelete = askCacheExternalDelete;
  50.218 -  }
  50.219 -  /** Getter for property cacheExternalDelete.
  50.220 -   * @return Value of property cacheExternalDelete.
  50.221 -   */
  50.222 -  public boolean isCacheExternalDelete() {
  50.223 -    return cacheExternalDelete;
  50.224 -  }
  50.225 -  /** Setter for property cacheExternalDelete.
  50.226 -   * @param cacheExternalDelete New value of property cacheExternalDelete.
  50.227 -   */
  50.228 -  public void setCacheExternalDelete(boolean cacheExternalDelete) {
  50.229 -    FTPSettings.cacheExternalDelete = cacheExternalDelete;
  50.230 -  }
  50.231 -  /** Getter for property askServerExternalDelete.
  50.232 -   * @return Value of property askServerExternalDelete.
  50.233 -   */
  50.234 -  public boolean isAskServerExternalDelete() {
  50.235 -    return askServerExternalDelete;
  50.236 -  }
  50.237 -  /** Setter for property askServerExternalDelete.
  50.238 -   * @param askServerExternalDelete New value of property askServerExternalDelete.
  50.239 -   */
  50.240 -  public void setAskServerExternalDelete(boolean askServerExternalDelete) {
  50.241 -    FTPSettings.askServerExternalDelete = askServerExternalDelete;
  50.242 -  }
  50.243 -  /** Getter for property serverExternalDelete.
  50.244 -   * @return Value of property serverExternalDelete.
  50.245 -   */
  50.246 -  public boolean isServerExternalDelete() {
  50.247 -    return serverExternalDelete;
  50.248 -  }
  50.249 -  /** Setter for property serverExternalDelete.
  50.250 -   * @param serverExternalDelete New value of property serverExternalDelete.
  50.251 -   */
  50.252 -  public void setServerExternalDelete(boolean serverExternalDelete) {
  50.253 -    FTPSettings.serverExternalDelete = serverExternalDelete;
  50.254 -  }
  50.255 -  
  50.256 -}
  50.257 \ No newline at end of file
    51.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPSettingsBeanInfo.java	Wed Jul 28 12:48:15 2010 -0400
    51.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    51.3 @@ -1,259 +0,0 @@
    51.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    51.5 -/*
    51.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    51.7 -/*
    51.8 -/* The contents of this file are subject to the terms of either the GNU
    51.9 -/* General Public License Version 2 only ("GPL") or the Common
   51.10 -/* Development and Distribution License("CDDL") (collectively, the
   51.11 -/* "License"). You may not use this file except in compliance with the
   51.12 -/* License. You can obtain a copy of the License at
   51.13 -/* http://www.netbeans.org/cddl-gplv2.html
   51.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   51.15 -/* specific language governing permissions and limitations under the
   51.16 -/* License.  When distributing the software, include this License Header
   51.17 -/* Notice in each file and include the License file at
   51.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   51.19 -/* particular file as subject to the "Classpath" exception as provided
   51.20 -/* by Sun in the GPL Version 2 section of the License file that
   51.21 -/* accompanied this code. If applicable, add the following below the
   51.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   51.23 -/* your own identifying information:
   51.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   51.25 -/*
   51.26 -/* Contributor(s):
   51.27 - *
   51.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   51.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   51.30 - * Copyright (C) 2000. All Rights Reserved.
   51.31 -/*
   51.32 -/* If you wish your version of this file to be governed by only the CDDL
   51.33 -/* or only the GPL Version 2, indicate your decision by adding
   51.34 -/* "[Contributor] elects to include this software in this distribution
   51.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   51.36 -/* single choice of license, a recipient has the option to distribute
   51.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   51.38 -/* to extend the choice of license to its licensees as provided above.
   51.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   51.40 -/* Version 2 license, then the option applies only if the new code is
   51.41 -/* made subject to such option by the copyright holder.
   51.42 - *
   51.43 - * Contributor(s): Libor Martinek.
   51.44 - */
   51.45 -
   51.46 -package org.netbeans.modules.remotefs.ftpfs;
   51.47 -
   51.48 -import java.beans.*;
   51.49 -
   51.50 -/** FTPSettingsBeanInfo.
   51.51 - *
   51.52 - * @author  Libor Martinek
   51.53 - * @version 1.0
   51.54 - */
   51.55 -public class FTPSettingsBeanInfo extends SimpleBeanInfo {
   51.56 -
   51.57 -  // Property identifiers //GEN-FIRST:Properties
   51.58 -  private static final int PROPERTY_askWhichFile = 0;
   51.59 -  private static final int PROPERTY_refreshServer = 1;
   51.60 -  private static final int PROPERTY_refreshAlways = 2;
   51.61 -  private static final int PROPERTY_scanCache = 3;
   51.62 -  private static final int PROPERTY_serverExternalDelete = 4;
   51.63 -  private static final int PROPERTY_cacheExternalDelete = 5;
   51.64 -  private static final int PROPERTY_askServerExternalDelete = 6;
   51.65 -  private static final int PROPERTY_offlineChanges = 7;
   51.66 -  private static final int PROPERTY_downloadServerChangedFile = 8;
   51.67 -  private static final int PROPERTY_passiveMode = 9;
   51.68 -  private static final int PROPERTY_askCacheExternalDelete = 10;
   51.69 -  private static final int PROPERTY_refreshTime = 11;
   51.70 -  private static final int PROPERTY_askServerChangedFile = 12;
   51.71 -
   51.72 -  // Property array 
   51.73 -  private static PropertyDescriptor[] properties = new PropertyDescriptor[13];
   51.74 -
   51.75 -  static {
   51.76 -    try {
   51.77 -      properties[PROPERTY_askWhichFile] = new PropertyDescriptor ( "askWhichFile", FTPSettings.class, "isAskWhichFile", "setAskWhichFile" );
   51.78 -      properties[PROPERTY_askWhichFile].setExpert ( true );
   51.79 -      properties[PROPERTY_askWhichFile].setDisplayName ( "Ask Which File" );
   51.80 -      properties[PROPERTY_askWhichFile].setShortDescription ( "Show Dialog if files in server and cache differ.Otherwise use newer one." );
   51.81 -      properties[PROPERTY_refreshServer] = new PropertyDescriptor ( "refreshServer", FTPSettings.class, "isRefreshServer", "setRefreshServer" );
   51.82 -      properties[PROPERTY_refreshServer].setDisplayName ( "Refresh From Server" );
   51.83 -      properties[PROPERTY_refreshServer].setShortDescription ( "Whether information from server should be used for refresh" );
   51.84 -      properties[PROPERTY_refreshAlways] = new PropertyDescriptor ( "refreshAlways", FTPSettings.class, "isRefreshAlways", "setRefreshAlways" );
   51.85 -      properties[PROPERTY_refreshAlways].setExpert ( true );
   51.86 -      properties[PROPERTY_refreshAlways].setDisplayName ( "Always Refresh From Server" );
   51.87 -      properties[PROPERTY_refreshAlways].setShortDescription ( "Whether refresh from server should be performed before every action.Usable for servers with fast connection" );
   51.88 -      properties[PROPERTY_scanCache] = new PropertyDescriptor ( "scanCache", FTPSettings.class, "isScanCache", "setScanCache" );
   51.89 -      properties[PROPERTY_scanCache].setDisplayName ( "Scan Cache" );
   51.90 -      properties[PROPERTY_scanCache].setShortDescription ( "Whether cache should be scaned for external modification" );
   51.91 -      properties[PROPERTY_serverExternalDelete] = new PropertyDescriptor ( "serverExternalDelete", FTPSettings.class, "isServerExternalDelete", "setServerExternalDelete" );
   51.92 -      properties[PROPERTY_serverExternalDelete].setExpert ( true );
   51.93 -      properties[PROPERTY_serverExternalDelete].setDisplayName ( "Server external deletion" );
   51.94 -      properties[PROPERTY_serverExternalDelete].setShortDescription ( "Delete file if file in server was delete externally" );
   51.95 -      properties[PROPERTY_cacheExternalDelete] = new PropertyDescriptor ( "cacheExternalDelete", FTPSettings.class, "isCacheExternalDelete", "setCacheExternalDelete" );
   51.96 -      properties[PROPERTY_cacheExternalDelete].setExpert ( true );
   51.97 -      properties[PROPERTY_cacheExternalDelete].setDisplayName ( "Cache external deletion" );
   51.98 -      properties[PROPERTY_cacheExternalDelete].setShortDescription ( "Delete file if file in cache was delete externally" );
   51.99 -      properties[PROPERTY_askServerExternalDelete] = new PropertyDescriptor ( "askServerExternalDelete", FTPSettings.class, "isAskServerExternalDelete", "setAskServerExternalDelete" );
  51.100 -      properties[PROPERTY_askServerExternalDelete].setExpert ( true );
  51.101 -      properties[PROPERTY_askServerExternalDelete].setDisplayName ( "Confirm server external deletion" );
  51.102 -      properties[PROPERTY_askServerExternalDelete].setShortDescription ( "Whether you want to confirm external deletion from server" );
  51.103 -      properties[PROPERTY_offlineChanges] = new PropertyDescriptor ( "offlineChanges", FTPSettings.class, "isOfflineChanges", "setOfflineChanges" );
  51.104 -      properties[PROPERTY_offlineChanges].setDisplayName ( "Offline Changes" );
  51.105 -      properties[PROPERTY_offlineChanges].setShortDescription ( "Whether you want to permit modification in offline mode" );
  51.106 -      properties[PROPERTY_downloadServerChangedFile] = new PropertyDescriptor ( "downloadServerChangedFile", FTPSettings.class, "isDownloadServerChangedFile", "setDownloadServerChangedFile" );
  51.107 -      properties[PROPERTY_downloadServerChangedFile].setDisplayName ( "Download server changed file" );
  51.108 -      properties[PROPERTY_downloadServerChangedFile].setShortDescription ( "Whether changed file from server should be downloaded or old file in cache only deleted." );
  51.109 -      properties[PROPERTY_passiveMode] = new PropertyDescriptor ( "passiveMode", FTPSettings.class, "isPassiveMode", "setPassiveMode" );
  51.110 -      properties[PROPERTY_passiveMode].setDisplayName ( "Passive mode" );
  51.111 -      properties[PROPERTY_passiveMode].setShortDescription ( "Whether passive mode should be used.Usable if you are behind firewall" );
  51.112 -      properties[PROPERTY_askCacheExternalDelete] = new PropertyDescriptor ( "askCacheExternalDelete", FTPSettings.class, "isAskCacheExternalDelete", "setAskCacheExternalDelete" );
  51.113 -      properties[PROPERTY_askCacheExternalDelete].setExpert ( true );
  51.114 -      properties[PROPERTY_askCacheExternalDelete].setDisplayName ( "Confirm cache external deletion" );
  51.115 -      properties[PROPERTY_askCacheExternalDelete].setShortDescription ( "Whether you want to confirm external deletion from cache" );
  51.116 -      properties[PROPERTY_refreshTime] = new PropertyDescriptor ( "refreshTime", FTPSettings.class, "getRefreshTime", "setRefreshTime" );
  51.117 -      properties[PROPERTY_refreshTime].setDisplayName ( "Refresh Time in ms" );
  51.118 -      properties[PROPERTY_refreshTime].setShortDescription ( "Time to refresh folder" );
  51.119 -      properties[PROPERTY_askServerChangedFile] = new PropertyDescriptor ( "askServerChangedFile", FTPSettings.class, "isAskServerChangedFile", "setAskServerChangedFile" );
  51.120 -      properties[PROPERTY_askServerChangedFile].setExpert ( true );
  51.121 -      properties[PROPERTY_askServerChangedFile].setDisplayName ( "Ask if server file changed" );
  51.122 -      properties[PROPERTY_askServerChangedFile].setShortDescription ( "Show dialog if file in server has been changed" );
  51.123 -    }
  51.124 -    catch( IntrospectionException e) {}//GEN-HEADEREND:Properties
  51.125 -  
  51.126 -  // Here you can add code for customizing the properties array.  
  51.127 -
  51.128 -}//GEN-LAST:Properties
  51.129 -
  51.130 -  // EventSet identifiers//GEN-FIRST:Events
  51.131 -
  51.132 -  // EventSet array
  51.133 -  private static EventSetDescriptor[] eventSets = new EventSetDescriptor[0];
  51.134 -//GEN-HEADEREND:Events
  51.135 -
  51.136 -  // Here you can add code for customizing the event sets array.  
  51.137 -
  51.138 -  //GEN-LAST:Events
  51.139 -
  51.140 -  private static java.awt.Image iconColor16 = null; //GEN-BEGIN:IconsDef
  51.141 -  private static java.awt.Image iconColor32 = null;
  51.142 -  private static java.awt.Image iconMono16 = null;
  51.143 -  private static java.awt.Image iconMono32 = null; //GEN-END:IconsDef
  51.144 -  private static String iconNameC16 = null;//GEN-BEGIN:Icons
  51.145 -  private static String iconNameC32 = null;
  51.146 -  private static String iconNameM16 = null;
  51.147 -  private static String iconNameM32 = null;//GEN-END:Icons
  51.148 -                                                 
  51.149 -  private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
  51.150 -  private static int defaultEventIndex = -1;//GEN-END:Idx
  51.151 -
  51.152 -
  51.153 -  /**
  51.154 -   * Gets the beans <code>PropertyDescriptor</code>s.
  51.155 -   * 
  51.156 -   * @return An array of PropertyDescriptors describing the editable
  51.157 -   * properties supported by this bean.  May return null if the
  51.158 -   * information should be obtained by automatic analysis.
  51.159 -   * <p>
  51.160 -   * If a property is indexed, then its entry in the result array will
  51.161 -   * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
  51.162 -   * A client of getPropertyDescriptors can use "instanceof" to check
  51.163 -   * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
  51.164 -   */
  51.165 -  public PropertyDescriptor[] getPropertyDescriptors() {
  51.166 -    return properties;
  51.167 -  }
  51.168 -
  51.169 -  /**
  51.170 -   * Gets the beans <code>EventSetDescriptor</code>s.
  51.171 -   * 
  51.172 -   * @return  An array of EventSetDescriptors describing the kinds of 
  51.173 -   * events fired by this bean.  May return null if the information
  51.174 -   * should be obtained by automatic analysis.
  51.175 -   */
  51.176 -  public EventSetDescriptor[] getEventSetDescriptors() {
  51.177 -    return eventSets;
  51.178 -  }
  51.179 -
  51.180 -  /**
  51.181 -   * A bean may have a "default" property that is the property that will
  51.182 -   * mostly commonly be initially chosen for update by human's who are 
  51.183 -   * customizing the bean.
  51.184 -   * @return  Index of default property in the PropertyDescriptor array
  51.185 -   * 		returned by getPropertyDescriptors.
  51.186 -   * <P>	Returns -1 if there is no default property.
  51.187 -   */
  51.188 -  public int getDefaultPropertyIndex() {
  51.189 -    return defaultPropertyIndex;
  51.190 -  }
  51.191 -
  51.192 -  /**
  51.193 -   * A bean may have a "default" event that is the event that will
  51.194 -   * mostly commonly be used by human's when using the bean. 
  51.195 -   * @return Index of default event in the EventSetDescriptor array
  51.196 -   *		returned by getEventSetDescriptors.
  51.197 -   * <P>	Returns -1 if there is no default event.
  51.198 -   */
  51.199 -  public int getDefaultEventIndex() {
  51.200 -    return defaultPropertyIndex;
  51.201 -  }
  51.202 -
  51.203 -  /**
  51.204 -   * This method returns an image object that can be used to
  51.205 -   * represent the bean in toolboxes, toolbars, etc.   Icon images
  51.206 -   * will typically be GIFs, but may in future include other formats.
  51.207 -   * <p>
  51.208 -   * Beans aren't required to provide icons and may return null from
  51.209 -   * this method.
  51.210 -   * <p>
  51.211 -   * There are four possible flavors of icons (16x16 color,
  51.212 -   * 32x32 color, 16x16 mono, 32x32 mono).  If a bean choses to only
  51.213 -   * support a single icon we recommend supporting 16x16 color.
  51.214 -   * <p>
  51.215 -   * We recommend that icons have a "transparent" background
  51.216 -   * so they can be rendered onto an existing background.
  51.217 -   *
  51.218 -   * @param  iconKind  The kind of icon requested.  This should be
  51.219 -   *    one of the constant values ICON_COLOR_16x16, ICON_COLOR_32x32, 
  51.220 -   *    ICON_MONO_16x16, or ICON_MONO_32x32.
  51.221 -   * @return  An image object representing the requested icon.  May
  51.222 -   *    return null if no suitable icon is available.
  51.223 -   */
  51.224 -  public java.awt.Image getIcon(int iconKind) {
  51.225 -    switch ( iconKind ) {
  51.226 -      case ICON_COLOR_16x16:
  51.227 -        if ( iconNameC16 == null )
  51.228 -          return null;
  51.229 -        else {
  51.230 -          if( iconColor16 == null )
  51.231 -            iconColor16 = loadImage( iconNameC16 );
  51.232 -          return iconColor16;
  51.233 -          }
  51.234 -      case ICON_COLOR_32x32:
  51.235 -        if ( iconNameC32 == null )
  51.236 -          return null;
  51.237 -        else {
  51.238 -          if( iconColor32 == null )
  51.239 -            iconColor32 = loadImage( iconNameC32 );
  51.240 -          return iconColor32;
  51.241 -          }
  51.242 -      case ICON_MONO_16x16:
  51.243 -        if ( iconNameM16 == null )
  51.244 -          return null;
  51.245 -        else {
  51.246 -          if( iconMono16 == null )
  51.247 -            iconMono16 = loadImage( iconNameM16 );
  51.248 -          return iconMono16;
  51.249 -          }
  51.250 -      case ICON_MONO_32x32:
  51.251 -        if ( iconNameM32 == null )
  51.252 -          return null;
  51.253 -        else {
  51.254 -          if( iconNameM32 == null )
  51.255 -            iconMono32 = loadImage( iconNameM32 );
  51.256 -          return iconMono32;
  51.257 -          }
  51.258 -    }
  51.259 -    return null;
  51.260 -  }
  51.261 -
  51.262 -}
    52.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpfs/FTPfsModule.java	Wed Jul 28 12:48:15 2010 -0400
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,82 +0,0 @@
    52.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    52.5 -/*
    52.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    52.7 -/*
    52.8 -/* The contents of this file are subject to the terms of either the GNU
    52.9 -/* General Public License Version 2 only ("GPL") or the Common
   52.10 -/* Development and Distribution License("CDDL") (collectively, the
   52.11 -/* "License"). You may not use this file except in compliance with the
   52.12 -/* License. You can obtain a copy of the License at
   52.13 -/* http://www.netbeans.org/cddl-gplv2.html
   52.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   52.15 -/* specific language governing permissions and limitations under the
   52.16 -/* License.  When distributing the software, include this License Header
   52.17 -/* Notice in each file and include the License file at
   52.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   52.19 -/* particular file as subject to the "Classpath" exception as provided
   52.20 -/* by Sun in the GPL Version 2 section of the License file that
   52.21 -/* accompanied this code. If applicable, add the following below the
   52.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   52.23 -/* your own identifying information:
   52.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   52.25 -/*
   52.26 -/* Contributor(s):
   52.27 - *
   52.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   52.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   52.30 - * Copyright (C) 2000. All Rights Reserved.
   52.31 -/*
   52.32 -/* If you wish your version of this file to be governed by only the CDDL
   52.33 -/* or only the GPL Version 2, indicate your decision by adding
   52.34 -/* "[Contributor] elects to include this software in this distribution
   52.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   52.36 -/* single choice of license, a recipient has the option to distribute
   52.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   52.38 -/* to extend the choice of license to its licensees as provided above.
   52.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   52.40 -/* Version 2 license, then the option applies only if the new code is
   52.41 -/* made subject to such option by the copyright holder.
   52.42 - *
   52.43 - * Contributor(s): Libor Martinek.
   52.44 - */
   52.45 -
   52.46 -package org.netbeans.modules.remotefs.ftpfs;
   52.47 -
   52.48 -import org.openide.modules.ModuleInstall;
   52.49 -
   52.50 -/** FTP filesystem module class.
   52.51 - *
   52.52 - * @author  Libor Martinek
   52.53 - * @version 1.0
   52.54 - */
   52.55 -public class FTPfsModule extends ModuleInstall {
   52.56 -  static final long serialVersionUID = 2289861663533516525L;
   52.57 -
   52.58 -  public FTPfsModule() {
   52.59 -    // A public default constructor is required!
   52.60 -    // Of course, Java makes one by default for a public class too.
   52.61 -  }
   52.62 -
   52.63 -  public void installed() {
   52.64 -    // This module has been installed for the first time! Notify authors.
   52.65 -    // Handle setup within this session too:
   52.66 -    restored();
   52.67 -  }
   52.68 -
   52.69 -  public void restored() {
   52.70 -    //FileUtil.setMIMEType("test", "text/x-clipboard-content-test");
   52.71 -  }
   52.72 -
   52.73 -  public void uninstalled() {
   52.74 -    // Do not need to do anything special on uninstall.
   52.75 -    // Action will already be removed from Edit menu automatically.
   52.76 -  }
   52.77 -
   52.78 -  public boolean closing() {
   52.79 -    // Ask the user to save any open, modified clipboard contents.
   52.80 -    // If the user selects "Cancel" on one of these dialogs, don't exit yet!
   52.81 -    //return DisplayClipboardAction.askAboutExiting();
   52.82 -    return true;
   52.83 -  }
   52.84 -}
   52.85 -
    53.1 --- a/remotefs/src/org/netbeans/modules/remotefs/ftpfs/PasswordEditor.java	Wed Jul 28 12:48:15 2010 -0400
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,149 +0,0 @@
    53.4 -/* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    53.5 -/*
    53.6 -/* Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    53.7 -/*
    53.8 -/* The contents of this file are subject to the terms of either the GNU
    53.9 -/* General Public License Version 2 only ("GPL") or the Common
   53.10 -/* Development and Distribution License("CDDL") (collectively, the
   53.11 -/* "License"). You may not use this file except in compliance with the
   53.12 -/* License. You can obtain a copy of the License at
   53.13 -/* http://www.netbeans.org/cddl-gplv2.html
   53.14 -/* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   53.15 -/* specific language governing permissions and limitations under the
   53.16 -/* License.  When distributing the software, include this License Header
   53.17 -/* Notice in each file and include the License file at
   53.18 -/* nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   53.19 -/* particular file as subject to the "Classpath" exception as provided
   53.20 -/* by Sun in the GPL Version 2 section of the License file that
   53.21 -/* accompanied this code. If applicable, add the following below the
   53.22 -/* License Header, with the fields enclosed by brackets [] replaced by
   53.23 -/* your own identifying information:
   53.24 -/* "Portions Copyrighted [year] [name of copyright owner]"
   53.25 -/*
   53.26 -/* Contributor(s):
   53.27 - *
   53.28 - * The Original Software is RemoteFS. The Initial Developer of the Original
   53.29 -/* Software is Libor Martinek. Portions created by Libor Martinek are
   53.30 - * Copyright (C) 2000. All Rights Reserved.
   53.31 -/*
   53.32 -/* If you wish your version of this file to be governed by only the CDDL
   53.33 -/* or only the GPL Version 2, indicate your decision by adding
   53.34 -/* "[Contributor] elects to include this software in this distribution
   53.35 -/* under the [CDDL or GPL Version 2] license." If you do not indicate a
   53.36 -/* single choice of license, a recipient has the option to distribute
   53.37 -/* your version of this file under either the CDDL, the GPL Version 2 or
   53.38 -/* to extend the choice of license to its licensees as provided above.
   53.39 -/* However, if you add GPL Version 2 code and therefore, elected the GPL
   53.40 -/* Version 2 license, then the option applies only if the new code is
   53.41 -/* made subject to such option by the copyright holder.
   53.42 - *
   53.43 - * Contributor(s): Libor Martinek.
   53.44 - */
   53.45 -
   53.46 -package org.netbeans.modules.remotefs.ftpfs;
   53.47 -
   53.48 -import java.awt.*;
   53.49 -import java.awt.event.*;
   53.50 -import java.beans.*;
   53.51 -import javax.swing.*;
   53.52 -
   53.53 -import org.openide.explorer.propertysheet.editors.*;
   53.54 -
   53.55 -/** Password editor.
   53.56 - *
   53.57 - * @author  Libor Martinek
   53.58 - * @version 1.1
   53.59 - */
   53.60 -public class PasswordEditor implements EnhancedPropertyEditor, ActionListener, FocusListener {
   53.61 -
   53.62 -  private String password;
   53.63 -  private PropertyChangeSupport support;
   53.64 -  transient private JPasswordField field;
   53.65 -
   53.66 -  /** Creates new PasswordEditor. */
   53.67 -  public PasswordEditor() {
   53.68 -    support = new PropertyChangeSupport (this);
   53.69 -  }
   53.70 -  
   53.71 -  public boolean supportsEditingTaggedValues() {
   53.72 -    return false;
   53.73 -  }
   53.74 -
   53.75 -  public java.lang.String[] getTags() {
   53.76 -    return new String[] {};
   53.77 -  }
   53.78 -
   53.79 -  public boolean hasInPlaceCustomEditor() {
   53.80 -    return true;
   53.81 -  }
   53.82 -
   53.83 -  public java.awt.Component getInPlaceCustomEditor() {
   53.84 -    if (field == null) {
   53.85 -      field = new JPasswordField();
   53.86 -      field.addActionListener(this);
   53.87 -      field.addFocusListener(this);
   53.88 -    }
   53.89 -    if (password != null) {
   53.90 -      field.setText(password);
   53.91 -      field.setSelectionStart(0);
   53.92 -      field.setSelectionEnd(password.length());
   53.93 -    }
   53.94 -    return field;
   53.95 -  }
   53.96 -
   53.97 -  public void setValue(final java.lang.Object p0) {
   53.98 -    if (p0 instanceof String) password = (String)p0;
   53.99 -    support.firePropertyChange ("", null, null);
  53.100 -  }
  53.101 -
  53.102 -  public java.lang.Object getValue() {
  53.103 -    return password;
  53.104 -  }
  53.105 -
  53.106 -  public java.lang.String getJavaInitializationString() {
  53.107 -    return "";
  53.108 -  }
  53.109 -
  53.110 -  public boolean supportsCustomEditor() {
  53.111 -    return false;
  53.112 -  }
  53.113 -
  53.114 -  public java.awt.Component getCustomEditor() {
  53.115 -    return null;
  53.116 -  }
  53.117 -
  53.118 -  public boolean isPaintable() {
  53.119 -    return false;
  53.120 -  }
  53.121 -
  53.122 -  public void paintValue(final java.awt.Graphics p0,final java.awt.Rectangle p1) {
  53.123 -  }
  53.124 -
  53.125 -  public java.lang.String getAsText() {
  53.126 -    return "***********";
  53.127 -  }
  53.128 -
  53.129 -  public void setAsText(java.lang.String p0) throws java.lang.IllegalArgumentException {
  53.130 -  }
  53.131 -
  53.132 -  public void addPropertyChangeListener(final java.beans.PropertyChangeListener p0) {
  53.133 -    support.addPropertyChangeListener(p0);
  53.134 -  }
  53.135 -
  53.136 -  public void removePropertyChangeListener(final java.beans.PropertyChangeListener p0) {
  53.137 -    support.removePropertyChangeListener(p0);
  53.138 -  }
  53.139 -  
  53.140 -  public void actionPerformed(ActionEvent ev) {
  53.141 -    setValue(new String(field.getPassword()));
  53.142 -  }
  53.143 -  
  53.144 -  public void focusGained(final java.awt.event.FocusEvent p1) {
  53.145 -  }
  53.146 -
  53.147 -  public void focusLost(final java.awt.event.FocusEvent p1) {
  53.148 -      setValue(new String(field.getPassword()));
  53.149 -  }
  53.150 -
  53.151 -}
  53.152 -
    54.1 --- a/remotefs/test/unit/src/org/netbeans/modules/remotefs/ftpclient/FTPClientTest.java	Wed Jul 28 12:48:15 2010 -0400
    54.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    54.3 @@ -1,153 +0,0 @@
    54.4 -/*
    54.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    54.6 - * 
    54.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    54.8 - * 
    54.9 - * The contents of this file are subject to the terms of either the GNU
   54.10 - * General Public License Version 2 only ("GPL") or the Common
   54.11 - * Development and Distribution License("CDDL") (collectively, the
   54.12 - * "License"). You may not use this file except in compliance with the
   54.13 - * License. You can obtain a copy of the License at
   54.14 - * http://www.netbeans.org/cddl-gplv2.html
   54.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   54.16 - * specific language governing permissions and limitations under the
   54.17 - * License.  When distributing the software, include this License Header
   54.18 - * Notice in each file and include the License file at
   54.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   54.20 - * particular file as subject to the "Classpath" exception as provided
   54.21 - * by Sun in the GPL Version 2 section of the License file that
   54.22 - * accompanied this code. If applicable, add the following below the
   54.23 - * License Header, with the fields enclosed by brackets [] replaced by
   54.24 - * your own identifying information:
   54.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   54.26 - * 
   54.27 - * If you wish your version of this file to be governed by only the CDDL
   54.28 - * or only the GPL Version 2, indicate your decision by adding
   54.29 - * "[Contributor] elects to include this software in this distribution
   54.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   54.31 - * single choice of license, a recipient has the option to distribute
   54.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   54.33 - * to extend the choice of license to its licensees as provided above.
   54.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   54.35 - * Version 2 license, then the option applies only if the new code is
   54.36 - * made subject to such option by the copyright holder.
   54.37 - * 
   54.38 - * Contributor(s): Dirk Estievenart
   54.39 - * 
   54.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
   54.41 - */
   54.42 -package org.netbeans.modules.remotefs.ftpclient;
   54.43 -
   54.44 -import java.io.File;
   54.45 -import java.io.IOException;
   54.46 -import org.netbeans.junit.NbTestCase;
   54.47 -import org.netbeans.junit.NbTestSuite;
   54.48 -import org.netbeans.modules.remotefs.core.RemoteFileName;
   54.49 -import org.netbeans.modules.remotefs.testutils.MockFTPServer;
   54.50 -import org.openide.util.Exceptions;
   54.51 -
   54.52 -/**
   54.53 - * A Test based on NbTestCase. It is a NetBeans extension to JUnit TestCase
   54.54 - * which among othres allows to compare files via assertFile methods, create
   54.55 - * working directories for testcases, write to log files, compare log files
   54.56 - * against reference (golden) files, etc.
   54.57 - * 
   54.58 - * More details here http://xtest.netbeans.org/NbJUnit/NbJUnit-overview.html.
   54.59 - * 
   54.60 - * @author dirke
   54.61 - */
   54.62 -public class FTPClientTest extends NbTestCase {
   54.63 -
   54.64 -    private FTPClient client;
   54.65 -    private MockFTPServer mockServer;
   54.66 -
   54.67 -    /** Default constructor.
   54.68 -     * @param testName name of particular test case
   54.69 -     */
   54.70 -    public FTPClientTest(String testName) {
   54.71 -        super(testName);
   54.72 -    }
   54.73 -
   54.74 -    /** Creates suite from particular test cases. You can define order of testcases here. */
   54.75 -    public static NbTestSuite suite() {
   54.76 -        NbTestSuite suite = new NbTestSuite();
   54.77 -        suite.addTest(new FTPClientTest("testConnect"));
   54.78 -        suite.addTest(new FTPClientTest("testTransfer"));
   54.79 -        return suite;
   54.80 -    }
   54.81 -
   54.82 -    /* Method allowing test execution directly from the IDE. */
   54.83 -    public static void main(java.lang.String[] args) {
   54.84 -        // run whole suite
   54.85 -        junit.textui.TestRunner.run(suite());
   54.86 -        // run only selected test case
   54.87 -        //junit.textui.TestRunner.run(new FTPClientTest("test1"));
   54.88 -    }
   54.89 -
   54.90 -    /** Called before every test case. */
   54.91 -    @Override
   54.92 -    public void setUp() {
   54.93 -        try {
   54.94 -            System.out.println("########  " + getName() + "  #######");
   54.95 -            mockServer = new MockFTPServer();
   54.96 -            mockServer.start();
   54.97 -            
   54.98 -            mockServer.makeTestDir(this);
   54.99 -        } catch (IOException ex) {
  54.100 -            Exceptions.printStackTrace(ex);
  54.101 -            fail("Cannot initialise test folders!");
  54.102 -        }
  54.103 -    }
  54.104 -
  54.105 -    /** Called after every test case. */
  54.106 -    @Override
  54.107 -    public void tearDown() {
  54.108 -        
  54.109 -    }
  54.110 -
  54.111 -    /** Test Connect. 
  54.112 -     * Attempts to connect to the FTP server using a valid user and pwd.
  54.113 -     * Note that the FTPClient automatically logs in and changes to binary.
  54.114 -     * TODO: Test also if the logging in FTPClient works...
  54.115 -     */
  54.116 -    public void testConnect() {
  54.117 -        try {
  54.118 -            client = new FTPClient(new FTPLogInfo("localhost", MockFTPServer.DEFAULT_SERVER_PORT, "testUser", "foobar"));
  54.119 -            client.connect();
  54.120 -            assertTrue(client.isConnected());
  54.121 -            assertTrue(client.isUnixType());
  54.122 -            assertFalse(client.isPassiveMode());
  54.123 -            client.disconnect();
  54.124 -            assertFalse(client.isConnected());
  54.125 -        } catch (IOException ex) {
  54.126 -            Exceptions.printStackTrace(ex);
  54.127 -            fail();
  54.128 -        }
  54.129 -    }
  54.130 -    
  54.131 -    public void testTransfer() {
  54.132 -        try {
  54.133 -            File workDir = this.getWorkDir();
  54.134 -            client = new FTPClient(new FTPLogInfo("localhost", MockFTPServer.DEFAULT_SERVER_PORT, "testUser", "foobar"));
  54.135 -            client.connect();
  54.136 -            assertTrue(client.isConnected());
  54.137 -            client.cwd("foo/bar");
  54.138 -            assertEquals("\"CWD foo/bar\" is not correct!",mockServer.getWorkingDir().getPath(), mockServer.getRoot().getPath()+File.separator+"foo"+File.separator+"bar");
  54.139 -            client.cwd("/foo/bar");
  54.140 -            assertEquals("\"CWD foo/bar\" is not correct!",mockServer.getWorkingDir().getPath(), mockServer.getRoot().getPath()+File.separator+"foo"+File.separator+"bar");
  54.141 -            File target = new File(this.getWorkDir(), "nb.txt");
  54.142 -//            RemoteFileName source = new FTPFileName(mockServer.getRoot().getPath()+"");
  54.143 -//            client.get("nb.txt", "where");
  54.144 -//            client.delete("");
  54.145 -//            client.list(directory);
  54.146 -//            client.put(what, where);
  54.147 -//            client.rmdir(path);
  54.148 -            client.disconnect();
  54.149 -        } catch (IOException ex) {
  54.150 -            Exceptions.printStackTrace(ex);
  54.151 -            fail();
  54.152 -        }
  54.153 -    }
  54.154 -    
  54.155 -    
  54.156 -}
    55.1 --- a/remotefs/test/unit/src/org/netbeans/modules/remotefs/testutils/MockFTPServer.java	Wed Jul 28 12:48:15 2010 -0400
    55.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.3 @@ -1,345 +0,0 @@
    55.4 -/*
    55.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    55.6 - * 
    55.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    55.8 - * 
    55.9 - * The contents of this file are subject to the terms of either the GNU
   55.10 - * General Public License Version 2 only ("GPL") or the Common
   55.11 - * Development and Distribution License("CDDL") (collectively, the
   55.12 - * "License"). You may not use this file except in compliance with the
   55.13 - * License. You can obtain a copy of the License at
   55.14 - * http://www.netbeans.org/cddl-gplv2.html
   55.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   55.16 - * specific language governing permissions and limitations under the
   55.17 - * License.  When distributing the software, include this License Header
   55.18 - * Notice in each file and include the License file at
   55.19 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
   55.20 - * particular file as subject to the "Classpath" exception as provided
   55.21 - * by Sun in the GPL Version 2 section of the License file that
   55.22 - * accompanied this code. If applicable, add the following below the
   55.23 - * License Header, with the fields enclosed by brackets [] replaced by
   55.24 - * your own identifying information:
   55.25 - * "Portions Copyrighted [year] [name of copyright owner]"
   55.26 - * 
   55.27 - * If you wish your version of this file to be governed by only the CDDL
   55.28 - * or only the GPL Version 2, indicate your decision by adding
   55.29 - * "[Contributor] elects to include this software in this distribution
   55.30 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
   55.31 - * single choice of license, a recipient has the option to distribute
   55.32 - * your version of this file under either the CDDL, the GPL Version 2 or
   55.33 - * to extend the choice of license to its licensees as provided above.
   55.34 - * However, if you add GPL Version 2 code and therefore, elected the GPL
   55.35 - * Version 2 license, then the option applies only if the new code is
   55.36 - * made subject to such option by the copyright holder.
   55.37 - * 
   55.38 - * Contributor(s): Dirk Estievenart
   55.39 - * 
   55.40 - * Portions Copyrighted 2008 Sun Microsystems, Inc.
   55.41 - */
   55.42 -package org.netbeans.modules.remotefs.testutils;
   55.43 -
   55.44 -import java.io.BufferedReader;
   55.45 -import java.io.File;
   55.46 -import java.io.FileOutputStream;
   55.47 -import java.net.Socket;
   55.48 -import org.openide.util.Exceptions;
   55.49 -import java.io.IOException;
   55.50 -import java.io.InputStreamReader;
   55.51 -import java.io.PrintWriter;
   55.52 -import java.net.ServerSocket;
   55.53 -import org.netbeans.junit.NbTestCase;
   55.54 -
   55.55 -/**
   55.56 - * Should act as a FTP server. <br/>
   55.57 - * <ul>
   55.58 - * <li>Accepts only one client connection.</li>
   55.59 - * <li>Implemented following RFC 959.  </li>
   55.60 - * <li>not all commands are implemented, only the ones needed for FTPClient.</li>
   55.61 - * <li>only STREAM mode and FILE structure is supported.</li>
   55.62 - * <li>login with user "testUser" and password "foobar"</li>
   55.63 - * </ul>
   55.64 - */
   55.65 -public class MockFTPServer extends Thread {
   55.66 -    public static final int DEFAULT_SERVER_PORT = 40021;
   55.67 -    private int serverPort;
   55.68 -    private boolean quit = false;
   55.69 -    private String user = "unknown";
   55.70 -    private boolean loggedIn = false;
   55.71 -    /** FTP server starts in ASCII mode */
   55.72 -    private boolean transferTypeBinary = false;
   55.73 -    /** FTP client socket */
   55.74 -    private Socket client;
   55.75 -    /** FTP server starts in active mode (i.e. connects to port given by client)*/
   55.76 -    private boolean activeMode = true;
   55.77 -    /** server socket for communication */
   55.78 -    private ServerSocket commSS;
   55.79 -        /** socket for data transfer when client is in Active mode*/
   55.80 -    private Socket dataCS;
   55.81 -    /** server socket for data transfer client is in passive mode*/
   55.82 -    private ServerSocket dataSS;
   55.83 -    /** the current working directory */
   55.84 -    private File workingDir;
   55.85 -
   55.86 -    /**
   55.87 -     * The root of the server's virtual filesystem.
   55.88 -     */
   55.89 -    private File root;
   55.90 -
   55.91 -    /**
   55.92 -     * Default Constructor. <br/>
   55.93 -     * Server will use port 40021.
   55.94 -     */
   55.95 -    public MockFTPServer() {
   55.96 -        this(DEFAULT_SERVER_PORT);
   55.97 -    }
   55.98 -    /**
   55.99 -     * Constructor accepting port number to use.<br/>
  55.100 -     * Note that for port numbers &lt; 1024 on some systems superuser rights are required.
  55.101 -     * 
  55.102 -     * @param port
  55.103 -     */
  55.104 -    public MockFTPServer(int port) {
  55.105 -        super("MockFTPServer");
  55.106 -        serverPort = port;
  55.107 -
  55.108 -    }
  55.109 -
  55.110 -    /**
  55.111 -     * Starts server. Server accepts only one connection.
  55.112 -     */
  55.113 -    @Override
  55.114 -    public void run() {
  55.115 -        PrintWriter pw = null;
  55.116 -        BufferedReader br = null;
  55.117 -        try {
  55.118 -            commSS = new ServerSocket(serverPort);
  55.119 -            commSS.setSoTimeout(10000);
  55.120 -            System.out.println("FTP server: started.");
  55.121 -            client = commSS.accept();
  55.122 -            System.out.println("FTP server: received request.");
  55.123 -            pw = new PrintWriter(client.getOutputStream());
  55.124 -            pw.println("220 test FTP server ready");
  55.125 -            System.out.println("220 test FTP server ready");
  55.126 -            pw.flush();
  55.127 -            br = new BufferedReader(new InputStreamReader(client.getInputStream()));
  55.128 -            String line = null;
  55.129 -            while (!quit && (line = br.readLine()) != null) {
  55.130 -                System.out.println("CLIENT : "+line);
  55.131 -                String result = handleCommand(line);
  55.132 -                System.out.println("SERVER : "+result);
  55.133 -                pw.println(result);
  55.134 -                pw.flush();
  55.135 -            }
  55.136 -        } catch (IOException ex) {
  55.137 -            Exceptions.printStackTrace(ex);
  55.138 -        } finally {
  55.139 -            if (client != null) {
  55.140 -                try {
  55.141 -                    client.close();
  55.142 -                } catch (IOException ex) {
  55.143 -                    Exceptions.printStackTrace(ex);
  55.144 -                }
  55.145 -            }
  55.146 -            if (commSS != null) {
  55.147 -                try {
  55.148 -                    commSS.close();
  55.149 -                } catch (IOException ex) {
  55.150 -                    Exceptions.printStackTrace(ex);
  55.151 -                }
  55.152 -            }
  55.153 -        }
  55.154 -    }
  55.155 -
  55.156 -    /**
  55.157 -     * Process the request of the client
  55.158 -     * @param line
  55.159 -     * @return
  55.160 -     */
  55.161 -    private String handleCommand(String line) {
  55.162 -        String[] sa = line.split(" ");
  55.163 -        if (sa.length > 0) {
  55.164 -            String cmd = sa[0].toUpperCase();
  55.165 -            // just store the user given
  55.166 -            if (cmd.equals("USER")) {
  55.167 -                if (sa.length == 2) {
  55.168 -                    user = sa[1];
  55.169 -                }
  55.170 -                return "331 Password please.";
  55.171 -            }
  55.172 -            // check if pass == foobar and user == testUser
  55.173 -            if (cmd.equals("PASS")) {
  55.174 -                if (!"testUser".equals(user)) {
  55.175 -                    return "503 Login with USER first.";
  55.176 -                }
  55.177 -                if (sa.length == 2 && sa[1].equals("foobar")) {
  55.178 -                    loggedIn = true;
  55.179 -                    return "230 Hi! Thanks for testing.";
  55.180 -                }
  55.181 -                return "530 Don't know you! Go away!";
  55.182 -            }
  55.183 -            // Let's pretend we're unix
  55.184 -            if (cmd.equals("SYST")) {
  55.185 -                return "215 UNIX of course! What else?";
  55.186 -            }
  55.187 -            // ASCII Non-print or Image (binary) are the only ones accepted.
  55.188 -            if (cmd.equals("TYPE")) {
  55.189 -                if (sa.length >= 2) {
  55.190 -                    if (sa[1].equals("A")) {
  55.191 -                        if (sa.length == 2 || sa[2].equals("N")) {
  55.192 -                            transferTypeBinary = false;
  55.193 -                            return "200 Type set to ASCII";
  55.194 -                        } else {
  55.195 -                            return "504 Form must be N";
  55.196 -                        }
  55.197 -                    }
  55.198 -                    if (sa[1].equals("E")) {
  55.199 -                        return "504 Type E not implemented";
  55.200 -                    }
  55.201 -                    if (sa[1].equals("I")) {
  55.202 -                        transferTypeBinary = true;
  55.203 -                        return "200 Type set to BINARY";
  55.204 -                    }
  55.205 -                    if (sa[1].equals("L")) {
  55.206 -                        return "504 Type L not implemented";
  55.207 -                    }
  55.208 -                }
  55.209 -            }
  55.210 -            if (cmd.equals("QUIT")) {
  55.211 -              //  quit = true;
  55.212 -                return "221 CU soon.";
  55.213 -            }
  55.214 -            if (cmd.equals("PASV")) {
  55.215 -
  55.216 -            }
  55.217 -            if (cmd.equals("RETR")) {
  55.218 -
  55.219 -            }
  55.220 -            if (cmd.equals("STOR")) {
  55.221 -
  55.222 -            }
  55.223 -            if (cmd.equals("RNFR")) {
  55.224 -
  55.225 -            }
  55.226 -            if (cmd.equals("RNTO")) {
  55.227 -
  55.228 -            }
  55.229 -            if (cmd.equals("DELE")) {
  55.230 -
  55.231 -            }
  55.232 -            if (cmd.equals("RMD")) {
  55.233 -
  55.234 -            }
  55.235 -            if (cmd.equals("PWD")) {
  55.236 -
  55.237 -            }
  55.238 -            if (cmd.equals("LIST")) {
  55.239 -
  55.240 -            }
  55.241 -            if (cmd.equals("PORT")) {
  55.242 -
  55.243 -            }
  55.244 -            if (cmd.equals("CWD")) {
  55.245 -                if(!loggedIn){
  55.246 -                    return "530 Please login with USER and PASS.";
  55.247 -                }
  55.248 -                //if no argument, i.e. a folder path, is given, we return succesful.
  55.249 -                if(sa.length == 2){
  55.250 -                    File cwd = new File(getRoot(), sa[1]);
  55.251 -                    if(cwd.exists() && cwd.isDirectory()){
  55.252 -                        workingDir = cwd;
  55.253 -                        return "250 CWD command succesful.";
  55.254 -                    }else{
  55.255 -                         return "550 "+sa[1]+": No such file or directory.";
  55.256 -                    }
  55.257 -                }else{
  55.258 -                    return "250 CWD command succesful.";
  55.259 -                }
  55.260 -            }
  55.261 -//            if (cmd.equals("NLIST")) {
  55.262 -//            // not used by FTPClient
  55.263 -//            }
  55.264 -//            if (cmd.equals("SITE")) {
  55.265 -//            // not used by FTPClient
  55.266 -//            }
  55.267 -//            if (cmd.equals("STAT")) {
  55.268 -//            // not used by FTPClient
  55.269 -//            }
  55.270 -//            if (cmd.equals("STOU")) {
  55.271 -//            // not used by FTPClient
  55.272 -//            }
  55.273 -//            if (cmd.equals("APPE")) {
  55.274 -//            // not used by FTPClient
  55.275 -//            }
  55.276 -//            if (cmd.equals("ACCT")) {
  55.277 -//            // not used by FTPClient
  55.278 -//            }
  55.279 -//            if (cmd.equals("CDUP")) {
  55.280 -//            // not used by FTPClient
  55.281 -//            }
  55.282 -//            if (cmd.equals("REST")) {
  55.283 -//            // not used by FTPClient
  55.284 -//            }
  55.285 -//            if (cmd.equals("ABOR")) {
  55.286 -//            // not used by FTPClient
  55.287 -//            }
  55.288 -//            if (cmd.equals("STRU")) {
  55.289 -//            // not used by FTPClient
  55.290 -//            }
  55.291 -//            if (cmd.equals("MODE")) {
  55.292 -//            // not used by FTPClient
  55.293 -//            }
  55.294 -//            if (cmd.equals("HELP")) {
  55.295 -//            // not used by FTPClient
  55.296 -//            }
  55.297 -//            if (cmd.equals("NOOP")) {
  55.298 -//            // not used by FTPClient
  55.299 -//            }
  55.300 -//            if (cmd.equals("SMNT")) {
  55.301 -//            // not used by FTPClient
  55.302 -//            }
  55.303 -//            if (cmd.equals("REIN")) {
  55.304 -//            // not used by FTPClient
  55.305 -//            }
  55.306 -            
  55.307 -        }
  55.308 -        return "504 " + line + " : Huh? Don't understand you!(Maybe command is not implemented)";
  55.309 -    }
  55.310 -
  55.311 -    /**
  55.312 -     * Creates a folder structure to mimic the server's filesystem.<br/>
  55.313 -     * Folders are created in the working directory for the running NbTestCase.
  55.314 -     * <p>
  55.315 -     * /<br/>
  55.316 -     * |_foo<br/>
  55.317 -     * &nbsp;&nbsp;&nbsp;&nbsp;|_bar<br/>
  55.318 -     * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|_ nb.txt<br/>
  55.319 -     * </p>
  55.320 -     * @param test
  55.321 -     */
  55.322 -    public void makeTestDir(NbTestCase test) throws IOException {
  55.323 -            File workDir = test.getWorkDir();
  55.324 -            root = new File(workDir, "server");
  55.325 -            getRoot().mkdir();            
  55.326 -            File folders = new File(getRoot(), "foo/bar");
  55.327 -            folders.mkdirs();
  55.328 -            File file = new File(folders, "nb.txt");
  55.329 -            PrintWriter p = new PrintWriter(new FileOutputStream(file));
  55.330 -            p.println("NetBeans - The Only IDE You Need!");
  55.331 -            p.println("=================================");
  55.332 -            p.println("The NetBeans IDE is a free, open-source Integrated Development Environment for software developers. ");
  55.333 -            p.println("You get all the tools you need to create professional desktop, enterprise, web and mobile applications,");
  55.334 -            p.println("in Java, C/C++ and even Ruby. ");
  55.335 -            p.println("The IDE runs on many platforms including Windows, Linux, Mac OS X and Solaris; ");
  55.336 -            p.println("it is easy to install and use straight out of the box.");
  55.337 -            p.flush();
  55.338 -            p.close();
  55.339 -    }
  55.340 -
  55.341 -    public File getWorkingDir() {
  55.342 -        return workingDir;
  55.343 -    }
  55.344 -
  55.345 -    public File getRoot() {
  55.346 -        return root;
  55.347 -    }
  55.348 -}