Bug 394739 - Remove org.eclipse.core.runtime.compatibility* bundles
Deletes org.eclipse.core.runtime.compatibility.auth
Change-Id: I9c365cd6d4aa7fbd83f42706beb0741121d89232
Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.classpath b/bundles/org.eclipse.core.runtime.compatibility.auth/.classpath
deleted file mode 100644
index ce0c7a5..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.0%Foundation-1.0"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.cvsignore b/bundles/org.eclipse.core.runtime.compatibility.auth/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.project b/bundles/org.eclipse.core.runtime.compatibility.auth/.project
deleted file mode 100644
index edb37fa..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.core.runtime.compatibility.auth</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.resources.prefs b/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 16532b2..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Tue May 25 15:00:03 EDT 2004
-encoding/<project>=ISO-8859-1
-eclipse.preferences.version=1
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.runtime.prefs
deleted file mode 100644
index 5a0ad22..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.core.runtime.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-line.separator=\n
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 56cd28a..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Wed Apr 19 17:13:49 EDT 2006
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
-org.eclipse.jdt.core.compiler.compliance=1.3
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.pde.core.prefs
deleted file mode 100644
index 6b9194f..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/.settings/org.eclipse.pde.core.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Sat Mar 11 22:15:20 EST 2006
-eclipse.preferences.version=1
-pluginProject.extensions=false
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.runtime.compatibility.auth/META-INF/MANIFEST.MF
deleted file mode 100644
index 9e20b0c..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,18 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.core.runtime.compatibility.auth
-Bundle-Version: 3.2.300.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Import-Package: org.eclipse.osgi.framework.log; version="[1.1,2.0)",
- org.eclipse.osgi.service.datalocation,
- org.eclipse.osgi.util;version="1.0.0",
- org.osgi.framework,
- org.osgi.util.tracker
-Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)"
-Bundle-Activator: org.eclipse.core.internal.runtime.auth.Activator
-Export-Package: org.eclipse.core.internal.runtime.auth;x-friends:="org.eclipse.core.runtime"
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
- J2SE-1.3
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/about.html b/bundles/org.eclipse.core.runtime.compatibility.auth/about.html
deleted file mode 100644
index 82c2fe1..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/about.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!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>October 30, 2006</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">http://www.eclipse.org</a>.</p>
-
-<h3>Cryptography</h3>
-
-<h4>Export Control</h4>
-<p>The plug-in contains encryption software. The country in which you are currently may have restrictions on the import, possession,
-and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's
-laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this
-is permitted.</p>
-
-<h4>Encryption Items</h4>
-
-<p>Details of the encryption software in this plug-in are provided to assist in obtaining relevant export control classification and approval.
-Cryptography in this plug-in has been deemed eligible by the U.S. Government Department of Commerce for export under License Exception Technology Software Unrestricted (TSU) for both object code and source code.</p>
-
-<p>The plug-in contains a proprietary routine that encrypts and decrypts information used to login to Version Control Management (VCM) repositories.
-This routine uses the SHA-1 message digest algorithm implemented in a Java (TM) Runtime Environment (JRE), to generate a cryptographically secure sequence of bytes based on a
-user-supplied password combined with bytes supplied by a random number generator. The secure random numbers generated by this sequence are then added to each byte in the data
-to be encrypted. When the data is to be decrypted, the same password will generate the same sequence of random numbers, which is then subtracted from each byte in the encrypted data.
-Note that a JRE and therefore the aforementioned SHA-1 message digest code is not included with the plug-in.</p>
-
-<p>The following Java classes contain encryption items (the plug-in may contain both binary and source code):</p>
-
-<ul>
- <li>org.eclipse.core.internal.runtime.auth.Cipher</li>
-</ul>
-
-<small>Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.</small>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/build.properties b/bundles/org.eclipse.core.runtime.compatibility.auth/build.properties
deleted file mode 100644
index 8949718..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2006 IBM Corporation 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:
-# IBM Corporation - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties
-src.includes = about.html
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/forceQualifierUpdate.txt b/bundles/org.eclipse.core.runtime.compatibility.auth/forceQualifierUpdate.txt
deleted file mode 100644
index 56f1032..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/forceQualifierUpdate.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# To force a version qualifier update add the bug here
-Bug 403352 - Update all parent versions to match our build stream
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/plugin.properties b/bundles/org.eclipse.core.runtime.compatibility.auth/plugin.properties
deleted file mode 100644
index 20f5a09..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2006 IBM Corporation 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:
-# IBM Corporation - initial API and implementation
-###############################################################################
-pluginName = Authorization Compatibility Plug-in
-providerName = Eclipse.org
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/pom.xml b/bundles/org.eclipse.core.runtime.compatibility.auth/pom.xml
deleted file mode 100644
index 38c7743..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/pom.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2012 Eclipse Foundation.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Igor Fedorenko - initial implementation
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>eclipse.platform.runtime</artifactId>
- <groupId>org.eclipse.platform.runtime</groupId>
- <version>4.4.0-SNAPSHOT</version>
- <relativePath>../../</relativePath>
- </parent>
- <groupId>org.eclipse.core</groupId>
- <artifactId>org.eclipse.core.runtime.compatibility.auth</artifactId>
- <version>3.2.300-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Activator.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Activator.java
deleted file mode 100644
index f496037..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Activator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.framework.log.FrameworkLog;
-import org.eclipse.osgi.framework.log.FrameworkLogEntry;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext bundleContext;
- private static ServiceTracker logTracker;
-
- /*
- * Return this activator's bundle context.
- */
- public static BundleContext getContext() {
- return bundleContext;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- Activator.bundleContext = context;
- }
-
- /* (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- if (logTracker != null) {
- logTracker.close();
- logTracker = null;
- }
- Activator.bundleContext = null;
- }
-
- /*
- * Log the given status in the framework log.
- */
- public static void log(IStatus status) {
- if (logTracker == null) {
- logTracker = new ServiceTracker(getContext(), FrameworkLog.class.getName(), null);
- logTracker.open();
- }
- FrameworkLog log = (FrameworkLog) logTracker.getService();
- log.log(getEntry(status));
- }
-
- /*
- * Copied code from PlatformLogWriter to convert a status object into
- * a FrameworkLogEntry.
- */
- private static FrameworkLogEntry getEntry(IStatus status) {
- Throwable t = status.getException();
- ArrayList childlist = new ArrayList();
-
- int stackCode = t instanceof CoreException ? 1 : 0;
- // ensure a sub-status inside a CoreException is properly logged
- if (stackCode == 1) {
- IStatus coreStatus = ((CoreException) t).getStatus();
- if (coreStatus != null)
- childlist.add(getEntry(coreStatus));
- }
-
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++)
- childlist.add(getEntry(children[i]));
- }
-
- FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()]));
-
- return new FrameworkLogEntry(status, status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children);
- }
-
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationDatabase.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationDatabase.java
deleted file mode 100644
index e96eb81..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/AuthorizationDatabase.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.*;
-import java.net.URL;
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * A database that remembers information, such as user-names and
- * passwords. The information is stored in memory and can be saved
- * to disk in an encrypted format. While the API is phrased in terms of
- * URLs, realms and authentication schemes, not all of these must have
- * significant values. For example, if "realm" is not relevant to a
- * particular application, it can be left blank (though not
- * <code>null</code>).
- */
-public class AuthorizationDatabase {
- public static final String PI_RUNTIME_AUTH = "org.eclipse.core.runtime.auth.compatibility"; //$NON-NLS-1$
-
- /**
- * Status code constant (value 4) indicating the platform could not read
- * some of its metadata.
- */
- public static final int FAILED_READ_METADATA = 4;
-
- /**
- * Status code constant (value 5) indicating the platform could not write
- * some of its metadata.
- */
- public static final int FAILED_WRITE_METADATA = 5;
-
- /**
- * Version number for the format of the key-ring file.
- */
- private static final int KEYRING_FILE_VERSION = 1;
-
- /**
- * A nested hashtable that stores authorization information. The
- * table maps server URLs to realms to authentication schemes to
- * authorization information.
- */
- private Hashtable authorizationInfo = new Hashtable(5);
-
- /**
- * A hashtable mapping resource URLs to realms.
- */
- private Hashtable protectionSpace = new Hashtable(5);
-
- private File file = null;
- private String password = null;
- private boolean needsSaving = true;
-
- /**
- * Creates a new authorization database whose data cannot be saved to
- * disk.
- */
- public AuthorizationDatabase() {
- super();
- }
-
- /**
- * Creates a new authorization database, or opens an existing one, whose
- * data is, or can be, saved to a file with the given filename. A
- * password must be given to create a new database and an existing
- * database is opened by supplying the password that was given to create
- * it.
- *
- * @param filename the location of the database on disk. For example,
- * "c:/temp/database"
- * @param password the password to access the database. For example,
- * "secret"
- * @exception CoreException if there are problems creating the database.
- * Reasons include:
- * <ul>
- * <li>The database could not be opened because the wrong password was given.
- * <li>The database could not be opened because the specified file is corrupt.
- * </ul>
- */
- public AuthorizationDatabase(String filename, String password) throws CoreException {
- Assert.isNotNull(filename);
- Assert.isNotNull(password);
- this.password = password;
- file = new File(filename).getAbsoluteFile();
- load();
- }
-
- /**
- * Adds the given authorization information to the database. The
- * information is relevant for the specified protection space and the
- * given authorization scheme. The protection space is defined by the
- * combination of the given server URL and realm. The authorization
- * scheme determines what the authorization information contains and how
- * it should be used. The authorization information is a <code>Map</code>
- * of <code>String</code> to <code>String</code> and typically
- * contain information such as usernames and passwords.
- *
- * @param serverUrl the URL identifying the server for this authorization
- * information. For example, "http://www.hostname.com/".
- * @param realm the subsection of the given server to which this
- * authorization information applies. For example,
- * "realm1@hostname.com" or "" for no realm.
- * @param authScheme the scheme for which this authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @param info a <code>Map</code> containing authorization information
- * such as usernames and passwords
- */
- public void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) {
- Assert.isNotNull(serverUrl);
- Assert.isNotNull(realm);
- Assert.isNotNull(authScheme);
- Assert.isNotNull(info);
-
- String url = serverUrl.toString();
- Hashtable realmToAuthScheme = (Hashtable) authorizationInfo.get(url);
- if (realmToAuthScheme == null) {
- realmToAuthScheme = new Hashtable(5);
- authorizationInfo.put(url, realmToAuthScheme);
- }
-
- Hashtable authSchemeToInfo = (Hashtable) realmToAuthScheme.get(realm);
- if (authSchemeToInfo == null) {
- authSchemeToInfo = new Hashtable(5);
- realmToAuthScheme.put(realm, authSchemeToInfo);
- }
-
- authSchemeToInfo.put(authScheme.toLowerCase(), info);
- needsSaving = true;
- }
-
- /**
- * Adds the specified resource to the protection space specified by the
- * given realm. All resources at or deeper than the depth of the last
- * symbolic element in the path of the given resource URL are assumed to
- * be in the same protection space.
- *
- * @param resourceUrl the URL identifying the resources to be added to
- * the specified protection space. For example,
- * "http://www.hostname.com/folder/".
- * @param realm the name of the protection space. For example,
- * "realm1@hostname.com"
- */
- public void addProtectionSpace(URL resourceUrl, String realm) {
- Assert.isNotNull(resourceUrl);
- Assert.isNotNull(realm);
-
- if (!resourceUrl.getFile().endsWith("/")) { //$NON-NLS-1$
- resourceUrl = URLTool.getParent(resourceUrl);
- }
-
- String oldRealm = getProtectionSpace(resourceUrl);
- if (oldRealm != null && oldRealm.equals(realm)) {
- return;
- }
-
- String url1 = resourceUrl.toString();
- Enumeration urls = protectionSpace.keys();
- while (urls.hasMoreElements()) {
- String url2 = (String) urls.nextElement();
- if (url1.startsWith(url2) || url2.startsWith(url1)) {
- protectionSpace.remove(url2);
- break;
- }
- }
-
- protectionSpace.put(url1, realm);
- needsSaving = true;
- }
-
- /**
- * Removes the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm.
- *
- * @param serverUrl the URL identifying the server to remove the
- * authorization information for. For example,
- * "http://www.hostname.com/".
- * @param realm the subsection of the given server to remove the
- * authorization information for. For example,
- * "realm1@hostname.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * to remove applies. For example, "Basic" or "" for no
- * authorization scheme.
- */
- public void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- Hashtable realmToAuthScheme = (Hashtable) authorizationInfo.get(serverUrl.toString());
-
- if (realmToAuthScheme == null) {
- return;
- }
-
- Hashtable authSchemeToInfo = (Hashtable) realmToAuthScheme.get(realm);
-
- if (authSchemeToInfo == null) {
- return;
- }
-
- authSchemeToInfo.remove(authScheme.toLowerCase());
-
- needsSaving = true;
- }
-
- /**
- * Returns the authorization information for the specified protection
- * space and given authorization scheme. The protection space is defined
- * by the given server URL and realm. Returns <code>null</code> if no
- * such information exists.
- *
- * @param serverUrl the URL identifying the server for the authorization
- * information. For example, "http://www.hostname.com/".
- * @param realm the subsection of the given server to which the
- * authorization information applies. For example,
- * "realm1@hostname.com" or "" for no realm.
- * @param authScheme the scheme for which the authorization information
- * applies. For example, "Basic" or "" for no authorization scheme
- * @return the authorization information for the specified protection
- * space and given authorization scheme, or <code>null</code> if no
- * such information exists
- */
- public Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) {
- Hashtable realmToAuthScheme = (Hashtable) authorizationInfo.get(serverUrl.toString());
- if (realmToAuthScheme == null) {
- return null;
- }
-
- Hashtable authSchemeToInfo = (Hashtable) realmToAuthScheme.get(realm);
- if (authSchemeToInfo == null) {
- return null;
- }
-
- return (Map) authSchemeToInfo.get(authScheme.toLowerCase());
- }
-
- /**
- * Returns the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown.
- *
- * @param resourceUrl the URL of the resource whose protection space is
- * returned. For example, "http://www.hostname.com/folder/".
- * @return the protection space (realm) for the specified resource, or
- * <code>null</code> if the realm is unknown
- */
- public String getProtectionSpace(URL resourceUrl) {
- while (resourceUrl != null) {
- String realm = (String) protectionSpace.get(resourceUrl.toString());
- if (realm != null) {
- return realm;
- }
- resourceUrl = URLTool.getParent(resourceUrl);
- }
-
- return null;
- }
-
- private void load() throws CoreException {
- if (file == null)
- return;
- if (!file.exists()) {
- save();
- return;
- }
- try {
- InputStream input = new FileInputStream(file);
- try {
- load(input);
- } finally {
- input.close();
- }
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_READ_METADATA, NLS.bind(Messages.meta_unableToReadAuthorization, file), e));
- } catch (ClassNotFoundException e) {
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_READ_METADATA, NLS.bind(Messages.meta_unableToReadAuthorization, file), e));
- }
- }
-
- private void load(InputStream is) throws IOException, ClassNotFoundException, CoreException {
- //try to read the file version number. Pre 2.0 versions had no number
- int version = is.read();
- if (version == KEYRING_FILE_VERSION) {
- //read the authorization data
- CipherInputStream cis = new CipherInputStream(is, password);
- ObjectInputStream ois = new ObjectInputStream(cis);
- try {
- authorizationInfo = (Hashtable) ois.readObject();
- protectionSpace = (Hashtable) ois.readObject();
- } finally {
- ois.close();
- }
- } else {
- //the format has changed, just log a warning
- Activator.log(new Status(IStatus.WARNING, PI_RUNTIME_AUTH, FAILED_READ_METADATA, Messages.meta_authFormatChanged, null));
- //close the stream and save a new file in the correct format
- try {
- is.close();
- } catch (IOException e) {
- //ignore failure to close
- }
- needsSaving = true;
- save();
- }
- }
-
- /**
- * Saves the authorization database to disk.
- */
- public void save() throws CoreException {
- if (!needsSaving || file == null)
- return;
- try {
- file.delete();
- if ((!file.getParentFile().exists() && !file.getParentFile().mkdirs()) || !canWrite(file.getParentFile()))
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_WRITE_METADATA, NLS.bind(Messages.meta_unableToWriteAuthorization, file), null));
- file.createNewFile();
- FileOutputStream out = new FileOutputStream(file);
- try {
- save(out);
- } finally {
- out.close();
- }
- } catch (IOException e) {
- throw new CoreException(new Status(IStatus.ERROR, PI_RUNTIME_AUTH, FAILED_WRITE_METADATA, NLS.bind(Messages.meta_unableToWriteAuthorization, file), e));
- }
- needsSaving = false;
- }
-
- private static boolean canWrite(File installDir) {
- if (!installDir.canWrite())
- return false;
-
- if (!installDir.isDirectory())
- return false;
-
- File fileTest = null;
- try {
- fileTest = File.createTempFile("writtableArea", null, installDir); //$NON-NLS-1$
- } catch (IOException e) {
- // If an exception occurred while trying to create the file, it means that it is not writable
- return false;
- } finally {
- if (fileTest != null)
- fileTest.delete();
- }
- return true;
- }
-
- private void save(FileOutputStream os) throws IOException {
- //write the version number
- os.write(KEYRING_FILE_VERSION);
-
- CipherOutputStream cos = new CipherOutputStream(os, password);
- ObjectOutputStream oos = new ObjectOutputStream(cos);
- //write the data
- try {
- oos.writeObject(authorizationInfo);
- oos.writeObject(protectionSpace);
- os.flush();
- os.getFD().sync();
- } finally {
- oos.close();
- }
- }
-
- /**
- * Sets the password to use for accessing this database. If the database
- * is subsequently saved, this new password is used.
- */
- public boolean setPassword(String oldValue, String newValue) {
- if (!oldValue.equals(password))
- return false;
- password = newValue;
- needsSaving = true;
- return true;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Cipher.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Cipher.java
deleted file mode 100644
index 7fa97d7..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Cipher.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.UnsupportedEncodingException;
-import java.security.MessageDigest;
-import java.util.Random;
-
-/**
- * <P>Encrypts or decrypts a sequence of bytes. The bytes are decrypted
- * by supplying the same password that was given when the bytes were
- * encrypted.
- * <P>Here is an example showing how to encrypt and then decrypt the
- * string "Hello, world!" using the password "music":
- * <pre>
- * String password = "music";
- * byte[] data = "Hello, world!".getBytes("UTF8");
- *
- * // Encrypt
- * Cipher cipher = new Cipher(ENCRYPT_MODE, password);
- * byte[] encrypted = cipher.cipher(data);
- *
- * // Decrypt
- * cipher = new Cipher(DECRYPT_MODE, password);
- * byte[] decrypted = cipher.cipher(encrypted);
- * </pre>
- */
-public class Cipher {
- public static final int DECRYPT_MODE = -1;
- public static final int ENCRYPT_MODE = 1;
- private static final int RANDOM_SIZE = 16;
-
- private int mode = 0;
- private byte[] password = null;
-
- //the following fields are used for generating a secure byte stream
- //used by the decryption algorithm
- private byte[] byteStream;
- private int byteStreamOffset;
- private MessageDigest digest;
- private Random random;
- private final byte[] toDigest;
-
- /**
- * Initializes the cipher with the given mode and password. This method
- * must be called first (before any encryption of decryption takes
- * place) to specify whether the cipher should be in encrypt or decrypt
- * mode and to set the password.
- *
- * @param mode
- * @param passwordString
- */
- public Cipher(int mode, String passwordString) {
- this.mode = mode;
- try {
- this.password = passwordString.getBytes("UTF8"); //$NON-NLS-1$
- } catch (UnsupportedEncodingException e) {
- this.password = passwordString.getBytes();
- }
- toDigest = new byte[password.length + RANDOM_SIZE];
- }
-
- /**
- * Encrypts or decrypts (depending on which mode the cipher is in) the
- * given data and returns the result.
- *
- * @param data
- * @return the result of encrypting or decrypting the given data
- */
- public byte[] cipher(byte[] data) throws Exception {
- return transform(data, 0, data.length, mode);
- }
-
- /**
- * Encrypts or decrypts (depending on which mode the cipher is in) the
- * given data and returns the result.
- *
- * @param data the byte array containg the given data
- * @param off the index of the first byte in the given byte array
- * to be transformed
- * @param len the number of bytes to be transformed
- * @return the result of encrypting or decrypting the given data
- */
- public byte[] cipher(byte[] data, int off, int len) throws Exception {
- return transform(data, off, len, mode);
- }
-
- /**
- * Encrypts or decrypts (depending on which mode the cipher is in) the
- * given byte and returns the result.
- *
- * @param datum the given byte
- * @return the result of encrypting or decrypting the given byte
- */
- public byte cipher(byte datum) throws Exception {
- byte[] data = {datum};
- return cipher(data)[0];
- }
-
- /**
- * Generates a secure stream of bytes based on the input seed.
- * This routine works by combining the input seed with random bytes
- * generated by a random number generator, and then computing the
- * SHA-1 hash of those bytes.
- */
- private byte[] generateBytes() throws Exception {
- if (digest == null) {
- digest = MessageDigest.getInstance("SHA"); //$NON-NLS-1$
- //also seed random number generator based on password
- long seed = 0;
- for (int i = 0; i < password.length; i++)
- //this function is known to give good hash distribution for character data
- seed = (seed * 37) + password[i];
- random = new Random(seed);
- }
- //add random bytes to digest array
- random.nextBytes(toDigest);
-
- //overlay password onto digest array
- System.arraycopy(password, 0, toDigest, 0, password.length);
-
- //compute and return SHA-1 hash of digest array
- return digest.digest(toDigest);
- }
-
- /**
- * Returns a stream of cryptographically secure bytes of the given length.
- * The result is deterministically based on the input seed (password).
- */
- private byte[] nextRandom(int length) throws Exception {
- byte[] nextRandom = new byte[length];
- int nextRandomOffset = 0;
- while (nextRandomOffset < length) {
- if (byteStream == null || byteStreamOffset >= byteStream.length) {
- byteStream = generateBytes();
- byteStreamOffset = 0;
- }
- nextRandom[nextRandomOffset++] = byteStream[byteStreamOffset++];
- }
- return nextRandom;
- }
-
- private byte[] transform(byte[] data, int off, int len, int mod) throws Exception {
- byte[] result = nextRandom(len);
- for (int i = 0; i < len; ++i) {
- result[i] = (byte) (data[i + off] + mod * result[i]);
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherInputStream.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherInputStream.java
deleted file mode 100644
index ec8d276..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherInputStream.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.*;
-
-/**
- * Decrypts a stream of data that was encrypted using the
- * <code>Cipher</code> or <code>CipherOutputStream</code>.
- *
- * @see Cipher
- * @see CipherOutputStream
- */
-public class CipherInputStream extends FilterInputStream {
- private static final int SKIP_BUFFER_SIZE = 2048;
- private Cipher cipher;
-
- /**
- * Constructs a new <code>CipherInputStream</code> that decrypts the
- * data in the given <code>InputStream</code>. The data can only be
- * decrypted if the given password is the same as that which was used
- * to encrypt it.
- *
- * @param is
- * @param password
- */
- public CipherInputStream(InputStream is, String password) {
- super(is);
- cipher = new Cipher(Cipher.DECRYPT_MODE, password);
- }
-
- /**
- * @see InputStream#markSupported()
- */
- public boolean markSupported() {
- return false;
- }
-
- /**
- * @see InputStream#read()
- */
- public int read() throws IOException {
- int b = super.read();
- if (b == -1)
- return -1;
- try {
- return (cipher.cipher((byte) b)) & 0x00ff;
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- /**
- * @see InputStream#read(byte[], int, int)
- */
- public int read(byte b[], int off, int len) throws IOException {
- int bytesRead = in.read(b, off, len);
- if (bytesRead == -1)
- return -1;
- try {
- byte[] result = cipher.cipher(b, off, bytesRead);
- for (int i = 0; i < result.length; ++i)
- b[i + off] = result[i];
- return bytesRead;
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- /**
- * @see InputStream#skip(long)
- */
- public long skip(long n) throws IOException {
- byte[] buffer = new byte[SKIP_BUFFER_SIZE];
-
- int bytesRead = 0;
- long bytesRemaining = n;
-
- while (bytesRead != -1 && bytesRemaining > 0) {
- bytesRead = read(buffer, 0, (int) Math.min(SKIP_BUFFER_SIZE, bytesRemaining));
- if (bytesRead > 0) {
- bytesRemaining -= bytesRead;
- }
- }
-
- return n - bytesRemaining;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherOutputStream.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherOutputStream.java
deleted file mode 100644
index 7301435..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/CipherOutputStream.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.io.*;
-
-/**
- * Encrypts a stream of data that can be decrypted using the
- * <code>Cipher</code> or <code>CipherInputStream</code>.
- *
- * @see Cipher
- * @see CipherInputStream
- */
-public class CipherOutputStream extends FilterOutputStream {
- private Cipher cipher;
-
- /**
- * Constructs a new <code>CipherOutputStream</code> that encrypts the
- * data in the given <code>OutputStream</code>. Once the data is
- * encrypted it can be decrypted by suppying the encrupted data and
- * given password to a <code>Cipher</code> or
- * <code>CipherInputStream</code>.
- *
- * @param os
- * @param password
- */
- public CipherOutputStream(OutputStream os, String password) {
- super(os);
- cipher = new Cipher(Cipher.ENCRYPT_MODE, password);
- }
-
- /**
- * @see OutputStream#write(int)
- */
- public void write(int b) throws IOException {
- try {
- out.write(cipher.cipher((byte) b));
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Messages.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Messages.java
deleted file mode 100644
index 732bb8d..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/Messages.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation 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:
- * IBM - Initial API and implementation
- **********************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import org.eclipse.osgi.util.NLS;
-
-// Runtime plugin message catalog
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.core.internal.runtime.auth.messages"; //$NON-NLS-1$
-
- public static String meta_authFormatChanged;
- public static String meta_unableToReadAuthorization;
- public static String meta_unableToWriteAuthorization;
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/URLTool.java b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/URLTool.java
deleted file mode 100644
index 87ad397..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/URLTool.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.core.internal.runtime.auth;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.eclipse.core.runtime.Assert;
-
-/**
- * A utility for manipulating <code>URL</code>s.
- */
-public class URLTool {
-
- /**
- * Returns the parent URL of the given URL, or <code>null</code> if the
- * given URL is the root.
- * <table>
- * <caption>Example</caption>
- * <tr>
- * <th>Given URL</th>
- * <th>Parent URL</th>
- * <tr>
- * <td>"http://hostname/"</td>
- * <td>null</td>
- * <tr>
- * <td>"http://hostname/folder/file</td>
- * <td>"http://hostname/folder/</td>
- * </table>
- *
- * @param url a URL
- * @return the parent of the given URL
- */
- public static URL getParent(URL url) {
- String file = url.getFile();
- int len = file.length();
- if (len == 0 || len == 1 && file.charAt(0) == '/')
- return null;
- int lastSlashIndex = -1;
- for (int i = len - 2; lastSlashIndex == -1 && i >= 0; --i) {
- if (file.charAt(i) == '/')
- lastSlashIndex = i;
- }
- if (lastSlashIndex == -1)
- file = ""; //$NON-NLS-1$
- else
- file = file.substring(0, lastSlashIndex + 1);
-
- try {
- url = new URL(url.getProtocol(), url.getHost(), url.getPort(), file);
- } catch (MalformedURLException e) {
- Assert.isTrue(false, e.getMessage());
- }
- return url;
- }
-}
diff --git a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/messages.properties b/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/messages.properties
deleted file mode 100644
index ba0a736..0000000
--- a/bundles/org.eclipse.core.runtime.compatibility.auth/src/org/eclipse/core/internal/runtime/auth/messages.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2006, 2012 IBM Corporation 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:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-auth_notAvailable = Authorization infrastructure (org.eclipse.core.runtime.compatibility.auth) not installed.
-meta_authFormatChanged = The platform authorization database file format has changed. Cached authorization information will be lost.
-meta_unableToReadAuthorization = Unable to read authorization database: {0}.
-meta_unableToWriteAuthorization = Unable to write to authorization database: {0}.