org.eclipse.osgi_3.7.2.v20120110-1415

g.eclipse.osgi.internal.profile.DefaultProfileLogger
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.profile;

import org.eclipse.osgi.framework.debug.FrameworkDebugOptions;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;

public class Profile
{
  public static final boolean PROFILE = true;
  public static boolean STARTUP = false;
  public static boolean BENCHMARK = false;
  public static boolean DEBUG = false;
  private static final String OSGI_PROP = "osgi.profile.";
  private static final String PROP_STARTUP = "osgi.profile.startup";
  private static final String PROP_BENCHMARK = "osgi.profile.benchmark";
  private static final String PROP_DEBUG = "osgi.profile.debug";
  private static final String PROP_IMPL = "osgi.profile.impl";
  private static final String OSGI_OPTION = "org.eclipse.osgi/profile/";
  private static final String OPTION_STARTUP = "org.eclipse.osgi/profile/startup";
  private static final String OPTION_BENCHMARK = "org.eclipse.osgi/profile/benchmark";
  private static final String OPTION_DEBUG = "org.eclipse.osgi/profile/debug";
  private static final String OPTION_IMPL = "org.eclipse.osgi/profile/impl";
  public static final int FLAG_NONE = 0;
  public static final int FLAG_ENTER = 1;
  public static final int FLAG_EXIT = 2;
  public static final String ENTER_DESCRIPTION = "enter";
  public static final String EXIT_DESCRIPTION = "exit";
  private static ProfileLogger profileLogger = null;
  private static String profileLoggerClassName = null;
  
  static
  {
    initProps();
  }
  
  public static void initProps()
  {
    FrameworkDebugOptions dbgOptions = null;
    if (FrameworkProperties.getProperty("osgi.debug") != null)
    {
      dbgOptions = FrameworkDebugOptions.getDefault();
      if (dbgOptions != null)
      {
        STARTUP = dbgOptions.getBooleanOption("org.eclipse.osgi/profile/startup", false);
        BENCHMARK = dbgOptions.getBooleanOption("org.eclipse.osgi/profile/benchmark", false);
        DEBUG = dbgOptions.getBooleanOption("org.eclipse.osgi/profile/debug", false);
        if (profileLogger == null) {
          profileLoggerClassName = dbgOptions.getOption("org.eclipse.osgi/profile/impl");
        }
      }
    }
    String prop;
    if ((prop = FrameworkProperties.getProperty("osgi.profile.startup")) != null)
    {
      STARTUP = Boolean.valueOf(prop).booleanValue();
      if (dbgOptions != null) {
        dbgOptions.setOption("org.eclipse.osgi/profile/startup", new Boolean(STARTUP).toString());
      }
    }
    if ((prop = FrameworkProperties.getProperty("osgi.profile.benchmark")) != null)
    {
      BENCHMARK = Boolean.valueOf(prop).booleanValue();
      if (dbgOptions != null) {
        dbgOptions.setOption("org.eclipse.osgi/profile/benchmark", new Boolean(BENCHMARK).toString());
      }
    }
    if ((prop = FrameworkProperties.getProperty("osgi.profile.debug")) != null)
    {
      DEBUG = Boolean.valueOf(prop).booleanValue();
      if (dbgOptions != null) {
        dbgOptions.setOption("org.eclipse.osgi/profile/debug", new Boolean(DEBUG).toString());
      }
    }
    if (profileLogger == null)
    {
      if ((prop = FrameworkProperties.getProperty("osgi.profile.impl")) != null)
      {
        profileLoggerClassName = prop;
        if (dbgOptions != null) {
          dbgOptions.setOption("org.eclipse.osgi/profile/impl", profileLoggerClassName);
        }
      }
    }
    else {
      profileLogger.initProps();
    }
  }
  
  public static void logEnter(String id)
  {
    logTime(1, id, "enter", null);
  }
  
  public static void logEnter(String id, String description)
  {
    logTime(1, id, "enter", description);
  }
  
  public static void logExit(String id)
  {
    logTime(2, id, "exit", null);
  }
  
  public static void logExit(String id, String description)
  {
    logTime(2, id, "exit", description);
  }
  
  public static void logTime(String id, String msg)
  {
    logTime(0, id, msg, null);
  }
  
  public static void logTime(String id, String msg, String description)
  {
    logTime(0, id, msg, description);
  }
  
  public static void logTime(int flag, String id, String msg, String description)
  {
    if (profileLogger == null) {
      profileLogger = createProfileLogger();
    }
    profileLogger.logTime(flag, id, msg, description);
  }
  
  public static void accumLogEnter(String scope)
  {
    if (profileLogger == null) {
      profileLogger = createProfileLogger();
    }
    profileLogger.accumLogEnter(scope);
  }
  
  public static void accumLogExit(String scope)
  {
    if (profileLogger == null) {
      profileLogger = createProfileLogger();
    }
    profileLogger.accumLogExit(scope);
  }
  
  public static String getProfileLog()
  {
    if (profileLogger != null) {
      return profileLogger.getProfileLog();
    }
    return "";
  }
  
  private static ProfileLogger createProfileLogger()
  {
    ProfileLogger result = null;
    if (profileLoggerClassName != null)
    {
      Class<?> profileImplClass = null;
      try
      {
        profileImplClass = Class.forName(profileLoggerClassName);
        result = (ProfileLogger)profileImplClass.newInstance();
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    }
    if (result == null) {
      result = new DefaultProfileLogger();
    }
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.profile.Profile
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.profile;

public abstract interface ProfileLogger
{
  public abstract void initProps();
  
  public abstract void logTime(int paramInt, String paramString1, String paramString2, String paramString3);
  
  public abstract void accumLogEnter(String paramString);
  
  public abstract void accumLogExit(String paramString);
  
  public abstract String getProfileLog();
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.profile.ProfileLogger
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.service.security;

import org.eclipse.osgi.framework.eventmgr.EventDispatcher;

class AuthorizationEngine$AuthEventDispatcher
  implements EventDispatcher<AuthorizationListener, Object, AuthorizationEvent>
{
  final AuthorizationEngine this$0;
  
  AuthorizationEngine$AuthEventDispatcher(AuthorizationEngine paramAuthorizationEngine) {}
  
  public void dispatchEvent(AuthorizationListener eventListener, Object listenerObject, int eventAction, AuthorizationEvent eventObject)
  {
    eventListener.authorizationEvent(eventObject);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.service.security.AuthorizationEngine.AuthEventDispatcher
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.service.security;

import java.util.HashMap;
import java.util.Map;
import org.eclipse.osgi.framework.eventmgr.EventDispatcher;
import org.eclipse.osgi.framework.eventmgr.EventManager;
import org.eclipse.osgi.framework.eventmgr.ListenerQueue;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;

public abstract class AuthorizationEngine
{
  private EventManager manager = new EventManager();
  private EventDispatcher<AuthorizationListener, Object, AuthorizationEvent> dispatcher = new AuthEventDispatcher();
  private final ServiceTracker<AuthorizationListener, AuthorizationListener> listenerTracker;
  
  public AuthorizationEngine(BundleContext context)
  {
    listenerTracker = new ServiceTracker(context, AuthorizationListener.class.getName(), null);
    listenerTracker.open();
  }
  
  public final void authorize(SignedContent content, Object context)
  {
    fireEvent(doAuthorize(content, context));
  }
  
  private void fireEvent(AuthorizationEvent event)
  {
    if (event == null) {
      return;
    }
    Object[] services = listenerTracker.getServices();
    if (services == null) {
      return;
    }
    Map<AuthorizationListener, Object> listeners = new HashMap();
    Object[] arrayOfObject1;
    int j = (arrayOfObject1 = services).length;
    for (int i = 0; i < j; i++)
    {
      Object service = arrayOfObject1[i];
      listeners.put((AuthorizationListener)service, service);
    }
    ListenerQueue<AuthorizationListener, Object, AuthorizationEvent> queue = new ListenerQueue(manager);
    queue.queueListeners(listeners.entrySet(), dispatcher);
    queue.dispatchEventSynchronous(0, event);
  }
  
  protected abstract AuthorizationEvent doAuthorize(SignedContent paramSignedContent, Object paramObject);
  
  public abstract int getStatus();
  
  class AuthEventDispatcher
    implements EventDispatcher<AuthorizationListener, Object, AuthorizationEvent>
  {
    AuthEventDispatcher() {}
    
    public void dispatchEvent(AuthorizationListener eventListener, Object listenerObject, int eventAction, AuthorizationEvent eventObject)
    {
      eventListener.authorizationEvent(eventObject);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.service.security.AuthorizationEngine
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.service.security;

import org.eclipse.osgi.signedcontent.SignedContent;

public class AuthorizationEvent
{
  public static final int ALLOWED = 0;
  public static final int DENIED = 1;
  private final int result;
  private final SignedContent content;
  private final Object context;
  private final int severity;
  
  public AuthorizationEvent(int result, SignedContent content, Object context, int severity)
  {
    this.result = result;
    this.content = content;
    this.context = context;
    this.severity = severity;
  }
  
  public int getResult()
  {
    return result;
  }
  
  public int getSeverity()
  {
    return severity;
  }
  
  public SignedContent getSignedContent()
  {
    return content;
  }
  
  public Object getContext()
  {
    return context;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.service.security.AuthorizationEvent
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.service.security;

import java.util.EventListener;

public abstract interface AuthorizationListener
  extends EventListener
{
  public abstract void authorizationEvent(AuthorizationEvent paramAuthorizationEvent);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.service.security.AuthorizationListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.service.security;

public class AuthorizationStatus
{
  public static final int OK = 0;
  public static final int ERROR = 1;
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.service.security.AuthorizationStatus
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.verifier;

import java.security.cert.Certificate;
import java.util.Date;

public abstract interface CertificateChain
{
  public abstract String getChain();
  
  public abstract Certificate[] getCertificates();
  
  public abstract Certificate getSigner();
  
  public abstract Certificate getRoot();
  
  public abstract boolean isTrusted();
  
  public abstract Date getSigningTime();
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.verifier.CertificateChain
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.verifier;

import java.security.cert.Certificate;
import java.security.cert.CertificateException;

public abstract interface CertificateTrustAuthority
{
  public abstract void checkTrust(Certificate[] paramArrayOfCertificate)
    throws CertificateException;
  
  public abstract void addTrusted(Certificate[] paramArrayOfCertificate)
    throws CertificateException;
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.verifier.CertificateTrustAuthority
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.verifier;

import java.security.SignatureException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateExpiredException;

public abstract interface CertificateVerifier
{
  public abstract void checkContent()
    throws CertificateException, CertificateExpiredException, SignatureException;
  
  public abstract String[] verifyContent();
  
  public abstract boolean isSigned();
  
  public abstract CertificateChain[] getChains();
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.verifier.CertificateVerifier
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.provisional.verifier;

import java.io.File;
import java.io.IOException;
import org.osgi.framework.Bundle;

public abstract interface CertificateVerifierFactory
{
  public abstract CertificateVerifier getVerifier(File paramFile)
    throws IOException;
  
  public abstract CertificateVerifier getVerifier(Bundle paramBundle)
    throws IOException;
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.provisional.verifier.CertificateVerifierFactory
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.resolver;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;

class BaseDescriptionImpl$BaseCapability
  implements BundleCapability
{
  private final String namespace;
  final BaseDescriptionImpl this$0;
  
  public BaseDescriptionImpl$BaseCapability(BaseDescriptionImpl paramBaseDescriptionImpl, String namespace)
  {
    this.namespace = namespace;
  }
  
  public BundleRevision getRevision()
  {
    return this$0.getSupplier();
  }
  
  public String getNamespace()
  {
    return namespace;
  }
  
  public Map<String, String> getDirectives()
  {
    return this$0.getDeclaredDirectives();
  }
  
  public Map<String, Object> getAttributes()
  {
    Map<String, Object> attrs = this$0.getDeclaredAttributes();
    String internalName = this$0.getInternalNameSpace();
    if (namespace.equals(internalName)) {
      return attrs;
    }
    attrs = new HashMap(attrs);
    Object nameValue = attrs.remove(internalName);
    if (nameValue != null) {
      attrs.put(namespace, nameValue);
    }
    return Collections.unmodifiableMap(attrs);
  }
  
  public int hashCode()
  {
    return System.identityHashCode(this$0);
  }
  
  protected BaseDescriptionImpl getBaseDescription()
  {
    return this$0;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof BaseCapability)) {
      return false;
    }
    return (((BaseCapability)obj).getBaseDescription() == this$0) && (namespace.equals(((BaseCapability)obj).getNamespace()));
  }
  
  public String toString()
  {
    return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.resolver.BaseDescriptionImpl.BaseCapability
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.resolver;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.osgi.framework.Version;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;

public abstract class BaseDescriptionImpl
  implements BaseDescription
{
  protected final Object monitor = new Object();
  private volatile String name;
  private volatile Version version;
  
  public String getName()
  {
    return name;
  }
  
  public Version getVersion()
  {
    synchronized (monitor)
    {
      if (version == null) {
        return Version.emptyVersion;
      }
      return version;
    }
  }
  
  protected void setName(String name)
  {
    this.name = name;
  }
  
  protected void setVersion(Version version)
  {
    this.version = version;
  }
  
  static String toString(Map<String, Object> map, boolean directives)
  {
    if (map.size() == 0) {
      return "";
    }
    String assignment = directives ? ":=" : "=";
    Set<Map.Entry<String, Object>> set = map.entrySet();
    StringBuffer sb = new StringBuffer();
    for (Iterator localIterator1 = set.iterator(); localIterator1.hasNext();)
    {
      Map.Entry<String, Object> entry = (Map.Entry)localIterator1.next();
      sb.append("; ");
      String key = (String)entry.getKey();
      Object value = entry.getValue();
      if ((value instanceof List))
      {
        List<Object> list = (List)value;
        if (list.size() != 0)
        {
          Object component = list.get(0);
          String className = component.getClass().getName();
          String type = className.substring(className.lastIndexOf('.') + 1);
          sb.append(key).append(':').append("List<").append(type).append(">").append(assignment).append('"');
          for (Iterator localIterator2 = list.iterator(); localIterator2.hasNext();)
          {
            Object object = localIterator2.next();
            sb.append(object).append(',');
          }
          sb.setLength(sb.length() - 1);
          sb.append('"');
        }
      }
      else
      {
        String type = "";
        if (!(value instanceof String))
        {
          String className = value.getClass().getName();
          type = ":" + className.substring(className.lastIndexOf('.') + 1);
        }
        sb.append(key).append(type).append(assignment).append('"').append(value).append('"');
      }
    }
    return sb.toString();
  }
  
  String getInternalNameSpace()
  {
    return null;
  }
  
  public BaseDescription getFragmentDeclaration()
  {
    return null;
  }
  
  public BundleCapability getCapability()
  {
    return getCapability(null);
  }
  
  BundleCapability getCapability(String namespace)
  {
    BaseDescriptionImpl fragmentDeclaration = (BaseDescriptionImpl)getFragmentDeclaration();
    if (fragmentDeclaration != null) {
      return fragmentDeclaration.getCapability(namespace);
    }
    if (namespace == null) {
      namespace = getInternalNameSpace();
    }
    if (namespace == null) {
      return null;
    }
    return new BaseCapability(namespace);
  }
  
  class BaseCapability
    implements BundleCapability
  {
    private final String namespace;
    
    public BaseCapability(String namespace)
    {
      this.namespace = namespace;
    }
    
    public BundleRevision getRevision()
    {
      return getSupplier();
    }
    
    public String getNamespace()
    {
      return namespace;
    }
    
    public Map<String, String> getDirectives()
    {
      return getDeclaredDirectives();
    }
    
    public Map<String, Object> getAttributes()
    {
      Map<String, Object> attrs = getDeclaredAttributes();
      String internalName = getInternalNameSpace();
      if (namespace.equals(internalName)) {
        return attrs;
      }
      attrs = new HashMap(attrs);
      Object nameValue = attrs.remove(internalName);
      if (nameValue != null) {
        attrs.put(namespace, nameValue);
      }
      return Collections.unmodifiableMap(attrs);
    }
    
    public int hashCode()
    {
      return System.identityHashCode(BaseDescriptionImpl.this);
    }
    
    protected BaseDescriptionImpl getBaseDescription()
    {
      return BaseDescriptionImpl.this;
    }
    
    public boolean equals(Object obj)
    {
      if (this == obj) {
        return true;
      }
      if (!(obj instanceof BaseCapability)) {
        return false;
      }
      return (((BaseCapability)obj).getBaseDescription() == BaseDescriptionImpl.this) && (namespace.equals(((BaseCapability)obj).getNamespace()));
    }
    
    public String toString()
    {
      return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.resolver.BaseDescriptionImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.resolver;

import org.eclipse.osgi.service.resolver.BundleDelta;
import org.eclipse.osgi.service.resolver.BundleDescription;

final class BundleDeltaImpl
  implements BundleDelta
{
  private volatile BundleDescription bundleDescription;
  private volatile int type;
  
  public BundleDeltaImpl(BundleDescription bundleDescription)
  {
    this(bundleDescription, 0);
  }
  
  public BundleDeltaImpl(BundleDescription bundleDescription, int type)
  {
    this.bundleDescription = bundleDescription;
    this.type = type;
  }
  
  public BundleDescription getBundle()
  {
    return bundleDescription;
  }
  
  public int getType()
  {
    return type;
  }
  
  protected void setBundle(BundleDescription bundleDescription)
  {
    this.bundleDescription = bundleDescription;
  }
  
  protected void setType(int type)
  {
    this.type = type;
  }
  
  public String toString()
  {
    return bundleDescription.getSymbolicName() + '_' + bundleDescription.getVersion() + " (" + toTypeString(type) + ")";
  }
  
  private static String toTypeString(int type)
  {
    StringBuffer typeStr = new StringBuffer();
    if ((type & 0x1) != 0) {
      typeStr.append("ADDED,");
    }
    if ((type & 0x2) != 0) {
      typeStr.append("REMOVED,");
    }
    if ((type & 0x8) != 0) {
      typeStr.append("RESOLVED,");
    }
    if ((type & 0x10) != 0) {
      typeStr.append("UNRESOLVED,");
    }
    if ((type & 0x20) != 0) {
      typeStr.append("LINKAGE_CHANGED,");
    }
    if ((type & 0x4) != 0) {
      typeStr.append("UPDATED,");
    }
    if ((type & 0x80) != 0) {
      typeStr.append("REMOVAL_PENDING,");
    }
    if ((type & 0x100) != 0) {
      typeStr.append("REMOVAL_COMPLETE,");
    }
    if (typeStr.length() > 0) {
      typeStr.deleteCharAt(typeStr.length() - 1);
    }
    return typeStr.toString();
  }
  
  public int compareTo(BundleDelta obj)
  {
    long idcomp = getBundle().getBundleId() - obj.getBundle().getBundleId();
    return idcomp > 0L ? 1 : idcomp < 0L ? -1 : 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.resolver.BundleDeltaImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.resolver;

import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.HostSpecification;
import org.eclipse.osgi.service.resolver.StateWire;
import org.eclipse.osgi.service.resolver.VersionConstraint;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;

class BundleDescriptionImpl$BundleWireImpl
  implements BundleWire
{
  private final BundleCapability capability;
  private final BundleWiring provider;
  private final BundleRequirement requirement;
  private final BundleWiring requirer;
  
  public BundleDescriptionImpl$BundleWireImpl(StateWire wire)
  {
    VersionConstraint declaredRequirement = wire.getDeclaredRequirement();
    if ((declaredRequirement instanceof HostSpecification)) {
      capability = ((BaseDescriptionImpl)wire.getDeclaredCapability()).getCapability("osgi.wiring.host");
    } else {
      capability = wire.getDeclaredCapability().getCapability();
    }
    provider = wire.getCapabilityHost().getWiring();
    requirement = declaredRequirement.getRequirement();
    requirer = wire.getRequirementHost().getWiring();
  }
  
  public BundleCapability getCapability()
  {
    return capability;
  }
  
  public BundleRequirement getRequirement()
  {
    return requirement;
  }
  
  public BundleWiring getProviderWiring()
  {
    return provider;
  }
  
  public BundleWiring getRequirerWiring()
  {
    return requirer;
  }
  
  public int hashCode()
  {
    int hashcode = 31 + capability.hashCode();
    hashcode = hashcode * 31 + requirement.hashCode();
    hashcode = hashcode * 31 + provider.hashCode();
    hashcode = hashcode * 31 + requirer.hashCode();
    return hashcode;
  }
  
  public boolean equals(Object obj)
  {
    if (!(obj instanceof BundleWireImpl)) {
      return false;
    }
    BundleWireImpl other = (BundleWireImpl)obj;
    return (capability.equals(other.getCapability())) && (requirement.equals(other.getRequirement())) && (provider.equals(other.getProviderWiring())) && (requirer.equals(other.getRequirerWiring()));
  }
  
  public String toString()
  {
    return getRequirement() + " -> " + getCapability();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.resolver.BundleDescriptionImpl.BundleWireImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.resolver;

import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;
import org.eclipse.osgi.framework.internal.core.BundleHost;
import org.eclipse.osgi.internal.loader.BundleLoader;
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.GenericDescription;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.eclipse.osgi.service.resolver.StateWire;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;

class BundleDescriptionImpl$DescriptionWiring
  implements BundleWiring
{
  private volatile boolean valid = true;
  final BundleDescriptionImpl this$0;
  
  BundleDescriptionImpl$DescriptionWiring(BundleDescriptionImpl paramBundleDescriptionImpl) {}
  
  public Bundle getBundle()
  {
    return this$0.getBundle();
  }
  
  public boolean isInUse()
  {
    return (valid) && ((isCurrent()) || (this$0.hasDependents()));
  }
  
  void invalidate()
  {
    valid = false;
  }
  
  public boolean isCurrent()
  {
    return (valid) && (!this$0.isRemovalPending());
  }
  
  public List<BundleCapability> getCapabilities(String namespace)
  {
    if (!isInUse()) {
      return null;
    }
    List<BundleCapability> result = Collections.EMPTY_LIST;
    if (this$0.host != null) {
      return result;
    }
    result = new ArrayList();
    if (this$0.getSymbolicName() != null)
    {
      if ((namespace == null) || ("osgi.wiring.bundle".equals(namespace))) {
        result.add(this$0.getCapability());
      }
      if ((this$0.attachFragments()) && ((namespace == null) || ("osgi.wiring.host".equals(namespace)))) {
        result.add(this$0.getCapability("osgi.wiring.host"));
      }
    }
    Object localObject;
    if ((namespace == null) || ("osgi.wiring.package".equals(namespace)))
    {
      ExportPackageDescription[] exports = this$0.getSelectedExports();
      j = (localObject = exports).length;
      for (i = 0; i < j; i++)
      {
        ExportPackageDescription exportPkg = localObject[i];
        result.add(exportPkg.getCapability());
      }
    }
    GenericDescription[] genericCapabilities = this$0.getSelectedGenericCapabilities();
    int j = (localObject = genericCapabilities).length;
    for (int i = 0; i < j; i++)
    {
      GenericDescription capabilitiy = localObject[i];
      if ((namespace == null) || (namespace.equals(capabilitiy.getType()))) {
        result.add(capabilitiy.getCapability());
      }
    }
    return result;
  }
  
  public List<BundleRequirement> getRequirements(String namespace)
  {
    List<BundleWire> requiredWires = getRequiredWires(namespace);
    if (requiredWires == null) {
      return null;
    }
    List<BundleRequirement> requirements = new ArrayList(requiredWires.size());
    for (Iterator localIterator = requiredWires.iterator(); localIterator.hasNext();)
    {
      BundleWire wire = (BundleWire)localIterator.next();
      if (!requirements.contains(wire.getRequirement())) {
        requirements.add(wire.getRequirement());
      }
    }
    if (((namespace == null) || ("osgi.wiring.package".equals(namespace))) && 
      (this$0.hasDynamicImports()))
    {
      ImportPackageSpecification[] imports = this$0.getImportPackages();
      ImportPackageSpecification[] arrayOfImportPackageSpecification1;
      int j = (arrayOfImportPackageSpecification1 = imports).length;
      for (int i = 0; i < j; i++)
      {
        ImportPackageSpecification impPackage = arrayOfImportPackageSpecification1[i];
        if ("dynamic".equals(impPackage.getDirective("resolution")))
        {
          BundleRequirement req = impPackage.getRequirement();
          if (!requirements.contains(req)) {
            requirements.add(req);
          }
        }
      }
    }
    return requirements;
  }
  
  public List<BundleWire> getProvidedWires(String namespace)
  {
    if (!isInUse()) {
      return null;
    }
    BundleDescription[] dependentBundles = this$0.getDependents();
    List<BundleWire> unorderedResult = new ArrayList();
    int j = (localObject1 = dependentBundles).length;
    for (int i = 0; i < j; i++)
    {
      BundleDescription dependent = localObject1[i];
      List<BundleWire> dependentWires = dependent.getWiring().getRequiredWires(namespace);
      if (dependentWires != null) {
        for (Iterator localIterator = dependentWires.iterator(); localIterator.hasNext();)
        {
          BundleWire bundleWire = (BundleWire)localIterator.next();
          if (bundleWire.getProviderWiring() == this) {
            unorderedResult.add(bundleWire);
          }
        }
      }
    }
    List<BundleWire> orderedResult = new ArrayList(unorderedResult.size());
    Object capabilities = getCapabilities(namespace);
    Iterator<BundleWire> wires;
    for (Object localObject1 = ((List)capabilities).iterator(); ((Iterator)localObject1).hasNext(); wires.hasNext())
    {
      BundleCapability capability = (BundleCapability)((Iterator)localObject1).next();
      wires = unorderedResult.iterator(); continue;
      BundleWire wire = (BundleWire)wires.next();
      if (wire.getCapability().equals(capability))
      {
        wires.remove();
        orderedResult.add(wire);
      }
    }
    return orderedResult;
  }
  
  public List<BundleWire> getRequiredWires(String namespace)
  {
    if (!isInUse()) {
      return null;
    }
    List<BundleWire> result = Collections.EMPTY_LIST;
    Map<String, List<StateWire>> wireMap = this$0.getWires();
    if (namespace == null)
    {
      result = new ArrayList();
      Iterator localIterator2;
      for (Iterator localIterator1 = wireMap.values().iterator(); localIterator1.hasNext(); localIterator2.hasNext())
      {
        List<StateWire> wires = (List)localIterator1.next();
        localIterator2 = wires.iterator(); continue;wire = (StateWire)localIterator2.next();
        result.add(new BundleDescriptionImpl.BundleWireImpl(wire));
      }
      return result;
    }
    List<StateWire> wires = (List)wireMap.get(namespace);
    if (wires == null) {
      return result;
    }
    result = new ArrayList(wires.size());
    for (StateWire wire = wires.iterator(); wire.hasNext();)
    {
      StateWire wire = (StateWire)wire.next();
      result.add(new BundleDescriptionImpl.BundleWireImpl(wire));
    }
    return result;
  }
  
  public BundleRevision getRevision()
  {
    return this$0;
  }
  
  public ClassLoader getClassLoader()
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      sm.checkPermission(BundleDescriptionImpl.GET_CLASSLOADER_PERM);
    }
    if (!isInUse()) {
      return null;
    }
    return (ClassLoader)getBundleClassLoader();
  }
  
  private BundleClassLoader getBundleClassLoader()
  {
    Object o = this$0.getUserObject();
    if (!(o instanceof BundleLoaderProxy))
    {
      if ((o instanceof BundleReference)) {
        o = ((BundleReference)o).getBundle();
      }
      if ((o instanceof BundleHost)) {
        o = ((BundleHost)o).getLoaderProxy();
      }
    }
    if ((o instanceof BundleLoaderProxy)) {
      return ((BundleLoaderProxy)o).getBundleLoader().createClassLoader();
    }
    return null;
  }
  
  private boolean hasResourcePermission()
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      try
      {
        sm.checkPermission(new AdminPermission(getBundle(), "resource"));
      }
      catch (SecurityException localSecurityException)
      {
        return false;
      }
    }
    return true;
  }
  
  public List<URL> findEntries(String path, String filePattern, int options)
  {
    if ((!hasResourcePermission()) || (!isInUse())) {
      return null;
    }
    List<URL> result = Collections.EMPTY_LIST;
    BundleClassLoader bcl = getBundleClassLoader();
    if (bcl != null) {
      result = bcl.findEntries(path, filePattern, options);
    }
    return Collections.unmodifiableList(result);
  }
  
  public Collection<String> listResources(String path, String filePattern, int options)
  {
    if ((!hasResourcePermission()) || (!isInUse())) {
      return null;
    }
    Collection<String> result = Collections.EMPTY_LIST;
    BundleClassLoader bcl = getBundleClassLoader();
    if (bcl != null) {
      result = bcl.listResources(path, filePattern, options);
    }
    return Collections.unmodifiableCollection(result);
  }
  
  public String toString()
  {
    return this$0.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.resolver.BundleDescriptionImpl.DescriptionWiring
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.resolver;

import java.util.List;
import java.util.Map;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.BundleSpecification;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.GenericDescription;
import org.eclipse.osgi.service.resolver.GenericSpecification;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.eclipse.osgi.service.resolver.NativeCodeSpecification;
import org.eclipse.osgi.service.resolver.StateWire;

final class BundleDescriptionImpl$LazyData
{
  String location;
  String platformFilter;
  BundleSpecification[] requiredBundles;
  ExportPackageDescription[] exportPackages;
  ImportPackageSpecification[] importPackages;
  GenericDescription[] genericCapabilities;
  GenericSpecification[] genericRequires;
  NativeCodeSpecification nativeCode;
  ExportPackageDescription[] selectedExports;
  GenericDescription[] selectedCapabilities;
  BundleDescription[] resolvedRequires;
  ExportPackageDescription[] resolvedImports;
  GenericDescription[] resolvedCapabilities;
  ExportPackageDescription[] substitutedExports;
  String[] executionEnvironments;
  Map<String, Long> dynamicStamps;
  Map<String, List<StateWire>> stateWires;
  List<ImportPackageSpecification> addedDynamicImports;
  final BundleDescriptionImpl this$0;
  
  BundleDescriptionImpl$LazyData(BundleDescriptionImpl paramBundleDescriptionImpl) {}
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.resolver.BundleDescriptionImpl.LazyData
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.resolver;

import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;
import org.eclipse.osgi.framework.internal.core.BundleHost;
import org.eclipse.osgi.framework.util.KeyedElement;
import org.eclipse.osgi.internal.loader.BundleLoader;
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
import org.eclipse.osgi.service.resolver.BaseDescription;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.BundleSpecification;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.GenericDescription;
import org.eclipse.osgi.service.resolver.GenericSpecification;
import org.eclipse.osgi.service.resolver.HostSpecification;
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
import org.eclipse.osgi.service.resolver.NativeCodeDescription;
import org.eclipse.osgi.service.resolver.NativeCodeSpecification;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.StateWire;
import org.eclipse.osgi.service.resolver.VersionConstraint;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;

public final class BundleDescriptionImpl
  extends BaseDescriptionImpl
  implements BundleDescription, KeyedElement
{
  static final String[] EMPTY_STRING = new String[0];
  static final ImportPackageSpecification[] EMPTY_IMPORTS = new ImportPackageSpecification[0];
  static final BundleSpecification[] EMPTY_BUNDLESPECS = new BundleSpecification[0];
  static final ExportPackageDescription[] EMPTY_EXPORTS = new ExportPackageDescription[0];
  static final BundleDescription[] EMPTY_BUNDLEDESCS = new BundleDescription[0];
  static final GenericSpecification[] EMPTY_GENERICSPECS = new GenericSpecification[0];
  static final GenericDescription[] EMPTY_GENERICDESCS = new GenericDescription[0];
  static final RuntimePermission GET_CLASSLOADER_PERM = new RuntimePermission("getClassLoader");
  static final int RESOLVED = 1;
  static final int SINGLETON = 2;
  static final int REMOVAL_PENDING = 4;
  static final int FULLY_LOADED = 8;
  static final int LAZY_LOADED = 16;
  static final int HAS_DYNAMICIMPORT = 32;
  static final int ATTACH_FRAGMENTS = 64;
  static final int DYNAMIC_FRAGMENTS = 128;
  private volatile int stateBits = 200;
  private volatile long bundleId = -1L;
  volatile HostSpecification host;
  private volatile StateImpl containingState;
  private volatile Object userObject;
  private volatile int lazyDataOffset = -1;
  private volatile int lazyDataSize = -1;
  private List<BundleDescription> dependencies;
  private List<BundleDescription> dependents;
  private String[] mandatory;
  private Map<String, Object> attributes;
  private volatile LazyData lazyData;
  private volatile int equinox_ee = -1;
  private DescriptionWiring bundleWiring;
  
  public long getBundleId()
  {
    return bundleId;
  }
  
  public String getSymbolicName()
  {
    return getName();
  }
  
  public BundleDescription getSupplier()
  {
    return this;
  }
  
  /* Error */
  public String getLocation()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 707	org/eclipse/osgi/internal/resolver/BundleDescriptionImpl:loadLazyData	()Lorg/eclipse/osgi/internal/resolver/BundleDescription
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

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