Lines Matching refs:service

41  * A simple service-provider loading facility.
43 * <p> A <i>service</i> is a well-known set of interfaces and (usually
44 * abstract) classes. A <i>service provider</i> is a specific implementation
45 * of a service. The classes in a provider typically implement the interfaces
46 * and subclass the classes defined in the service itself. Service providers
52 * <p> For the purpose of loading, a service is represented by a single type,
54 * used, but this is not recommended.) A provider of a given service contains
55 * one or more concrete classes that extend this <i>service type</i> with data
60 * The details of provider classes tend to be highly service-specific; no
66 * <p><a name="format"> A service provider is identified by placing a
69 * href="../lang/ClassLoader.html#name">binary name</a> of the service's type.
87 * service loader maintains a cache of the providers that have been loaded so
107 * Suppose we have a service type <tt>com.example.CodecSet</tt> which is
120 * <tt>CodecSet</tt> service then its jar file also contains a file named
130 * <p> The <tt>CodecSet</tt> class creates and saves a single service instance
175 * The type of the service to be loaded by this loader
187 // The class or interface representing the service being loaded
188 private Class<S> service;
212 lookupIterator = new LazyIterator(service, loader);
216 service = svc;
221 private static void fail(Class service, String msg, Throwable cause)
224 throw new ServiceConfigurationError(service.getName() + ": " + msg,
228 private static void fail(Class service, String msg)
231 throw new ServiceConfigurationError(service.getName() + ": " + msg);
234 private static void fail(Class service, URL u, int line, String msg)
237 fail(service, u + ":" + line + ": " + msg);
243 private int parseLine(Class service, URL u, BufferedReader r, int lc,
257 fail(service, u, lc, "Illegal configuration-file syntax");
260 fail(service, u, lc, "Illegal provider-class name: " + ln);
264 fail(service, u, lc, "Illegal provider-class name: " + ln);
274 // @param service
275 // The service type for which providers are being sought;
289 private Iterator<String> parse(Class service, URL u)
299 while ((lc = parseLine(service, u, r, lc, names)) >= 0);
301 fail(service, "Error reading configuration file", x);
307 fail(service, "Error closing configuration file", y);
319 Class<S> service;
325 private LazyIterator(Class<S> service, ClassLoader loader) {
326 this.service = service;
336 String fullName = PREFIX + service.getName();
342 fail(service, "Error locating configuration files", x);
349 pending = parse(service, configs.nextElement());
365 fail(service,
368 if (!service.isAssignableFrom(c)) {
369 fail(service,
373 S p = service.cast(c.newInstance());
377 fail(service,
391 * Lazily loads the available providers of this loader's service.
405 * class is not assignable to the service type, or if any other kind of
408 * ServiceConfigurationError} when using a service iterator.
428 * service
456 * Creates a new service loader for the given service type and class
459 * @param service
460 * The interface or abstract class representing the service
468 * @return A new service loader
470 public static <S> ServiceLoader<S> load(Class<S> service,
473 return new ServiceLoader<>(service, loader);
477 * Creates a new service loader for the given service type, using the
484 * ServiceLoader.load(<i>service</i>)</pre></blockquote>
489 * ServiceLoader.load(<i>service</i>,
492 * @param service
493 * The interface or abstract class representing the service
495 * @return A new service loader
497 public static <S> ServiceLoader<S> load(Class<S> service) {
499 return ServiceLoader.load(service, cl);
503 * Creates a new service loader for the given service type, using the
510 * ServiceLoader.load(<i>service</i>, <i>extClassLoader</i>)</pre></blockquote>
517 * desired. The resulting service will only find and load providers that
521 * @param service
522 * The interface or abstract class representing the service
524 * @return A new service loader
526 public static <S> ServiceLoader<S> loadInstalled(Class<S> service) {
533 return ServiceLoader.load(service, prev);
537 * Returns a string describing this service.
542 return "java.util.ServiceLoader[" + service.getName() + "]";