/** * Get a Transport object using the given provider and urlname. * * @param provider the provider to use * @param url urlname to use (can be null) * @return A Transport object * @exception NoSuchProviderException If no provider or the provider * was the wrong class. */ private Transport getTransport(Provider provider, URLName url) throws NoSuchProviderException { // make sure we have the correct type of provider if (provider == null || provider.getType() != Provider.Type.TRANSPORT) { throw new NoSuchProviderException("invalid provider"); } return getService(provider, url, Transport.class); }
/** * Set the passed Provider to be the default implementation * for the protocol in Provider.protocol overriding any previous values. * * @param provider Currently configured Provider which will be * set as the default for the protocol * @exception NoSuchProviderException If the provider passed in * is invalid. */ public synchronized void setProvider(Provider provider) throws NoSuchProviderException { if (provider == null) { throw new NoSuchProviderException("Can't set null provider"); } providersByProtocol.put(provider.getProtocol(), provider); props.put("mail." + provider.getProtocol() + ".class", provider.getClassName()); }
/** * Get a Transport object using the given provider and urlname. * * @param provider the provider to use * @param url urlname to use (can be null) * @return A Transport object * @exception NoSuchProviderException If no provider or the provider * was the wrong class. */ private Transport getTransport(Provider provider, URLName url) throws NoSuchProviderException { // make sure we have the correct type of provider if (provider == null || provider.getType() != Provider.Type.TRANSPORT) { throw new NoSuchProviderException("invalid provider"); } return getService(provider, url, Transport.class); }
/** * Get an instance of the store specified by Provider. If the URLName * is not null, uses it, otherwise creates a new one. Instantiates * the store and returns it. This is a private method used by * getStore(Provider) and getStore(URLName) * * @param provider Store Provider that will be instantiated * @param url URLName used to instantiate the Store * @return Instantiated Store * @exception NoSuchProviderException If a provider for the given * Provider/URLName is not found. */ private Store getStore(Provider provider, URLName url) throws NoSuchProviderException { // make sure we have the correct type of provider if (provider == null || provider.getType() != Provider.Type.STORE ) { throw new NoSuchProviderException("invalid provider"); } return getService(provider, url, Store.class); }
/** * Get an instance of the store specified by Provider. If the URLName * is not null, uses it, otherwise creates a new one. Instantiates * the store and returns it. This is a private method used by * getStore(Provider) and getStore(URLName) * * @param provider Store Provider that will be instantiated * @param url URLName used to instantiate the Store * @return Instantiated Store * @exception NoSuchProviderException If a provider for the given * Provider/URLName is not found. */ private Store getStore(Provider provider, URLName url) throws NoSuchProviderException { // make sure we have the correct type of provider if (provider == null || provider.getType() != Provider.Type.STORE ) { throw new NoSuchProviderException("invalid provider"); } return getService(provider, url, Store.class); }
/** * Set the passed Provider to be the default implementation * for the protocol in Provider.protocol overriding any previous values. * * @param provider Currently configured Provider which will be * set as the default for the protocol * @exception NoSuchProviderException If the provider passed in * is invalid. */ public synchronized void setProvider(Provider provider) throws NoSuchProviderException { if (provider == null) { throw new NoSuchProviderException("Can't set null provider"); } providersByProtocol.put(provider.getProtocol(), provider); providersByClassName.put(provider.getClassName(), provider); props.put("mail." + provider.getProtocol() + ".class", provider.getClassName()); }
/** * Get a Transport object that can transport a Message of the * specified address type. * * @param address an address for which a Transport is needed * @return A Transport object * @see javax.mail.Address * @exception NoSuchProviderException If provider for the * Address type is not found */ public Transport getTransport(Address address) throws NoSuchProviderException { String transportProtocol; transportProtocol = getProperty("mail.transport.protocol." + address.getType()); if (transportProtocol != null) return getTransport(transportProtocol); transportProtocol = (String)addressMap.get(address.getType()); if (transportProtocol != null) return getTransport(transportProtocol); throw new NoSuchProviderException("No provider for Address type: "+ address.getType()); }
/** * Get a Transport object that can transport a Message of the * specified address type. * * @param address an address for which a Transport is needed * @return A Transport object * @see javax.mail.Address * @exception NoSuchProviderException If provider for the * Address type is not found */ public Transport getTransport(Address address) throws NoSuchProviderException { String transportProtocol; transportProtocol = getProperty("mail.transport.protocol." + address.getType()); if (transportProtocol != null) return getTransport(transportProtocol); transportProtocol = (String)addressMap.get(address.getType()); if (transportProtocol != null) return getTransport(transportProtocol); throw new NoSuchProviderException("No provider for Address type: "+ address.getType()); }
throw new NoSuchProviderException("Invalid protocol: null"); throw new NoSuchProviderException("No provider for " + protocol); } else { if (logger.isLoggable(Level.FINE)) {
throw new NoSuchProviderException("null"); throw new NoSuchProviderException(provider.getProtocol()); throw new NoSuchProviderException(provider.getProtocol());
throw new NoSuchProviderException("null"); throw new NoSuchProviderException(provider.getProtocol()); throw new NoSuchProviderException(provider.getProtocol());
throw new NoSuchProviderException("Invalid protocol: null"); throw new NoSuchProviderException("No provider for " + protocol); } else { if (logger.isLoggable(Level.FINE)) {
/** * Return a Transport for the default protocol specified by the * <code>mail.transport.protocol</code> property. * * @return a Transport * @throws NoSuchProviderException */ public Transport getTransport() throws NoSuchProviderException { String protocol = properties.getProperty("mail.transport.protocol"); if (protocol == null) { throw new NoSuchProviderException("mail.transport.protocol property is not set"); } return getTransport(protocol); }
/** * Return a Transport for the default protocol specified by the * <code>mail.transport.protocol</code> property. * * @return a Transport * @throws NoSuchProviderException */ public Transport getTransport() throws NoSuchProviderException { String protocol = properties.getProperty("mail.transport.protocol"); if (protocol == null) { throw new NoSuchProviderException("mail.transport.protocol property is not set"); } return getTransport(protocol); }
/** * Return a Store for the default protocol defined by the mail.store.protocol property. * * @return the store for the default protocol * @throws NoSuchProviderException */ public Store getStore() throws NoSuchProviderException { String protocol = properties.getProperty("mail.store.protocol"); if (protocol == null) { throw new NoSuchProviderException("mail.store.protocol property is not set"); } return getStore(protocol); }
/** * Return a Store for the default protocol defined by the mail.store.protocol property. * * @return the store for the default protocol * @throws NoSuchProviderException */ public Store getStore() throws NoSuchProviderException { String protocol = properties.getProperty("mail.store.protocol"); if (protocol == null) { throw new NoSuchProviderException("mail.store.protocol property is not set"); } return getStore(protocol); }
/** * Return a transport for the protocol associated with the type of this address. * * @param address the address we are trying to deliver to * @return a Transport * @throws NoSuchProviderException */ public Transport getTransport(Address address) throws NoSuchProviderException { String type = address.getType(); // load the address map from the resource files. Map addressMap = getAddressMap(); String protocolName = (String)addressMap.get(type); if (protocolName == null) { throw new NoSuchProviderException("No provider for address type " + type); } return getTransport(protocolName); }
/** * Return a transport for the protocol associated with the type of this address. * * @param address the address we are trying to deliver to * @return a Transport * @throws NoSuchProviderException */ public Transport getTransport(Address address) throws NoSuchProviderException { String type = address.getType(); // load the address map from the resource files. Map addressMap = getAddressMap(); String protocolName = (String)addressMap.get(type); if (protocolName == null) { throw new NoSuchProviderException("No provider for address type " + type); } return getTransport(protocolName); }
/** * Return the Store specified by the given provider. * * @param provider the provider to create from * @return a Store * @throws NoSuchProviderException if there was a problem creating the Store */ public Store getStore(Provider provider) throws NoSuchProviderException { if (Provider.Type.STORE != provider.getType()) { throw new NoSuchProviderException("Not a Store Provider: " + provider); } return (Store) getService(provider, null); }
/** * Return the Store specified by the given provider. * * @param provider the provider to create from * @return a Store * @throws NoSuchProviderException if there was a problem creating the Store */ public Store getStore(Provider provider) throws NoSuchProviderException { if (Provider.Type.STORE != provider.getType()) { throw new NoSuchProviderException("Not a Store Provider: " + provider); } return (Store) getService(provider, null); }