org.eclipse.mylyn.commons.notifications.core_0.9.1.v20120425-0100

16:46:25.311 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.commons.notifications.core_0.9.1.v20120425-0100.jar
package org.eclipse.mylyn.commons.notifications.core;

import java.util.List;

public abstract interface INotificationService
{
  public abstract void notify(List<? extends AbstractNotification> paramList);
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.notifications.core.INotificationService
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.notifications.core;

import java.util.Collections;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.mylyn.commons.core.CoreUtil;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.osgi.framework.Bundle;
import org.osgi.framework.Filter;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.Version;

public class NotificationEnvironment
{
  private final Dictionary<Object, Object> environment;
  
  public NotificationEnvironment()
  {
    environment = new Hashtable(System.getProperties());
  }
  
  public Version getFrameworkVersion()
  {
    return CoreUtil.getFrameworkVersion();
  }
  
  public Version getPlatformVersion()
  {
    Bundle bundle = Platform.getBundle("org.eclipse.platform");
    if (bundle == null) {
      bundle = Platform.getBundle("org.eclipse.core.runtime");
    }
    if (bundle != null)
    {
      String versionString = (String)bundle.getHeaders().get("Bundle-Version");
      try
      {
        return new Version(versionString);
      }
      catch (IllegalArgumentException localIllegalArgumentException) {}
    }
    return Version.emptyVersion;
  }
  
  public Version getRuntimeVersion()
  {
    return CoreUtil.getRuntimeVersion();
  }
  
  public boolean matches(IAdaptable item, IProgressMonitor monitor)
  {
    IFilterable entry = (IFilterable)item.getAdapter(IFilterable.class);
    if (entry == null) {
      return true;
    }
    if (!matchesVersion(entry.getFilter("frameworkVersion"), getFrameworkVersion())) {
      return false;
    }
    if (!matchesVersion(entry.getFilter("platformVersion"), getPlatformVersion())) {
      return false;
    }
    if (!matchesVersion(entry.getFilter("runtimeVersion"), getRuntimeVersion())) {
      return false;
    }
    List<String> filterExpressions = entry.getFilters("filter");
    Filter filter;
    for (String filterExpression : filterExpressions) {
      try
      {
        filter = FrameworkUtil.createFilter(filterExpression);
        if (!filter.match(environment)) {
          return false;
        }
      }
      catch (InvalidSyntaxException localInvalidSyntaxException) {}
    }
    List<String> requiredFeatures = entry.getFilters("requires");
    for (String requiredFeature : requiredFeatures) {
      if (!getInstalledFeatures(monitor).contains(parseFeature(requiredFeature))) {
        return false;
      }
    }
    Object conflictedFeatures = entry.getFilters("conflicts");
    for (String conflictedFeature : (List)conflictedFeatures) {
      if (getInstalledFeatures(monitor).contains(parseFeature(conflictedFeature))) {
        return false;
      }
    }
    return true;
  }
  
  public Set<String> getInstalledFeatures(IProgressMonitor monitor)
  {
    return Collections.emptySet();
  }
  
  private boolean matchesVersion(String expectedVersionRangeExpression, Version actualVersion)
  {
    if (expectedVersionRangeExpression != null) {
      try
      {
        VersionRange versionRange = new VersionRange(expectedVersionRangeExpression);
        if (!versionRange.isIncluded(actualVersion)) {
          return false;
        }
      }
      catch (IllegalArgumentException localIllegalArgumentException) {}
    }
    return true;
  }
  
  private String parseFeature(String requiredFeature)
  {
    int i = requiredFeature.indexOf(";");
    if (i != -1) {
      return requiredFeature.substring(0, i);
    }
    return requiredFeature;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.notifications.core.NotificationEnvironment
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.notifications.core;

import java.util.List;

public class NotificationSinkEvent
{
  private final List<AbstractNotification> notifications;
  
  public NotificationSinkEvent(List<AbstractNotification> notifications)
  {
    this.notifications = notifications;
  }
  
  public List<AbstractNotification> getNotifications()
  {
    return notifications;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.notifications.core.NotificationSinkEvent
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.notifications.core;

import java.util.Date;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.commons.core.CoreUtil;

public abstract class AbstractNotification
  implements Comparable<AbstractNotification>, IAdaptable
{
  private final String eventId;
  
  public AbstractNotification(String eventId)
  {
    Assert.isNotNull(eventId);
    this.eventId = eventId;
  }
  
  public int compareTo(AbstractNotification o)
  {
    if (o == null) {
      return 1;
    }
    return CoreUtil.compare(getDate(), o.getDate());
  }
  
  public String getEventId()
  {
    return eventId;
  }
  
  public abstract Date getDate();
  
  public abstract String getDescription();
  
  public abstract String getLabel();
  
  public Object getToken()
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.notifications.core.AbstractNotification
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.notifications.core;

import java.util.List;

public abstract interface IFilterable
{
  public abstract String getFilter(String paramString);
  
  public abstract List<String> getFilters(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.notifications.core.IFilterable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.commons.notifications.core;

public abstract class NotificationSink
{
  public abstract void notify(NotificationSinkEvent paramNotificationSinkEvent);
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.commons.notifications.core.NotificationSink
 * 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