diff options
author | slewis | 2008-04-07 21:32:11 +0000 |
---|---|---|
committer | slewis | 2008-04-07 21:32:11 +0000 |
commit | 3f688d259f6661eda26f7d4ed5b71c5e2a695652 (patch) | |
tree | fe220014c2b78669cc8d3721f99573b7fcb3e510 /providers | |
parent | 20d881601ec2f1e56ad3cb16c618d356a71082e7 (diff) | |
download | org.eclipse.ecf-3f688d259f6661eda26f7d4ed5b71c5e2a695652.tar.gz org.eclipse.ecf-3f688d259f6661eda26f7d4ed5b71c5e2a695652.tar.xz org.eclipse.ecf-3f688d259f6661eda26f7d4ed5b71c5e2a695652.zip |
Initial commit of org.eclipse.ecf.provider.filetransfer.ssl fragment
Diffstat (limited to 'providers')
9 files changed, 164 insertions, 0 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.classpath b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.classpath new file mode 100644 index 000000000..2fbb7a23e --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.project b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.project new file mode 100644 index 000000000..c26821380 --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.ecf.provider.filetransfer.ssl</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.settings/org.eclipse.jdt.core.prefs b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..589c63a30 --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +#Mon Apr 07 11:22:47 PDT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.settings/org.eclipse.pde.core.prefs b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..bbed9a27d --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,4 @@ +#Mon Apr 07 11:22:47 PDT 2008 +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/META-INF/MANIFEST.MF new file mode 100644 index 000000000..d498aefaa --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/META-INF/MANIFEST.MF @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %plugin.name +Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer.ssl +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: %plugin.provider +Fragment-Host: org.eclipse.ecf.provider.filetransfer;bundle-version="2.0.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-Localization: plugin diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/about.html b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/about.html new file mode 100644 index 000000000..6a60a262f --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 29, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/build.properties b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/build.properties new file mode 100644 index 000000000..00da4cab1 --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + about.html,\ + plugin.properties +src.includes = plugin.properties,\ + about.html,\ + META-INF/ diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/plugin.properties new file mode 100644 index 000000000..78a636e0e --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/plugin.properties @@ -0,0 +1,11 @@ +############################################################################ +# Copyright (c) 2007 Composent Inc., IBM Corp, 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 +# +############################################################################ +plugin.name=ECF Filetransfer SSL Fragment +plugin.provider=Eclipse.org + diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/ssl/ECFURLConnectionModifier.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/ssl/ECFURLConnectionModifier.java new file mode 100644 index 000000000..397400d65 --- /dev/null +++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.ssl/src/org/eclipse/ecf/internal/provider/filetransfer/ssl/ECFURLConnectionModifier.java @@ -0,0 +1,61 @@ +/**************************************************************************** + * Copyright (c) 2008 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.ssl; + +import java.net.URLConnection; + +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSocketFactory; + +import org.eclipse.ecf.internal.provider.filetransfer.IURLConnectionModifier; +import org.osgi.framework.BundleContext; +import org.osgi.util.tracker.ServiceTracker; + +/** + * + */ +public class ECFURLConnectionModifier implements IURLConnectionModifier { + + private BundleContext context; + private ServiceTracker sslSocketFactoryTracker; + + public void init(BundleContext ctxt) { + this.context = ctxt; + } + + private SSLSocketFactory getSSLSocketFactory() { + if (context == null) + return null; + if (sslSocketFactoryTracker == null) { + sslSocketFactoryTracker = new ServiceTracker(this.context, SSLSocketFactory.class.getName(), null); + sslSocketFactoryTracker.open(); + } + return (SSLSocketFactory) sslSocketFactoryTracker.getService(); + } + + public void dispose() { + this.context = null; + if (sslSocketFactoryTracker != null) { + sslSocketFactoryTracker.close(); + sslSocketFactoryTracker = null; + } + } + + public void setSocketFactoryForConnection(URLConnection urlConnection) { + if (urlConnection instanceof HttpsURLConnection) { + final HttpsURLConnection httpsURLConnection = (HttpsURLConnection) urlConnection; + final SSLSocketFactory sslSocketFactory = getSSLSocketFactory(); + if (sslSocketFactory != null) + httpsURLConnection.setSSLSocketFactory(sslSocketFactory); + } + } +} |