/** * This method returns an array of all the implementations installed * via the javamail.[default.]providers files that can * be loaded using the ClassLoader available to this application. * * @return Array of configured providers */ public synchronized Provider[] getProviders() { List<Provider> plist = new ArrayList<Provider>(); boolean needFallback = true; // first, add all the services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider p : loader) { plist.add(p); needFallback = false; } // then, add all the providers from config files if (!loadedProviders) loadProviders(needFallback); if (providers != null) plist.addAll(providers); Provider[] _providers = new Provider[plist.size()]; plist.toArray(_providers); return _providers; }
/** * Get the Provider for the specified protocol. * * @param protocol the protocol * @return the Provider */ private Provider getProviderByProtocol(String protocol) { // first, try our local list of providers Provider p = providersByProtocol.get(protocol); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (protocol.equals(pp.getProtocol())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByProtocol.get(protocol); } return p; }
/** * Get the Provider that uses the specified class name. * * @param className the class name * @return the Provider */ private Provider getProviderByClassName(String className) { // first, try our local list of providers Provider p = providersByClassName.get(className); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (className.equals(pp.getClassName())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByClassName.get(className); } return p; }
private Session(Properties props, Authenticator authenticator) { this.props = props; this.authenticator = authenticator; if (Boolean.valueOf(props.getProperty("mail.debug")).booleanValue()) debug = true; initLogger(); logger.log(Level.CONFIG, "JavaMail version {0}", Version.version); // get the Class associated with the Authenticator Class<?> cl; if (authenticator != null) cl = authenticator.getClass(); else cl = this.getClass(); // load the resources loadProviders(cl); loadAddressMap(cl); q = new EventQueue((Executor)props.get("mail.event.executor")); }
private ProviderInfo getProviderInfo() { ClassLoader cl = getClassLoader(); synchronized (providersByClassLoader) { ProviderInfo info = (ProviderInfo) providersByClassLoader.get(cl); if (info == null) { info = loadProviders(cl); } return info; } }
private ProviderInfo getProviderInfo() { ClassLoader cl = getClassLoader(); ProviderInfo info = (ProviderInfo) providersByClassLoader.get(cl); if (info == null) { info = loadProviders(cl); } return info; }
/** * This method returns an array of all the implementations installed * via the javamail.[default.]providers files that can * be loaded using the ClassLoader available to this application. * * @return Array of configured providers */ public synchronized Provider[] getProviders() { List<Provider> plist = new ArrayList<Provider>(); boolean needFallback = true; // first, add all the services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider p : loader) { plist.add(p); needFallback = false; } // then, add all the providers from config files if (!loadedProviders) loadProviders(needFallback); if (providers != null) plist.addAll(providers); Provider[] _providers = new Provider[plist.size()]; plist.toArray(_providers); return _providers; }
/** * This method returns an array of all the implementations installed * via the javamail.[default.]providers files that can * be loaded using the ClassLoader available to this application. * * @return Array of configured providers */ public synchronized Provider[] getProviders() { List<Provider> plist = new ArrayList<Provider>(); boolean needFallback = true; // first, add all the services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider p : loader) { plist.add(p); needFallback = false; } // then, add all the providers from config files if (!loadedProviders) loadProviders(needFallback); if (providers != null) plist.addAll(providers); Provider[] _providers = new Provider[plist.size()]; plist.toArray(_providers); return _providers; }
/** * This method returns an array of all the implementations installed * via the javamail.[default.]providers files that can * be loaded using the ClassLoader available to this application. * * @return Array of configured providers */ public synchronized Provider[] getProviders() { List<Provider> plist = new ArrayList<Provider>(); boolean needFallback = true; // first, add all the services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider p : loader) { plist.add(p); needFallback = false; } // then, add all the providers from config files if (!loadedProviders) loadProviders(needFallback); if (providers != null) plist.addAll(providers); Provider[] _providers = new Provider[plist.size()]; plist.toArray(_providers); return _providers; }
private Session(Properties props, Authenticator authenticator) { this.props = props; this.authenticator = authenticator; if (Boolean.valueOf(props.getProperty("mail.debug")).booleanValue()) debug = true; if (debug) pr("DEBUG: JavaMail version " + Version.version); // get the Class associated with the Authenticator Class cl; if (authenticator != null) cl = authenticator.getClass(); else cl = this.getClass(); // load the resources loadProviders(cl); loadAddressMap(cl); }
/** * Get the Provider for the specified protocol. * * @param protocol the protocol * @return the Provider */ private Provider getProviderByProtocol(String protocol) { // first, try our local list of providers Provider p = providersByProtocol.get(protocol); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (protocol.equals(pp.getProtocol())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByProtocol.get(protocol); } return p; }
/** * Get the Provider for the specified protocol. * * @param protocol the protocol * @return the Provider */ private Provider getProviderByProtocol(String protocol) { // first, try our local list of providers Provider p = providersByProtocol.get(protocol); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (protocol.equals(pp.getProtocol())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByProtocol.get(protocol); } return p; }
private Session(Properties props, Authenticator authenticator) { this.props = props; this.authenticator = authenticator; if (Boolean.valueOf(props.getProperty("mail.debug")).booleanValue()) debug = true; if (debug) pr("DEBUG: JavaMail version " + Version.version); // get the Class associated with the Authenticator Class cl; if (authenticator != null) cl = authenticator.getClass(); else cl = this.getClass(); // load the resources loadProviders(cl); loadAddressMap(cl); }
/** * Get the Provider that uses the specified class name. * * @param className the class name * @return the Provider */ private Provider getProviderByClassName(String className) { // first, try our local list of providers Provider p = providersByClassName.get(className); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (className.equals(pp.getClassName())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByClassName.get(className); } return p; }
/** * Get the Provider for the specified protocol. * * @param protocol the protocol * @return the Provider */ private Provider getProviderByProtocol(String protocol) { // first, try our local list of providers Provider p = providersByProtocol.get(protocol); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (protocol.equals(pp.getProtocol())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByProtocol.get(protocol); } return p; }
/** * Get the Provider that uses the specified class name. * * @param className the class name * @return the Provider */ private Provider getProviderByClassName(String className) { // first, try our local list of providers Provider p = providersByClassName.get(className); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (className.equals(pp.getClassName())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByClassName.get(className); } return p; }
/** * Get the Provider that uses the specified class name. * * @param className the class name * @return the Provider */ private Provider getProviderByClassName(String className) { // first, try our local list of providers Provider p = providersByClassName.get(className); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (className.equals(pp.getClassName())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByClassName.get(className); } return p; }
/** * Get the Provider for the specified protocol. * * @param protocol the protocol * @return the Provider */ private Provider getProviderByProtocol(String protocol) { // first, try our local list of providers Provider p = providersByProtocol.get(protocol); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (protocol.equals(pp.getProtocol())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByProtocol.get(protocol); } return p; }
/** * Get the Provider that uses the specified class name. * * @param className the class name * @return the Provider */ private Provider getProviderByClassName(String className) { // first, try our local list of providers Provider p = providersByClassName.get(className); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (className.equals(pp.getClassName())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByClassName.get(className); } return p; }
/** * Get the Provider for the specified protocol. * * @param protocol the protocol * @return the Provider */ private Provider getProviderByProtocol(String protocol) { // first, try our local list of providers Provider p = providersByProtocol.get(protocol); if (p != null) return p; // now, try services ServiceLoader<Provider> loader = ServiceLoader.load(Provider.class); for (Provider pp : loader) { if (protocol.equals(pp.getProtocol())) return pp; } // finally, if we haven't loaded our config, load it and try again if (!loadedProviders) { loadProviders(true); p = providersByProtocol.get(protocol); } return p; }