Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2007-12-22 13:33:47 -0500
committerslewis2007-12-22 13:33:47 -0500
commit55558f8b6d3eff1d0e7c38d8ec5c6e2178551e17 (patch)
treef99a53cba9c23371da54e5a1e15770eb12d21148
parenta83a9f4de76d384ebc676bcef518591989f7ae50 (diff)
downloadorg.eclipse.ecf-55558f8b6d3eff1d0e7c38d8ec5c6e2178551e17.tar.gz
org.eclipse.ecf-55558f8b6d3eff1d0e7c38d8ec5c6e2178551e17.tar.xz
org.eclipse.ecf-55558f8b6d3eff1d0e7c38d8ec5c6e2178551e17.zip
Added support for efs-bases file send.
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/plugin.xml10
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/RetrieveFileTransfer.java (renamed from providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/EFSRetrieveFileTransfer.java)46
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/RetrieveFileTransferFactory.java (renamed from providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/EFSRetrieveFileTransferFactory.java)4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransfer.java95
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransferFactory.java29
5 files changed, 150 insertions, 34 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/plugin.xml
index 13a2e003e..21eec7d64 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/plugin.xml
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/plugin.xml
@@ -4,9 +4,17 @@
<extension
point="org.eclipse.ecf.provider.filetransfer.retrieveFileTransferProtocolFactory">
<retrieveFileTransferProtocolFactory
- class="org.eclipse.ecf.internal.provider.filetransfer.efs.EFSRetrieveFileTransferFactory"
+ class="org.eclipse.ecf.internal.provider.filetransfer.efs.RetrieveFileTransferFactory"
protocol="efs">
</retrieveFileTransferProtocolFactory>
</extension>
+ <extension
+ point="org.eclipse.ecf.provider.filetransfer.sendFileTransferProtocolFactory">
+ <sendFileTransferProtocolFactory
+ class="org.eclipse.ecf.internal.provider.filetransfer.efs.SendFileTransferFactory"
+ protocol="efs">
+ </sendFileTransferProtocolFactory>
+ </extension>
+
</plugin>
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/EFSRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/RetrieveFileTransfer.java
index 3d214b537..492e2b301 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/EFSRetrieveFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/RetrieveFileTransfer.java
@@ -21,8 +21,6 @@ import java.net.URI;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.ecf.core.identity.ID;
-import org.eclipse.ecf.core.security.IConnectContext;
import org.eclipse.ecf.core.util.Proxy;
import org.eclipse.ecf.filetransfer.IIncomingFileTransfer;
import org.eclipse.ecf.filetransfer.IncomingFileTransferException;
@@ -34,18 +32,26 @@ import org.eclipse.ecf.provider.filetransfer.util.JREProxyHelper;
/**
*
*/
-public class EFSRetrieveFileTransfer extends AbstractRetrieveFileTransfer {
-
- IConnectContext connectContext;
- Proxy proxy;
+public class RetrieveFileTransfer extends AbstractRetrieveFileTransfer {
JREProxyHelper proxyHelper = null;
- public EFSRetrieveFileTransfer() {
+ public RetrieveFileTransfer() {
super();
proxyHelper = new JREProxyHelper();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#hardClose()
+ */
+ protected void hardClose() {
+ super.hardClose();
+ if (proxyHelper != null) {
+ proxyHelper.dispose();
+ proxyHelper = null;
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -69,7 +75,7 @@ public class EFSRetrieveFileTransfer extends AbstractRetrieveFileTransfer {
setOutputStream(new BufferedOutputStream(new FileOutputStream(localFileToSave)));
job = new FileTransferJob(getRemoteFileURL().toString());
job.schedule();
- return EFSRetrieveFileTransfer.this;
+ return RetrieveFileTransfer.this;
}
public String toString() {
@@ -89,7 +95,7 @@ public class EFSRetrieveFileTransfer extends AbstractRetrieveFileTransfer {
setCloseOutputStream(false);
job = new FileTransferJob(getRemoteFileURL().toString());
job.schedule();
- return EFSRetrieveFileTransfer.this;
+ return RetrieveFileTransfer.this;
}
});
@@ -99,28 +105,6 @@ public class EFSRetrieveFileTransfer extends AbstractRetrieveFileTransfer {
}
}
- /**
- *
- * @see org.eclipse.ecf.core.identity.IIdentifiable#getID()
- */
- public ID getID() {
- return remoteFileID;
- }
-
- /**
- * @see org.eclipse.ecf.filetransfer.IRetrieveFileTransferContainerAdapter#setConnectContextForAuthentication(org.eclipse.ecf.core.security.IConnectContext)
- */
- public void setConnectContextForAuthentication(IConnectContext connectContext) {
- this.connectContext = connectContext;
- }
-
- /**
- * @see org.eclipse.ecf.filetransfer.IRetrieveFileTransferContainerAdapter#setProxy(org.eclipse.ecf.core.util.Proxy)
- */
- public void setProxy(Proxy proxy) {
- this.proxy = proxy;
- }
-
/* (non-Javadoc)
* @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#doPause()
*/
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/EFSRetrieveFileTransferFactory.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/RetrieveFileTransferFactory.java
index 96fc30718..f77aa63ba 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/EFSRetrieveFileTransferFactory.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/RetrieveFileTransferFactory.java
@@ -6,13 +6,13 @@ import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
/**
* EFS factory
*/
-public class EFSRetrieveFileTransferFactory implements IRetrieveFileTransferFactory {
+public class RetrieveFileTransferFactory implements IRetrieveFileTransferFactory {
/**
* @see org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory#newInstance()
*/
public IRetrieveFileTransfer newInstance() {
- return new EFSRetrieveFileTransfer();
+ return new RetrieveFileTransfer();
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransfer.java
new file mode 100644
index 000000000..705f89c85
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransfer.java
@@ -0,0 +1,95 @@
+/****************************************************************************
+ * Copyright (c) 2007 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.ecf.internal.provider.filetransfer.efs;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.net.URI;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.ecf.core.util.Proxy;
+import org.eclipse.ecf.filetransfer.IOutgoingFileTransfer;
+import org.eclipse.ecf.filetransfer.SendFileTransferException;
+import org.eclipse.ecf.filetransfer.events.IOutgoingFileTransferResponseEvent;
+import org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer;
+import org.eclipse.ecf.provider.filetransfer.util.JREProxyHelper;
+
+/**
+ *
+ */
+public class SendFileTransfer extends AbstractOutgoingFileTransfer {
+
+ JREProxyHelper proxyHelper = null;
+
+ public SendFileTransfer() {
+ super();
+ this.proxyHelper = new JREProxyHelper();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#hardClose()
+ */
+ protected void hardClose() {
+ super.hardClose();
+ if (proxyHelper != null) {
+ proxyHelper.dispose();
+ proxyHelper = null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#openStreams()
+ */
+ protected void openStreams() throws SendFileTransferException {
+ try {
+ // Get/open input file
+ setInputStream(new BufferedInputStream(new FileInputStream(getFileTransferInfo().getFile())));
+ // Open target
+ final IFileStore fileStore = EFS.getStore(new URI(getRemoteFileURL().getFile()));
+ setOutputStream(fileStore.openOutputStream(0, null));
+ // Notify listener
+ listener.handleTransferEvent(new IOutgoingFileTransferResponseEvent() {
+
+ private static final long serialVersionUID = 8414116325104138848L;
+
+ public String toString() {
+ final StringBuffer sb = new StringBuffer("IOutgoingFileTransferResponseEvent["); //$NON-NLS-1$
+ sb.append("isdone=").append(done).append(";"); //$NON-NLS-1$ //$NON-NLS-2$
+ sb.append("bytesSent=").append( //$NON-NLS-1$
+ bytesSent).append("]"); //$NON-NLS-1$
+ return sb.toString();
+ }
+
+ public boolean requestAccepted() {
+ return true;
+ }
+
+ public IOutgoingFileTransfer getSource() {
+ return SendFileTransfer.this;
+ }
+
+ });
+
+ } catch (final Exception e) {
+ throw new SendFileTransferException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#setupProxy(org.eclipse.ecf.core.util.Proxy)
+ */
+ protected void setupProxy(Proxy proxy) {
+ proxyHelper.setupProxy(proxy);
+ }
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransferFactory.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransferFactory.java
new file mode 100644
index 000000000..a7ba568b3
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.efs/src/org/eclipse/ecf/internal/provider/filetransfer/efs/SendFileTransferFactory.java
@@ -0,0 +1,29 @@
+/****************************************************************************
+ * Copyright (c) 2007 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.ecf.internal.provider.filetransfer.efs;
+
+import org.eclipse.ecf.filetransfer.service.ISendFileTransfer;
+import org.eclipse.ecf.filetransfer.service.ISendFileTransferFactory;
+
+/**
+ *
+ */
+public class SendFileTransferFactory implements ISendFileTransferFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.filetransfer.service.ISendFileTransferFactory#newInstance()
+ */
+ public ISendFileTransfer newInstance() {
+ return new SendFileTransfer();
+ }
+
+}

Back to the top