org.eclipse.osgi_3.8.2.v20130124-134944

tring baseName, final Class<?> clazz)
  {
    if (System.getSecurityManager() == null)
    {
      load(baseName, clazz);
      return;
    }
    AccessController.doPrivileged(new PrivilegedAction()
    {
      public Object run()
      {
        NLS.load(NLS.this, clazz);
        return null;
      }
    });
  }
  
  private static String internalBind(String message, Object[] args, String argZero, String argOne)
  {
    if (message == null) {
      return "No message available.";
    }
    if ((args == null) || (args.length == 0)) {
      args = EMPTY_ARGS;
    }
    int length = message.length();
    
    int bufLen = length + args.length * 5;
    if (argZero != null) {
      bufLen += argZero.length() - 3;
    }
    if (argOne != null) {
      bufLen += argOne.length() - 3;
    }
    StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
    for (int i = 0; i < length; i++)
    {
      char c = message.charAt(i);
      switch (c)
      {
      case '{': 
        int index = message.indexOf('}', i);
        if (index == -1)
        {
          buffer.append(c);
        }
        else
        {
          i++;
          if (i >= length)
          {
            buffer.append(c);
          }
          else
          {
            int number = -1;
            try
            {
              number = Integer.parseInt(message.substring(i, index));
            }
            catch (NumberFormatException e)
            {
              throw ((IllegalArgumentException)new IllegalArgumentException().initCause(e));
            }
            if ((number == 0) && (argZero != null))
            {
              buffer.append(argZero);
            }
            else if ((number == 1) && (argOne != null))
            {
              buffer.append(argOne);
            }
            else
            {
              if ((number >= args.length) || (number < 0))
              {
                buffer.append("<missing argument>");
                i = index;
                continue;
              }
              buffer.append(args[number]);
            }
            i = index;
          }
        }
        break;
      case '\'': 
        int nextIndex = i + 1;
        if (nextIndex >= length)
        {
          buffer.append(c);
        }
        else
        {
          char next = message.charAt(nextIndex);
          if (next == '\'')
          {
            i++;
            buffer.append(c);
          }
          else
          {
            int index = message.indexOf('\'', nextIndex);
            if (index == -1)
            {
              buffer.append(c);
            }
            else
            {
              buffer.append(message.substring(nextIndex, index));
              i = index;
            }
          }
        }
        break;
      default: 
        buffer.append(c);
      }
    }
    return buffer.toString();
  }
  
  private static String[] buildVariants(String root)
  {
    if (nlSuffixes == null)
    {
      String nl = Locale.getDefault().toString();
      List<String> result = new ArrayList(4);
      for (;;)
      {
        result.add('_' + nl + ".properties");
        int lastSeparator = nl.lastIndexOf('_');
        if (lastSeparator == -1) {
          break;
        }
        nl = nl.substring(0, lastSeparator);
      }
      int lastSeparator;
      result.add(".properties");
      nlSuffixes = (String[])result.toArray(new String[result.size()]);
    }
    root = root.replace('.', '/');
    String[] variants = new String[nlSuffixes.length];
    for (int i = 0; i < variants.length; i++) {
      variants[i] = (root + nlSuffixes[i]);
    }
    return variants;
  }
  
  private static void computeMissingMessages(String bundleName, Class<?> clazz, Map<Object, Object> fieldMap, Field[] fieldArray, boolean isAccessible)
  {
    int numFields = fieldArray.length;
    for (int i = 0; i < numFields; i++)
    {
      Field field = fieldArray[i];
      if ((field.getModifiers() & 0x19) == 9) {
        if (fieldMap.get(field.getName()) != ASSIGNED) {
          try
          {
            String value = "NLS missing message: " + field.getName() + " in: " + bundleName;
            if (Debug.DEBUG_MESSAGE_BUNDLES) {
              System.out.println(value);
            }
            log(2, value, null);
            if (!isAccessible) {
              field.setAccessible(true);
            }
            field.set(null, value);
          }
          catch (Exception e)
          {
            log(4, "Error setting the missing message value for: " + field.getName(), e);
          }
        }
      }
    }
  }
  
  /* Error */
  static void load(String bundleName, Class<?> clazz)
  {
    // Byte code:
    //   0: invokestatic 354	java/lang/System:currentTimeMillis	()J
    //   3: lstore_2
    //   4: aload_1
    //   5: invokevirtual 329	java/lang/Class:getDeclaredFields	()[Ljava/lang/reflect/Field;
    //   8: astore 4
    //   10: aload_1
    //   11: invokevirtual 328	java/lang/Class:getClassLoader	()Ljava/lang/ClassLoader;
    //   14: astore 5
    //   16: aload_1
    //   17: invokevirtual 327	java/lang/Class:getModifiers	()I
    //   20: iconst_1
    //   21: iand
    //   22: ifeq +7 -> 29
    //   25: iconst_1
    //   26: goto +4 -> 30
    //   29: iconst_0
    //   30: istore 6
    //   32: aload 4
    //   34: arraylength
    //   35: istore 7
    //   37: new 189	java/util/HashMap
    //   40: dup
    //   41: iload 7
    //   43: iconst_2
    //   44: imul
    //   45: invokespecial 362	java/util/HashMap:<init>	(I)V
    //   48: astore 8
    //   50: iconst_0
    //   51: istore 9
    //   53: goto +27 -> 80
    //   56: aload 8
    //   58: aload 4
    //   60: iload 9
    //   62: aaload
    //   63: invokevirtual 358	java/lang/reflect/Field:getName	()Ljava/lang/String;
    //   66: aload 4
    //   68: iload 9
    //   70: aaload
    //   71: invokeinterface 379 3 0
    //   76: pop
    //   77: iinc 9 1
    //   80: iload 9
    //   82: iload 7
    //   84: if_icmplt -28 -> 56
    //   87: aload_0
    //   88: invokestatic 369	org/eclipse/osgi/util/NLS:buildVariants	(Ljava/lang/String;)[Ljava/lang/String;
    //   91: astore 9
    //   93: iconst_0
    //   94: istore 10
    //   96: goto +145 -> 241
    //   99: aload 5
    //   101: ifnonnull +14 -> 115
    //   104: aload 9
    //   106: iload 10
    //   108: aaload
    //   109: invokestatic 331	java/lang/ClassLoader:getSystemResourceAsStream	(Ljava/lang/String;)Ljava/io/InputStream;
    //   112: goto +13 -> 125
    //   115: aload 5
    //   117: aload 9
    //   119: iload 10
    //   121: aaload
    //   122: invokevirtual 330	java/lang/ClassLoader:getResourceAsStream	(Ljava/lang/String;)Ljava/io/InputStream;
    //   125: astore 11
    //   127: aload 11
    //   129: ifnonnull +6 -> 135
    //   132: goto +106 -> 238
    //   135: new 199	org/eclipse/osgi/util/NLS$MessagesProperties
    //   138: dup
    //   139: aload 8
    //   141: aload_0
    //   142: iload 6
    //   144: invokespecial 374	org/eclipse/osgi/util/NLS$MessagesProperties:<init>	(Ljava/util/Map;Ljava/lang/String;Z)V
    //   147: astore 12
    //   149: aload 12
    //   151: aload 11
    //   153: invokevirtual 373	org/eclipse/osgi/util/NLS$MessagesProperties:load	(Ljava/io/InputStream;)V
    //   156: goto +68 -> 224
    //   159: astore 12
    //   161: iconst_4
    //   162: new 184	java/lang/StringBuffer
    //   165: dup
    //   166: ldc_w 165
    //   169: invokespecial 349	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   172: aload 9
    //   174: iload 10
    //   176: aaload
    //   177: invokevirtual 353	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   180: invokevirtual 348	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   183: aload 12
    //   185: invokestatic 368	org/eclipse/osgi/util/NLS:log	(ILjava/lang/String;Ljava/lang/Exception;)V
    //   188: aload 11
    //   190: ifnull +48 -> 238
    //   193: aload 11
    //   195: invokevirtual 325	java/io/InputStream:close	()V
    //   198: goto +40 -> 238
    //   201: pop
    //   202: goto +36 -> 238
    //   205: astore 13
    //   207: aload 11
    //   209: ifnull +12 -> 221
    //   212: aload 11
    //   214: invokevirtual 325	java/io/InputStream:close	()V
    //   217: goto +4 -> 221
    //   220: pop
    //   221: aload 13
    //   223: athrow
    //   224: aload 11
    //   226: ifnull +12 -> 238
    //   229: aload 11
    //   231: invokevirtual 325	java/io/InputStream:close	()V
    //   234: goto +4 -> 238
    //   237: pop
    //   238: iinc 10 1
    //   241: iload 10
    //   243: aload 9
    //   245: arraylength
    //   246: if_icmplt -147 -> 99
    //   249: aload_0
    //   250: aload_1
    //   251: aload 8
    //   253: aload 4
    //   255: iload 6
    //   257: invokestatic 370	org/eclipse/osgi/util/NLS:computeMissingMessages	(Ljava/lang/String;Ljava/lang/Class;Ljava/util/Map;[Ljava/lang/reflect/Field;Z)V
    //   260: getstatic 319	org/eclipse/osgi/framework/debug/Debug:DEBUG_MESSAGE_BUNDLES	Z
    //   263: ifeq +46 -> 309
    //   266: getstatic 318	java/lang/System:out	Ljava/io/PrintStream;
    //   269: new 184	java/lang/StringBuffer
    //   272: dup
    //   273: ldc_w 168
    //   276: invokespecial 349	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   279: aload_0
    //   280: invokevirtual 353	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   283: ldc_w 163
    //   286: invokevirtual 353	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   289: invokestatic 354	java/lang/System:currentTimeMillis	()J
    //   292: lload_2
    //   293: lsub
    //   294: invokevirtual 351	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   297: ldc_w 170
    //   300: invokevirtual 353	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   303: invokevirtual 348	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   306: invokevirtual 326	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   309: return
    // Line number table:
    //   Java source line #301	-> byte code offset #0
    //   Java source line #302	-> byte code offset #4
    //   Java source line #303	-> byte code offset #10
    //   Java source line #305	-> byte code offset #16
    //   Java source line #308	-> byte code offset #32
    //   Java source line #309	-> byte code offset #37
    //   Java source line #310	-> byte code offset #50
    //   Java source line #311	-> byte code offset #56
    //   Java source line #310	-> byte code offset #77
    //   Java source line #316	-> byte code offset #87
    //   Java source line #317	-> byte code offset #93
    //   Java source line #319	-> byte code offset #99
    //   Java source line #320	-> byte code offset #127
    //   Java source line #321	-> byte code offset #132
    //   Java source line #323	-> byte code offset #135
    //   Java source line #324	-> byte code offset #149
    //   Java source line #325	-> byte code offset #156
    //   Java source line #326	-> byte code offset #161
    //   Java source line #328	-> byte code offset #188
    //   Java source line #330	-> byte code offset #193
    //   Java source line #331	-> byte code offset #198
    //   Java source line #327	-> byte code offset #205
    //   Java source line #328	-> byte code offset #207
    //   Java source line #330	-> byte code offset #212
    //   Java source line #331	-> byte code offset #217
    //   Java source line #334	-> byte code offset #221
    //   Java source line #328	-> byte code offset #224
    //   Java source line #330	-> byte code offset #229
    //   Java source line #331	-> byte code offset #234
    //   Java source line #317	-> byte code offset #238
    //   Java source line #336	-> byte code offset #249
    //   Java source line #337	-> byte code offset #260
    //   Java source line #338	-> byte code offset #266
    //   Java source line #339	-> byte code offset #309
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	310	0	bundleName	String
    //   0	310	1	clazz	Class<?>
    //   3	290	2	start	long
    //   8	246	4	fieldArray	Field[]
    //   14	102	5	loader	ClassLoader
    //   30	226	6	isAccessible	boolean
    //   35	48	7	len	int
    //   48	204	8	fields	Map<Object, Object>
    //   51	30	9	i	int
    //   91	153	9	variants	String[]
    //   94	148	10	i	int
    //   125	105	11	input	java.io.InputStream
    //   147	3	12	properties	MessagesProperties
    //   159	25	12	e	java.io.IOException
    //   205	17	13	localObject	Object
    //   201	1	15	localIOException1	java.io.IOException
    //   220	1	16	localIOException2	java.io.IOException
    //   237	1	17	localIOException3	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   135	156	159	java/io/IOException
    //   193	198	201	java/io/IOException
    //   135	188	205	finally
    //   212	217	220	java/io/IOException
    //   229	234	237	java/io/IOException
  }
  
  static void log(int severity, String message, Exception e)
  {
    if ((severity == 2) && (ignoreWarnings)) {
      return;
    }
    if (frameworkLog != null)
    {
      frameworkLog.log(new FrameworkLogEntry("org.eclipse.osgi", severity, 1, message, 0, e, null)); return;
    }
    String statusMsg;
    String statusMsg;
    switch (severity)
    {
    case 4: 
      statusMsg = "Error: ";
      break;
    case 2: 
    case 3: 
    default: 
      statusMsg = "Warning: ";
    }
    if (message != null) {
      statusMsg = statusMsg + message;
    }
    if (e != null) {
      statusMsg = statusMsg + ": " + e.getMessage();
    }
    System.err.println(statusMsg);
    if (e != null) {
      e.printStackTrace();
    }
  }
  
  private static class MessagesProperties
    extends Properties
  {
    private static final int MOD_EXPECTED = 9;
    private static final int MOD_MASK = 25;
    private static final long serialVersionUID = 1L;
    private final String bundleName;
    private final Map<Object, Object> fields;
    private final boolean isAccessible;
    
    public MessagesProperties(Map<Object, Object> fieldMap, String bundleName, boolean isAccessible)
    {
      fields = fieldMap;
      this.bundleName = bundleName;
      this.isAccessible = isAccessible;
    }
    
    public synchronized Object put(Object key, Object value)
    {
      Object fieldObject = fields.put(key, NLS.ASSIGNED);
      if (fieldObject == NLS.ASSIGNED) {
        return null;
      }
      if (fieldObject == null)
      {
        String msg = "NLS unused message: " + key + " in: " + bundleName;
        if (Debug.DEBUG_MESSAGE_BUNDLES) {
          System.out.println(msg);
        }
        NLS.log(2, msg, null);
        return null;
      }
      Field field = (Field)fieldObject;
      if ((field.getModifiers() & 0x19) != 9) {
        return null;
      }
      try
      {
        if (!isAccessible) {
          field.setAccessible(true);
        }
        field.set(null, new String(((String)value).toCharArray()));
      }
      catch (Exception e)
      {
        NLS.log(4, "Exception setting field value.", e);
      }
      return null;
    }
  }
}

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

import java.util.Locale;

public class TextProcessor
{
  private static final String DOT = ".";
  private static final String COLON = ":";
  private static final String FILE_SEP_FSLASH = "/";
  private static final String FILE_SEP_BSLASH = "\\";
  private static final String delimiterString = ".:/\\";
  private static final char LRM = '?';
  private static final char LRE = '?';
  private static final char PDF = '?';
  private static boolean IS_PROCESSING_NEEDED = false;
  private static final int INDEX_NOT_SET = 999999999;
  
  static
  {
    Locale locale = Locale.getDefault();
    String lang = locale.getLanguage();
    if (("iw".equals(lang)) || ("he".equals(lang)) || ("ar".equals(lang)) || ("fa".equals(lang)) || ("ur".equals(lang)))
    {
      String osName = System.getProperty("os.name").toLowerCase();
      if ((osName.startsWith("windows")) || (osName.startsWith("linux")) || (osName.startsWith("mac"))) {
        IS_PROCESSING_NEEDED = true;
      }
    }
  }
  
  public static String process(String text)
  {
    if ((!IS_PROCESSING_NEEDED) || (text == null) || (text.length() <= 1)) {
      return text;
    }
    return process(text, getDefaultDelimiters());
  }
  
  public static String process(String str, String delimiter)
  {
    if ((!IS_PROCESSING_NEEDED) || (str == null) || (str.length() <= 1)) {
      return str;
    }
    if ((str.charAt(0) == '?') && (str.charAt(str.length() - 1) == '?')) {
      return str;
    }
    boolean isStringBidi = false;
    
    boolean isLastRTL = false;
    
    int delimIndex = 999999999;
    
    delimiter = delimiter == null ? getDefaultDelimiters() : delimiter;
    
    StringBuffer target = new StringBuffer();
    target.append('?');
    
    int i = 0;
    for (int n = str.length(); i < n; i++)
    {
      char ch = str.charAt(i);
      if (delimiter.indexOf(ch) != -1)
      {
        if (isLastRTL) {
          delimIndex = target.length();
        }
      }
      else if (Character.isDigit(ch))
      {
        if (delimIndex != 999999999)
        {
          target.insert(delimIndex, '?');
          delimIndex = 999999999;
          isLastRTL = false;
        }
      }
      else if (Character.isLetter(ch)) {
        if (isRTL(ch))
        {
          isStringBidi = true;
          if (delimIndex != 999999999)
          {
            target.insert(delimIndex, '?');
            delimIndex = 999999999;
          }
          isLastRTL = true;
        }
        else
        {
          delimIndex = 999999999;
          isLastRTL = false;
        }
      }
      target.append(ch);
    }
    if ((isStringBidi) || (!Character.isLetter(str.charAt(0))) || (isNeutral(str.charAt(str.length() - 1))))
    {
      target.append('?');
      return target.toString();
    }
    return str;
  }
  
  public static String deprocess(String str)
  {
    if ((!IS_PROCESSING_NEEDED) || (str == null) || (str.length() <= 1)) {
      return str;
    }
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < str.length(); i++)
    {
      char c = str.charAt(i);
      switch (c)
      {
      case '?': 
        break;
      case '?': 
        break;
      case '?': 
        break;
      default: 
        buf.append(c);
      }
    }
    return buf.toString();
  }
  
  public static String getDefaultDelimiters()
  {
    return ".:/\\";
  }
  
  private static boolean isRTL(char c)
  {
    return ((c >= '?') && (c <= '?')) || ((c >= 64285) && (c <= 65276));
  }
  
  private static boolean isNeutral(char c)
  {
    return (!Character.isDigit(c)) && (!Character.isLetter(c));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.util.TextProcessor
 * 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 AdaptPermission$1
  implements PrivilegedAction<Object>
{
  final AdaptPermission this$0;
  
  AdaptPermission$1(AdaptPermission paramAdaptPermission, 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.AdaptPermission.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 AdaptPermission
  extends BasicPermission
{
  private static final long serialVersionUID = 1L;
  public static final String ADAPT = "adapt";
  private static final int ACTION_ADAPT = 1;
  private static final int ACTION_ALL = 1;
  static final int ACTION_NONE = 0;
  transient int action_mask;
  private volatile String actions = null;
  final transient Bundle bundle;
  transient Filter filter;
  private volatile transient Map<String, Object> properties;
  
  public AdaptPermission(String filter, String actions)
  {
    this(parseFilter(filter), parseActions(actions));
  }
  
  public AdaptPermission(String adaptClass, Bundle adaptableBundle, String actions)
  {
    super(adaptClass);
    setTransients(null, parseActions(actions));
    bundle = adaptableBundle;
    if (adaptClass == null) {
      throw new NullPointerException("adaptClass must not be null");
    }
    if (adaptableBundle == null) {
      throw new NullPointerException("adaptableBundle must not be null");
    }
  }
  
  AdaptPermission(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 & 0x1) != mask)) {
      throw new IllegalArgumentException("invalid action string");
    }
    action_mask = 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 >= 4) && ((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)] == 'p') || (a[(i - 1)] == 'P')) && (
        (a[i] == 't') || (a[i] == 'T')))
      {
        int matchlen = 5;
        mask |= 0x1;
      }
      else
      {
        throw new IllegalArgumentException("invalid actions: " + 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 actions: " + actions);
    }
    return mask;
  }
  
  private static Filter parseFilter(String filterString)
  {
    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 AdaptPermission)) {
      return false;
    }
    AdaptPermission requested = (AdaptPermission)p;
    if (bundle != null) {
      return false;
    }
    if (filter != null) {
      return false;
    }
    return implies0(requested, 0);
  }
  
  boolean implies0(AdaptPermission requested, int effective)
  {
    effective |= action_mask;
    int desired = action_mask;
    if ((effective & desired) != desired) {
      return false;
    }
    Filter f = filter;
    if (f == null) {
      return true;
    }
    return f.matches(requested.getProperties());
  }
  
  public String getActions()
  {
    String result = actions;
    if (result == null) {
      actions = (result = "adapt");
    }
    return result;
  }
  
  public PermissionCollection newPermissionCollection()
  {
    return new AdaptPermissionCollection();
  }
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof AdaptPermission)) {
      return false;
    }
    AdaptPermission cp = (AdaptPermission)obj;
    
    return (action_mask == action_mask) && (getName().equals(cp.getName())) && ((bundle == bundle) || ((bundle != null) && (bundle.equals(bundle))));
  }
  
  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;
    }
    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')) && 
       
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 85 86 87

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