Blob Blame History Raw
--- org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/plugin.xml.bak	2012-03-08 11:41:59.000000000 +0100
+++ org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/plugin.xml	2012-03-27 14:16:20.168665293 +0200
@@ -34,11 +34,4 @@
          </description>
       </wizard>
    </extension>
-   <extension
-         point="org.eclipse.mylyn.builds.ui.startup">
-      <startup
-            class="org.eclipse.mylyn.internal.hudson.ui.HudsonStartup">
-      </startup>
-   </extension>
-
 </plugin>
--- org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/src/org/eclipse/mylyn/internal/hudson/ui/HudsonUiPlugin.java.bak	2012-03-08 11:41:59.000000000 +0100
+++ org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/src/org/eclipse/mylyn/internal/hudson/ui/HudsonUiPlugin.java	1970-01-01 01:00:00.000000000 +0100
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Tasktop Technologies.
- * 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:
- *     Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.hudson.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Steffen Pingel
- */
-public class HudsonUiPlugin extends AbstractUIPlugin {
-
-	public static String ID_PLUGIN = "org.eclipse.mylyn.hudson.ui";
-
-	public HudsonUiPlugin() {
-	}
-
-	@Override
-	public void stop(BundleContext context) throws Exception {
-		if (HudsonStartup.getInstance() != null) {
-			HudsonStartup.getInstance().stop();
-		}
-		super.stop(context);
-	}
-
-}
--- org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/src/org/eclipse/mylyn/internal/hudson/ui/HudsonDiscovery.java.bak	2012-03-08 11:41:59.000000000 +0100
+++ org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/src/org/eclipse/mylyn/internal/hudson/ui/HudsonDiscovery.java	1970-01-01 01:00:00.000000000 +0100
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 Itema AS 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:
- *     Torkild U. Resheim - initial API and implementation
- *     Torkild U. Resheim - Uniquely identify Jenkins servers, bug 341725
- *     Torkild U. Resheim - Distinguish between Hudson and Jenkins, bug 353861
- *     Tasktop Technologies - improvements
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.hudson.ui;
-
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.UUID;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ecf.core.ContainerConnectException;
-import org.eclipse.ecf.core.ContainerCreateException;
-import org.eclipse.ecf.core.ContainerFactory;
-import org.eclipse.ecf.core.IContainer;
-import org.eclipse.ecf.discovery.IDiscoveryLocator;
-import org.eclipse.ecf.discovery.IServiceEvent;
-import org.eclipse.ecf.discovery.IServiceInfo;
-import org.eclipse.ecf.discovery.IServiceListener;
-import org.eclipse.ecf.discovery.IServiceProperties;
-import org.eclipse.ecf.discovery.identity.IServiceID;
-import org.eclipse.ecf.discovery.identity.IServiceTypeID;
-import org.eclipse.mylyn.builds.ui.BuildsUi;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This class implements a mechanism for discovering Hudson and Jenkins servers through the use of Multicast DNS (MDNS).
- * 
- * @author Torkild U. Resheim, Itema AS
- * @author Steffen Pingel
- */
-public class HudsonDiscovery {
-
-	private static final String ECF_DISCOVERY_JMDNS = "ecf.discovery.jmdns"; //$NON-NLS-1$
-
-	private static final String HUDSON_MDNS_ID = "_hudson._tcp.local._iana"; //$NON-NLS-1$
-
-	private static final String JENKINS_MDNS_ID = "_jenkins._tcp.local._iana"; //$NON-NLS-1$
-
-	private static final String URL_PROPERTY = "url"; //$NON-NLS-1$
-
-	/** Server id property name (Jenkins only). */
-	private static final String SERVER_ID_PROPERTY = "server-id"; //$NON-NLS-1$
-
-	private IContainer container;
-
-	public HudsonDiscovery() {
-	}
-
-	protected IContainer getContainer() throws ContainerCreateException {
-		return ContainerFactory.getDefault().createContainer(ECF_DISCOVERY_JMDNS);
-	}
-
-	/**
-	 * Determines whether or not the detected server is a new server or not.
-	 * 
-	 * @param url
-	 *            the server URL
-	 * @param id
-	 *            the server identifier
-	 * @return <code>true</code> if the detected server is new.
-	 */
-	private boolean isNew(String url, String id) {
-		if (url == null) {
-			return false;
-		}
-		List<RepositoryLocation> locations = BuildsUi.getServerLocations();
-		for (RepositoryLocation location : locations) {
-			if (location.hasUrl(url) || location.getId().equals(id)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public void start() {
-		try {
-			container = getContainer();
-			final IDiscoveryLocator adapter = (IDiscoveryLocator) container.getAdapter(IDiscoveryLocator.class);
-			adapter.addServiceListener(new IServiceListener() {
-				public void serviceDiscovered(IServiceEvent anEvent) {
-					IServiceInfo serviceInfo = anEvent.getServiceInfo();
-					IServiceID serviceId = serviceInfo.getServiceID();
-					IServiceTypeID serviceTypeId = serviceId.getServiceTypeID();
-					// Note that Jenkins will claim that it's both Jenkins and
-					// Hudson for backward compatibility.
-					if (serviceTypeId.getName().equals(JENKINS_MDNS_ID)) {
-						IServiceProperties properties = serviceInfo.getServiceProperties();
-						try {
-							if (properties.getProperty(URL_PROPERTY) == null) {
-								notifyMessage(Messages.JenkinsDiscovery_MessageTitle, NLS.bind(
-										Messages.JenkinsDiscovery_MissingURL, new Object[] { serviceInfo.getLocation()
-												.getHost() }));
-							} else {
-								issueJenkinsNotification(properties);
-							}
-						} catch (URISyntaxException e) {
-							StatusHandler.log(new Status(IStatus.ERROR, HudsonConnectorUi.ID_PLUGIN, NLS.bind(
-									Messages.Discovery_IncorrectURI,
-									new Object[] { properties.getProperty(URL_PROPERTY).toString() }), e));
-						}
-					}
-					if (serviceTypeId.getName().equals(HUDSON_MDNS_ID)) {
-						IServiceProperties properties = serviceInfo.getServiceProperties();
-						try {
-							if (properties.getProperty(URL_PROPERTY) == null) {
-								notifyMessage(Messages.HudsonDiscovery_MessageTitle, NLS.bind(
-										Messages.HudsonDiscovery_MissingURL, new Object[] { serviceInfo.getLocation()
-												.getHost() }));
-							} else {
-								issueHudsonNotification(properties);
-							}
-						} catch (URISyntaxException e) {
-							StatusHandler.log(new Status(IStatus.ERROR, HudsonConnectorUi.ID_PLUGIN, NLS.bind(
-									Messages.Discovery_IncorrectURI,
-									new Object[] { properties.getProperty(URL_PROPERTY).toString() }), e));
-						}
-					}
-				}
-
-				public void serviceUndiscovered(IServiceEvent anEvent) {
-					// Ignore this for now
-				}
-			});
-			container.connect(null, null);
-
-		} catch (ContainerCreateException e) {
-			StatusHandler.log(new Status(IStatus.WARNING, HudsonConnectorUi.ID_PLUGIN,
-					Messages.Discovery_CouldNotStartService, e));
-		} catch (ContainerConnectException e) {
-			StatusHandler.log(new Status(IStatus.WARNING, HudsonConnectorUi.ID_PLUGIN,
-					Messages.Discovery_CouldNotStartService, e));
-		}
-	}
-
-	public void stop() {
-		if (container != null) {
-			container.disconnect();
-			container = null;
-		}
-	}
-
-	private void notifyMessage(String title, String description) {
-		BuildsUi.serverDiscovered(title, description);
-	}
-
-	private void issueHudsonNotification(IServiceProperties properties) throws URISyntaxException {
-		String url = properties.getProperty(URL_PROPERTY).toString();
-		String id = getId(properties);
-		if (isNew(url, id)) {
-			notifyMessage(
-					Messages.HudsonDiscovery_MessageTitle,
-					NLS.bind(Messages.HudsonDiscovery_MessageText, new Object[] { url,
-							Messages.HudsonDiscovery_ServerName, url, id }));
-		}
-	}
-
-	private void issueJenkinsNotification(IServiceProperties properties) throws URISyntaxException {
-		String url = properties.getProperty(URL_PROPERTY).toString();
-		String id = getId(properties);
-		if (isNew(url, id)) {
-			// Change the first segment (org.eclipse.mylyn.hudson) to the id of 
-			// the new repository type when we start differentiation between the two
-			notifyMessage(
-					Messages.JenkinsDiscovery_MessageTitle,
-					NLS.bind(Messages.JenkinsDiscovery_MessageText, new Object[] { url,
-							Messages.JenkinsDiscovery_ServerName, url, id }));
-		}
-	}
-
-	private String getId(IServiceProperties properties) {
-		String id = (String) properties.getProperty(SERVER_ID_PROPERTY);
-		if (id == null) {
-			id = UUID.randomUUID().toString();
-		}
-		return id;
-	}
-
-}
--- org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/build.properties.bak	2012-03-27 14:48:20.000000000 +0200
+++ org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/build.properties	2012-03-27 14:48:32.555612843 +0200
@@ -18,4 +18,4 @@
                icons/
 src.includes = about.html
 
-jars.extra.classpath = platform:/plugin/org.eclipse.ecf,platform:/plugin/org.eclipse.ecf.discovery,platform:/plugin/org.eclipse.ecf.provider.discovery,platform:/plugin/org.eclipse.ecf.provider.jmdns
+#jars.extra.classpath = platform:/plugin/org.eclipse.ecf,platform:/plugin/org.eclipse.ecf.discovery,platform:/plugin/org.eclipse.ecf.provider.discovery,platform:/plugin/org.eclipse.ecf.provider.jmdns
--- org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/src/org/eclipse/mylyn/internal/hudson/ui/HudsonStartup.java.bak	2012-03-08 11:41:59.000000000 +0100
+++ org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/src/org/eclipse/mylyn/internal/hudson/ui/HudsonStartup.java	1970-01-01 01:00:00.000000000 +0100
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Tasktop Technologies 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:
- *     Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.hudson.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.builds.ui.BuildsUiStartup;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-
-/**
- * @author Steffen Pingel
- */
-public class HudsonStartup extends BuildsUiStartup {
-
-	private static HudsonStartup instance;
-
-	public static HudsonStartup getInstance() {
-		return instance;
-	}
-
-	public HudsonStartup() {
-		instance = this;
-	}
-
-	private HudsonDiscovery discovery;
-
-	@Override
-	public void lazyStartup() {
-		if (discovery != null) {
-			throw new IllegalStateException("Already started"); //$NON-NLS-1$
-		}
-		try {
-			discovery = new HudsonDiscovery();
-			discovery.start();
-		} catch (LinkageError e) {
-			// occurs when the optional ECF depedency is not satisfied 
-			StatusHandler.log(new Status(IStatus.WARNING, HudsonUiPlugin.ID_PLUGIN,
-					"ECF integration failed to load. Hudson server auto discovery is not available.", e));
-			discovery = null;
-		}
-	}
-
-	public void stop() {
-		if (discovery != null) {
-			discovery.stop();
-			discovery = null;
-		}
-	}
-
-}
--- org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/META-INF/MANIFEST.MF.orig	2012-03-08 11:41:59.000000000 +0100
+++ org.eclipse.mylyn.builds/org.eclipse.mylyn.hudson.ui/META-INF/MANIFEST.MF	2012-04-13 11:31:55.411145074 +0200
@@ -20,5 +20,4 @@
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-Localization: plugin
-Export-Package: org.eclipse.mylyn.internal.hudson.ui;x-internal:=true
-Bundle-Activator: org.eclipse.mylyn.internal.hudson.ui.HudsonUiPlugin
+