Ejemplo n.º 1
0
  /** Resolve available formats */
  public static Format[] getFormats() {

    // known?
    if (formats != null) return formats;

    // look 'em up
    List<Format> list = new ArrayList<Format>(10);
    list.add(DEFAULT);

    Iterator<Format> it = ServiceRegistry.lookupProviders(Format.class);
    while (it.hasNext()) {
      try {
        Format f = (Format) it.next();
        if (!list.contains(f)) list.add(f);
      } catch (Throwable t) {
        if (t.getCause() != t) t = t.getCause();
        LOG.log(Level.WARNING, "Encountered exception loading Format: " + t.getMessage());
      }
    }

    // keep 'em
    formats = (Format[]) list.toArray(new Format[list.size()]);

    // done
    return formats;
  }
Ejemplo n.º 2
0
 private static synchronized void initIfNecessary() {
   if (readers == null) {
     readers = new HashMap<String, OctaveDataReader>();
     final Iterator<OctaveDataReader> sp = ServiceRegistry.lookupProviders(OctaveDataReader.class);
     while (sp.hasNext()) {
       final OctaveDataReader odr = sp.next();
       readers.put(odr.octaveType(), odr);
     }
   }
 }
Ejemplo n.º 3
0
  public RepairerProvider(ClassLoader classLoader, Document document) {

    repairers = new HashMap<String, Repairer>();

    Repairer repairer;
    Iterator<Repairer> i = ServiceRegistry.lookupProviders(Repairer.class, classLoader);
    while (i.hasNext()) {
      repairer = i.next();
      repairers.put(repairer.getIdentifier(), repairer);
    }

    try {
      Repairer mainRepairer = new MainRepairer(document);
      repairers.put(mainRepairer.getIdentifier(), mainRepairer);
    } catch (com.sun.star.uno.Exception e) {
    }
  }