org.eclipse.ecf.identity_3.1.100.v20110531-2218

16:43:07.671 INFO  jd.cli.Main - Decompiling org.eclipse.ecf.identity_3.1.100.v20110531-2218.jar
package org.eclipse.ecf.core.identity;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.ecf.internal.core.identity.Activator;

public abstract class BaseID
  implements ID
{
  private static final long serialVersionUID = -6242599410460002514L;
  protected Namespace namespace;
  
  protected BaseID() {}
  
  protected BaseID(Namespace namespace)
  {
    Assert.isNotNull(namespace, "namespace cannot be null");
    this.namespace = namespace;
  }
  
  public int compareTo(Object o)
  {
    Assert.isTrue((o != null) && ((o instanceof BaseID)), 
      "incompatible types for compare");
    return namespace.getCompareToForObject(this, (BaseID)o);
  }
  
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if ((o == null) || (!(o instanceof BaseID))) {
      return false;
    }
    return namespace.testIDEquals(this, (BaseID)o);
  }
  
  public String getName()
  {
    return namespace.getNameForID(this);
  }
  
  public Namespace getNamespace()
  {
    return namespace;
  }
  
  public int hashCode()
  {
    return namespace.getHashCodeForID(this);
  }
  
  public String toExternalForm()
  {
    return namespace.toExternalForm(this);
  }
  
  protected abstract int namespaceCompareTo(BaseID paramBaseID);
  
  protected abstract boolean namespaceEquals(BaseID paramBaseID);
  
  protected abstract String namespaceGetName();
  
  protected abstract int namespaceHashCode();
  
  protected String namespaceToExternalForm()
  {
    return 
      namespace.getScheme() + ":" + namespaceGetName();
  }
  
  public Object getAdapter(Class clazz)
  {
    IAdapterManager adapterManager = Activator.getDefault()
      .getAdapterManager();
    if (adapterManager == null) {
      return null;
    }
    return adapterManager.loadAdapter(this, clazz.getName());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.BaseID
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

public class GUID$GUIDNamespace
  extends Namespace
{
  private static final long serialVersionUID = -8546568877571886386L;
  
  public GUID$GUIDNamespace()
  {
    super(tmp4_1.getName(), "GUID Namespace");
  }
  
  public ID createInstance(Object[] args)
    throws IDCreateException
  {
    try
    {
      String init = getInitStringFromExternalForm(args);
      if (init != null) {
        return new GUID(this, init);
      }
      if ((args == null) || (args.length <= 0)) {
        return new GUID(this);
      }
      if ((args.length == 1) && ((args[0] instanceof Integer))) {
        return new GUID(this, ((Integer)args[0]).intValue());
      }
      if ((args.length == 1) && ((args[0] instanceof String))) {
        return new GUID(this, (String)args[0]);
      }
      return new GUID(this);
    }
    catch (Exception e)
    {
      throw new IDCreateException(getName() + " createInstance()", e);
    }
  }
  
  public String getScheme()
  {
    Class tmp3_0 = GUID.class$0;
    if (tmp3_0 == null)
    {
      tmp3_0;
      try
      {
        tmpTernaryOp = (GUID.class$0 = Class.forName("org.eclipse.ecf.core.identity.GUID"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    return tmp3_0.getName();
  }
  
  public Class[][] getSupportedParameterTypes()
  {
    Class[] tmp17_14 = new Class[1]; Class tmp22_19 = GUID.class$1;
    if (tmp22_19 == null)
    {
      tmp22_19;
      try
      {
        tmpTernaryOp = (GUID.class$1 = Class.forName("java.lang.Integer"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    tmp17_14[0] = tmp22_19;{ new Class[0] }[1] = tmp17_14;return tmp11_4;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.GUID.GUIDNamespace
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.security.SecureRandom;
import org.eclipse.ecf.core.util.Base64;

public class GUID
  extends StringID
{
  private static final long serialVersionUID = 3545794369039972407L;
  
  public static class GUIDNamespace
    extends Namespace
  {
    private static final long serialVersionUID = -8546568877571886386L;
    
    public GUIDNamespace()
    {
      super("GUID Namespace");
    }
    
    public ID createInstance(Object[] args)
      throws IDCreateException
    {
      try
      {
        String init = getInitStringFromExternalForm(args);
        if (init != null) {
          return new GUID(this, init);
        }
        if ((args == null) || (args.length <= 0)) {
          return new GUID(this);
        }
        if ((args.length == 1) && ((args[0] instanceof Integer))) {
          return new GUID(this, ((Integer)args[0]).intValue());
        }
        if ((args.length == 1) && ((args[0] instanceof String))) {
          return new GUID(this, (String)args[0]);
        }
        return new GUID(this);
      }
      catch (Exception e)
      {
        throw new IDCreateException(getName() + " createInstance()", e);
      }
    }
    
    public String getScheme()
    {
      Class tmp3_0 = GUID.class$0;
      if (tmp3_0 == null)
      {
        tmp3_0;
        try
        {
          tmpTernaryOp = (GUID.class$0 = Class.forName("org.eclipse.ecf.core.identity.GUID"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      return tmp3_0.getName();
    }
    
    public Class[][] getSupportedParameterTypes()
    {
      Class[] tmp17_14 = new Class[1]; Class tmp22_19 = GUID.class$1;
      if (tmp22_19 == null)
      {
        tmp22_19;
        try
        {
          tmpTernaryOp = (GUID.class$1 = Class.forName("java.lang.Integer"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      tmp17_14[0] = tmp22_19;{ new Class[0] }[1] = tmp17_14;return tmp11_4;
    }
  }
  
  public static final String SR_DEFAULT_ALGO = null;
  public static final String SR_DEFAULT_PROVIDER = null;
  public static final int DEFAULT_BYTE_LENGTH = 20;
  protected static transient SecureRandom random;
  static Class class$0;
  static Class class$1;
  
  protected GUID(Namespace n, String algo, String provider, int byteLength)
    throws IDCreateException
  {
    super(n, "");
    try
    {
      getRandom(algo, provider);
    }
    catch (Exception e)
    {
      throw new IDCreateException(
        "GUID creation failure: " + e.getMessage());
    }
    if (byteLength <= 0) {
      byteLength = 1;
    }
    byte[] newBytes = new byte[byteLength];
    
    random.nextBytes(newBytes);
    
    value = Base64.encode(newBytes);
  }
  
  protected GUID(Namespace n, String value)
  {
    super(n, value);
  }
  
  protected GUID(Namespace n, int byteLength)
    throws IDCreateException
  {
    this(n, SR_DEFAULT_ALGO, SR_DEFAULT_PROVIDER, byteLength);
  }
  
  protected GUID(Namespace n)
    throws IDCreateException
  {
    this(n, 20);
  }
  
  protected static synchronized SecureRandom getRandom(String algo, String provider)
    throws Exception
  {
    if (random == null) {
      initializeRandom(algo, provider);
    }
    return random;
  }
  
  protected static synchronized void initializeRandom(String algo, String provider)
    throws Exception
  {
    if (provider == null)
    {
      if (algo == null) {
        try
        {
          random = SecureRandom.getInstance("IBMSECURERANDOM");
        }
        catch (Exception e)
        {
          random = SecureRandom.getInstance("SHA1PRNG");
        }
      } else {
        random = SecureRandom.getInstance(algo);
      }
    }
    else {
      random = SecureRandom.getInstance(algo, provider);
    }
  }
  
  public String toString()
  {
    StringBuffer sb = new StringBuffer("GUID[");
    sb.append(value).append("]");
    return sb.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.GUID
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.io.Serializable;
import java.security.Principal;
import org.eclipse.core.runtime.IAdaptable;

public abstract interface ID
  extends Serializable, Comparable, Principal, IAdaptable
{
  public abstract boolean equals(Object paramObject);
  
  public abstract int hashCode();
  
  public abstract String getName();
  
  public abstract Namespace getNamespace();
  
  public abstract String toExternalForm();
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.ID
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.ecf.core.util.ECFRuntimeException;

public class IDCreateException
  extends ECFRuntimeException
{
  private static final long serialVersionUID = 3258416140119323960L;
  
  public IDCreateException() {}
  
  public IDCreateException(IStatus status)
  {
    super(status);
  }
  
  public IDCreateException(String message)
  {
    super(message);
  }
  
  public IDCreateException(Throwable cause)
  {
    super(cause);
  }
  
  public IDCreateException(String message, Throwable cause)
  {
    super(message, cause);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.IDCreateException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.security.AccessController;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import org.eclipse.core.runtime.Status;
import org.eclipse.ecf.internal.core.identity.Activator;

public class IDFactory
  implements IIDFactory
{
  public static final String SECURITY_PROPERTY = IDFactory.class.getName() + 
    ".security";
  private static final int IDENTITY_CREATION_ERRORCODE = 2001;
  private static Hashtable namespaces = new Hashtable();
  private static boolean securityEnabled = false;
  protected static IIDFactory instance = null;
  
  static
  {
    instance = new IDFactory();
    addNamespace0(new StringID.StringIDNamespace());
    addNamespace0(new GUID.GUIDNamespace());
    addNamespace0(new LongID.LongNamespace());
  }
  
  private static synchronized void initialize()
  {
    if (!initialized)
    {
      Activator a = Activator.getDefault();
      if (a != null) {
        a.setupNamespaceExtensionPoint();
      }
      initialized = true;
    }
  }
  
  private static boolean initialized = false;
  
  public static synchronized IIDFactory getDefault()
  {
    return instance;
  }
  
  public Namespace addNamespace(Namespace namespace)
    throws SecurityException
  {
    if (namespace == null) {
      return null;
    }
    checkPermission(new NamespacePermission(namespace.toString(), 
      "add"));
    initialize();
    return addNamespace0(namespace);
  }
  
  public static final Namespace addNamespace0(Namespace namespace)
  {
    if (namespace == null) {
      return null;
    }
    return (Namespace)namespaces.put(namespace.getName(), namespace);
  }
  
  protected static final void checkPermission(NamespacePermission namespacepermission)
    throws SecurityException
  {
    if (securityEnabled) {
      AccessController.checkPermission(namespacepermission);
    }
  }
  
  public boolean containsNamespace(Namespace namespace)
    throws SecurityException
  {
    if (namespace == null) {
      return false;
    }
    checkPermission(new NamespacePermission(namespace.toString(), 
      "contains"));
    initialize();
    return containsNamespace0(namespace);
  }
  
  public List getNamespaces()
  {
    initialize();
    return new ArrayList(namespaces.values());
  }
  
  public static final boolean containsNamespace0(Namespace n)
  {
    if (n == null) {
      return false;
    }
    return namespaces.containsKey(n.getName());
  }
  
  public Namespace getNamespace(Namespace namespace)
    throws SecurityException
  {
    if (namespace == null) {
      return null;
    }
    checkPermission(new NamespacePermission(namespace.toString(), 
      "get"));
    initialize();
    return getNamespace0(namespace);
  }
  
  public Namespace getNamespaceByName(String name)
    throws SecurityException
  {
    initialize();
    return getNamespace0(name);
  }
  
  protected static final Namespace getNamespace0(Namespace n)
  {
    if (n == null) {
      return null;
    }
    return (Namespace)namespaces.get(n.getName());
  }
  
  protected static final Namespace getNamespace0(String name)
  {
    if (name == null) {
      return null;
    }
    return (Namespace)namespaces.get(name);
  }
  
  public ID createGUID()
    throws IDCreateException
  {
    return createGUID(20);
  }
  
  public ID createGUID(int length)
    throws IDCreateException
  {
    return createID(new GUID.GUIDNamespace(), new Integer[] { new Integer(
      length) });
  }
  
  protected static void logAndThrow(String s, Throwable t)
    throws IDCreateException
  {
    IDCreateException e = null;
    if (t != null) {
      e = new IDCreateException(s + ": " + t.getClass().getName() + ": " + 
        t.getMessage(), t);
    } else {
      e = new IDCreateException(s);
    }
    Activator.getDefault().log(
      new Status(4, "org.eclipse.ecf.identity", 
      2001, s, e));
    throw e;
  }
  
  public ID createID(Namespace n, Object[] args)
    throws IDCreateException
  {
    if (n == null) {
      logAndThrow("Namespace cannot be null", null);
    }
    initialize();
    
    Namespace ns = getNamespace0(n);
    if (ns == null) {
      logAndThrow("Namespace " + n.getName() + " not found", null);
    }
    return ns.createInstance(args);
  }
  
  public ID createID(String namespaceName, Object[] args)
    throws IDCreateException
  {
    Namespace n = getNamespaceByName(namespaceName);
    if (n == null) {
      throw new IDCreateException(
        "Namespace " + namespaceName + " not found");
    }
    return createID(n, args);
  }
  
  public ID createID(Namespace namespace, String uri)
    throws IDCreateException
  {
    return createID(namespace, new Object[] { uri });
  }
  
  public ID createID(String namespace, String uri)
    throws IDCreateException
  {
    return createID(namespace, new Object[] { uri });
  }
  
  public ID createStringID(String idstring)
    throws IDCreateException
  {
    if (idstring == null) {
      throw new IDCreateException("StringID cannot be null");
    }
    return createID(new StringID.StringIDNamespace(), 
      new String[] { idstring });
  }
  
  public ID createLongID(long l)
    throws IDCreateException
  {
    return createID(new LongID.LongNamespace(), new Long[] { new Long(l) });
  }
  
  public Namespace removeNamespace(Namespace n)
    throws SecurityException
  {
    if (n == null) {
      return null;
    }
    checkPermission(new NamespacePermission(n.toString(), 
      "remove"));
    initialize();
    return removeNamespace0(n);
  }
  
  protected static final Namespace removeNamespace0(Namespace n)
  {
    if (n == null) {
      return null;
    }
    return (Namespace)namespaces.remove(n.getName());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.IDFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.util.List;

public abstract interface IIDFactory
{
  public abstract Namespace addNamespace(Namespace paramNamespace)
    throws SecurityException;
  
  public abstract boolean containsNamespace(Namespace paramNamespace)
    throws SecurityException;
  
  public abstract List getNamespaces()
    throws SecurityException;
  
  public abstract Namespace getNamespace(Namespace paramNamespace)
    throws SecurityException;
  
  public abstract Namespace getNamespaceByName(String paramString)
    throws SecurityException;
  
  public abstract ID createGUID()
    throws IDCreateException;
  
  public abstract ID createGUID(int paramInt)
    throws IDCreateException;
  
  public abstract ID createID(Namespace paramNamespace, Object[] paramArrayOfObject)
    throws IDCreateException;
  
  public abstract ID createID(String paramString, Object[] paramArrayOfObject)
    throws IDCreateException;
  
  public abstract ID createID(Namespace paramNamespace, String paramString)
    throws IDCreateException;
  
  public abstract ID createID(String paramString1, String paramString2)
    throws IDCreateException;
  
  public abstract ID createStringID(String paramString)
    throws IDCreateException;
  
  public abstract ID createLongID(long paramLong)
    throws IDCreateException;
  
  public abstract Namespace removeNamespace(Namespace paramNamespace)
    throws SecurityException;
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.IIDFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

public abstract interface IIdentifiable
{
  public abstract ID getID();
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.IIdentifiable
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.net.URI;

public abstract interface IResourceID
  extends ID
{
  public abstract URI toURI();
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.IResourceID
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

public class LongID$LongNamespace
  extends Namespace
{
  private static final long serialVersionUID = -1580533392719331665L;
  
  public LongID$LongNamespace()
  {
    super(tmp4_1.getName(), "LongID Namespace");
  }
  
  public ID createInstance(Object[] args)
    throws IDCreateException
  {
    try
    {
      String init = getInitStringFromExternalForm(args);
      if (init != null) {
        return new LongID(this, Long.decode(init));
      }
      return new LongID(this, (Long)args[0]);
    }
    catch (Exception e)
    {
      throw new IDCreateException(getName() + " createInstance()", e);
    }
  }
  
  public String getScheme()
  {
    Class tmp3_0 = LongID.class$0;
    if (tmp3_0 == null)
    {
      tmp3_0;
      try
      {
        tmpTernaryOp = (LongID.class$0 = Class.forName("org.eclipse.ecf.core.identity.LongID"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    return tmp3_0.getName();
  }
  
  public Class[][] getSupportedParameterTypes()
  {
    Class[][] tmp4_1 = new Class[1][]; Class[] tmp10_7 = new Class[1]; Class tmp15_12 = LongID.class$1;
    if (tmp15_12 == null)
    {
      tmp15_12;
      try
      {
        tmpTernaryOp = (LongID.class$1 = Class.forName("java.lang.Long"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    tmp10_7[0] = tmp15_12;tmp4_1[0] = tmp10_7;return tmp4_1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.LongID.LongNamespace
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

public class LongID
  extends BaseID
{
  private static final long serialVersionUID = 4049072748317914423L;
  Long value = null;
  static Class class$0;
  static Class class$1;
  
  public static class LongNamespace
    extends Namespace
  {
    private static final long serialVersionUID = -1580533392719331665L;
    
    public LongNamespace()
    {
      super("LongID Namespace");
    }
    
    public ID createInstance(Object[] args)
      throws IDCreateException
    {
      try
      {
        String init = getInitStringFromExternalForm(args);
        if (init != null) {
          return new LongID(this, Long.decode(init));
        }
        return new LongID(this, (Long)args[0]);
      }
      catch (Exception e)
      {
        throw new IDCreateException(getName() + " createInstance()", e);
      }
    }
    
    public String getScheme()
    {
      Class tmp3_0 = LongID.class$0;
      if (tmp3_0 == null)
      {
        tmp3_0;
        try
        {
          tmpTernaryOp = (LongID.class$0 = Class.forName("org.eclipse.ecf.core.identity.LongID"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      return tmp3_0.getName();
    }
    
    public Class[][] getSupportedParameterTypes()
    {
      Class[][] tmp4_1 = new Class[1][]; Class[] tmp10_7 = new Class[1]; Class tmp15_12 = LongID.class$1;
      if (tmp15_12 == null)
      {
        tmp15_12;
        try
        {
          tmpTernaryOp = (LongID.class$1 = Class.forName("java.lang.Long"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      tmp10_7[0] = tmp15_12;tmp4_1[0] = tmp10_7;return tmp4_1;
    }
  }
  
  protected LongID(Namespace n, Long v)
  {
    super(n);
    value = v;
  }
  
  protected LongID(Namespace n, long v)
  {
    super(n);
    value = new Long(v);
  }
  
  protected int namespaceCompareTo(BaseID o)
  {
    Long ovalue = value;
    return value.compareTo(ovalue);
  }
  
  protected boolean namespaceEquals(BaseID o)
  {
    if (!(o instanceof LongID)) {
      return false;
    }
    LongID obj = (LongID)o;
    return value.equals(value);
  }
  
  protected String namespaceGetName()
  {
    return value.toString();
  }
  
  protected int namespaceHashCode()
  {
    return value.hashCode();
  }
  
  public long longValue()
  {
    return value.longValue();
  }
  
  public String toString()
  {
    StringBuffer sb = new StringBuffer("LongID[");
    sb.append(value).append("]");
    return sb.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.LongID
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.io.Serializable;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.ecf.internal.core.identity.Activator;

public abstract class Namespace
  implements Serializable, IAdaptable
{
  private static final long serialVersionUID = 3976740272094720312L;
  public static final String SCHEME_SEPARATOR = ":";
  private String name;
  private String description;
  private int hashCode;
  private boolean isInitialized = false;
  
  public Namespace() {}
  
  public final boolean initialize(String n, String desc)
  {
    Assert.isNotNull(n, "Namespace<init> name cannot be null");
    if (!isInitialized)
    {
      name = n;
      description = desc;
      hashCode = name.hashCode();
      isInitialized = true;
      return true;
    }
    return false;
  }
  
  public Namespace(String name, String desc)
  {
    initialize(name, desc);
  }
  
  public boolean equals(Object other)
  {
    if (!(other instanceof Namespace)) {
      return false;
    }
    return name.equals(name);
  }
  
  public int hashCode()
  {
    return hashCode;
  }
  
  protected boolean testIDEquals(BaseID first, BaseID second)
  {
    Namespace sn = second.getNamespace();
    if ((sn == null) || (!equals(sn))) {
      return false;
    }
    return first.namespaceEquals(second);
  }
  
  protected String getNameForID(BaseID id)
  {
    return id.namespaceGetName();
  }
  
  protected int getCompareToForObject(BaseID first, BaseID second)
  {
    return first.namespaceCompareTo(second);
  }
  
  protected int getHashCodeForID(BaseID id)
  {
    return id.namespaceHashCode();
  }
  
  protected String toExternalForm(BaseID id)
  {
    return id.namespaceToExternalForm();
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getDescription()
  {
    return description;
  }
  
  public abstract ID createInstance(Object[] paramArrayOfObject)
    throws IDCreateException;
  
  public abstract String getScheme();
  
  public String[] getSupportedSchemes()
  {
    return new String[0];
  }
  
  public Class[][] getSupportedParameterTypes()
  {
    return new Class[][] { new Class[0] };
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter.isInstance(this)) {
      return this;
    }
    IAdapterManager manager = Activator.getDefault().getAdapterManager();
    if (manager == null) {
      return null;
    }
    return manager.loadAdapter(this, adapter.getName());
  }
  
  protected String getInitStringFromExternalForm(Object[] args)
  {
    if ((args == null) || (args.length < 1) || (args[0] == null)) {
      return null;
    }
    if ((args[0] instanceof String))
    {
      String arg = (String)args[0];
      if (arg.startsWith(getScheme() + ":"))
      {
        int index = arg.indexOf(":");
        if (index >= arg.length()) {
          return null;
        }
        return arg.substring(index + 1);
      }
    }
    return null;
  }
  
  public String toString()
  {
    StringBuffer b = new StringBuffer("Namespace[");
    b.append("name=").append(name).append(";");
    b.append("scheme=").append(getScheme()).append(";");
    b.append("description=").append("]");
    return b.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.Namespace
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.security.BasicPermission;
import java.security.Permission;

public class NamespacePermission
  extends BasicPermission
{
  private static final long serialVersionUID = 3257004371500806969L;
  public static final String ADD_NAMESPACE = "add";
  public static final String ALL_NAMESPACE = "all";
  public static final String CONTAINS_NAMESPACE = "contains";
  public static final String GET_NAMESPACE = "get";
  public static final String REMOVE_NAMESPACE = "remove";
  protected String actions;
  
  public NamespacePermission(String s)
  {
    super(s);
  }
  
  public NamespacePermission(String s, String s1)
  {
    super(s, s1);
    actions = s1;
  }
  
  public String getActions()
  {
    return actions;
  }
  
  public boolean implies(Permission p)
  {
    if ((p == null) || (p.getClass() != getClass())) {
      return false;
    }
    NamespacePermission np = (NamespacePermission)p;
    String act = getActions();
    if (act == null) {
      return false;
    }
    if ((act.equals("all")) || (act.equals(np.getActions()))) {
      return true;
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.NamespacePermission
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

public class StringID$StringIDNamespace
  extends Namespace
{
  private static final long serialVersionUID = 7924280015192029963L;
  
  public StringID$StringIDNamespace(String name, String desc)
  {
    super(name, desc);
  }
  
  public StringID$StringIDNamespace()
  {
    super(tmp4_1.getName(), "StringID Namespace");
  }
  
  public ID createInstance(Object[] parameters)
    throws IDCreateException
  {
    try
    {
      String init = getInitStringFromExternalForm(parameters);
      if (init != null) {
        return new StringID(this, init);
      }
      return new StringID(this, (String)parameters[0]);
    }
    catch (Exception e)
    {
      throw new IDCreateException(getName() + 
        " createInstance()", e);
    }
  }
  
  public String getScheme()
  {
    Class tmp3_0 = StringID.class$0;
    if (tmp3_0 == null)
    {
      tmp3_0;
      try
      {
        tmpTernaryOp = (StringID.class$0 = Class.forName("org.eclipse.ecf.core.identity.StringID"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    return tmp3_0.getName();
  }
  
  public Class[][] getSupportedParameterTypes()
  {
    Class[][] tmp4_1 = new Class[1][]; Class[] tmp10_7 = new Class[1]; Class tmp15_12 = StringID.class$1;
    if (tmp15_12 == null)
    {
      tmp15_12;
      try
      {
        tmpTernaryOp = (StringID.class$1 = Class.forName("java.lang.String"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    tmp10_7[0] = tmp15_12;tmp4_1[0] = tmp10_7;return tmp4_1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.StringID.StringIDNamespace
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

public class StringID
  extends BaseID
{
  private static final long serialVersionUID = 3256437019155446068L;
  protected String value;
  static Class class$1;
  
  public static class StringIDNamespace
    extends Namespace
  {
    private static final long serialVersionUID = 7924280015192029963L;
    
    public StringIDNamespace(String name, String desc)
    {
      super(desc);
    }
    
    public StringIDNamespace()
    {
      super("StringID Namespace");
    }
    
    public ID createInstance(Object[] parameters)
      throws IDCreateException
    {
      try
      {
        String init = getInitStringFromExternalForm(parameters);
        if (init != null) {
          return new StringID(this, init);
        }
        return new StringID(this, (String)parameters[0]);
      }
      catch (Exception e)
      {
        throw new IDCreateException(getName() + 
          " createInstance()", e);
      }
    }
    
    public String getScheme()
    {
      Class tmp3_0 = StringID.class$0;
      if (tmp3_0 == null)
      {
        tmp3_0;
        try
        {
          tmpTernaryOp = (StringID.class$0 = Class.forName("org.eclipse.ecf.core.identity.StringID"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      return tmp3_0.getName();
    }
    
    public Class[][] getSupportedParameterTypes()
    {
      Class[][] tmp4_1 = new Class[1][]; Class[] tmp10_7 = new Class[1]; Class tmp15_12 = StringID.class$1;
      if (tmp15_12 == null)
      {
        tmp15_12;
        try
        {
          tmpTernaryOp = (StringID.class$1 = Class.forName("java.lang.String"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      tmp10_7[0] = tmp15_12;tmp4_1[0] = tmp10_7;return tmp4_1;
    }
  }
  
  protected StringID(Namespace n, String s)
  {
    super(n);
    value = s;
    setEmptyNamespace();
  }
  
  public int compareTo(Object o)
  {
    setEmptyNamespace();
    return super.compareTo(o);
  }
  
  public boolean equals(Object o)
  {
    setEmptyNamespace();
    return super.equals(o);
  }
  
  public String getName()
  {
    setEmptyNamespace();
    return super.getName();
  }
  
  public int hashCode()
  {
    setEmptyNamespace();
    return super.hashCode();
  }
  
  public Namespace getNamespace()
  {
    setEmptyNamespace();
    return namespace;
  }
  
  public String toExternalForm()
  {
    setEmptyNamespace();
    return super.toExternalForm();
  }
  
  public String toString()
  {
    setEmptyNamespace();
    int strlen = value.length();
    StringBuffer sb = new StringBuffer(strlen + 10);
    sb.insert(0, "StringID[").insert(9, value).insert(strlen + 9, ']');
    return sb.toString();
  }
  
  protected int namespaceCompareTo(BaseID obj)
  {
    return getName().compareTo(obj.getName());
  }
  
  protected boolean namespaceEquals(BaseID obj)
  {
    if (!(obj instanceof StringID)) {
      return false;
    }
    StringID o = (StringID)obj;
    return value.equals(o.getName());
  }
  
  protected String namespaceGetName()
  {
    return value;
  }
  
  protected int namespaceHashCode()
  {
    return value.hashCode() ^ getClass().hashCode();
  }
  
  protected synchronized void setEmptyNamespace()
  {
    if (namespace == null) {
      namespace = IDFactory.getDefault().getNamespaceByName(
        StringID.class.getName());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.StringID
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.identity;

import java.net.URI;
import org.eclipse.core.runtime.Assert;

public class URIID
  extends BaseID
  implements IResourceID
{
  private static final long serialVersionUID = 7328962407044918278L;
  private final URI uri;
  
  public URIID(Namespace namespace, URI uri)
  {
    super(namespace);
    Assert.isNotNull(uri);
    this.uri = uri;
  }
  
  protected int namespaceCompareTo(BaseID o)
  {
    if (this == o) {
      return 0;
    }
    if (!getClass().equals(o.getClass())) {
      return Integer.MIN_VALUE;
    }
    return uri.compareTo(uri);
  }
  
  protected boolean namespaceEquals(BaseID o)
  {
    if (this == o) {
      return true;
    }
    if (!getClass().equals(o.getClass())) {
      return false;
    }
    return uri.equals(uri);
  }
  
  protected String namespaceGetName()
  {
    return uri.toString();
  }
  
  protected int namespaceHashCode()
  {
    return uri.hashCode();
  }
  
  public URI toURI()
  {
    return uri;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.identity.URIID
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.util;

public class AbstractFactory
{
  public static Class[] getClassesForTypes(String[] argTypes, Object[] args, ClassLoader cl)
    throws ClassNotFoundException
  {
    Class[] clazzes = (Class[])null;
    if ((args == null) || (args.length == 0))
    {
      clazzes = new Class[0];
    }
    else if (argTypes != null)
    {
      clazzes = new Class[argTypes.length];
      for (int i = 0; i < argTypes.length; i++) {
        clazzes[i] = Class.forName(argTypes[i], true, cl);
      }
    }
    else
    {
      clazzes = new Class[args.length];
      for (int i = 0; i < args.length; i++) {
        if (args[i] == null) {
          clazzes[i] = null;
        } else {
          clazzes[i] = args[i].getClass();
        }
      }
    }
    return clazzes;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.util.AbstractFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.util;

import java.io.UnsupportedEncodingException;

public class Base64
{
  private static final byte equalSign = 61;
  static char[] digits = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 
    'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 
    'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 
    'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
  
  public static byte[] decodeFromCharArray(byte[] data)
  {
    if (data.length == 0) {
      return data;
    }
    int lastRealDataIndex = data.length - 1;
    while (data[lastRealDataIndex] == 61) {
      lastRealDataIndex--;
    }
    int padBytes = data.length - 1 - lastRealDataIndex;
    int byteLength = data.length * 6 / 8 - padBytes;
    byte[] result = new byte[byteLength];
    
    int dataIndex = 0;
    int resultIndex = 0;
    int allBits = 0;
    
    int resultChunks = (lastRealDataIndex + 1) / 4;
    for (int i = 0; i < resultChunks; i++)
    {
      allBits = 0;
      for (int j = 0; j < 4; j++) {
        allBits = allBits << 6 | decodeDigit(data[(dataIndex++)]);
      }
      for (int j = resultIndex + 2; j >= resultIndex; j--)
      {
        result[j] = ((byte)(allBits & 0xFF));
        allBits >>>= 8;
      }
      resultIndex += 3;
    }
    switch (padBytes)
    {
    case 1: 
      allBits = 0;
      for (int j = 0; j < 3; j++) {
        allBits = allBits << 6 | decodeDigit(data[(dataIndex++)]);
      }
      allBits <<= 6;
      
      allBits >>>= 8;
      for (int j = resultIndex + 1; j >= resultIndex; j--)
      {
        result[j] = ((byte)(allBits & 0xFF));
        
        allBits >>>= 8;
      }
      break;
    case 2: 
      allBits = 0;
      for (int j = 0; j < 2; j++) {
        allBits = allBits << 6 | decodeDigit(data[(dataIndex++)]);
      }
      allBits <<= 6;
      allBits <<= 6;
      
      allBits >>>= 8;
      allBits >>>= 8;
      result[resultIndex] = ((byte)(allBits & 0xFF));
    }
    return result;
  }
  
  static int decodeDigit(byte data)
  {
    char charData = (char)data;
    if ((charData <= 'Z') && (charData >= 'A')) {
      return charData - 'A';
    }
    if ((charData <= 'z') && (charData >= 'a')) {
      return charData - 'a' + 26;
    }
    if ((charData <= '9') && (charData >= '0')) {
      return charData - '0' + 52;
    }
    switch (charData)
    {
    case '+': 
      return 62;
    case '/': 
      return 63;
    }
    throw new IllegalArgumentException("Invalid char to decode: " + data);
  }
  
  public static byte[] encodeToCharArray(byte[] data)
  {
    int sourceChunks = data.length / 3;
    int len = (data.length + 2) / 3 * 4;
    byte[] result = new byte[len];
    int extraBytes = data.length - sourceChunks * 3;
    
    int dataIndex = 0;
    int resultIndex = 0;
    int allBits = 0;
    for (int i = 0; i < sourceChunks; i++)
    {
      allBits = 0;
      for (int j = 0; j < 3; j++) {
        allBits = allBits << 8 | data[(dataIndex++)] & 0xFF;
      }
      for (int j = resultIndex + 3; j >= resultIndex; j--)
      {
        result[j] = ((byte)digits[(allBits & 0x3F)]);
        
        allBits >>>= 6;
      }
      resultIndex += 4;
    }
    switch (extraBytes)
    {
    case 1: 
      allBits = data[(dataIndex++)];
      allBits <<= 8;
      allBits <<= 8;
      for (int j = resultIndex + 3; j >= resultIndex; j--)
      {
        result[j] = ((byte)digits[(allBits & 0x3F)]);
        
        allBits >>>= 6;
      }
      result[(result.length - 1)] = 61;
      result[(result.length - 2)] = 61;
      break;
    case 2: 
      allBits = data[(dataIndex++)];
      allBits = allBits << 8 | data[(dataIndex++)] & 0xFF;
      
      allBits <<= 8;
      for (int j = resultIndex + 3; j >= resultIndex; j--)
      {
        result[j] = ((byte)digits[(allBits & 0x3F)]);
        
        allBits >>>= 6;
      }
      result[(result.length - 1)] = 61;
    }
    return result;
  }
  
  public static String encode(byte[] bytes)
  {
    try
    {
      return new String(encodeToCharArray(bytes), "ISO8859_1");
    }
    catch (UnsupportedEncodingException e)
    {
      throw new NullPointerException("Do not have ISO8859_1 encoder");
    }
  }
  
  public static byte[] decode(String encoded)
  {
    try
    {
      return decodeFromCharArray(encoded.getBytes("ISO8859_1"));
    }
    catch (UnsupportedEncodingException e)
    {
      throw new NullPointerException("Do not have ISO8859_1 encoder");
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.ecf.core.util.Base64
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.ecf.core.util;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

public class ECFException
  ext
1 2

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