org.eclipse.mylyn.hudson.ui_0.9.1.v20120425-0100

16:46:43.677 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.hudson.ui_0.9.1.v20120425-0100.jar
package org.eclipse.mylyn.internal.hudson.ui;

import org.eclipse.mylyn.builds.ui.spi.BuildConnectorUi;

public class HudsonConnectorUi
  extends BuildConnectorUi
{
  public static final String ID_PLUGIN = "org.eclipse.mylyn.hudson.ui";
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.hudson.ui.HudsonConnectorUi
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.hudson.ui;

import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.builds.ui.BuildsUi;
import org.eclipse.mylyn.builds.ui.spi.BuildServerWizard;
import org.eclipse.mylyn.builds.ui.spi.BuildServerWizardPage;

public class NewHudsonServerWizard
  extends BuildServerWizard
{
  public NewHudsonServerWizard(IBuildServer model)
  {
    super(model);
  }
  
  public NewHudsonServerWizard()
  {
    super(BuildsUi.createServer("org.eclipse.mylyn.hudson"));
  }
  
  protected void initPage(BuildServerWizardPage page)
  {
    page.setTitle(Messages.NewServerWizard_Title);
    page.setMessage(Messages.NewServerWizard_Message);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.hudson.ui.NewHudsonServerWizard
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.hudson.ui;

import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.runtime.Status;
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.commons.core.StatusHandler;
import org.eclipse.osgi.util.NLS;

class HudsonDiscovery$1
  implements IServiceListener
{
  HudsonDiscovery$1(HudsonDiscovery paramHudsonDiscovery) {}
  
  public void serviceDiscovered(IServiceEvent anEvent)
  {
    IServiceInfo serviceInfo = anEvent.getServiceInfo();
    IServiceID serviceId = serviceInfo.getServiceID();
    IServiceTypeID serviceTypeId = serviceId.getServiceTypeID();
    if (serviceTypeId.getName().equals("_jenkins._tcp.local._iana"))
    {
      IServiceProperties properties = serviceInfo.getServiceProperties();
      try
      {
        if (properties.getProperty("url") == null) {
          HudsonDiscovery.access$0(this$0, Messages.JenkinsDiscovery_MessageTitle, NLS.bind(
            Messages.JenkinsDiscovery_MissingURL, new Object[] {serviceInfo.getLocation()
            .getHost() }));
        } else {
          HudsonDiscovery.access$1(this$0, properties);
        }
      }
      catch (URISyntaxException e)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.hudson.ui", NLS.bind(
          Messages.Discovery_IncorrectURI, 
          new Object[] { properties.getProperty("url").toString() }), e));
      }
    }
    if (serviceTypeId.getName().equals("_hudson._tcp.local._iana"))
    {
      IServiceProperties properties = serviceInfo.getServiceProperties();
      try
      {
        if (properties.getProperty("url") == null) {
          HudsonDiscovery.access$0(this$0, Messages.HudsonDiscovery_MessageTitle, NLS.bind(
            Messages.HudsonDiscovery_MissingURL, new Object[] {serviceInfo.getLocation()
            .getHost() }));
        } else {
          HudsonDiscovery.access$2(this$0, properties);
        }
      }
      catch (URISyntaxException e)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.hudson.ui", NLS.bind(
          Messages.Discovery_IncorrectURI, 
          new Object[] { properties.getProperty("url").toString() }), e));
      }
    }
  }
  
  public void serviceUndiscovered(IServiceEvent anEvent) {}
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.hudson.ui.HudsonDiscovery.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.hudson.ui;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.UUID;
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.core.IContainerFactory;
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;

public class HudsonDiscovery
{
  private static final String ECF_DISCOVERY_JMDNS = "ecf.discovery.jmdns";
  private static final String HUDSON_MDNS_ID = "_hudson._tcp.local._iana";
  private static final String JENKINS_MDNS_ID = "_jenkins._tcp.local._iana";
  private static final String URL_PROPERTY = "url";
  private static final String SERVER_ID_PROPERTY = "server-id";
  private IContainer container;
  
  protected IContainer getContainer()
    throws ContainerCreateException
  {
    return ContainerFactory.getDefault().createContainer("ecf.discovery.jmdns");
  }
  
  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();
      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();
          if (serviceTypeId.getName().equals("_jenkins._tcp.local._iana"))
          {
            IServiceProperties properties = serviceInfo.getServiceProperties();
            try
            {
              if (properties.getProperty("url") == null) {
                HudsonDiscovery.this.notifyMessage(Messages.JenkinsDiscovery_MessageTitle, NLS.bind(
                  Messages.JenkinsDiscovery_MissingURL, new Object[] {serviceInfo.getLocation()
                  .getHost() }));
              } else {
                HudsonDiscovery.this.issueJenkinsNotification(properties);
              }
            }
            catch (URISyntaxException e)
            {
              StatusHandler.log(new Status(4, "org.eclipse.mylyn.hudson.ui", NLS.bind(
                Messages.Discovery_IncorrectURI, 
                new Object[] { properties.getProperty("url").toString() }), e));
            }
          }
          if (serviceTypeId.getName().equals("_hudson._tcp.local._iana"))
          {
            IServiceProperties properties = serviceInfo.getServiceProperties();
            try
            {
              if (properties.getProperty("url") == null) {
                HudsonDiscovery.this.notifyMessage(Messages.HudsonDiscovery_MessageTitle, NLS.bind(
                  Messages.HudsonDiscovery_MissingURL, new Object[] {serviceInfo.getLocation()
                  .getHost() }));
              } else {
                HudsonDiscovery.this.issueHudsonNotification(properties);
              }
            }
            catch (URISyntaxException e)
            {
              StatusHandler.log(new Status(4, "org.eclipse.mylyn.hudson.ui", NLS.bind(
                Messages.Discovery_IncorrectURI, 
                new Object[] { properties.getProperty("url").toString() }), e));
            }
          }
        }
        
        public void serviceUndiscovered(IServiceEvent anEvent) {}
      });
      container.connect(null, null);
    }
    catch (ContainerCreateException e)
    {
      StatusHandler.log(new Status(2, "org.eclipse.mylyn.hudson.ui", 
        Messages.Discovery_CouldNotStartService, e));
    }
    catch (ContainerConnectException e)
    {
      StatusHandler.log(new Status(2, "org.eclipse.mylyn.hudson.ui", 
        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").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").toString();
    String id = getId(properties);
    if (isNew(url, id)) {
      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");
    if (id == null) {
      id = UUID.randomUUID().toString();
    }
    return id;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.hudson.ui.HudsonDiscovery
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.hudson.ui;

import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class HudsonUiPlugin
  extends AbstractUIPlugin
{
  public static String ID_PLUGIN = "org.eclipse.mylyn.hudson.ui";
  
  public void stop(BundleContext context)
    throws Exception
  {
    if (HudsonStartup.getInstance() != null) {
      HudsonStartup.getInstance().stop();
    }
    super.stop(context);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.hudson.ui.HudsonUiPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.hudson.ui;

import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.builds.ui.BuildsUiStartup;
import org.eclipse.mylyn.commons.core.StatusHandler;

public class HudsonStartup
  extends BuildsUiStartup
{
  private static HudsonStartup instance;
  private HudsonDiscovery discovery;
  
  public static HudsonStartup getInstance()
  {
    return instance;
  }
  
  public HudsonStartup()
  {
    instance = this;
  }
  
  public void lazyStartup()
  {
    if (discovery != null) {
      throw new IllegalStateException("Already started");
    }
    try
    {
      discovery = new HudsonDiscovery();
      discovery.start();
    }
    catch (LinkageError e)
    {
      StatusHandler.log(new Status(2, 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;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.hudson.ui.HudsonStartup
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.hudson.ui;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.hudson.ui.messages";
  public static String Discovery_CouldNotStartService;
  public static String Discovery_IncorrectURI;
  public static String HudsonDiscovery_MessageText;
  public static String HudsonDiscovery_MessageTitle;
  public static String HudsonDiscovery_MissingURL;
  public static String HudsonDiscovery_ServerName;
  public static String JenkinsDiscovery_MessageText;
  public static String JenkinsDiscovery_MessageTitle;
  public static String JenkinsDiscovery_MissingURL;
  public static String JenkinsDiscovery_ServerName;
  public static String NewServerWizard_Message;
  public static String NewServerWizard_Title;
  
  static
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.hudson.ui.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.hudson.ui.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd