Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86498 Details for
Bug 214796
[Proxy] org.eclipse.core.net bundle should not require org.eclipse.core.runtime
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
core-net.txt (text/plain), 14.26 KB, created by
DJ Houghton
on 2008-01-09 14:35:12 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
DJ Houghton
Created:
2008-01-09 14:35:12 EST
Size:
14.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.net >Index: src/org/eclipse/core/internal/net/ProxyManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java,v >retrieving revision 1.7 >diff -u -r1.7 ProxyManager.java >--- src/org/eclipse/core/internal/net/ProxyManager.java 5 Jul 2007 20:32:18 -0000 1.7 >+++ src/org/eclipse/core/internal/net/ProxyManager.java 9 Jan 2008 19:32:28 -0000 >@@ -90,7 +90,7 @@ > */ > public synchronized String[] getNonProxiedHosts() { > if (nonProxiedHosts == null) { >- String prop = Activator.getInstance().getInstancePreferences().get(PREF_NON_PROXIED_HOSTS, "localhost|127.0.0.1"); //$NON-NLS-1$ >+ String prop = Activator.getInstancePreferences().get(PREF_NON_PROXIED_HOSTS, "localhost|127.0.0.1"); //$NON-NLS-1$ > nonProxiedHosts = ProxyType.convertPropertyStringToHosts(prop); > } > if (nonProxiedHosts.length == 0) >@@ -112,9 +112,9 @@ > } > String[] oldHosts = nonProxiedHosts; > nonProxiedHosts = hosts; >- Activator.getInstance().getInstancePreferences().put(PREF_NON_PROXIED_HOSTS, ProxyType.convertHostsToPropertyString(nonProxiedHosts)); >+ Activator.getInstancePreferences().put(PREF_NON_PROXIED_HOSTS, ProxyType.convertHostsToPropertyString(nonProxiedHosts)); > try { >- Activator.getInstance().getInstancePreferences().flush(); >+ Activator.getInstancePreferences().flush(); > } catch (BackingStoreException e) { > Activator.logError( > "An error occurred while writing out the non-proxied hosts list", e); //$NON-NLS-1$ >@@ -174,7 +174,7 @@ > * @see org.eclipse.core.net.IProxyManager#isProxiesEnabled() > */ > public boolean isProxiesEnabled() { >- return Activator.getInstance().getInstancePreferences().getBoolean(PREF_ENABLED, false); >+ return Activator.getInstancePreferences().getBoolean(PREF_ENABLED, false); > } > > /* (non-Javadoc) >@@ -186,7 +186,7 @@ > return; > // Setting the preference will trigger the system property update > // (see preferenceChange) >- Activator.getInstance().getInstancePreferences().putBoolean(PREF_ENABLED, enabled); >+ Activator.getInstancePreferences().putBoolean(PREF_ENABLED, enabled); > } > > private void internalSetEnabled(boolean enabled) { >@@ -194,7 +194,7 @@ > sysProps.put("proxySet", enabled ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > updateSystemProperties(); > try { >- Activator.getInstance().getInstancePreferences().flush(); >+ Activator.getInstancePreferences().flush(); > } catch (BackingStoreException e) { > Activator.logError( > "An error occurred while writing out the enablement state", e); //$NON-NLS-1$ >@@ -215,7 +215,7 @@ > public void initialize() { > // First see if there is an http proxy to migrate > migrateUpdateHttpProxy(new InstanceScope().getNode(""), true); //$NON-NLS-1$ >- ((IEclipsePreferences)Activator.getInstance().getInstancePreferences()).addPreferenceChangeListener(this); >+ ((IEclipsePreferences)Activator.getInstancePreferences()).addPreferenceChangeListener(this); > // Now initialize each proxy type > for (int i = 0; i < proxies.length; i++) { > ProxyType type = proxies[i]; >@@ -287,7 +287,7 @@ > } > > private Authenticator getPluggedInAuthenticator() { >- IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); >+ IExtension[] extensions = Activator.getExtensionRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); > if (extensions.length == 0) > return null; > IExtension extension = extensions[0]; >@@ -366,7 +366,7 @@ > > public void preferenceChange(PreferenceChangeEvent event) { > if (event.getKey().equals(PREF_ENABLED)) { >- internalSetEnabled(Activator.getInstance().getInstancePreferences().getBoolean(PREF_ENABLED, false)); >+ internalSetEnabled(Activator.getInstancePreferences().getBoolean(PREF_ENABLED, false)); > } > } > >Index: src/org/eclipse/core/internal/net/Activator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java,v >retrieving revision 1.1 >diff -u -r1.1 Activator.java >--- src/org/eclipse/core/internal/net/Activator.java 26 Feb 2007 18:16:41 -0000 1.1 >+++ src/org/eclipse/core/internal/net/Activator.java 9 Jan 2008 19:32:28 -0000 >@@ -15,15 +15,18 @@ > > package org.eclipse.core.internal.net; > >-import java.util.Hashtable; >- >+import java.net.URL; >+import java.util.*; >+import org.eclipse.core.internal.runtime.auth.AuthorizationHandler; > import org.eclipse.core.net.proxy.IProxyService; > import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.preferences.InstanceScope; >-import org.osgi.framework.BundleContext; >-import org.osgi.framework.ServiceRegistration; >+import org.eclipse.osgi.framework.log.FrameworkLog; >+import org.eclipse.osgi.framework.log.FrameworkLogEntry; >+import org.osgi.framework.*; >+import org.osgi.util.tracker.ServiceTracker; > >-public class Activator extends Plugin { >+public class Activator implements BundleActivator { > /** > * The identifier of the descriptor of this plugin in plugin.xml. > */ >@@ -33,63 +36,150 @@ > > private static final String PROP_REGISTER_SERVICE = "org.eclipse.net.core.enableProxyService"; //$NON-NLS-1$ > >- /** >- * The instance of this plugin. >- */ >- private static Activator instance; >- >+ private static BundleContext bundleContext; >+ private static ServiceTracker extensionRegistryTracker; >+ private static ServiceTracker logTracker; > private ServiceRegistration proxyService; > >- /** >- * Constructor for use by the Eclipse platform only. >+ /* >+ * Return this bundle's context, or null. > */ >- public Activator() { >- super(); >- instance = this; >+ public static BundleContext getBundleContext() { >+ return bundleContext; > } > >- /** >- * Returns the instance of this plugin. >- * @return the singleton instance of this plug-in class >+ /* (non-Javadoc) >+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) > */ >- static public Activator getInstance() { >- return instance; >- } >- > public void start(BundleContext context) throws Exception { >- super.start(context); >+ bundleContext = context; > if (Boolean.valueOf(System.getProperty(PROP_REGISTER_SERVICE, "true")).booleanValue()) { //$NON-NLS-1$ > ProxyManager proxyManager = (ProxyManager)ProxyManager.getProxyManager(); > proxyManager.initialize(); >- proxyService = getBundle().getBundleContext().registerService(IProxyService.class.getName(), proxyManager, new Hashtable()); >+ proxyService = getBundleContext().registerService(IProxyService.class.getName(), proxyManager, new Hashtable()); > } > } > >+ /* (non-Javadoc) >+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) >+ */ > public void stop(BundleContext context) throws Exception { > if (proxyService != null) { > proxyService.unregister(); > proxyService = null; > } >- super.stop(context); >+ if (extensionRegistryTracker != null) { >+ extensionRegistryTracker.close(); >+ extensionRegistryTracker = null; >+ } >+ if (logTracker != null) { >+ logTracker.close(); >+ logTracker = null; >+ } >+ bundleContext = null; > } >- >- public static void logError(String message, Throwable exc) { >- IStatus status = new Status(IStatus.ERROR, ID, 0, message, exc); > >- getInstance().getLog().log(status); >+ /* >+ * Log the given message as an error. >+ */ >+ public static void logError(String message, Throwable exc) { >+ log(new Status(IStatus.ERROR, ID, 0, message, exc)); > } > >+ /* >+ * Log the given message as an informational message. >+ */ > public static void logInfo(String message, Throwable exc) { >- IStatus status = new Status(IStatus.INFO, ID, 0, message, exc); >- >- getInstance().getLog().log(status); >+ log(new Status(IStatus.INFO, ID, 0, message, exc)); > } > >- public org.osgi.service.prefs.Preferences getInstancePreferences() { >- return new InstanceScope().getNode(getBundle().getSymbolicName()); >+ public static org.osgi.service.prefs.Preferences getInstancePreferences() { >+ return new InstanceScope().getNode(ID); > } > > public static void log(int severity, String message, Throwable throwable) { >- getInstance().getLog().log(new Status(severity, ID, 0, message, throwable)); >+ log(new Status(severity, ID, 0, message, throwable)); > } >+ >+ /* >+ * Return the extension registry. It is acquired lazily. >+ */ >+ public static IExtensionRegistry getExtensionRegistry() { >+ if (extensionRegistryTracker == null) { >+ extensionRegistryTracker = new ServiceTracker(getBundleContext(), IExtensionRegistry.class.getName(), null); >+ extensionRegistryTracker.open(); >+ } >+ return (IExtensionRegistry) extensionRegistryTracker.getService(); >+ } >+ >+ /* >+ * TODO: This currently references internal classes but will be replaced by the new security work >+ * to be available in Eclipse 3.4. >+ */ >+ public static void addAuthorizationInfo(URL serverUrl, String realm, String authScheme, Map info) throws CoreException { >+ AuthorizationHandler.addAuthorizationInfo(serverUrl, realm, authScheme, info); >+ } >+ >+ /* >+ * TODO: This currently references internal classes but will be replaced by the new security work >+ * to be available in Eclipse 3.4. >+ */ >+ public static Map getAuthorizationInfo(URL serverUrl, String realm, String authScheme) { >+ return AuthorizationHandler.getAuthorizationInfo(serverUrl, realm, authScheme); >+ } >+ >+ /* >+ * TODO: This currently references internal classes but will be replaced by the new security work >+ * to be available in Eclipse 3.4. >+ */ >+ public static void flushAuthorizationInfo(URL serverUrl, String realm, String authScheme) throws CoreException { >+ AuthorizationHandler.flushAuthorizationInfo(serverUrl, realm, authScheme); >+ } >+ >+ /* >+ * Log the given status to the log file. If the log is not available, log the status to the console. >+ */ >+ public static void log(IStatus status) { >+ if (logTracker == null) { >+ logTracker = new ServiceTracker(getBundleContext(), FrameworkLog.class.getName(), null); >+ logTracker.open(); >+ } >+ FrameworkLog log = (FrameworkLog) logTracker.getService(); >+ if (log != null) { >+ log.log(getLog(status)); >+ } else { >+ System.out.println(status.getMessage()); >+ if (status.getException() != null) >+ status.getException().printStackTrace(); >+ } >+ } >+ >+ /** >+ * Copied from PlatformLogWriter in core runtime. >+ */ >+ private static FrameworkLogEntry getLog(IStatus status) { >+ Throwable t = status.getException(); >+ ArrayList childlist = new ArrayList(); >+ >+ int stackCode = t instanceof CoreException ? 1 : 0; >+ // ensure a substatus inside a CoreException is properly logged >+ if (stackCode == 1) { >+ IStatus coreStatus = ((CoreException) t).getStatus(); >+ if (coreStatus != null) { >+ childlist.add(getLog(coreStatus)); >+ } >+ } >+ >+ if (status.isMultiStatus()) { >+ IStatus[] children = status.getChildren(); >+ for (int i = 0; i < children.length; i++) { >+ childlist.add(getLog(children[i])); >+ } >+ } >+ >+ FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null : childlist.toArray(new FrameworkLogEntry[childlist.size()])); >+ >+ return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), status.getMessage(), stackCode, t, children); >+ } >+ > } >Index: src/org/eclipse/core/internal/net/ProxyType.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyType.java,v >retrieving revision 1.7 >diff -u -r1.7 ProxyType.java >--- src/org/eclipse/core/internal/net/ProxyType.java 12 Apr 2007 20:55:52 -0000 1.7 >+++ src/org/eclipse/core/internal/net/ProxyType.java 9 Jan 2008 19:32:28 -0000 >@@ -114,8 +114,7 @@ > * @return a preferences node > */ > private Preferences getParentPreferences() { >- return Activator.getInstance().getInstancePreferences().node( >- PREF_PROXY_DATA_NODE); >+ return Activator.getInstancePreferences().node(PREF_PROXY_DATA_NODE); > } > > public IProxyData getProxyData(int verifyFlag) { >@@ -472,7 +471,7 @@ > > private Map getAuthInfo() { > // Retrieve username and password from keyring. >- Map authInfo = Platform.getAuthorizationInfo(FAKE_URL, getName(), ""); //$NON-NLS-1$ >+ Map authInfo = Activator.getAuthorizationInfo(FAKE_URL, getName(), ""); //$NON-NLS-1$ > return authInfo != null ? authInfo : Collections.EMPTY_MAP; > } > >@@ -501,9 +500,9 @@ > } > try { > if (authInfo.isEmpty()) { >- Platform.flushAuthorizationInfo(FAKE_URL, getName(), ""); //$NON-NLS-1$ >+ Activator.flushAuthorizationInfo(FAKE_URL, getName(), ""); //$NON-NLS-1$ > } else { >- Platform.addAuthorizationInfo(FAKE_URL, getName(), "", authInfo); //$NON-NLS-1$ >+ Activator.addAuthorizationInfo(FAKE_URL, getName(), "", authInfo); //$NON-NLS-1$ > } > } catch (CoreException e) { > Activator.logError(e.getMessage(), e); >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/META-INF/MANIFEST.MF,v >retrieving revision 1.3 >diff -u -r1.3 MANIFEST.MF >--- META-INF/MANIFEST.MF 9 Jul 2007 18:51:44 -0000 1.3 >+++ META-INF/MANIFEST.MF 9 Jan 2008 19:32:28 -0000 >@@ -6,10 +6,18 @@ > Bundle-Activator: org.eclipse.core.internal.net.Activator > Bundle-Vendor: %PLUGIN_PROVIDER > Bundle-Localization: plugin >-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)" > Eclipse-LazyStart: true > Export-Package: org.eclipse.core.internal.net;x-internal:=true, > org.eclipse.core.net.proxy > Bundle-RequiredExecutionEnvironment: J2SE-1.4, > CDC-1.0/Foundation-1.0, > J2SE-1.3 >+Import-Package: org.eclipse.core.runtime.preferences, >+ org.eclipse.osgi.framework.log;version="1.0.0", >+ org.eclipse.osgi.util;version="1.1.0", >+ org.osgi.framework;version="1.4.0", >+ org.osgi.service.prefs;version="1.1.0", >+ org.osgi.util.tracker;version="1.3.3" >+Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.3.0,4.0.0)", >+ org.eclipse.equinox.registry;bundle-version="[3.3.0,4.0.0)", >+ org.eclipse.core.runtime.compatibility.auth;bundle-version="[3.2.0,4.0.0)"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 214796
:
86498
|
93623
|
93624
|
94562
|
96057
|
96079
|
96575