Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2007-12-13 23:48:42 +0000
committerslewis2007-12-13 23:48:42 +0000
commitc5f412cc2ca707a8084518df00ca477b2f853a2f (patch)
tree9884be233e17819f0c1eabb0f0ff5400c0467534 /providers
parentb6118899f1caf128c5e371bfd31fd9186476ca67 (diff)
downloadorg.eclipse.ecf-c5f412cc2ca707a8084518df00ca477b2f853a2f.tar.gz
org.eclipse.ecf-c5f412cc2ca707a8084518df00ca477b2f853a2f.tar.xz
org.eclipse.ecf-c5f412cc2ca707a8084518df00ca477b2f853a2f.zip
Fix for CVS screw up
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/.project2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF27
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/build.properties11
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/plugin.xml18
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Activator.java61
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/IScpFileTransfer.java35
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Messages.java40
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java172
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java239
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransferFactory.java16
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpSendFileTransferFactory.java16
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java286
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/messages.properties11
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/tests/provider/filetransfer/scp/Activator.java50
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java74
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java95
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/test.txt818
17 files changed, 922 insertions, 1049 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/.project b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/.project
index 5d2017caf..5af7c0dc9 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/.project
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.ecf.tests.provider.filetransfer.scp</name>
+ <name>org.eclipse.ecf.provider.filetransfer.scp</name>
<comment></comment>
<projects>
</projects>
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF
index 0628c44a2..a0d5622c2 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF
@@ -1,15 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: SCP Provider Tests
-Bundle-SymbolicName: org.eclipse.ecf.tests.provider.filetransfer.scp
-Bundle-Version: 1.0.0
-Bundle-Activator: org.eclipse.ecf.internal.tests.provider.filetransfer.scp.Activator
-Bundle-Vendor: Eclipse.org
-Require-Bundle: org.eclipse.core.runtime,
+Bundle-Name: %plugin.name
+Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer.scp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.ecf.internal.provider.filetransfer.scp.Activator
+Bundle-Vendor: %plugin.provider
+Import-Package: com.jcraft.jsch,
+ org.eclipse.osgi.util;version="1.1.0",
+ org.osgi.framework;version="1.3.0",
+ org.osgi.service.log;version="1.3.0",
+ org.osgi.util.tracker;version="1.3.3"
+Eclipse-LazyStart: true
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.equinox.common,
org.eclipse.ecf,
- org.eclipse.ecf.filetransfer,
- org.junit,
- org.eclipse.ecf.tests.filetransfer,
- org.eclipse.ecf.tests
+ org.eclipse.ecf.provider.filetransfer,
+ org.eclipse.ecf.filetransfer
+Export-Package: org.eclipse.ecf.internal.provider.filetransfer.scp;x-internal:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Eclipse-LazyStart: true
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/build.properties b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/build.properties
new file mode 100644
index 000000000..0ad98afea
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/build.properties
@@ -0,0 +1,11 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties
+src.includes = about.html,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/plugin.xml
new file mode 100644
index 000000000..db397a12d
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/plugin.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ecf.provider.filetransfer.sendFileTransferProtocolFactory">
+ <sendFileTransferProtocolFactory
+ class="org.eclipse.ecf.internal.provider.filetransfer.scp.ScpSendFileTransferFactory"
+ protocol="scp">
+ </sendFileTransferProtocolFactory>
+ </extension>
+ <extension
+ point="org.eclipse.ecf.provider.filetransfer.retrieveFileTransferProtocolFactory">
+ <retrieveFileTransferProtocolFactory
+ class="org.eclipse.ecf.internal.provider.filetransfer.scp.ScpRetrieveFileTransferFactory"
+ protocol="scp">
+ </retrieveFileTransferProtocolFactory>
+ </extension>
+</plugin>
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Activator.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Activator.java
new file mode 100644
index 000000000..c6e187eea
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Activator.java
@@ -0,0 +1,61 @@
+package org.eclipse.ecf.internal.provider.filetransfer.scp;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.ecf.core.util.LogHelper;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator {
+
+ public static final String PLUGIN_ID = "org.eclipse.ecf.provider.scp"; //$NON-NLS-1$
+
+ static Activator instance;
+
+ private BundleContext context;
+
+ private ServiceTracker logServiceTracker = null;
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext ctxt) throws Exception {
+ instance = this;
+ this.context = ctxt;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext ctxt) throws Exception {
+ if (logServiceTracker != null) {
+ logServiceTracker.close();
+ logServiceTracker = null;
+ }
+ instance = null;
+ this.context = null;
+ }
+
+ public static Activator getDefault() {
+ return instance;
+ }
+
+ protected LogService getLogService() {
+ if (logServiceTracker == null) {
+ logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null);
+ logServiceTracker.open();
+ }
+ return (LogService) logServiceTracker.getService();
+ }
+
+ public void log(IStatus status) {
+ final LogService logService = getLogService();
+ if (logService != null) {
+ logService.log(LogHelper.getLogCode(status), LogHelper.getLogMessage(status), status.getException());
+ }
+ }
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/IScpFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/IScpFileTransfer.java
new file mode 100644
index 000000000..700359f74
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/IScpFileTransfer.java
@@ -0,0 +1,35 @@
+/****************************************************************************
+ * 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.scp;
+
+import java.net.URL;
+import java.util.Map;
+
+import org.eclipse.ecf.core.security.IConnectContext;
+import org.eclipse.ecf.core.util.Proxy;
+
+/**
+ *
+ */
+public interface IScpFileTransfer {
+
+ public IConnectContext getConnectContext();
+
+ public String getUsername();
+
+ public Proxy getProxy();
+
+ public URL getTargetURL();
+
+ public Map getOptions();
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Messages.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Messages.java
new file mode 100644
index 000000000..71a6e7be1
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/Messages.java
@@ -0,0 +1,40 @@
+/****************************************************************************
+ * 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.scp;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.ecf.internal.provider.filetransfer.scp.messages"; //$NON-NLS-1$
+ public static String ScpOutgoingFileTransfer_EXCEPTION_CONNECTING;
+ public static String ScpOutgoingFileTransfer_EXCEPTION_SETTING_KNOWN_HOSTS;
+ public static String ScpOutgoingFileTransfer_EXCEPTION_SETTING_SSH_IDENTITY;
+ public static String ScpOutgoingFileTransfer_PASSPHRASE_PROMPT;
+ public static String ScpOutgoingFileTransfer_PASSWORD_PROMPT;
+ public static String ScpOutgoingFileTransfer_USERNAME_PROMPT;
+ public static String ScpRetrieveFileTransfer_EXCEPTION_CONNECTING;
+ public static String ScpRetrieveFileTransfer_EXCEPTION_ERROR_READING_FILE;
+ public static String ScpRetrieveFileTransfer_EXCEPTION_SCP_PROTOCOL;
+ public static String ScpUtil_EXCEPTION_UNKNOWN_SCP_ERROR;
+ public static String ScpUtil_SCP_ERROR;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ //
+ }
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java
new file mode 100644
index 000000000..e39beabfd
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java
@@ -0,0 +1,172 @@
+/****************************************************************************
+ * 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.scp;
+
+import com.jcraft.jsch.*;
+import java.io.*;
+import java.net.URL;
+import java.util.Map;
+import org.eclipse.ecf.core.security.IConnectContext;
+import org.eclipse.ecf.core.util.Proxy;
+import org.eclipse.ecf.filetransfer.IIncomingFileTransferRequestListener;
+import org.eclipse.ecf.filetransfer.SendFileTransferException;
+import org.eclipse.ecf.filetransfer.service.ISendFileTransfer;
+import org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ */
+public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer implements ISendFileTransfer, IScpFileTransfer {
+
+ private static final String SCP_COMMAND = "scp -p -t "; //$NON-NLS-1$
+ private static final String SCP_EXEC = "exec"; //$NON-NLS-1$
+
+ String username;
+
+ private Channel channel;
+
+ private InputStream responseStream;
+ private IConnectContext connectContext;
+
+ private ScpUtil scpUtil;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#openStreams()
+ */
+ protected void openStreams() throws SendFileTransferException {
+ try {
+ final File localFile = getFileTransferInfo().getFile();
+ // Set input stream from local file
+ setInputStream(new BufferedInputStream(new FileInputStream(localFile)));
+ final URL url = getRemoteFileURL();
+ this.username = (url.getUserInfo() == null) ? System.getProperty("user.name") : url.getUserInfo(); //$NON-NLS-1$
+ scpUtil = new ScpUtil(this);
+ final Session s = scpUtil.getSession();
+ s.connect();
+ final String targetFileName = scpUtil.trimTargetFile(url.getPath());
+ final String command = SCP_COMMAND + targetFileName;
+ channel = s.openChannel(SCP_EXEC);
+ ((ChannelExec) channel).setCommand(command);
+ final OutputStream outs = channel.getOutputStream();
+ responseStream = channel.getInputStream();
+ channel.connect();
+ scpUtil.checkAck(responseStream);
+ sendFileNameAndSize(localFile, targetFileName, outs, responseStream);
+ setOutputStream(outs);
+ fireSendStartEvent();
+ } catch (final Exception e) {
+ throw new SendFileTransferException(NLS.bind(Messages.ScpOutgoingFileTransfer_EXCEPTION_CONNECTING, getRemoteFileURL().toString()), e);
+ }
+
+ }
+
+ public Map getOptions() {
+ return options;
+ }
+
+ public URL getTargetURL() {
+ return getRemoteFileURL();
+ }
+
+ public Proxy getProxy() {
+ return this.proxy;
+ }
+
+ private void sendFileNameAndSize(File localFile, String fileName, OutputStream outs, InputStream ins) throws IOException {
+ // send "C0644 filesize filename", where filename should not include '/'
+ final long filesize = localFile.length();
+ final StringBuffer command = new StringBuffer("C0644 "); //$NON-NLS-1$
+ command.append(filesize).append(" ").append(fileName).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ outs.write(command.toString().getBytes());
+ outs.flush();
+ scpUtil.checkAck(ins);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#hardClose()
+ */
+ protected void hardClose() {
+ try {
+ if (scpUtil != null) {
+ scpUtil.sendZeroToStream(remoteFileContents);
+ scpUtil.checkAck(responseStream);
+ }
+ if (remoteFileContents != null) {
+ remoteFileContents.close();
+ remoteFileContents = null;
+ }
+ if (channel != null) {
+ channel.disconnect();
+ channel = null;
+ }
+ if (scpUtil != null) {
+ scpUtil.dispose();
+ scpUtil = null;
+ }
+ } catch (final IOException e) {
+ exception = e;
+ }
+ username = null;
+ super.hardClose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#setupProxy(org.eclipse.ecf.core.util.Proxy)
+ */
+ protected void setupProxy(Proxy proxy) {
+ this.proxy = proxy;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.filetransfer.ISendFileTransferContainerAdapter#addListener(org.eclipse.ecf.filetransfer.IIncomingFileTransferRequestListener)
+ */
+ public void addListener(IIncomingFileTransferRequestListener l) {
+ // SCP doesn't have listener
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.filetransfer.ISendFileTransferContainerAdapter#removeListener(org.eclipse.ecf.filetransfer.IIncomingFileTransferRequestListener)
+ */
+ public boolean removeListener(IIncomingFileTransferRequestListener l) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.filetransfer.ISendFileTransferContainerAdapter#setConnectContextForAuthentication(org.eclipse.ecf.core.security.IConnectContext)
+ */
+ public void setConnectContextForAuthentication(IConnectContext connectContext) {
+ this.connectContext = connectContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.filetransfer.ISendFileTransferContainerAdapter#setProxy(org.eclipse.ecf.core.util.Proxy)
+ */
+ public void setProxy(Proxy proxy) {
+ this.proxy = proxy;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getConnectContext()
+ */
+ public IConnectContext getConnectContext() {
+ return connectContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getUsername()
+ */
+ public String getUsername() {
+ return username;
+ }
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java
new file mode 100644
index 000000000..691e480ab
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java
@@ -0,0 +1,239 @@
+/****************************************************************************
+ * 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.scp;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ecf.core.security.IConnectContext;
+import org.eclipse.ecf.core.util.Proxy;
+import org.eclipse.ecf.filetransfer.IFileTransferPausable;
+import org.eclipse.ecf.filetransfer.IncomingFileTransferException;
+import org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer;
+import org.eclipse.osgi.util.NLS;
+
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelExec;
+import com.jcraft.jsch.Session;
+
+/**
+ *
+ */
+public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implements IScpFileTransfer {
+
+ private static final String SCP_COMMAND = "scp -f "; //$NON-NLS-1$
+ private static final String SCP_EXEC = "exec"; //$NON-NLS-1$
+
+ String username;
+
+ Channel channel;
+
+ OutputStream responseStream;
+
+ private IConnectContext connectContext;
+
+ private ScpUtil scpUtil;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#doPause()
+ */
+ protected boolean doPause() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#doResume()
+ */
+ protected boolean doResume() {
+ return false;
+ }
+
+ public URL getTargetURL() {
+ return getRemoteFileURL();
+ }
+
+ public Map getOptions() {
+ return options;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#openStreams()
+ */
+ protected void openStreams() throws IncomingFileTransferException {
+ try {
+ // Set input stream from local file
+ final URL url = getRemoteFileURL();
+ this.username = (url.getUserInfo() == null) ? System.getProperty("user.name") : url.getUserInfo(); //$NON-NLS-1$
+
+ scpUtil = new ScpUtil(this);
+ final Session s = scpUtil.getSession();
+ s.connect();
+
+ final String command = SCP_COMMAND + scpUtil.trimTargetFile(url.getPath());
+ channel = s.openChannel(SCP_EXEC);
+ ((ChannelExec) channel).setCommand(command);
+ channel.connect();
+
+ final InputStream ins = channel.getInputStream();
+ responseStream = channel.getOutputStream();
+ scpUtil.sendZeroToStream(responseStream);
+ // read and set filesize
+ final int c = ins.read();
+ if (c != 'C')
+ throw new IOException(Messages.ScpRetrieveFileTransfer_EXCEPTION_SCP_PROTOCOL);
+ // read '0644 '
+ final byte[] buf = new byte[1024];
+ ins.read(buf, 0, 5);
+
+ setFileLength(readFileSize(ins, buf));
+ readFileName(ins, buf);
+ // set input stream for reading rest of file
+ setInputStream(ins);
+ scpUtil.sendZeroToStream(responseStream);
+
+ fireReceiveStartEvent();
+ } catch (final Exception e) {
+ channel = null;
+ username = null;
+ throw new IncomingFileTransferException(NLS.bind(Messages.ScpRetrieveFileTransfer_EXCEPTION_CONNECTING, getRemoteFileURL().toString()), e);
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#handleReceivedData(byte[], int, double, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void handleReceivedData(byte[] buf, int bytes, double factor, IProgressMonitor monitor) throws IOException {
+ if (bytes == -1) {
+ done = true;
+ } else {
+ int fileBytes = bytes;
+ if ((bytesReceived + bytes) > fileLength) {
+ fileBytes = (int) (fileLength - bytesReceived);
+ }
+ bytesReceived += fileBytes;
+ localFileContents.write(buf, 0, fileBytes);
+ fireTransferReceiveDataEvent();
+ monitor.worked((int) Math.round(factor * fileBytes));
+ if (fileBytes != bytes) {
+ scpUtil.checkAck(buf[fileBytes], remoteFileContents);
+ done = true;
+ }
+ }
+ }
+
+ private long readFileSize(InputStream ins, byte[] buf) throws IOException {
+ long filesize = 0L;
+ while (true) {
+ if (ins.read(buf, 0, 1) < 0) {
+ throw new IOException(Messages.ScpRetrieveFileTransfer_EXCEPTION_ERROR_READING_FILE);
+ }
+ if (buf[0] == ' ')
+ break;
+ filesize = filesize * 10L + (buf[0] - '0');
+ }
+ return filesize;
+ }
+
+ private String readFileName(InputStream ins, byte[] buf) throws IOException {
+ String file = null;
+ for (int i = 0;; i++) {
+ ins.read(buf, i, 1);
+ if (buf[i] == (byte) 0x0a) {
+ file = new String(buf, 0, i);
+ break;
+ }
+ }
+ return file;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#hardClose()
+ */
+ protected void hardClose() {
+ try {
+ if (remoteFileContents != null && scpUtil != null) {
+ scpUtil.sendZeroToStream(responseStream);
+ scpUtil.dispose();
+ scpUtil = null;
+ remoteFileContents = null;
+ responseStream = null;
+ }
+ } catch (final IOException e) {
+ exception = e;
+ } finally {
+ super.hardClose();
+ channel = null;
+ username = null;
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if (adapter == null)
+ return null;
+ if (adapter.equals(IFileTransferPausable.class))
+ return null;
+ return super.getAdapter(adapter);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#setupProxy(org.eclipse.ecf.core.util.Proxy)
+ */
+ protected void setupProxy(Proxy proxy) {
+ this.proxy = proxy;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.filetransfer.IRetrieveFileTransferContainerAdapter#setConnectContextForAuthentication(org.eclipse.ecf.core.security.IConnectContext)
+ */
+ public void setConnectContextForAuthentication(IConnectContext connectContext) {
+ this.connectContext = connectContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getConnectContext()
+ */
+ public IConnectContext getConnectContext() {
+ return connectContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getUsername()
+ */
+ public String getUsername() {
+ return username;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#promptPassphrase()
+ */
+ public boolean promptPassphrase() {
+ // XXX TODO
+ //return (keyFile != null);
+ return false;
+ }
+
+ public Proxy getProxy() {
+ return this.proxy;
+ }
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransferFactory.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransferFactory.java
new file mode 100644
index 000000000..b91db5666
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransferFactory.java
@@ -0,0 +1,16 @@
+package org.eclipse.ecf.internal.provider.filetransfer.scp;
+
+import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransfer;
+import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
+
+public class ScpRetrieveFileTransferFactory implements IRetrieveFileTransferFactory {
+
+ public ScpRetrieveFileTransferFactory() {
+ //
+ }
+
+ public IRetrieveFileTransfer newInstance() {
+ return new ScpRetrieveFileTransfer();
+ }
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpSendFileTransferFactory.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpSendFileTransferFactory.java
new file mode 100644
index 000000000..3ba01359c
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpSendFileTransferFactory.java
@@ -0,0 +1,16 @@
+package org.eclipse.ecf.internal.provider.filetransfer.scp;
+
+import org.eclipse.ecf.filetransfer.service.ISendFileTransfer;
+import org.eclipse.ecf.filetransfer.service.ISendFileTransferFactory;
+
+public class ScpSendFileTransferFactory implements ISendFileTransferFactory {
+
+ public ScpSendFileTransferFactory() {
+ //
+ }
+
+ public ISendFileTransfer newInstance() {
+ return new ScpOutgoingFileTransfer();
+ }
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java
new file mode 100644
index 000000000..cc22e9745
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java
@@ -0,0 +1,286 @@
+/****************************************************************************
+ * 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.scp;
+
+import com.jcraft.jsch.*;
+import java.io.*;
+import java.net.URL;
+import java.util.Map;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ecf.core.security.*;
+import org.eclipse.ecf.core.util.Proxy;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ */
+public class ScpUtil implements UserInfo, UIKeyboardInteractive {
+
+ public static final String SCP_SSHHOMEDIRECTORY = "sshHomeDirectory"; //$NON-NLS-1$
+ public static final String SCP_PUBLICKEYFILE = "keyFile"; //$NON-NLS-1$
+ public static final String SCP_KNOWNHOSTSFILE = "knownHostsFile"; //$NON-NLS-1$
+
+ public static final int DEFAULT_SCP_PORT = 22;
+
+ private IScpFileTransfer handler;
+ private String password;
+ private String passphrase;
+ private Session session;
+
+ private String sshHome = null;
+ private String keyFile = null;
+ private String knownHostsFile = null;
+
+ public ScpUtil(IScpFileTransfer handler) throws JSchException {
+ this.handler = handler;
+ final JSch jsch = new JSch();
+ final URL url = handler.getTargetURL();
+ int port = url.getPort();
+ if (port == -1)
+ port = DEFAULT_SCP_PORT;
+ setupOptions(jsch);
+ session = jsch.getSession(handler.getUsername(), url.getHost(), port);
+ setupProxy();
+ session.setUserInfo(this);
+ }
+
+ Session getSession() {
+ return session;
+ }
+
+ String promptCredentials(boolean usePassphrase) {
+ try {
+ final IConnectContext connectContext = handler.getConnectContext();
+ if (connectContext != null) {
+ final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
+ if (handler != null) {
+ final Callback[] callbacks = new Callback[2];
+ final NameCallback nc = new NameCallback(Messages.ScpOutgoingFileTransfer_USERNAME_PROMPT);
+ nc.setName(handler.getUsername());
+ callbacks[0] = nc;
+ if (usePassphrase) {
+ callbacks[1] = new PassphraseCallback(Messages.ScpOutgoingFileTransfer_PASSPHRASE_PROMPT);
+ } else
+ callbacks[1] = new PasswordCallback(Messages.ScpOutgoingFileTransfer_PASSWORD_PROMPT);
+ callbackHandler.handle(callbacks);
+ if (usePassphrase) {
+ passphrase = ((PassphraseCallback) callbacks[1]).getPassphrase();
+ } else
+ password = ((PasswordCallback) callbacks[1]).getPassword();
+ }
+ }
+ return (usePassphrase) ? this.passphrase : this.password;
+ } catch (final Exception e) {
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcraft.jsch.UserInfo#getPassphrase()
+ */
+ public String getPassphrase() {
+ return promptCredentials(true);
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcraft.jsch.UserInfo#getPassword()
+ */
+ public String getPassword() {
+ return promptCredentials(false);
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcraft.jsch.UserInfo#promptPassphrase(java.lang.String)
+ */
+ public boolean promptPassphrase(String message) {
+ return (keyFile != null);
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcraft.jsch.UserInfo#promptPassword(java.lang.String)
+ */
+ public boolean promptPassword(String message) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcraft.jsch.UserInfo#promptYesNo(java.lang.String)
+ */
+ public boolean promptYesNo(String message) {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcraft.jsch.UserInfo#showMessage(java.lang.String)
+ */
+ public void showMessage(String message) {
+ // do nothing
+ }
+
+ /* (non-Javadoc)
+ * @see com.jcraft.jsch.UIKeyboardInteractive#promptKeyboardInteractive(java.lang.String, java.lang.String, java.lang.String, java.lang.String[], boolean[])
+ */
+ public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) {
+ promptCredentials(false);
+ return new String[] {password};
+ }
+
+ /**
+ */
+ void setupProxy() {
+ com.jcraft.jsch.Proxy jProxy = null;
+ final Proxy proxy = handler.getProxy();
+ if (proxy != null) {
+ final String hostname = proxy.getAddress().getHostName();
+ final int port = proxy.getAddress().getPort();
+ if (proxy.getType().equals(Proxy.Type.HTTP)) {
+ if (port == -1)
+ jProxy = new ProxyHTTP(hostname);
+ else
+ jProxy = new ProxyHTTP(hostname, port);
+ } else if (proxy.getType().equals(Proxy.Type.SOCKS)) {
+ if (port == -1)
+ jProxy = new ProxySOCKS5(hostname);
+ else
+ jProxy = new ProxySOCKS5(hostname, port);
+ }
+ if (jProxy != null)
+ session.setProxy(jProxy);
+ }
+ }
+
+ private void setupOptions(JSch jsch) {
+ // Get sshHome
+ sshHome = getProperty(SCP_SSHHOMEDIRECTORY, sshHome);
+ if (sshHome == null) {
+ final String userHome = System.getProperty("user.home"); //$NON-NLS-1$
+ if (userHome != null) {
+ File dir = new File(userHome + File.separator + ".ssh"); //$NON-NLS-1$
+ if (dir.exists())
+ sshHome = dir.getAbsolutePath();
+ else
+ dir = new File(userHome + File.separator + "ssh"); //$NON-NLS-1$
+ if (dir.exists())
+ sshHome = dir.getAbsolutePath();
+ }
+ }
+ keyFile = getProperty(SCP_PUBLICKEYFILE);
+ if (keyFile != null) {
+ if (!(new File(keyFile).exists()))
+ keyFile = null;
+ } else {
+ File file = new File(sshHome + File.separator + "id_dsa"); //$NON-NLS-1$
+ if (file.exists())
+ keyFile = file.getAbsolutePath();
+ else {
+ file = new File(sshHome + File.separator + "id_rsa"); //$NON-NLS-1$
+ if (file.exists())
+ keyFile = file.getAbsolutePath();
+ }
+ }
+ if (keyFile != null) {
+ try {
+ jsch.addIdentity(keyFile);
+ } catch (final JSchException e) {
+ Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.ScpOutgoingFileTransfer_EXCEPTION_SETTING_SSH_IDENTITY, e));
+ }
+ }
+ knownHostsFile = getProperty(SCP_KNOWNHOSTSFILE);
+ if (knownHostsFile != null) {
+ if (!(new File(knownHostsFile).exists()))
+ knownHostsFile = null;
+ } else {
+ final File file = new File(sshHome + File.separator + "known_hosts"); //$NON-NLS-1$
+ if (!file.exists()) {
+ knownHostsFile = null;
+ } else {
+ knownHostsFile = file.getAbsolutePath();
+ }
+ }
+ if (knownHostsFile != null) {
+ try {
+ jsch.setKnownHosts(knownHostsFile);
+ } catch (final JSchException e) {
+ Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.ScpOutgoingFileTransfer_EXCEPTION_SETTING_KNOWN_HOSTS, e));
+ }
+ }
+ }
+
+ private String getProperty(String key, String def) {
+ final Map options = handler.getOptions();
+ if (options == null)
+ return def;
+ final String result = (String) options.get(key);
+ if (result == null)
+ return def;
+ return result;
+ }
+
+ private String getProperty(String key) {
+ return getProperty(key, null);
+ }
+
+ String trimTargetFile(String string) {
+ if (string.charAt(0) == '/')
+ return string.substring(1);
+ return string;
+ }
+
+ void checkAck(InputStream ins) throws IOException {
+ checkAck(ins.read(), ins);
+ }
+
+ void checkAck(int b, InputStream ins) throws IOException {
+ if (b == 0)
+ return;
+ if (b == -1)
+ throw new IOException(Messages.ScpUtil_EXCEPTION_UNKNOWN_SCP_ERROR);
+
+ if (b == 1 || b == 2) {
+ final StringBuffer sb = new StringBuffer();
+ int c;
+ do {
+ c = ins.read();
+ sb.append((char) c);
+ } while (c != '\n');
+ if (b == 1) { // error
+ throw new IOException(NLS.bind(Messages.ScpUtil_SCP_ERROR, sb.toString()));
+ }
+ if (b == 2) { // fatal error
+ throw new IOException(NLS.bind(Messages.ScpUtil_SCP_ERROR, sb.toString()));
+ }
+ }
+
+ }
+
+ void sendZeroToStream(OutputStream outs) throws IOException {
+ // send '\0'
+ final byte[] buf = new byte[1];
+ buf[0] = 0;
+ outs.write(buf, 0, 1);
+ outs.flush();
+ }
+
+ void dispose() {
+ if (session != null) {
+ session.disconnect();
+ session = null;
+ }
+ handler = null;
+ password = null;
+ passphrase = null;
+ sshHome = null;
+ keyFile = null;
+ knownHostsFile = null;
+ }
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/messages.properties b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/messages.properties
new file mode 100644
index 000000000..2c6f66b18
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/messages.properties
@@ -0,0 +1,11 @@
+ScpOutgoingFileTransfer_EXCEPTION_CONNECTING=Exception connecting to {0}
+ScpOutgoingFileTransfer_EXCEPTION_SETTING_SSH_IDENTITY=Exception setting identity.
+ScpOutgoingFileTransfer_EXCEPTION_SETTING_KNOWN_HOSTS=Exception setting known hosts file.
+ScpOutgoingFileTransfer_USERNAME_PROMPT=Username:
+ScpOutgoingFileTransfer_PASSPHRASE_PROMPT=Passphrase:
+ScpOutgoingFileTransfer_PASSWORD_PROMPT=Password:
+ScpRetrieveFileTransfer_EXCEPTION_CONNECTING=Exception connecting to {0}
+ScpRetrieveFileTransfer_EXCEPTION_ERROR_READING_FILE=Error reading file length
+ScpRetrieveFileTransfer_EXCEPTION_SCP_PROTOCOL=Exception in scp protocol
+ScpUtil_EXCEPTION_UNKNOWN_SCP_ERROR=Unknown scp error.
+ScpUtil_SCP_ERROR=Error {0}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/tests/provider/filetransfer/scp/Activator.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/tests/provider/filetransfer/scp/Activator.java
deleted file mode 100644
index 82cdff1c0..000000000
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/tests/provider/filetransfer/scp/Activator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.ecf.internal.tests.provider.filetransfer.scp;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.ecf.tests.provider.filetransfer.scp";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java
deleted file mode 100644
index b142fb374..000000000
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPOutgoingTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
- * Copyright (c) 2004 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.tests.provider.filetransfer.scp;
-
-import java.io.File;
-import java.net.URL;
-
-import org.eclipse.ecf.core.ContainerFactory;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.security.ConnectContextFactory;
-import org.eclipse.ecf.filetransfer.IFileTransferListener;
-import org.eclipse.ecf.filetransfer.ISendFileTransferContainerAdapter;
-import org.eclipse.ecf.filetransfer.events.IFileTransferEvent;
-import org.eclipse.ecf.filetransfer.events.IIncomingFileTransferReceiveDoneEvent;
-import org.eclipse.ecf.filetransfer.identity.FileIDFactory;
-import org.eclipse.ecf.filetransfer.identity.IFileID;
-import org.eclipse.ecf.tests.ContainerAbstractTestCase;
-
-/**
- *
- */
-public class SCPOutgoingTest extends ContainerAbstractTestCase {
-
- private static final String TESTSRCFILE = "test.txt";
-
- // URL (example: scp://slewis@ecf1.osuosl.org/test.txt
- private static final String TESTTARGETURL = System.getProperty("url");
-
- String password = System.getProperty("password");
-
- protected ISendFileTransferContainerAdapter adapter = null;
- protected IFileTransferListener senderTransferListener = null;
-
- protected IFileTransferListener getFileTransferListener(final String prefix) {
- return new IFileTransferListener() {
- public void handleTransferEvent(IFileTransferEvent event) {
- System.out.println(prefix + ".handleTransferEvent(" + event + ")");
- if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
-
- }
- }
- };
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- final IContainer container = ContainerFactory.getDefault().createContainer();
- adapter = (ISendFileTransferContainerAdapter) container.getAdapter(ISendFileTransferContainerAdapter.class);
- senderTransferListener = getFileTransferListener("localhost");
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- adapter = null;
- senderTransferListener = null;
- }
-
- public void testSend() throws Exception {
- final IFileID targetID = FileIDFactory.getDefault().createFileID(adapter.getOutgoingNamespace(), new URL(TESTTARGETURL));
- adapter.setConnectContextForAuthentication(ConnectContextFactory.createPasswordConnectContext(password));
- adapter.sendOutgoingRequest(targetID, new File(TESTSRCFILE), senderTransferListener, null);
-
- sleep(10000);
- }
-}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java
deleted file mode 100644
index 0b4a84f26..000000000
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/tests/provider/filetransfer/scp/SCPRetrieveTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
- * Copyright (c) 2004 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.tests.provider.filetransfer.scp;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.ecf.core.ContainerFactory;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.core.security.ConnectContextFactory;
-import org.eclipse.ecf.filetransfer.IFileTransferListener;
-import org.eclipse.ecf.filetransfer.IRetrieveFileTransferContainerAdapter;
-import org.eclipse.ecf.filetransfer.events.IFileTransferEvent;
-import org.eclipse.ecf.filetransfer.events.IIncomingFileTransferReceiveDataEvent;
-import org.eclipse.ecf.filetransfer.events.IIncomingFileTransferReceiveDoneEvent;
-import org.eclipse.ecf.filetransfer.events.IIncomingFileTransferReceiveStartEvent;
-import org.eclipse.ecf.filetransfer.identity.FileIDFactory;
-import org.eclipse.ecf.tests.ContainerAbstractTestCase;
-
-public class SCPRetrieveTest extends ContainerAbstractTestCase {
-
- private static final String SCP_RETRIEVE = "scp://ecf1.osuosl.org/test.txt";
-
- IRetrieveFileTransferContainerAdapter adapter = null;
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- final IContainer container = ContainerFactory.getDefault().createContainer();
- adapter = (IRetrieveFileTransferContainerAdapter) container.getAdapter(IRetrieveFileTransferContainerAdapter.class);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- adapter = null;
- }
-
- List receiveStartEvents = new ArrayList();
-
- List receiveDataEvents = new ArrayList();
-
- List receiveDoneEvents = new ArrayList();
-
- public void testReceive() throws Exception {
- assertNotNull(adapter);
- final IFileTransferListener listener = new IFileTransferListener() {
- public void handleTransferEvent(IFileTransferEvent event) {
- if (event instanceof IIncomingFileTransferReceiveStartEvent) {
- IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
- receiveStartEvents.add(rse);
- assertNotNull(rse.getFileID());
- assertNotNull(rse.getFileID().getFilename());
- try {
- rse.receive(System.out);
- } catch (IOException e) {
- fail(e.getLocalizedMessage());
- }
- } else if (event instanceof IIncomingFileTransferReceiveDataEvent) {
- receiveDataEvents.add(event);
- } else if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
- receiveDoneEvents.add(event);
- }
- }
- };
-
- adapter.setConnectContextForAuthentication(ConnectContextFactory.createPasswordConnectContext(System.getProperty("password")));
- adapter.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(adapter.getRetrieveNamespace(), SCP_RETRIEVE), listener, null);
- // Wait for 5 seconds
- sleep(5000, "Starting 5 second wait", "Ending 5 second wait");
-
- assertHasEvent(receiveStartEvents, IIncomingFileTransferReceiveStartEvent.class);
- assertHasMoreThanEventCount(receiveDataEvents, IIncomingFileTransferReceiveDataEvent.class, 0);
- assertHasEvent(receiveDoneEvents, IIncomingFileTransferReceiveDoneEvent.class);
-
- }
-}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/test.txt b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/test.txt
deleted file mode 100644
index bdec1b7e6..000000000
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/test.txt
+++ /dev/null
@@ -1,818 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-this is some text
-and some more text.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-this is some text
-and some more text.
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-this is some text
-and some more text.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-this is some text
-and some more text. \ No newline at end of file

Back to the top