Ejemplo n.º 1
0
    /**
     * @return zero or more <code>URL</code> instances
     * @throws Exception if an Exception is thrown by the underlying <code>
     *     ConfigurationResourceProvider</code>
     */
    public Collection<URI> call() throws Exception {
      Collection untypedCollection = provider.getResources(sc);
      Iterator untypedCollectionIterator = untypedCollection.iterator();
      Collection<URI> result = Collections.emptyList();
      if (untypedCollectionIterator.hasNext()) {
        Object cur = untypedCollectionIterator.next();
        // account for older versions of the provider that return Collection<URL>.
        if (cur instanceof URL) {
          result = new ArrayList<URI>(untypedCollection.size());
          result.add(new URI(((URL) cur).toExternalForm()));
          while (untypedCollectionIterator.hasNext()) {
            cur = untypedCollectionIterator.next();
            result.add(new URI(((URL) cur).toExternalForm()));
          }
        } else {
          result = (Collection<URI>) untypedCollection;
        }
      }

      return result;
    }
Ejemplo n.º 2
0
 /**
  * @return zero or more <code>URL</code> instances
  * @throws Exception if an Exception is thrown by the underlying <code>
  *     ConfigurationResourceProvider</code>
  */
 public Collection<URL> call() throws Exception {
   return provider.getResources(sc);
 }