org.eclipse.osgi_3.7.2.v20120110-1415

load_1
    //   48: invokevirtual 264	java/security/KeyStore:deleteEntry	(Ljava/lang/String;)V
    //   51: aload_0
    //   52: invokespecial 285	org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine:getOutputStream	()Ljava/io/OutputStream;
    //   55: astore 5
    //   57: aload_0
    //   58: aload_2
    //   59: aload 5
    //   61: invokespecial 292	org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine:saveStore	(Ljava/security/KeyStore;Ljava/io/OutputStream;)V
    //   64: goto +14 -> 78
    //   67: astore 6
    //   69: aload_0
    //   70: aload 5
    //   72: invokespecial 286	org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine:safeClose	(Ljava/io/OutputStream;)V
    //   75: aload 6
    //   77: athrow
    //   78: aload_0
    //   79: aload 5
    //   81: invokespecial 286	org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine:safeClose	(Ljava/io/OutputStream;)V
    //   84: aload_3
    //   85: monitorexit
    //   86: goto +26 -> 112
    //   89: aload_3
    //   90: monitorexit
    //   91: athrow
    //   92: astore_2
    //   93: new 133	java/security/cert/CertificateException
    //   96: dup
    //   97: aload_2
    //   98: invokevirtual 271	java/security/KeyStoreException:getMessage	()Ljava/lang/String;
    //   101: invokespecial 275	java/security/cert/CertificateException:<init>	(Ljava/lang/String;)V
    //   104: aload_2
    //   105: invokevirtual 276	java/security/cert/CertificateException:initCause	(Ljava/lang/Throwable;)Ljava/lang/Throwable;
    //   108: checkcast 133	java/security/cert/CertificateException
    //   111: athrow
    //   112: return
    // Line number table:
    //   Java source line #220	-> byte code offset #0
    //   Java source line #221	-> byte code offset #4
    //   Java source line #224	-> byte code offset #14
    //   Java source line #225	-> byte code offset #19
    //   Java source line #226	-> byte code offset #23
    //   Java source line #227	-> byte code offset #30
    //   Java source line #228	-> byte code offset #35
    //   Java source line #229	-> byte code offset #46
    //   Java source line #230	-> byte code offset #51
    //   Java source line #232	-> byte code offset #57
    //   Java source line #233	-> byte code offset #67
    //   Java source line #234	-> byte code offset #69
    //   Java source line #235	-> byte code offset #75
    //   Java source line #234	-> byte code offset #78
    //   Java source line #225	-> byte code offset #84
    //   Java source line #237	-> byte code offset #92
    //   Java source line #238	-> byte code offset #93
    //   Java source line #240	-> byte code offset #112
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	113	0	this	KeyStoreTrustEngine
    //   0	113	1	alias	String
    //   18	41	2	store	KeyStore
    //   92	13	2	ke	KeyStoreException
    //   21	69	3	Ljava/lang/Object;	Object
    //   28	3	4	oldCert	Certificate
    //   55	25	5	out	OutputStream
    //   67	9	6	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   57	67	67	finally
    //   23	86	89	finally
    //   89	91	89	finally
    //   14	92	92	java/security/KeyStoreException
  }
  
  /* Error */
  public Certificate getTrustAnchor(String alias)
    throws IOException, GeneralSecurityException
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnonnull +13 -> 14
    //   4: new 122	java/lang/IllegalArgumentException
    //   7: dup
    //   8: ldc 1
    //   10: invokespecial 260	java/lang/IllegalArgumentException:<init>	(Ljava/lang/String;)V
    //   13: athrow
    //   14: aload_0
    //   15: invokespecial 290	org/eclipse/osgi/internal/service/security/KeyStoreTrustEngine:getKeyStore	()Ljava/security/KeyStore;
    //   18: astore_2
    //   19: aload_2
    //   20: dup
    //   21: astore_3
    //   22: monitorenter
    //   23: aload_2
    //   24: aload_1
    //   25: invokevirtual 269	java/security/KeyStore:getCertificate	(Ljava/lang/String;)Ljava/security/cert/Certificate;
    //   28: aload_3
    //   29: monitorexit
    //   30: areturn
    //   31: aload_3
    //   32: monitorexit
    //   33: athrow
    //   34: astore_2
    //   35: new 133	java/security/cert/CertificateException
    //   38: dup
    //   39: aload_2
    //   40: invokevirtual 271	java/security/KeyStoreException:getMessage	()Ljava/lang/String;
    //   43: invokespecial 275	java/security/cert/CertificateException:<init>	(Ljava/lang/String;)V
    //   46: aload_2
    //   47: invokevirtual 276	java/security/cert/CertificateException:initCause	(Ljava/lang/Throwable;)Ljava/lang/Throwable;
    //   50: checkcast 133	java/security/cert/CertificateException
    //   53: athrow
    // Line number table:
    //   Java source line #244	-> byte code offset #0
    //   Java source line #245	-> byte code offset #4
    //   Java source line #249	-> byte code offset #14
    //   Java source line #250	-> byte code offset #19
    //   Java source line #251	-> byte code offset #23
    //   Java source line #250	-> byte code offset #31
    //   Java source line #253	-> byte code offset #34
    //   Java source line #254	-> byte code offset #35
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	54	0	this	KeyStoreTrustEngine
    //   0	54	1	alias	String
    //   18	6	2	store	KeyStore
    //   34	13	2	ke	KeyStoreException
    //   21	11	3	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   23	30	31	finally
    //   31	33	31	finally
    //   14	30	34	java/security/KeyStoreException
    //   31	34	34	java/security/KeyStoreException
  }
  
  public String[] getAliases()
    throws IOException, GeneralSecurityException
  {
    List<String> returnList = new ArrayList();
    try
    {
      KeyStore store = getKeyStore();
      synchronized (store)
      {
        for (Enumeration<String> aliases = store.aliases(); aliases.hasMoreElements();)
        {
          String currentAlias = (String)aliases.nextElement();
          if (store.isCertificateEntry(currentAlias)) {
            returnList.add(currentAlias);
          }
        }
      }
    }
    catch (KeyStoreException ke)
    {
      throw ((CertificateException)new CertificateException(ke.getMessage()).initCause(ke));
    }
    return (String[])returnList.toArray(new String[0]);
  }
  
  private void loadStore(KeyStore store, InputStream is)
    throws IOException, GeneralSecurityException
  {
    store.load(is, getPassword());
  }
  
  private void saveStore(KeyStore store, OutputStream os)
    throws IOException, GeneralSecurityException
  {
    store.store(os, getPassword());
  }
  
  private void safeClose(OutputStream out)
  {
    try
    {
      if (out != null) {
        out.close();
      }
    }
    catch (IOException localIOException) {}
  }
  
  private InputStream getInputStream()
    throws IOException
  {
    return new FileInputStream(new File(getPath()));
  }
  
  private OutputStream getOutputStream()
    throws IOException
  {
    File file = new File(getPath());
    if (!file.exists()) {
      file.createNewFile();
    }
    return new FileOutputStream(file);
  }
  
  public boolean isReadOnly()
  {
    return (getPassword() == null) || (!new File(path).canWrite());
  }
  
  public String getName()
  {
    return name;
  }
}

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

import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;
import org.eclipse.osgi.framework.internal.core.FilterImpl;
import org.osgi.framework.AllServiceListener;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.hooks.service.ListenerHook.ListenerInfo;

class FilteredServiceListener
  implements ServiceListener, ListenerHook.ListenerInfo
{
  private final FilterImpl filter;
  private final ServiceListener listener;
  private final BundleContextImpl context;
  private final boolean allservices;
  private final String objectClass;
  private volatile boolean removed;
  
  FilteredServiceListener(BundleContextImpl context, ServiceListener listener, String filterstring)
    throws InvalidSyntaxException
  {
    if (filterstring == null)
    {
      filter = null;
      objectClass = null;
    }
    else
    {
      FilterImpl filterImpl = FilterImpl.newInstance(filterstring);
      String clazz = filterImpl.getRequiredObjectClass();
      if (clazz == null)
      {
        objectClass = null;
        filter = filterImpl;
      }
      else
      {
        objectClass = clazz.intern();
        filter = (filterstring.equals(getObjectClassFilterString(objectClass)) ? null : filterImpl);
      }
    }
    removed = false;
    this.listener = listener;
    this.context = context;
    allservices = (listener instanceof AllServiceListener);
  }
  
  public void serviceChanged(ServiceEvent event)
  {
    ServiceReferenceImpl<?> reference = (ServiceReferenceImpl)event.getServiceReference();
    if (objectClass != null)
    {
      String[] classes = reference.getClasses();
      int size = classes.length;
      int i = 0;
      while (classes[i] != objectClass)
      {
        i++;
        if (i >= size) {
          return;
        }
      }
    }
    if (!ServiceRegistry.hasListenServicePermission(event, context)) {
      return;
    }
    if (Debug.DEBUG_EVENTS)
    {
      String listenerName = getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(this));
      Debug.println("filterServiceEvent(" + listenerName + ", \"" + getFilter() + "\", " + reference.getRegistration().getProperties() + ")");
    }
    event = filterMatch(event);
    if (event == null) {
      return;
    }
    if ((allservices) || (ServiceRegistry.isAssignableTo(context, reference)))
    {
      if (Debug.DEBUG_EVENTS)
      {
        String listenerName = listener.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(listener));
        Debug.println("dispatchFilteredServiceEvent(" + listenerName + ")");
      }
      listener.serviceChanged(event);
    }
  }
  
  private ServiceEvent filterMatch(ServiceEvent delivered)
  {
    boolean modified = delivered.getType() == 2;
    ServiceEvent event = modified ? ((ModifiedServiceEvent)delivered).getModifiedEvent() : delivered;
    if (filter == null) {
      return event;
    }
    ServiceReference<?> reference = event.getServiceReference();
    if (filter.match(reference)) {
      return event;
    }
    if (modified)
    {
      ModifiedServiceEvent modifiedServiceEvent = (ModifiedServiceEvent)delivered;
      if (modifiedServiceEvent.matchPreviousProperties(filter)) {
        return modifiedServiceEvent.getModifiedEndMatchEvent();
      }
    }
    return null;
  }
  
  public String toString()
  {
    String filterString = getFilter();
    if (filterString == null) {
      filterString = "";
    }
    return listener.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(listener)) + filterString;
  }
  
  public BundleContext getBundleContext()
  {
    return context;
  }
  
  public String getFilter()
  {
    if (filter != null) {
      return filter.toString();
    }
    return getObjectClassFilterString(objectClass);
  }
  
  public boolean isRemoved()
  {
    return removed;
  }
  
  void markRemoved()
  {
    removed = true;
  }
  
  private static String getObjectClassFilterString(String className)
  {
    if (className == null) {
      return null;
    }
    return "(objectClass=" + className + ")";
  }
}

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

import org.osgi.framework.ServiceRegistration;

public abstract interface HookContext
{
  public abstract void call(Object paramObject, ServiceRegistration<?> paramServiceRegistration)
    throws Exception;
  
  public abstract String getHookClassName();
  
  public abstract String getHookMethodName();
}

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

import org.osgi.framework.Filter;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceReference;

class ModifiedServiceEvent
  extends ServiceEvent
{
  private static final long serialVersionUID = -5373850978543026102L;
  private final ServiceEvent modified;
  private final ServiceEvent modifiedEndMatch;
  private final ServiceProperties previousProperties;
  
  ModifiedServiceEvent(ServiceReference<?> reference, ServiceProperties previousProperties)
  {
    super(2, reference);
    modified = new ServiceEvent(2, reference);
    modifiedEndMatch = new ServiceEvent(8, reference);
    this.previousProperties = previousProperties;
  }
  
  ServiceEvent getModifiedEvent()
  {
    return modified;
  }
  
  ServiceEvent getModifiedEndMatchEvent()
  {
    return modifiedEndMatch;
  }
  
  boolean matchPreviousProperties(Filter filter)
  {
    return filter.matchCase(previousProperties);
  }
}

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

import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.eclipse.osgi.framework.util.Headers;

class ServiceProperties
  extends Headers<String, Object>
{
  private ServiceProperties(int size, Dictionary<String, ?> props)
  {
    super(size);
    if (props == null) {
      return;
    }
    synchronized (props)
    {
      Enumeration<?> keysEnum = props.keys();
      while (keysEnum.hasMoreElements())
      {
        Object key = keysEnum.nextElement();
        if ((key instanceof String))
        {
          String header = (String)key;
          
          setProperty(header, props.get(header));
        }
      }
    }
  }
  
  ServiceProperties(Dictionary<String, ?> props)
  {
    this(props == null ? 2 : props.size() + 2, props);
  }
  
  Object getProperty(String key)
  {
    return cloneValue(get(key));
  }
  
  synchronized String[] getPropertyKeys()
  {
    int size = size();
    
    String[] keynames = new String[size];
    
    Enumeration<String> keysEnum = keys();
    for (int i = 0; i < size; i++) {
      keynames[i] = ((String)keysEnum.nextElement());
    }
    return keynames;
  }
  
  synchronized Object setProperty(String key, Object value)
  {
    return set(key, cloneValue(value));
  }
  
  private static Object cloneValue(Object value)
  {
    if (value == null) {
      return null;
    }
    if ((value instanceof String)) {
      return value;
    }
    if ((value instanceof Number)) {
      return value;
    }
    if ((value instanceof Character)) {
      return value;
    }
    if ((value instanceof Boolean)) {
      return value;
    }
    Class<?> clazz = value.getClass();
    if (clazz.isArray())
    {
      Class<?> type = clazz.getComponentType();
      int len = Array.getLength(value);
      Object clonedArray = Array.newInstance(type, len);
      System.arraycopy(value, 0, clonedArray, 0, len);
      return clonedArray;
    }
    try
    {
      return clazz.getMethod("clone", null).invoke(value, null);
    }
    catch (Exception localException) {}catch (Error localError)
    {
      if ((value instanceof Vector)) {
        return ((Vector)value).clone();
      }
      if ((value instanceof Hashtable)) {
        return ((Hashtable)value).clone();
      }
    }
    return value;
  }
  
  public synchronized String toString()
  {
    String[] keys = getPropertyKeys();
    
    int size = keys.length;
    
    StringBuffer sb = new StringBuffer(20 * size);
    
    sb.append('{');
    
    int n = 0;
    for (int i = 0; i < size; i++)
    {
      String key = keys[i];
      if (!key.equals("objectClass"))
      {
        if (n > 0) {
          sb.append(", ");
        }
        sb.append(key);
        sb.append('=');
        Object value = get(key);
        if (value.getClass().isArray())
        {
          sb.append('[');
          int length = Array.getLength(value);
          for (int j = 0; j < length; j++)
          {
            if (j > 0) {
              sb.append(',');
            }
            sb.append(Array.get(value, j));
          }
          sb.append(']');
        }
        else
        {
          sb.append(value);
        }
        n++;
      }
    }
    sb.append('}');
    
    return sb.toString();
  }
}

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

import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;

public class ServiceReferenceImpl<S>
  implements ServiceReference<S>
{
  private final ServiceRegistrationImpl<S> registration;
  
  ServiceReferenceImpl(ServiceRegistrationImpl<S> registration)
  {
    this.registration = registration;
  }
  
  public Object getProperty(String key)
  {
    return registration.getProperty(key);
  }
  
  public String[] getPropertyKeys()
  {
    return registration.getPropertyKeys();
  }
  
  public Bundle getBundle()
  {
    return registration.getBundle();
  }
  
  public Bundle[] getUsingBundles()
  {
    return registration.getUsingBundles();
  }
  
  public boolean isAssignableTo(Bundle bundle, String className)
  {
    return registration.isAssignableTo(bundle, className);
  }
  
  public int compareTo(Object object)
  {
    ServiceRegistrationImpl<?> other = registration;
    
    int thisRanking = registration.getRanking();
    int otherRanking = other.getRanking();
    if (thisRanking != otherRanking)
    {
      if (thisRanking < otherRanking) {
        return -1;
      }
      return 1;
    }
    long thisId = registration.getId();
    long otherId = other.getId();
    if (thisId == otherId) {
      return 0;
    }
    if (thisId < otherId) {
      return 1;
    }
    return -1;
  }
  
  public int hashCode()
  {
    return registration.hashCode();
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof ServiceReferenceImpl)) {
      return false;
    }
    ServiceReferenceImpl<?> other = (ServiceReferenceImpl)obj;
    
    return registration == registration;
  }
  
  public String toString()
  {
    return registration.toString();
  }
  
  public ServiceRegistrationImpl<S> getRegistration()
  {
    return registration;
  }
  
  String[] getClasses()
  {
    return registration.getClasses();
  }
}

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

import java.util.ArrayList;
import java.util.Dictionary;
import java.util.List;
import java.util.Map;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;
import org.eclipse.osgi.framework.internal.core.Framework;
import org.eclipse.osgi.framework.internal.core.Msg;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;

public class ServiceRegistrationImpl<S>
  implements ServiceRegistration<S>, Comparable<ServiceRegistrationImpl<?>>
{
  private final Framework framework;
  private final ServiceRegistry registry;
  private final BundleContextImpl context;
  private final Bundle bundle;
  private final String[] clazzes;
  private final S service;
  private ServiceReferenceImpl<S> reference;
  private final List<BundleContextImpl> contextsUsing;
  private ServiceProperties properties;
  private final long serviceid;
  private int serviceranking;
  
  static
  {
    try {}catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
    }
  }
  
  private final Object registrationLock = new Object();
  private int state;
  private static final int REGISTERED = 0;
  private static final int UNREGISTERING = 1;
  private static final int UNREGISTERED = 2;
  
  ServiceRegistrationImpl(ServiceRegistry registry, BundleContextImpl context, String[] clazzes, S service)
  {
    this.registry = registry;
    this.context = context;
    bundle = context.getBundleImpl();
    framework = context.getFramework();
    this.clazzes = clazzes;
    this.service = service;
    serviceid = registry.getNextServiceId();
    contextsUsing = new ArrayList(10);
    synchronized (registrationLock)
    {
      state = 0;
      
      reference = new ServiceReferenceImpl(this);
    }
  }
  
  void register(Dictionary<String, ?> props)
  {
    synchronized (registry)
    {
      context.checkValid();
      synchronized (registrationLock)
      {
        ServiceReferenceImpl<S> ref = reference;
        properties = createProperties(props);
      }
      ServiceReferenceImpl<S> ref;
      if (Debug.DEBUG_SERVICES) {
        Debug.println("registerService[" + bundle + "](" + this + ")");
      }
      registry.addServiceRegistration(context, this);
    }
    ServiceReferenceImpl<S> ref;
    registry.publishServiceEvent(new ServiceEvent(1, ref));
  }
  
  public void setProperties(Dictionary<String, ?> props)
  {
    synchronized (registry)
    {
      synchronized (registrationLock)
      {
        if (state != 0) {
          throw new IllegalStateException(Msg.SERVICE_ALREADY_UNREGISTERED_EXCEPTION);
        }
        ServiceReferenceImpl<S> ref = reference;
        ServiceProperties previousProperties = properties;
        properties = createProperties(props);
      }
      ServiceProperties previousProperties;
      ServiceReferenceImpl<S> ref;
      registry.modifyServiceRegistration(context, this);
    }
    ServiceProperties previousProperties;
    ServiceReferenceImpl<S> ref;
    registry.publishServiceEvent(new ModifiedServiceEvent(ref, previousProperties));
  }
  
  public void unregister()
  {
    ServiceReferenceImpl<S> ref;
    synchronized (registry)
    {
      ServiceReferenceImpl<S> ref;
      synchronized (registrationLock)
      {
        if (state != 0) {
          throw new IllegalStateException(Msg.SERVICE_ALREADY_UNREGISTERED_EXCEPTION);
        }
        if (Debug.DEBUG_SERVICES) {
          Debug.println("unregisterService[" + bundle + "](" + this + ")");
        }
        registry.removeServiceRegistration(context, this);
        
        state = 1;
        ref = reference;
      }
    }
    ServiceReferenceImpl<S> ref;
    registry.publishServiceEvent(new ServiceEvent(4, ref));
    
    int size = 0;
    BundleContextImpl[] users = (BundleContextImpl[])null;
    synchronized (registrationLock)
    {
      state = 2;
      
      size = contextsUsing.size();
      if (size > 0)
      {
        if (Debug.DEBUG_SERVICES) {
          Debug.println("unregisterService: releasing users");
        }
        users = (BundleContextImpl[])contextsUsing.toArray(new BundleContextImpl[size]);
      }
    }
    for (int i = 0; i < size; i++) {
      releaseService(users[i]);
    }
    synchronized (registrationLock)
    {
      contextsUsing.clear();
      
      reference = null;
    }
  }
  
  public ServiceReference<S> getReference()
  {
    return getReferenceImpl();
  }
  
  ServiceReferenceImpl<S> getReferenceImpl()
  {
    synchronized (registrationLock)
    {
      if (reference == null) {
        throw new IllegalStateException(Msg.SERVICE_ALREADY_UNREGISTERED_EXCEPTION);
      }
      return reference;
    }
  }
  
  private ServiceProperties createProperties(Dictionary<String, ?> p)
  {
    assert (Thread.holdsLock(registrationLock));
    ServiceProperties props = new ServiceProperties(p);
    
    props.set("objectClass", clazzes, true);
    props.set("service.id", new Long(serviceid), true);
    props.setReadOnly();
    Object ranking = props.getProperty("service.ranking");
    
    serviceranking = ((ranking instanceof Integer) ? ((Integer)ranking).intValue() : 0);
    
    return props;
  }
  
  /* Error */
  public ServiceProperties getProperties()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 341	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:registrationLock	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 347	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:properties	Lorg/eclipse/osgi/internal/serviceregistry/ServiceProperties;
    //   11: aload_1
    //   12: monitorexit
    //   13: areturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #311	-> byte code offset #0
    //   Java source line #312	-> byte code offset #7
    //   Java source line #311	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	ServiceRegistrationImpl<S>
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  /* Error */
  Object getProperty(String key)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 341	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:registrationLock	Ljava/lang/Object;
    //   4: dup
    //   5: astore_2
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 347	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:properties	Lorg/eclipse/osgi/internal/serviceregistry/ServiceProperties;
    //   11: aload_1
    //   12: invokevirtual 380	org/eclipse/osgi/internal/serviceregistry/ServiceProperties:getProperty	(Ljava/lang/String;)Ljava/lang/Object;
    //   15: aload_2
    //   16: monitorexit
    //   17: areturn
    //   18: aload_2
    //   19: monitorexit
    //   20: athrow
    // Line number table:
    //   Java source line #329	-> byte code offset #0
    //   Java source line #330	-> byte code offset #7
    //   Java source line #329	-> byte code offset #18
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	21	0	this	ServiceRegistrationImpl<S>
    //   0	21	1	key	String
    //   5	14	2	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	17	18	finally
    //   18	20	18	finally
  }
  
  /* Error */
  String[] getPropertyKeys()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 341	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:registrationLock	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 347	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:properties	Lorg/eclipse/osgi/internal/serviceregistry/ServiceProperties;
    //   11: invokevirtual 378	org/eclipse/osgi/internal/serviceregistry/ServiceProperties:getPropertyKeys	()[Ljava/lang/String;
    //   14: aload_1
    //   15: monitorexit
    //   16: areturn
    //   17: aload_1
    //   18: monitorexit
    //   19: athrow
    // Line number table:
    //   Java source line #345	-> byte code offset #0
    //   Java source line #346	-> byte code offset #7
    //   Java source line #345	-> byte code offset #17
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	20	0	this	ServiceRegistrationImpl<S>
    //   5	13	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	16	17	finally
    //   17	19	17	finally
  }
  
  long getId()
  {
    return serviceid;
  }
  
  /* Error */
  int getRanking()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 341	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:registrationLock	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 337	org/eclipse/osgi/internal/serviceregistry/ServiceRegistrationImpl:serviceranking	I
    //   11: aload_1
    //   12: monitorexit
    //   13: ireturn
    //   14: aload_1
    //   15: monitorexit
    //   16: athrow
    // Line number table:
    //   Java source line #363	-> byte code offset #0
    //   Java source line #364	-> byte code offset #7
    //   Java source line #363	-> byte code offset #14
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	17	0	this	ServiceRegistrationImpl<S>
    //   5	10	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	13	14	finally
    //   14	16	14	finally
  }
  
  String[] getClasses()
  {
    return clazzes;
  }
  
  S getServiceObject()
  {
    return (S)service;
  }
  
  Bundle getBundle()
  {
    synchronized (registrationLock)
    {
      if (reference == null) {
        return null;
      }
      return bundle;
    }
  }
  
  public Bundle getRegisteringBundle()
  {
    return bundle;
  }
  
  Object getSafeService(BundleContextImpl user)
  {
    try
    {
      return getService(user);
    }
    catch (IllegalStateException localIllegalStateException) {}
    return null;
  }
  
  Object getService(BundleContextImpl user)
  {
    synchronized (registrationLock)
    {
      if (state == 2) {
        return null;
      }
    }
    if (Debug.DEBUG_SERVICES) {
      Debug.println("getService[" + user.getBundleImpl() + "](" + this + ")");
    }
    Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = user.getServicesInUseMap();
    if (servicesInUse == null) {
      user.checkValid();
    }
    for (;;)
    {
      boolean added = false;
      synchronized (servicesInUse)
      {
        user.checkValid();
        ServiceUse<?> use = (ServiceUse)servicesInUse.get(this);
        if (use == null)
        {
          use = new ServiceUse(user, this);
          added = true;
          synchronized (registrationLock)
          {
            if (state == 2) {
              return null;
            }
            servicesInUse.put(this, use);
            contextsUsing.add(user);
          }
        }
      }
      synchronized (use)
      {
        ServiceUse<?> use;
        synchronized (servicesInUse)
        {
          user.checkValid();
          if (servicesInUse.get(this) != use) {
            continue;
          }
        }
        Object serviceObject = use.getService();
        if ((serviceObject == null) && (added)) {
          synchronized (servicesInUse)
          {
            synchronized (registrationLock)
            {
              servicesInUse.remove(this);
              contextsUsing.remove(user);
            }
          }
        }
        return serviceObject;
      }
    }
  }
  
  boolean ungetService(BundleContextImpl user)
  {
    synchronized (registrationLock)
    {
      if (state == 2) {
        return false;
      }
    }
    if (Debug.DEBUG_SERVICES) {
      Debug.println("ungetService[" + user.getBundleImpl() + "](" + this + ")");
    }
    Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = user.getServicesInUseMap();
    if (servicesInUse == null) {
      return false;
    }
    synchronized (servicesInUse)
    {
      ServiceUse<?> use = (ServiceUse)servicesInUse.get(this);
      if (use == null) {
        return false;
      }
    }
    synchronized (use)
    {
      ServiceUse<?> use;
      if (use.ungetService()) {
        synchronized (servicesInUse)
        {
          synchronized (registrationLock)
          {
            servicesInUse.remove(this);
            contextsUsing.remove(user);
          }
        }
      }
    }
    return true;
  }
  
  void releaseService(BundleContextImpl user)
  {
    synchronized (registrationLock)
    {
      if (reference == null) {
        return;
      }
    }
    if (Debug.DEBUG_SERVICES) {
      Debug.println("releaseService[" + user.getBundleImpl() + "](" + this + ")");
    }
    Map<ServiceRegistrationImpl<?>, ServiceUse<?>> servicesInUse = user.getServicesInUseMap();
    if (servicesInUse == null) {
      return;
    }
    ServiceUse<?> use;
    synchronized (servicesInUse)
    {
      synchronized (registrationLock)
      {
        ServiceUse<?> use = (ServiceUse)servicesInUse.remove(this);
        if (use == null) {
          return;
        }
        contextsUsing.remove(user);
      }
    }
    synchronized (use)
    {
      ServiceUse<?> use;
      use.releaseService();
    }
  }
  
  Bundle[] getUsingBundles()
  {
    synchronized (registrationLock)
    {
      if (state == 2) {
        return null;
      }
      int size = contextsUsing.size();
      if (size == 0) {
        return null;
      }
      Bundle[] bundles = new Bundle[size];
      for (int i = 0; i < size; i++) {
        bundles[i] = ((BundleContextImpl)contextsUsing.get(i)).getBundleImpl();
      }
      return bundles;
    }
  }
  
  boolean isAssignableTo(Bundle client, String className)
  {
    return framework.isServiceAssignableTo(bundle, client, className, service.getClass());
  }
  
  public String toString()
  {
    int size = clazzes.length;
    StringBuffer sb = new StringBuffer(50 * size);
    
    sb.append('{');
    for (int i = 0; i < size; i++)
    {
      if (i > 0) {
        sb.append(", ");
      }
      sb.append(clazzes[i]);
    }
    sb.append("}=");
    sb.append(getProperties().toString());
    
    return sb.toString();
  }
  
  public int compareTo(ServiceRegistrationImpl<?> other)
  {
    int thisRanking = getRanking();
    int otherRanking = other.getRanking();
    if (thisRanking != otherRanking)
    {
      if (thisRanking < otherRanking) {
        return 1;
      }
      return -1;
    }
    long thisId = getId();
    long otherId = other.getId();
    if (thisId == otherId) {
      return 0;
    }
    if (thisId < otherId) {
      return -1;
    }
    return 1;
  }
}

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

import java.security.PrivilegedAction;
import org.osgi.framework.ServiceEvent;

class ServiceRegistry$1
  implements PrivilegedAction<Object>
{
  final ServiceRegistry this$0;
  
  ServiceRegistry$1(ServiceRegistry paramServiceRegistry, ServiceEvent paramServiceEvent) {}
  
  public Object run()
  {
    this$0.publishServiceEventPrivileged(val$event);
    return null;
  }
}

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

import java.util.Collection;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.service.ListenerHook;

class ServiceRegistry$10
  implements HookContext
{
  final ServiceRegistry this$0;
  
  ServiceRegistry$10(ServiceRegistry paramServiceRegistry, boolean paramBoolean, Collection paramCollection) {}
  
  public void call(Object hook, ServiceRegistration<?> hookRegistration)
    throws Exception
  {
    if ((hook instanceof ListenerHook)) {
      if (val$added) {
        ((ListenerHook)hook).added(val$listeners);
      } else {
        ((ListenerHook)hook).removed(val$listeners);
      }
    }
  }
  
  public String getHookClassName()
  {
    return ServiceRegistry.listenerHookName;
  }
  
  public String getHookMethodName()
  {
    return val$added ? "added" : "removed";
  }
}

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

import java.security.PrivilegedAction;

class ServiceRegistry$2
  implements PrivilegedAction<ClassLoader>
{
  private final Object val$serviceObject;
  
  ServiceRegistry$2(Object paramObject) {}
  
  public ClassLoader run()
  {
    return val$serviceObject.getClass().getClassLoader();
  }
}

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

import java.security.PrivilegedAction;
import java.util.Collection;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;

class ServiceRegistry$3
  implements PrivilegedAction<Object>
{
  final ServiceRegistry this$0;
  
  ServiceRegistry$3(ServiceRegistry paramServiceRegistry, BundleContextImpl paramBundleContextImpl, String paramString1, String paramString2, boolean paramBoolean, Collection paramCollection) {}
  
  public Object run()
  {
    this$0.notifyFindHooksPrivileged(val$context, val$clazz, val$filterstring, val$allservices, val$result);
    return null;
  }
}

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

import java.util.Collection;
import org.eclipse.osgi.framework.internal.core.BundleContextImpl;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.service.FindHook;

class ServiceRegistry$4
  implements HookContext
{
  final ServiceRegistry this$0;
  
  ServiceRegistry$4(ServiceRegistry paramServiceRegistry, BundleContextImpl paramBundleContextImpl, String paramString1, String paramString2, boolean paramBoolean, Collection paramCollection) {}
  
  public void call(Object hook, ServiceRegistration<?> hookRegistration)
    throws Exception
  {
    if ((hook instanceof FindHook)) {
      ((FindHook)hook).find(val$context, val$clazz, val$filterstring, val$allservices, val$result);
    }
  }
  
  public String getHookClassName()
  {
    return ServiceRegistry.findHookName;
  }
  
  public String getHookMethodName()
  {
    return "find";
  }
}

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

import java.util.Collection;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.service.EventHook;

class ServiceRegistry$5
  implements HookContext
{
  final ServiceRegistry this$0;
  
  ServiceRegistry$5(ServiceRegistry paramServiceRegistry, ServiceEvent paramServiceEvent, Collection paramCollection) {}
  
  public void call(Object hook, ServiceRegistration<?> hookRegistration)
    throws Exception
  {
    if ((hook instanceof EventHook)) {
      ((EventHook)hook).event(val$event, val$result);
    }
  }
  
  public String getHookClassName()
  {
    return ServiceRegistry.eventHookName;
  }
  
  public String getHookMethodName()
  {
    return "event";
  }
}

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

import java.util.Map;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.service.EventListenerHook;

class ServiceRegistry$6
  implements HookContext
{
  final ServiceRegistry this$0;
  
  ServiceRegistry$6(ServiceReg
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