org.eclipse.osgi.util_3.2.200.v20110110

16:47:16.271 INFO  jd.cli.Main - Decompiling org.eclipse.osgi.util_3.2.200.v20110110.jar
package org.osgi.util.measurement;

public class Measurement
  implements Comparable
{
  private final double value;
  private final double error;
  private final long time;
  private final Unit unit;
  private transient String name;
  private transient int hashCode;
  
  public Measurement(double value, double error, Unit unit, long time)
  {
    this.value = value;
    this.error = Math.abs(error);
    this.unit = (unit != null ? unit : Unit.unity);
    this.time = time;
    name = null;
    hashCode = 0;
  }
  
  public Measurement(double value, double error, Unit unit)
  {
    this(value, error, unit, 0L);
  }
  
  public Measurement(double value, Unit unit)
  {
    this(value, 0.0D, unit, 0L);
  }
  
  public Measurement(double value)
  {
    this(value, 0.0D, null, 0L);
  }
  
  public final double getValue()
  {
    return value;
  }
  
  public final double getError()
  {
    return error;
  }
  
  public final Unit getUnit()
  {
    return unit;
  }
  
  public final long getTime()
  {
    return time;
  }
  
  public Measurement mul(Measurement m)
  {
    double mvalue = value;
    return new Measurement(value * mvalue, Math.abs(value) * error + error * Math.abs(mvalue), unit.mul(unit), time);
  }
  
  public Measurement mul(double d, Unit u)
  {
    return new Measurement(value * d, error * Math.abs(d), unit.mul(u), time);
  }
  
  public Measurement mul(double d)
  {
    return new Measurement(value * d, error * Math.abs(d), unit, time);
  }
  
  public Measurement div(Measurement m)
  {
    double mvalue = value;
    return new Measurement(value / mvalue, (Math.abs(value) * error + error * Math.abs(mvalue)) / (mvalue * mvalue), unit.div(unit), time);
  }
  
  public Measurement div(double d, Unit u)
  {
    return new Measurement(value / d, error / Math.abs(d), unit.div(u), time);
  }
  
  public Measurement div(double d)
  {
    return new Measurement(value / d, error / Math.abs(d), unit, time);
  }
  
  public Measurement add(Measurement m)
  {
    return new Measurement(value + value, error + error, unit.add(unit), time);
  }
  
  public Measurement add(double d, Unit u)
  {
    return new Measurement(value + d, error, unit.add(u), time);
  }
  
  public Measurement add(double d)
  {
    return new Measurement(value + d, error, unit, time);
  }
  
  public Measurement sub(Measurement m)
  {
    return new Measurement(value - value, error + error, unit.sub(unit), time);
  }
  
  public Measurement sub(double d, Unit u)
  {
    return new Measurement(value - d, error, unit.sub(u), time);
  }
  
  public Measurement sub(double d)
  {
    return new Measurement(value - d, error, unit, time);
  }
  
  public String toString()
  {
    String result = name;
    if (result == null)
    {
      StringBuffer sb = new StringBuffer();
      sb.append(value);
      if (error != 0.0D)
      {
        sb.append(" +/- ");
        sb.append(error);
      }
      String u = unit.toString();
      if (u.length() > 0)
      {
        sb.append(" ");
        sb.append(u);
      }
      result = sb.toString();
      name = result;
    }
    return result;
  }
  
  public int compareTo(Object obj)
  {
    if (this == obj) {
      return 0;
    }
    Measurement that = (Measurement)obj;
    if (!unit.equals(unit)) {
      throw new ArithmeticException(new StringBuffer().append("Cannot compare ").append(this).append(" and ").append(that).toString());
    }
    int result = Double.compare(value, value);
    if (result == 0) {
      return 0;
    }
    if (result < 0)
    {
      if (Double.compare(value + error, value - error) >= 0) {
        return 0;
      }
      return -1;
    }
    if (Double.compare(value - error, value + error) <= 0) {
      return 0;
    }
    return 1;
  }
  
  public int hashCode()
  {
    int h = hashCode;
    if (h == 0)
    {
      long bits = Double.doubleToLongBits(value);
      h = 527 + (int)(bits ^ bits >>> 32);
      bits = Double.doubleToLongBits(error);
      h = 31 * h + (int)(bits ^ bits >>> 32);
      h = 31 * h + unit.hashCode();
      hashCode = h;
    }
    return h;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof Measurement)) {
      return false;
    }
    Measurement that = (Measurement)obj;
    return (Double.compare(value, value) == 0) && (Double.compare(error, error) == 0) && (unit.equals(unit));
  }
}

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

public class State
{
  private final int value;
  private final long time;
  private final String name;
  
  public State(int value, String name, long time)
  {
    this.value = value;
    this.name = name;
    this.time = time;
  }
  
  public State(int value, String name)
  {
    this(value, name, 0L);
  }
  
  public final int getValue()
  {
    return value;
  }
  
  public final long getTime()
  {
    return time;
  }
  
  public final String getName()
  {
    return name;
  }
  
  public String toString()
  {
    StringBuffer sb = new StringBuffer();
    sb.append(value);
    if (name != null)
    {
      sb.append(" \"");
      sb.append(name);
      sb.append("\"");
    }
    return sb.toString();
  }
  
  public int hashCode()
  {
    int hash = 527 + value;
    if (name != null) {
      hash = 31 * hash + name.hashCode();
    }
    return hash;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof State)) {
      return false;
    }
    State that = (State)obj;
    if (value != value) {
      return false;
    }
    if (name == name) {
      return true;
    }
    if (name == null) {
      return false;
    }
    return name.equals(name);
  }
}

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

import java.util.Hashtable;

public class Unit
{
  private static final long UNITY = createType(0, 0, 0, 0, 0, 0, 0, 0, 0);
  private static final long ZERO = 64L;
  private static final long MASK = 127L;
  private static final int m_SHIFT = 0;
  private static final int s_SHIFT = 7;
  private static final int kg_SHIFT = 14;
  private static final int K_SHIFT = 21;
  private static final int A_SHIFT = 28;
  private static final int mol_SHIFT = 35;
  private static final int cd_SHIFT = 42;
  private static final int rad_SHIFT = 49;
  private static final int x_SHIFT = 56;
  private static final long x_MASK = 9151314442816847872L;
  public static final Unit unity = new Unit("", UNITY);
  public static final Unit m = new Unit("m", createType(0, 0, 0, 0, 0, 0, 0, 0, 1));
  public static final Unit s = new Unit("s", createType(0, 0, 0, 0, 0, 0, 0, 1, 0));
  public static final Unit kg = new Unit("kg", createType(0, 0, 0, 0, 0, 0, 1, 0, 0));
  public static final Unit K = new Unit("K", createType(0, 0, 0, 0, 0, 1, 0, 0, 0));
  public static final Unit A = new Unit("A", createType(0, 0, 0, 0, 1, 0, 0, 0, 0));
  public static final Unit mol = new Unit("mol", createType(0, 0, 0, 1, 0, 0, 0, 0, 0));
  public static final Unit cd = new Unit("cd", createType(0, 0, 1, 0, 0, 0, 0, 0, 0));
  public static final Unit m_s = new Unit("m/s", createType(0, 0, 0, 0, 0, 0, 0, -1, 1));
  public static final Unit m_s2 = new Unit("m/s2", createType(0, 0, 0, 0, 0, 0, 0, -2, 1));
  public static final Unit m2 = new Unit("m2", createType(0, 0, 0, 0, 0, 0, 0, 0, 2));
  public static final Unit m3 = new Unit("m3", createType(0, 0, 0, 0, 0, 0, 0, 0, 3));
  public static final Unit Hz = new Unit("Hz", createType(0, 0, 0, 0, 0, 0, 0, -1, 0));
  public static final Unit N = new Unit("N", createType(0, 0, 0, 0, 0, 0, 1, -2, 1));
  public static final Unit Pa = new Unit("Pa", createType(0, 0, 0, 0, 0, 0, 1, -2, -1));
  public static final Unit J = new Unit("J", createType(0, 0, 0, 0, 0, 0, 1, -2, 2));
  public static final Unit W = new Unit("W", createType(0, 0, 0, 0, 0, 0, 1, -3, 2));
  public static final Unit C = new Unit("C", createType(0, 0, 0, 0, 1, 0, 0, 1, 0));
  public static final Unit V = new Unit("V", createType(0, 0, 0, 0, -1, 0, 1, -3, 2));
  public static final Unit F = new Unit("F", createType(0, 0, 0, 0, 2, 0, -1, 4, -2));
  public static final Unit Ohm = new Unit("Ohm", createType(0, 0, 0, 0, -2, 0, 1, -3, 2));
  public static final Unit S = new Unit("S", createType(0, 0, 0, 0, 2, 0, -1, 3, -2));
  public static final Unit Wb = new Unit("Wb", createType(0, 0, 0, 0, -1, 0, 1, -2, 2));
  public static final Unit T = new Unit("T", createType(0, 0, 0, 0, -1, 0, 1, -2, 0));
  public static final Unit lx = new Unit("lx", createType(0, 0, 1, 0, 0, 0, 0, 0, -2));
  public static final Unit Gy = new Unit("Gy", createType(0, 0, 0, 0, 0, 0, 0, -2, 2));
  public static final Unit kat = new Unit("kat", createType(0, 0, 0, 1, 0, 0, 0, -1, 0));
  public static final Unit rad = new Unit("rad", createType(0, 1, 0, 0, 0, 0, 0, 0, 0));
  private static final Unit[] allUnits = { m, s, kg, K, A, mol, cd, rad, m_s, m_s2, m2, m3, Hz, N, Pa, J, W, C, V, F, Ohm, S, Wb, T, lx, Gy, kat, unity };
  private static Hashtable base;
  private final String name;
  private final long type;
  
  private Unit(String name, long type)
  {
    if (name == null) {
      name = computeName(type);
    }
    this.name = name;
    this.type = type;
  }
  
  private static long createType(int _x, int _rad, int _cd, int _mol, int _A, int _K, int _kg, int _s, int _m)
  {
    return (64L + _m & 0x7F) << 0 | (64L + _s & 0x7F) << 7 | (64L + _kg & 0x7F) << 14 | (64L + _K & 0x7F) << 21 | (64L + _A & 0x7F) << 28 | (64L + _mol & 0x7F) << 35 | (64L + _cd & 0x7F) << 42 | (64L + _rad & 0x7F) << 49 | _x << 56;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof Unit)) {
      return false;
    }
    return type == type;
  }
  
  public int hashCode()
  {
    return 527 + (int)(type ^ type >>> 32);
  }
  
  Unit mul(Unit that)
  {
    if ((isSpecial()) && (that.isSpecial())) {
      throw new ArithmeticException(new StringBuffer().append("Cannot multiply ").append(this).append(" with ").append(that).toString());
    }
    return find(type - UNITY + type);
  }
  
  Unit div(Unit that)
  {
    if ((isSpecial()) && (that.isSpecial()))
    {
      if (type == type) {
        return unity;
      }
      throw new ArithmeticException(new StringBuffer().append("Cannot divide ").append(this).append(" by ").append(that).toString());
    }
    return find(type - type + UNITY);
  }
  
  Unit add(Unit that)
  {
    if (!equals(that)) {
      throw new ArithmeticException(new StringBuffer().append("Cannot add ").append(this).append(" to ").append(that).toString());
    }
    return this;
  }
  
  Unit sub(Unit that)
  {
    if (!equals(that)) {
      throw new ArithmeticException(new StringBuffer().append("Cannot subtract ").append(that).append(" from ").append(this).toString());
    }
    return this;
  }
  
  static synchronized Unit find(long type)
  {
    if (base == null)
    {
      int size = allUnits.length;
      base = new Hashtable(size << 1);
      for (int i = 0; i < size; i++) {
        base.put(allUnits[i], allUnits[i]);
      }
    }
    Unit unit = new Unit(null, type);
    Unit out = (Unit)base.get(unit);
    if (out == null)
    {
      base.put(unit, unit);
      out = unit;
    }
    return out;
  }
  
  public String toString()
  {
    return name;
  }
  
  private static String computeName(long type)
  {
    int _m = (int)((type >> 0 & 0x7F) - 64L);
    int _s = (int)((type >> 7 & 0x7F) - 64L);
    int _kg = (int)((type >> 14 & 0x7F) - 64L);
    int _K = (int)((type >> 21 & 0x7F) - 64L);
    int _A = (int)((type >> 28 & 0x7F) - 64L);
    int _mol = (int)((type >> 35 & 0x7F) - 64L);
    int _cd = (int)((type >> 42 & 0x7F) - 64L);
    int _rad = (int)((type >> 49 & 0x7F) - 64L);
    StringBuffer numerator = new StringBuffer();
    StringBuffer denominator = new StringBuffer();
    addSIname(_m, "m", numerator, denominator);
    addSIname(_s, "s", numerator, denominator);
    addSIname(_kg, "kg", numerator, denominator);
    addSIname(_K, "K", numerator, denominator);
    addSIname(_A, "A", numerator, denominator);
    addSIname(_mol, "mol", numerator, denominator);
    addSIname(_cd, "cd", numerator, denominator);
    addSIname(_rad, "rad", numerator, denominator);
    if (denominator.length() > 0)
    {
      if (numerator.length() == 0) {
        numerator.append("1");
      }
      numerator.append("/");
      numerator.append(denominator.toString());
    }
    return numerator.toString();
  }
  
  private static void addSIname(int si, String name, StringBuffer numerator, StringBuffer denominator)
  {
    if (si != 0)
    {
      StringBuffer sb = si > 0 ? numerator : denominator;
      if (sb.length() > 0) {
        sb.append("*");
      }
      sb.append(name);
      int power = Math.abs(si);
      if (power > 1)
      {
        sb.append("^");
        sb.append(power);
      }
    }
  }
  
  private boolean isSpecial()
  {
    return (type & 0x7F00000000000000) != 0L;
  }
}

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

import org.osgi.util.measurement.Measurement;
import org.osgi.util.measurement.Unit;

public class Position
{
  private final Measurement altitude;
  private final Measurement longitude;
  private final Measurement latitude;
  private final Measurement speed;
  private final Measurement track;
  
  public Position(Measurement lat, Measurement lon, Measurement alt, Measurement speed, Measurement track)
  {
    if ((lat != null) && 
      (!Unit.rad.equals(lat.getUnit()))) {
      throw new IllegalArgumentException("Invalid Latitude");
    }
    if ((lon != null) && 
      (!Unit.rad.equals(lon.getUnit()))) {
      throw new IllegalArgumentException("Invalid Longitude");
    }
    if ((alt != null) && 
      (!Unit.m.equals(alt.getUnit()))) {
      throw new IllegalArgumentException("Invalid Altitude");
    }
    if ((speed != null) && 
      (!Unit.m_s.equals(speed.getUnit()))) {
      throw new IllegalArgumentException("Invalid Speed");
    }
    if ((track != null) && 
      (!Unit.rad.equals(track.getUnit()))) {
      throw new IllegalArgumentException("Invalid Track");
    }
    if ((lat != null) && (lon != null))
    {
      double dlat = lat.getValue();
      double dlon = lon.getValue();
      if ((dlon < -LON_RANGE) || (dlon >= LON_RANGE) || (dlat < -LAT_RANGE) || (dlat > LAT_RANGE))
      {
        dlon = normalize(dlon, LON_RANGE);
        dlat = normalize(dlat, LAT_RANGE * 2.0D);
        if ((dlat > LAT_RANGE) || (dlat < -LAT_RANGE))
        {
          dlon = normalize(dlon - LON_RANGE, LON_RANGE);
          dlat = normalize(LAT_RANGE * 2.0D - dlat, LAT_RANGE);
        }
        lon = new Measurement(dlon, lon.getError(), lon.getUnit(), lon.getTime());
        
        lat = new Measurement(dlat, lat.getError(), lat.getUnit(), lat.getTime());
      }
    }
    if (track != null)
    {
      double dtrack = track.getValue();
      if ((0.0D > dtrack) || (dtrack >= TRACK_RANGE))
      {
        dtrack %= TRACK_RANGE;
        if (dtrack < 0.0D) {
          dtrack += TRACK_RANGE;
        }
        track = new Measurement(dtrack, track.getError(), track.getUnit(), track.getTime());
      }
    }
    latitude = lat;
    longitude = lon;
    altitude = alt;
    this.speed = speed;
    this.track = track;
  }
  
  public Measurement getAltitude()
  {
    return altitude;
  }
  
  public Measurement getLongitude()
  {
    return longitude;
  }
  
  public Measurement getLatitude()
  {
    return latitude;
  }
  
  public Measurement getSpeed()
  {
    return speed;
  }
  
  public Measurement getTrack()
  {
    return track;
  }
  
  private static final double LON_RANGE = Math.PI;
  private static final double LAT_RANGE = Math.PI / 2.0D;
  
  private static double normalize(double value, double range)
  {
    double twiceRange = 2.0D * range;
    while (value >= range) {
      value -= twiceRange;
    }
    while (value < -range) {
      value += twiceRange;
    }
    return value;
  }
  
  private static final double TRACK_RANGE = Math.PI * 2.0D;
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.SAXParserFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;

public class XMLParserActivator
  implements BundleActivator, ServiceFactory
{
  private volatile BundleContext context;
  public static final String SAXFACTORYNAME = "javax.xml.parsers.SAXParserFactory";
  public static final String DOMFACTORYNAME = "javax.xml.parsers.DocumentBuilderFactory";
  private static final String PARSERCLASSFILEPATH = "/META-INF/services/";
  public static final String SAXCLASSFILE = "/META-INF/services/javax.xml.parsers.SAXParserFactory";
  public static final String DOMCLASSFILE = "/META-INF/services/javax.xml.parsers.DocumentBuilderFactory";
  private static final String SAXFACTORYDESCRIPTION = "A JAXP Compliant SAX Parser";
  private static final String DOMFACTORYDESCRIPTION = "A JAXP Compliant DOM Parser";
  public static final String PARSER_VALIDATING = "parser.validating";
  public static final String PARSER_NAMESPACEAWARE = "parser.namespaceAware";
  private static final String FACTORYNAMEKEY = "parser.factoryname";
  
  public void start(BundleContext context)
    throws Exception
  {
    this.context = context;
    Bundle parserBundle = context.getBundle();
    
    registerSAXParsers(getParserFactoryClassNames(parserBundle.getResource("/META-INF/services/javax.xml.parsers.SAXParserFactory")));
    
    registerDOMParsers(getParserFactoryClassNames(parserBundle.getResource("/META-INF/services/javax.xml.parsers.DocumentBuilderFactory")));
  }
  
  public void stop(BundleContext context)
    throws Exception
  {}
  
  private List getParserFactoryClassNames(URL parserUrl)
    throws IOException
  {
    if (parserUrl == null) {
      return Collections.EMPTY_LIST;
    }
    List v = new ArrayList(1);
    String parserFactoryClassName = null;
    InputStream is = parserUrl.openStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(is));
    for (;;)
    {
      parserFactoryClassName = br.readLine();
      if (parserFactoryClassName == null) {
        break;
      }
      String pfcName = parserFactoryClassName.trim();
      if (pfcName.length() != 0)
      {
        int commentIdx = pfcName.indexOf("#");
        if (commentIdx != 0) {
          if (commentIdx < 0) {
            v.add(pfcName);
          } else {
            v.add(pfcName.substring(0, commentIdx).trim());
          }
        }
      }
    }
    return v;
  }
  
  private void registerSAXParsers(List parserFactoryClassNames)
    throws FactoryConfigurationError
  {
    Iterator e = parserFactoryClassNames.iterator();
    int index = 0;
    while (e.hasNext())
    {
      String parserFactoryClassName = (String)e.next();
      
      SAXParserFactory factory = (SAXParserFactory)getFactory(parserFactoryClassName);
      Hashtable properties = new Hashtable(7);
      
      setDefaultSAXProperties(factory, properties, index);
      
      properties.put("parser.factoryname", parserFactoryClassName);
      
      context.registerService("javax.xml.parsers.SAXParserFactory", this, properties);
      index++;
    }
  }
  
  private void setDefaultSAXProperties(SAXParserFactory factory, Hashtable props, int index)
  {
    props.put("service.description", "A JAXP Compliant SAX Parser");
    props.put("service.pid", new StringBuffer().append("javax.xml.parsers.SAXParserFactory.").append(context.getBundle().getBundleId()).append(".").append(index).toString());
    
    setSAXProperties(factory, props);
  }
  
  public void setSAXProperties(SAXParserFactory factory, Hashtable properties)
  {
    boolean validating = true;
    factory.setValidating(true);
    factory.setNamespaceAware(false);
    try
    {
      factory.newSAXParser();
    }
    catch (Exception pce_val)
    {
      validating = false;
    }
    boolean namespaceaware = true;
    factory.setValidating(false);
    factory.setNamespaceAware(true);
    try
    {
      factory.newSAXParser();
    }
    catch (Exception pce_nsa)
    {
      namespaceaware = false;
    }
    factory.setValidating(validating);
    factory.setNamespaceAware(namespaceaware);
    
    properties.put("parser.namespaceAware", new Boolean(namespaceaware));
    properties.put("parser.validating", new Boolean(validating));
  }
  
  private void registerDOMParsers(List parserFactoryClassNames)
    throws FactoryConfigurationError
  {
    Iterator e = parserFactoryClassNames.iterator();
    int index = 0;
    while (e.hasNext())
    {
      String parserFactoryClassName = (String)e.next();
      
      DocumentBuilderFactory factory = (DocumentBuilderFactory)getFactory(parserFactoryClassName);
      Hashtable properties = new Hashtable(7);
      
      setDefaultDOMProperties(factory, properties, index);
      
      properties.put("parser.factoryname", parserFactoryClassName);
      
      context.registerService("javax.xml.parsers.DocumentBuilderFactory", this, properties);
      index++;
    }
  }
  
  private void setDefaultDOMProperties(DocumentBuilderFactory factory, Hashtable props, int index)
  {
    props.put("service.description", "A JAXP Compliant DOM Parser");
    props.put("service.pid", new StringBuffer().append("javax.xml.parsers.DocumentBuilderFactory.").append(context.getBundle().getBundleId()).append(".").append(index).toString());
    
    setDOMProperties(factory, props);
  }
  
  public void setDOMProperties(DocumentBuilderFactory factory, Hashtable props)
  {
    boolean validating = true;
    factory.setValidating(true);
    factory.setNamespaceAware(false);
    try
    {
      factory.newDocumentBuilder();
    }
    catch (Exception pce_val)
    {
      validating = false;
    }
    boolean namespaceaware = true;
    factory.setValidating(false);
    factory.setNamespaceAware(true);
    try
    {
      factory.newDocumentBuilder();
    }
    catch (Exception pce_nsa)
    {
      namespaceaware = false;
    }
    factory.setValidating(validating);
    factory.setNamespaceAware(namespaceaware);
    
    props.put("parser.validating", new Boolean(validating));
    props.put("parser.namespaceAware", new Boolean(namespaceaware));
  }
  
  private Object getFactory(String parserFactoryClassName)
    throws FactoryConfigurationError
  {
    try
    {
      return context.getBundle().loadClass(parserFactoryClassName).newInstance();
    }
    catch (RuntimeException e)
    {
      throw e;
    }
    catch (Exception e)
    {
      throw new FactoryConfigurationError(e);
    }
  }
  
  public Object getService(Bundle bundle, ServiceRegistration registration)
  {
    ServiceReference sref = registration.getReference();
    String parserFactoryClassName = (String)sref.getProperty("parser.factoryname");
    
    Object factory = getFactory(parserFactoryClassName);
    if ((factory instanceof SAXParserFactory))
    {
      ((SAXParserFactory)factory).setValidating(((Boolean)sref.getProperty("parser.validating")).booleanValue());
      
      ((SAXParserFactory)factory).setNamespaceAware(((Boolean)sref.getProperty("parser.namespaceAware")).booleanValue());
    }
    else if ((factory instanceof DocumentBuilderFactory))
    {
      ((DocumentBuilderFactory)factory).setValidating(((Boolean)sref.getProperty("parser.validating")).booleanValue());
      
      ((DocumentBuilderFactory)factory).setNamespaceAware(((Boolean)sref.getProperty("parser.namespaceAware")).booleanValue());
    }
    return factory;
  }
  
  public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {}
}

/* Location:
 * Qualified Name:     org.osgi.util.xml.XMLParserActivator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
1

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