org.eclipse.osgi_3.7.2.v20120110-1415

ashCode();
    if (bundle != null) {
      h = 31 * h + bundle.hashCode();
    }
    return h;
  }
  
  private synchronized void writeObject(ObjectOutputStream s)
    throws IOException
  {
    if (bundle != null) {
      throw new NotSerializableException("cannot serialize");
    }
    if (actions == null) {
      getActions();
    }
    s.defaultWriteObject();
  }
  
  private synchronized void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException
  {
    s.defaultReadObject();
    setTransients(parseFilter(getName()), parseActions(actions));
  }
  
  private Map<String, Object> getProperties()
  {
    Map<String, Object> result = properties;
    if (result != null) {
      return result;
    }
    final Map<String, Object> map = new HashMap(5);
    map.put("adaptClass", getName());
    if (bundle != null) {
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          map.put("id", new Long(bundle.getBundleId()));
          map.put("location", bundle.getLocation());
          String name = bundle.getSymbolicName();
          if (name != null) {
            map.put("name", name);
          }
          SignerProperty signer = new SignerProperty(bundle);
          if (signer.isBundleSigned()) {
            map.put("signer", signer);
          }
          return null;
        }
      });
    }
    return properties = map;
  }
}

/* Location:
 * Qualified Name:     org.osgi.framework.AdaptPermission
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectInputStream.GetField;
import java.io.ObjectOutputStream;
import java.io.ObjectOutputStream.PutField;
import java.io.ObjectStreamField;
import java.security.Permission;
import java.security.PermissionCollection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

final class AdaptPermissionCollection
  extends PermissionCollection
{
  static final long serialVersionUID = -3350758995234427603L;
  private Map<String, AdaptPermission> permissions;
  private boolean all_allowed;
  
  public AdaptPermissionCollection()
  {
    permissions = new HashMap();
    all_allowed = false;
  }
  
  public void add(Permission permission)
  {
    if (!(permission instanceof AdaptPermission)) {
      throw new IllegalArgumentException("invalid permission: " + 
        permission);
    }
    if (isReadOnly()) {
      throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
    }
    AdaptPermission ap = (AdaptPermission)permission;
    if (bundle != null) {
      throw new IllegalArgumentException("cannot add to collection: " + 
        ap);
    }
    String name = ap.getName();
    synchronized (this)
    {
      Map<String, AdaptPermission> pc = permissions;
      AdaptPermission existing = (AdaptPermission)pc.get(name);
      if (existing != null)
      {
        int oldMask = action_mask;
        int newMask = action_mask;
        if (oldMask != newMask) {
          pc.put(name, new AdaptPermission(filter, oldMask | 
            newMask));
        }
      }
      else
      {
        pc.put(name, ap);
      }
      if ((!all_allowed) && 
        (name.equals("*"))) {
        all_allowed = true;
      }
    }
  }
  
  public boolean implies(Permission permission)
  {
    if (!(permission instanceof AdaptPermission)) {
      return false;
    }
    AdaptPermission requested = (AdaptPermission)permission;
    if (filter != null) {
      return false;
    }
    int effective = 0;
    Collection<AdaptPermission> perms;
    synchronized (this)
    {
      pc = permissions;
      if (all_allowed)
      {
        AdaptPermission ap = (AdaptPermission)pc.get("*");
        if (ap != null)
        {
          effective |= action_mask;
          int desired = action_mask;
          if ((effective & desired) == desired) {
            return true;
          }
        }
      }
      perms = pc.values();
    }
    Collection<AdaptPermission> perms;
    for (Map<String, AdaptPermission> pc = perms.iterator(); pc.hasNext();)
    {
      AdaptPermission perm = (AdaptPermission)pc.next();
      if (perm.implies0(requested, effective)) {
        return true;
      }
    }
    return false;
  }
  
  public synchronized Enumeration<Permission> elements()
  {
    List<Permission> all = new ArrayList(permissions.values());
    return Collections.enumeration(all);
  }
  
  private static final ObjectStreamField[] serialPersistentFields = {
    new ObjectStreamField("permissions", HashMap.class), 
    new ObjectStreamField("all_allowed", Boolean.TYPE) };
  
  private synchronized void writeObject(ObjectOutputStream out)
    throws IOException
  {
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("permissions", permissions);
    pfields.put("all_allowed", all_allowed);
    out.writeFields();
  }
  
  private synchronized void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
  {
    ObjectInputStream.GetField gfields = in.readFields();
    permissions = ((HashMap)gfields.get(
      "permissions", null));
    all_allowed = gfields.get("all_allowed", false);
  }
}

/* Location:
 * Qualified Name:     org.osgi.framework.AdaptPermissionCollection
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.security.PrivilegedAction;
import java.util.Map;

class AdminPermission$1
  implements PrivilegedAction<Object>
{
  final AdminPermission this$0;
  
  AdminPermission$1(AdminPermission paramAdminPermission, Map paramMap) {}
  
  public Object run()
  {
    val$map.put("id", new Long(this$0.bundle.getBundleId()));
    val$map.put("location", this$0.bundle.getLocation());
    String name = this$0.bundle.getSymbolicName();
    if (name != null) {
      val$map.put("name", name);
    }
    SignerProperty signer = new SignerProperty(this$0.bundle);
    if (signer.isBundleSigned()) {
      val$map.put("signer", signer);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.osgi.framework.AdminPermission.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.io.IOException;
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.security.AccessController;
import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;
import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Map;

public final class AdminPermission
  extends BasicPermission
{
  static final long serialVersionUID = 307051004521261705L;
  public static final String CLASS = "class";
  public static final String EXECUTE = "execute";
  public static final String EXTENSIONLIFECYCLE = "extensionLifecycle";
  public static final String LIFECYCLE = "lifecycle";
  public static final String LISTENER = "listener";
  public static final String METADATA = "metadata";
  public static final String RESOLVE = "resolve";
  public static final String RESOURCE = "resource";
  public static final String STARTLEVEL = "startlevel";
  public static final String CONTEXT = "context";
  public static final String WEAVE = "weave";
  private static final int ACTION_CLASS = 1;
  private static final int ACTION_EXECUTE = 2;
  private static final int ACTION_LIFECYCLE = 4;
  private static final int ACTION_LISTENER = 8;
  private static final int ACTION_METADATA = 16;
  private static final int ACTION_RESOLVE = 64;
  private static final int ACTION_RESOURCE = 128;
  private static final int ACTION_STARTLEVEL = 256;
  private static final int ACTION_EXTENSIONLIFECYCLE = 512;
  private static final int ACTION_CONTEXT = 1024;
  private static final int ACTION_WEAVE = 2048;
  private static final int ACTION_ALL = 4063;
  static final int ACTION_NONE = 0;
  private volatile String actions = null;
  transient int action_mask;
  transient Filter filter;
  final transient Bundle bundle;
  private volatile transient Map<String, Object> properties;
  private static final ThreadLocal<Bundle> recurse = new ThreadLocal();
  
  public AdminPermission()
  {
    this(null, 4063);
  }
  
  public AdminPermission(String filter, String actions)
  {
    this(parseFilter(filter), parseActions(actions));
  }
  
  public AdminPermission(Bundle bundle, String actions)
  {
    super(createName(bundle));
    setTransients(null, parseActions(actions));
    this.bundle = bundle;
  }
  
  private static String createName(Bundle bundle)
  {
    if (bundle == null) {
      throw new IllegalArgumentException("bundle must not be null");
    }
    StringBuffer sb = new StringBuffer("(id=");
    sb.append(bundle.getBundleId());
    sb.append(")");
    return sb.toString();
  }
  
  AdminPermission(Filter filter, int mask)
  {
    super(filter == null ? "*" : filter.toString());
    setTransients(filter, mask);
    bundle = null;
  }
  
  private void setTransients(Filter filter, int mask)
  {
    this.filter = filter;
    if ((mask == 0) || ((mask & 0xFDF) != mask)) {
      throw new IllegalArgumentException("invalid action string");
    }
    action_mask = mask;
  }
  
  private static int parseActions(String actions)
  {
    if ((actions == null) || (actions.equals("*"))) {
      return 4063;
    }
    boolean seencomma = false;
    
    int mask = 0;
    
    char[] a = actions.toCharArray();
    
    int i = a.length - 1;
    if (i < 0) {}
    while (i != -1)
    {
      return mask;
      char c;
      while ((i != -1) && (
        ((c = a[i]) == ' ') || (c == '\r') || (c == '\n') || 
        (c == '\f') || (c == '\t')))
      {
        char c;
        i--;
      }
      if ((i >= 4) && ((a[(i - 4)] == 'c') || (a[(i - 4)] == 'C')) && 
        ((a[(i - 3)] == 'l') || (a[(i - 3)] == 'L')) && 
        ((a[(i - 2)] == 'a') || (a[(i - 2)] == 'A')) && 
        ((a[(i - 1)] == 's') || (a[(i - 1)] == 'S')) && (
        (a[i] == 's') || (a[i] == 'S')))
      {
        int matchlen = 5;
        mask |= 0x41;
      }
      else if ((i >= 6) && ((a[(i - 6)] == 'e') || (a[(i - 6)] == 'E')) && 
        ((a[(i - 5)] == 'x') || (a[(i - 5)] == 'X')) && 
        ((a[(i - 4)] == 'e') || (a[(i - 4)] == 'E')) && 
        ((a[(i - 3)] == 'c') || (a[(i - 3)] == 'C')) && 
        ((a[(i - 2)] == 'u') || (a[(i - 2)] == 'U')) && 
        ((a[(i - 1)] == 't') || (a[(i - 1)] == 'T')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 7;
        mask |= 0x42;
      }
      else if ((i >= 17) && ((a[(i - 17)] == 'e') || (a[(i - 17)] == 'E')) && 
        ((a[(i - 16)] == 'x') || (a[(i - 16)] == 'X')) && 
        ((a[(i - 15)] == 't') || (a[(i - 15)] == 'T')) && 
        ((a[(i - 14)] == 'e') || (a[(i - 14)] == 'E')) && 
        ((a[(i - 13)] == 'n') || (a[(i - 13)] == 'N')) && 
        ((a[(i - 12)] == 's') || (a[(i - 12)] == 'S')) && 
        ((a[(i - 11)] == 'i') || (a[(i - 11)] == 'I')) && 
        ((a[(i - 10)] == 'o') || (a[(i - 10)] == 'O')) && 
        ((a[(i - 9)] == 'n') || (a[(i - 9)] == 'N')) && 
        ((a[(i - 8)] == 'l') || (a[(i - 8)] == 'L')) && 
        ((a[(i - 7)] == 'i') || (a[(i - 7)] == 'I')) && 
        ((a[(i - 6)] == 'f') || (a[(i - 6)] == 'F')) && 
        ((a[(i - 5)] == 'e') || (a[(i - 5)] == 'E')) && 
        ((a[(i - 4)] == 'c') || (a[(i - 4)] == 'C')) && 
        ((a[(i - 3)] == 'y') || (a[(i - 3)] == 'Y')) && 
        ((a[(i - 2)] == 'c') || (a[(i - 2)] == 'C')) && 
        ((a[(i - 1)] == 'l') || (a[(i - 1)] == 'L')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 18;
        mask |= 0x200;
      }
      else if ((i >= 8) && ((a[(i - 8)] == 'l') || (a[(i - 8)] == 'L')) && 
        ((a[(i - 7)] == 'i') || (a[(i - 7)] == 'I')) && 
        ((a[(i - 6)] == 'f') || (a[(i - 6)] == 'F')) && 
        ((a[(i - 5)] == 'e') || (a[(i - 5)] == 'E')) && 
        ((a[(i - 4)] == 'c') || (a[(i - 4)] == 'C')) && 
        ((a[(i - 3)] == 'y') || (a[(i - 3)] == 'Y')) && 
        ((a[(i - 2)] == 'c') || (a[(i - 2)] == 'C')) && 
        ((a[(i - 1)] == 'l') || (a[(i - 1)] == 'L')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 9;
        mask |= 0x4;
      }
      else if ((i >= 7) && ((a[(i - 7)] == 'l') || (a[(i - 7)] == 'L')) && 
        ((a[(i - 6)] == 'i') || (a[(i - 6)] == 'I')) && 
        ((a[(i - 5)] == 's') || (a[(i - 5)] == 'S')) && 
        ((a[(i - 4)] == 't') || (a[(i - 4)] == 'T')) && 
        ((a[(i - 3)] == 'e') || (a[(i - 3)] == 'E')) && 
        ((a[(i - 2)] == 'n') || (a[(i - 2)] == 'N')) && 
        ((a[(i - 1)] == 'e') || (a[(i - 1)] == 'E')) && (
        (a[i] == 'r') || (a[i] == 'R')))
      {
        int matchlen = 8;
        mask |= 0x8;
      }
      else if ((i >= 7) && 
        ((a[(i - 7)] == 'm') || (a[(i - 7)] == 'M')) && 
        ((a[(i - 6)] == 'e') || (a[(i - 6)] == 'E')) && 
        ((a[(i - 5)] == 't') || (a[(i - 5)] == 'T')) && 
        ((a[(i - 4)] == 'a') || (a[(i - 4)] == 'A')) && 
        ((a[(i - 3)] == 'd') || (a[(i - 3)] == 'D')) && 
        ((a[(i - 2)] == 'a') || (a[(i - 2)] == 'A')) && 
        ((a[(i - 1)] == 't') || (a[(i - 1)] == 'T')) && (
        (a[i] == 'a') || (a[i] == 'A')))
      {
        int matchlen = 8;
        mask |= 0x10;
      }
      else if ((i >= 6) && 
        ((a[(i - 6)] == 'r') || (a[(i - 6)] == 'R')) && 
        ((a[(i - 5)] == 'e') || (a[(i - 5)] == 'E')) && 
        ((a[(i - 4)] == 's') || (a[(i - 4)] == 'S')) && 
        ((a[(i - 3)] == 'o') || (a[(i - 3)] == 'O')) && 
        ((a[(i - 2)] == 'l') || (a[(i - 2)] == 'L')) && 
        ((a[(i - 1)] == 'v') || (a[(i - 1)] == 'V')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 7;
        mask |= 0x40;
      }
      else if ((i >= 7) && 
        ((a[(i - 7)] == 'r') || (a[(i - 7)] == 'R')) && 
        ((a[(i - 6)] == 'e') || (a[(i - 6)] == 'E')) && 
        ((a[(i - 5)] == 's') || (a[(i - 5)] == 'S')) && 
        ((a[(i - 4)] == 'o') || (a[(i - 4)] == 'O')) && 
        ((a[(i - 3)] == 'u') || (a[(i - 3)] == 'U')) && 
        ((a[(i - 2)] == 'r') || (a[(i - 2)] == 'R')) && 
        ((a[(i - 1)] == 'c') || (a[(i - 1)] == 'C')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 8;
        mask |= 0xC0;
      }
      else if ((i >= 9) && 
        ((a[(i - 9)] == 's') || (a[(i - 9)] == 'S')) && 
        ((a[(i - 8)] == 't') || (a[(i - 8)] == 'T')) && 
        ((a[(i - 7)] == 'a') || (a[(i - 7)] == 'A')) && 
        ((a[(i - 6)] == 'r') || (a[(i - 6)] == 'R')) && 
        ((a[(i - 5)] == 't') || (a[(i - 5)] == 'T')) && 
        ((a[(i - 4)] == 'l') || (a[(i - 4)] == 'L')) && 
        ((a[(i - 3)] == 'e') || (a[(i - 3)] == 'E')) && 
        ((a[(i - 2)] == 'v') || (a[(i - 2)] == 'V')) && 
        ((a[(i - 1)] == 'e') || (a[(i - 1)] == 'E')) && (
        (a[i] == 'l') || (a[i] == 'L')))
      {
        int matchlen = 10;
        mask |= 0x100;
      }
      else if ((i >= 6) && 
        ((a[(i - 6)] == 'c') || (a[(i - 6)] == 'C')) && 
        ((a[(i - 5)] == 'o') || (a[(i - 5)] == 'O')) && 
        ((a[(i - 4)] == 'n') || (a[(i - 4)] == 'N')) && 
        ((a[(i - 3)] == 't') || (a[(i - 3)] == 'T')) && 
        ((a[(i - 2)] == 'e') || (a[(i - 2)] == 'E')) && 
        ((a[(i - 1)] == 'x') || (a[(i - 1)] == 'X')) && (
        (a[i] == 't') || (a[i] == 'T')))
      {
        int matchlen = 7;
        mask |= 0x400;
      }
      else if ((i >= 4) && 
        ((a[(i - 4)] == 'w') || (a[(i - 4)] == 'W')) && 
        ((a[(i - 3)] == 'e') || (a[(i - 3)] == 'E')) && 
        ((a[(i - 2)] == 'a') || (a[(i - 2)] == 'A')) && 
        ((a[(i - 1)] == 'v') || (a[(i - 1)] == 'V')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 5;
        mask |= 0x800;
      }
      else if ((i >= 0) && 
        (a[i] == '*'))
      {
        int matchlen = 1;
        mask |= 0xFDF;
      }
      else
      {
        throw new IllegalArgumentException(
          "invalid permission: " + 
          actions);
      }
      int matchlen;
      seencomma = false;
      while ((i >= matchlen) && (!seencomma))
      {
        switch (a[(i - matchlen)])
        {
        case ',': 
          seencomma = true;
        case '\t': 
        case '\n': 
        case '\f': 
        case '\r': 
        case ' ': 
          break;
        default: 
          throw new IllegalArgumentException(
            "invalid permission: " + actions);
        }
        i--;
      }
      i -= matchlen;
    }
    if (seencomma) {
      throw new IllegalArgumentException("invalid permission: " + 
        actions);
    }
    return mask;
  }
  
  private static Filter parseFilter(String filterString)
  {
    if (filterString == null) {
      return null;
    }
    filterString = filterString.trim();
    if (filterString.equals("*")) {
      return null;
    }
    try
    {
      return FrameworkUtil.createFilter(filterString);
    }
    catch (InvalidSyntaxException e)
    {
      IllegalArgumentException iae = new IllegalArgumentException(
        "invalid filter");
      iae.initCause(e);
      throw iae;
    }
  }
  
  public boolean implies(Permission p)
  {
    if (!(p instanceof AdminPermission)) {
      return false;
    }
    AdminPermission requested = (AdminPermission)p;
    if (bundle != null) {
      return false;
    }
    if (filter != null) {
      return false;
    }
    return implies0(requested, 0);
  }
  
  boolean implies0(AdminPermission requested, int effective)
  {
    effective |= action_mask;
    int desired = action_mask;
    if ((effective & desired) != desired) {
      return false;
    }
    Filter f = filter;
    if (f == null) {
      return true;
    }
    if (bundle == null) {
      return false;
    }
    Map<String, Object> requestedProperties = requested
      .getProperties();
    if (requestedProperties == null) {
      return true;
    }
    return f.matches(requestedProperties);
  }
  
  public String getActions()
  {
    String result = actions;
    if (result == null)
    {
      StringBuffer sb = new StringBuffer();
      
      int mask = action_mask;
      if ((mask & 0x1) == 1)
      {
        sb.append("class");
        sb.append(',');
      }
      if ((mask & 0x2) == 2)
      {
        sb.append("execute");
        sb.append(',');
      }
      if ((mask & 0x200) == 512)
      {
        sb.append("extensionLifecycle");
        sb.append(',');
      }
      if ((mask & 0x4) == 4)
      {
        sb.append("lifecycle");
        sb.append(',');
      }
      if ((mask & 0x8) == 8)
      {
        sb.append("listener");
        sb.append(',');
      }
      if ((mask & 0x10) == 16)
      {
        sb.append("metadata");
        sb.append(',');
      }
      if ((mask & 0x40) == 64)
      {
        sb.append("resolve");
        sb.append(',');
      }
      if ((mask & 0x80) == 128)
      {
        sb.append("resource");
        sb.append(',');
      }
      if ((mask & 0x100) == 256)
      {
        sb.append("startlevel");
        sb.append(',');
      }
      if ((mask & 0x400) == 1024)
      {
        sb.append("context");
        sb.append(',');
      }
      if ((mask & 0x800) == 2048)
      {
        sb.append("weave");
        sb.append(',');
      }
      if (sb.length() > 0) {
        sb.setLength(sb.length() - 1);
      }
      actions = (result = sb.toString());
    }
    return result;
  }
  
  public PermissionCollection newPermissionCollection()
  {
    return new AdminPermissionCollection();
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof AdminPermission)) {
      return false;
    }
    AdminPermission ap = (AdminPermission)obj;
    
    return (action_mask == action_mask) && ((bundle == bundle) || ((bundle != null) && (bundle.equals(bundle)))) && (filter == null ? filter == null : filter.equals(filter));
  }
  
  public int hashCode()
  {
    int h = 527 + getName().hashCode();
    h = 31 * h + getActions().hashCode();
    if (bundle != null) {
      h = 31 * h + bundle.hashCode();
    }
    return h;
  }
  
  private synchronized void writeObject(ObjectOutputStream s)
    throws IOException
  {
    if (bundle != null) {
      throw new NotSerializableException("cannot serialize");
    }
    if (actions == null) {
      getActions();
    }
    s.defaultWriteObject();
  }
  
  private synchronized void readObject(ObjectInputStream s)
    throws IOException, ClassNotFoundException
  {
    s.defaultReadObject();
    setTransients(parseFilter(getName()), parseActions(actions));
  }
  
  private Map<String, Object> getProperties()
  {
    Map<String, Object> result = properties;
    if (result != null) {
      return result;
    }
    Object mark = recurse.get();
    if (mark == bundle) {
      return null;
    }
    recurse.set(bundle);
    try
    {
      final Map<String, Object> map = new HashMap(
        4);
      AccessController.doPrivileged(new PrivilegedAction()
      {
        public Object run()
        {
          map.put("id", new Long(bundle.getBundleId()));
          map.put("location", bundle.getLocation());
          String name = bundle.getSymbolicName();
          if (name != null) {
            map.put("name", name);
          }
          SignerProperty signer = new SignerProperty(bundle);
          if (signer.isBundleSigned()) {
            map.put("signer", signer);
          }
          return null;
        }
      });
      return properties = map;
    }
    finally
    {
      recurse.set(null);
    }
  }
}

/* Location:
 * Qualified Name:     org.osgi.framework.AdminPermission
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectInputStream.GetField;
import java.io.ObjectOutputStream;
import java.io.ObjectOutputStream.PutField;
import java.io.ObjectStreamField;
import java.security.Permission;
import java.security.PermissionCollection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

final class AdminPermissionCollection
  extends PermissionCollection
{
  private static final long serialVersionUID = 3906372644575328048L;
  private transient Map<String, AdminPermission> permissions;
  private boolean all_allowed;
  
  public AdminPermissionCollection()
  {
    permissions = new HashMap();
  }
  
  public void add(Permission permission)
  {
    if (!(permission instanceof AdminPermission)) {
      throw new IllegalArgumentException("invalid permission: " + 
        permission);
    }
    if (isReadOnly()) {
      throw new SecurityException("attempt to add a Permission to a readonly PermissionCollection");
    }
    AdminPermission ap = (AdminPermission)permission;
    if (bundle != null) {
      throw new IllegalArgumentException("cannot add to collection: " + 
        ap);
    }
    String name = ap.getName();
    synchronized (this)
    {
      Map<String, AdminPermission> pc = permissions;
      AdminPermission existing = (AdminPermission)pc.get(name);
      if (existing != null)
      {
        int oldMask = action_mask;
        int newMask = action_mask;
        if (oldMask != newMask) {
          pc.put(name, new AdminPermission(filter, oldMask | 
            newMask));
        }
      }
      else
      {
        pc.put(name, ap);
      }
      if ((!all_allowed) && 
        (name.equals("*"))) {
        all_allowed = true;
      }
    }
  }
  
  public boolean implies(Permission permission)
  {
    if (!(permission instanceof AdminPermission)) {
      return false;
    }
    AdminPermission requested = (AdminPermission)permission;
    if (filter != null) {
      return false;
    }
    int effective = 0;
    Collection<AdminPermission> perms;
    synchronized (this)
    {
      pc = permissions;
      if (all_allowed)
      {
        AdminPermission ap = (AdminPermission)pc.get("*");
        if (ap != null)
        {
          effective |= action_mask;
          int desired = action_mask;
          if ((effective & desired) == desired) {
            return true;
          }
        }
      }
      perms = pc.values();
    }
    Collection<AdminPermission> perms;
    for (Map<String, AdminPermission> pc = perms.iterator(); pc.hasNext();)
    {
      AdminPermission perm = (AdminPermission)pc.next();
      if (perm.implies0(requested, effective)) {
        return true;
      }
    }
    return false;
  }
  
  public synchronized Enumeration<Permission> elements()
  {
    List<Permission> all = new ArrayList(permissions.values());
    return Collections.enumeration(all);
  }
  
  private static final ObjectStreamField[] serialPersistentFields = {
    new ObjectStreamField("permissions", Hashtable.class), 
    new ObjectStreamField("all_allowed", Boolean.TYPE) };
  
  private synchronized void writeObject(ObjectOutputStream out)
    throws IOException
  {
    Hashtable<String, AdminPermission> hashtable = new Hashtable(
      permissions);
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("permissions", hashtable);
    pfields.put("all_allowed", all_allowed);
    out.writeFields();
  }
  
  private synchronized void readObject(ObjectInputStream in)
    throws IOException, ClassNotFoundException
  {
    ObjectInputStream.GetField gfields = in.readFields();
    Hashtable<String, AdminPermission> hashtable = (Hashtable)gfields
      .get("permissions", null);
    permissions = new HashMap(hashtable);
    all_allowed = gfields.get("all_allowed", false);
  }
}

/* Location:
 * Qualified Name:     org.osgi.framework.AdminPermissionCollection
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

public abstract interface AllServiceListener
  extends ServiceListener
{}

/* Location:
 * Qualified Name:     org.osgi.framework.AllServiceListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.security.cert.X509Certificate;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;

public abstract interface Bundle
  extends Comparable<Bundle>
{
  public static final int UNINSTALLED = 1;
  public static final int INSTALLED = 2;
  public static final int RESOLVED = 4;
  public static final int STARTING = 8;
  public static final int STOPPING = 16;
  public static final int ACTIVE = 32;
  public static final int START_TRANSIENT = 1;
  public static final int START_ACTIVATION_POLICY = 2;
  public static final int STOP_TRANSIENT = 1;
  public static final int SIGNERS_ALL = 1;
  public static final int SIGNERS_TRUSTED = 2;
  
  public abstract int getState();
  
  public abstract void start(int paramInt)
    throws BundleException;
  
  public abstract void start()
    throws BundleException;
  
  public abstract void stop(int paramInt)
    throws BundleException;
  
  public abstract void stop()
    throws BundleException;
  
  public abstract void update(InputStream paramInputStream)
    throws BundleException;
  
  public abstract void update()
    throws BundleException;
  
  public abstract void uninstall()
    throws BundleException;
  
  public abstract Dictionary<String, String> getHeaders();
  
  public abstract long getBundleId();
  
  public abstract String getLocation();
  
  public abstract ServiceReference<?>[] getRegisteredServices();
  
  public abstract ServiceReference<?>[] getServicesInUse();
  
  public abstract boolean hasPermission(Object paramObject);
  
  public abstract URL getResource(String paramString);
  
  public abstract Dictionary<String, String> getHeaders(String paramString);
  
  public abstract String getSymbolicName();
  
  public abstract Class<?> loadClass(String paramString)
    throws ClassNotFoundException;
  
  public abstract Enumeration<URL> getResources(String paramString)
    throws IOException;
  
  public abstract Enumeration<String> getEntryPaths(String paramString);
  
  public abstract URL getEntry(String paramString);
  
  public abstract long getLastModified();
  
  public abstract Enumeration<URL> findEntries(String paramString1, String paramString2, boolean paramBoolean);
  
  public abstract BundleContext getBundleContext();
  
  public abstract Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int paramInt);
  
  public abstract Version getVersion();
  
  public abstract <A> A adapt(Class<A> paramClass);
  
  public abstract File getDataFile(String paramString);
}

/* Location:
 * Qualified Name:     org.osgi.framework.Bundle
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

public abstract interface BundleActivator
{
  public abstract void start(BundleContext paramBundleContext)
    throws Exception;
  
  public abstract void stop(BundleContext paramBundleContext)
    throws Exception;
}

/* Location:
 * Qualified Name:     org.osgi.framework.BundleActivator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.io.File;
import java.io.InputStream;
import java.util.Collection;
import java.util.Dictionary;

public abstract interface BundleContext
  extends BundleReference
{
  public abstract String getProperty(String paramString);
  
  public abstract Bundle getBundle();
  
  public abstract Bundle installBundle(String paramString, InputStream paramInputStream)
    throws BundleException;
  
  public abstract Bundle installBundle(String paramString)
    throws BundleException;
  
  public abstract Bundle getBundle(long paramLong);
  
  public abstract Bundle[] getBundles();
  
  public abstract void addServiceListener(ServiceListener paramServiceListener, String paramString)
    throws InvalidSyntaxException;
  
  public abstract void addServiceListener(ServiceListener paramServiceListener);
  
  public abstract void removeServiceListener(ServiceListener paramServiceListener);
  
  public abstract void addBundleListener(BundleListener paramBundleListener);
  
  public abstract void removeBundleListener(BundleListener paramBundleListener);
  
  public abstract void addFrameworkListener(FrameworkListener paramFrameworkListener);
  
  public abstract void removeFrameworkListener(FrameworkListener paramFrameworkListener);
  
  public abstract ServiceRegistration<?> registerService(String[] paramArrayOfString, Object paramObject, Dictionary<String, ?> paramDictionary);
  
  public abstract ServiceRegistration<?> registerService(String paramString, Object paramObject, Dictionary<String, ?> paramDictionary);
  
  public abstract <S> ServiceRegistration<S> registerService(Class<S> paramClass, S paramS, Dictionary<String, ?> paramDictionary);
  
  public abstract ServiceReference<?>[] getServiceReferences(String paramString1, String paramString2)
    throws InvalidSyntaxException;
  
  public abstract ServiceReference<?>[] getAllServiceReferences(String paramString1, String paramString2)
    throws InvalidSyntaxException;
  
  public abstract ServiceReference<?> getServiceReference(String paramString);
  
  public abstract <S> ServiceReference<S> getServiceReference(Class<S> paramClass);
  
  public abstract <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> paramClass, String paramString)
    throws InvalidSyntaxException;
  
  public abstract <S> S getService(ServiceReference<S> paramServiceReference);
  
  public abstract boolean ungetService(ServiceReference<?> paramServiceReference);
  
  public abstract File getDataFile(String paramString);
  
  public abstract Filter createFilter(String paramString)
    throws InvalidSyntaxException;
  
  public abstract Bundle getBundle(String paramString);
}

/* Location:
 * Qualified Name:     org.osgi.framework.BundleContext
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.util.EventObject;

public class BundleEvent
  extends EventObject
{
  static final long serialVersionUID = 4080640865971756012L;
  private final Bundle bundle;
  private final int type;
  public static final int INSTALLED = 1;
  public static final int STARTED = 2;
  public static final int STOPPED = 4;
  public static final int UPDATED = 8;
  public static final int UNINSTALLED = 16;
  public static final int RESOLVED = 32;
  public static final int UNRESOLVED = 64;
  public static final int STARTING = 128;
  public static final int STOPPING = 256;
  public static final int LAZY_ACTIVATION = 512;
  private final Bundle origin;
  
  public BundleEvent(int type, Bundle bundle, Bundle origin)
  {
    super(bundle);
    if (origin == null) {
      throw new IllegalArgumentException("null origin");
    }
    this.bundle = bundle;
    this.type = type;
    this.origin = origin;
  }
  
  public BundleEvent(int type, Bundle bundle)
  {
    super(bundle);
    this.bundle = bundle;
    this.type = type;
    origin = bundle;
  }
  
  public Bundle getBundle()
  {
    return bundle;
  }
  
  public int getType()
  {
    return type;
  }
  
  public Bundle getOrigin()
  {
    return origin;
  }
}

/* Location:
 * Qualified Name:     org.osgi.framework.BundleEvent
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

public class BundleException
  extends Exception
{
  static final long serialVersionUID = 3571095144220455665L;
  private final int type;
  public static final int UNSPECIFIED = 0;
  public static final int UNSUPPORTED_OPERATION = 1;
  public static final int INVALID_OPERATION = 2;
  public static final int MANIFEST_ERROR = 3;
  public static final int RESOLVE_ERROR = 4;
  public static final int ACTIVATOR_ERROR = 5;
  public static final int SECURITY_ERROR = 6;
  public static final int STATECHANGE_ERROR = 7;
  public static final int NATIVECODE_ERROR = 8;
  public static final int DUPLICATE_BUNDLE_ERROR = 9;
  public static final int START_TRANSIENT_ERROR = 10;
  public static final int READ_ERROR = 11;
  public static final int REJECTED_BY_HOOK = 12;
  
  public BundleException(String msg, Throwable cause)
  {
    this(msg, 0, cause);
  }
  
  public BundleException(String msg)
  {
    this(msg, 0);
  }
  
  public BundleException(String msg, int type, Throwable cause)
  {
    super(msg, cause);
    this.type = type;
  }
  
  public BundleException(String msg, int type)
  {
    super(msg);
    this.type = type;
  }
  
  public Throwable getNestedException()
  {
    return getCause();
  }
  
  public Throwable getCause()
  {
    return super.getCause();
  }
  
  public Throwable initCause(Throwable cause)
  {
    return super.initCause(cause);
  }
  
  public int getType()
  {
    return type;
  }
}

/* Location:
 * Qualified Name:     org.osgi.framework.BundleException
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.util.EventListener;

public abstract interface BundleListener
  extends EventListener
{
  public abstract void bundleChanged(BundleEvent paramBundleEvent);
}

/* Location:
 * Qualified Name:     org.osgi.framework.BundleListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.osgi.framework;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;

public final class BundlePermission
  extends BasicPermission
{
  private static final long serialVersionUID = 3257846601685873716L;
  public static final String PROVIDE = "provide";
  public static final String REQUIRE = "require";
  public static final String HOST = "host";
  public static final String FRAGMENT = "fragment";
  private static final int ACTION_PROVIDE = 1;
  private static final int ACTION_REQUIRE = 2;
  private static final int ACTION_HOST = 4;
  private static final int ACTION_FRAGMENT = 8;
  private static final int ACTION_ALL = 15;
  static final int ACTION_NONE = 0;
  private transient int action_mask;
  private volatile String actions = null;
  
  public BundlePermission(String symbolicName, String actions)
  {
    this(symbolicName, parseActions(actions));
  }
  
  BundlePermission(String symbolicName, int mask)
  {
    super(symbolicName);
    setTransients(mask);
  }
  
  private synchronized void setTransients(int mask)
  {
    if ((mask == 0) || ((mask & 0xF) != mask)) {
      throw new IllegalArgumentException("invalid action string");
    }
    action_mask = mask;
  }
  
  synchronized int getActionsMask()
  {
    return action_mask;
  }
  
  private static int parseActions(String actions)
  {
    boolean seencomma = false;
    
    int mask = 0;
    if (actions == null) {
      return mask;
    }
    char[] a = actions.toCharArray();
    
    int i = a.length - 1;
    if (i < 0) {}
    while (i != -1)
    {
      return mask;
      char c;
      while ((i != -1) && (
        ((c = a[i]) == ' ') || (c == '\r') || (c == '\n') || 
        (c == '\f') || (c == '\t')))
      {
        char c;
        i--;
      }
      if ((i >= 6) && ((a[(i - 6)] == 'p') || (a[(i - 6)] == 'P')) && 
        ((a[(i - 5)] == 'r') || (a[(i - 5)] == 'R')) && 
        ((a[(i - 4)] == 'o') || (a[(i - 4)] == 'O')) && 
        ((a[(i - 3)] == 'v') || (a[(i - 3)] == 'V')) && 
        ((a[(i - 2)] == 'i') || (a[(i - 2)] == 'I')) && 
        ((a[(i - 1)] == 'd') || (a[(i - 1)] == 'D')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 7;
        mask |= 0x3;
      }
      else if ((i >= 6) && ((a[(i - 6)] == 'r') || (a[(i - 6)] == 'R')) && 
        ((a[(i - 5)] == 'e') || (a[(i - 5)] == 'E')) && 
        ((a[(i - 4)] == 'q') || (a[(i - 4)] == 'Q')) && 
        ((a[(i - 3)] == 'u') || (a[(i - 3)] == 'U')) && 
        ((a[(i - 2)] == 'i') || (a[(i - 2)] == 'I')) && 
        ((a[(i - 1)] == 'r') || (a[(i - 1)] == 'R')) && (
        (a[i] == 'e') || (a[i] == 'E')))
      {
        int matchlen = 7;
        mask |= 0x2;
      }
      else if ((i >= 3) && ((a[(i - 3)] == 'h') || (a[(i - 3)] == 'H')) && 
        ((a[(i - 2)] == 'o') || (a[(i - 2)] == 'O')) && 
        ((a[(i - 1)] == 's') || (a[(i - 1)] == 'S')) && (
        (a[i] == 't') || (a[i] == 'T')))
      {
        int matchlen = 4;
        mask |= 0x4;
      }
      else if ((i >= 7) && ((a[(i - 7)] == 'f') || (a[(i - 7)] == 'F')) && 
        ((a[(i - 6)] == 'r') || (a[(i - 6)] == 'R')) && 
        ((a[(i - 5)] == 'a') || (a[(i - 5)] == 'A')) && 
        ((a[(i - 4)] == 'g') || (a[(i - 4)] == 'G')) && 
        ((a[(i - 3)] == 'm') || (a[(i - 3)] == 'M')) && 
        ((a[(i - 2)] == 'e') || (a[(i - 2)] == 'E')) && 
        ((a[(i - 1)] == 'n') || (a[(i - 1)] == 'N')) && (
        (a[i] == 't') || (a[i] == 'T')))
      {
        int matchlen = 8;
        mask |= 0x8;
      }
      else
      {
        throw new IllegalArgumentException(
          "invalid permission: " + actions);
      }
      int matchlen;
      seencomma = false;
      while ((i >= matchlen) && (!seencomma))
      {
        switch (a[(i - matchlen)])
        {
        case ',': 
          seencomma = true;
        case '\t': 
        case '\n': 
        case '\f': 
        case '\r': 
        case ' ': 
          break;
        default: 
          throw new IllegalArgumentException(
            "invalid permission: " + actions);
        }
        i--;
      }
      i -= matchlen;
    }
    if (seencomma) {
      throw new IllegalArgumentException("inva
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