|
From: Steve F. <sm...@us...> - 2002-10-14 22:58:31
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/alt/javax/mail
In directory usw-pr-cvs1:/tmp/cvs-serv10355/src/j2ee/1.3/alt/javax/mail
Added Files:
SessionImpl.java TransportImpl.java MessageImpl.java
ServiceImpl.java
Log Message:
moved some j2ee alt and helper classes from
common to 1.3 to avoid compilation failures
--- NEW FILE: SessionImpl.java ---
package alt.javax.mail;
import javax.mail.*;
import java.util.Properties;
public class SessionImpl implements Session {
private final javax.mail.Session session;
public SessionImpl(javax.mail.Session session) {
this.session = session;
}
public Session getInstance(Properties props, Authenticator
authenticator) {
return new SessionImpl(session.getInstance(props, authenticator));
}
public Session getInstance(Properties props) {
return new SessionImpl(session.getInstance(props));
}
public Session getDefaultInstance(Properties props, Authenticator
authenticator) {
return new SessionImpl(session.getDefaultInstance(
props, authenticator));
}
public Session getDefaultInstance(Properties props) {
return new SessionImpl(session.getDefaultInstance(props));
}
public void setDebug(boolean debug) {
}
public boolean getDebug() {
return session.getDebug();
}
public Provider getProviders()[] {
return session.getProviders();
}
public Provider getProvider(String protocol) throws NoSuchProviderException {
return session.getProvider(protocol);
}
public void setProvider(Provider provider) throws NoSuchProviderException {
session.setProvider(provider);
}
public Store getStore() throws NoSuchProviderException {
return session.getStore();
}
public Store getStore(String protocol) throws NoSuchProviderException {
return session.getStore(protocol);
}
public Store getStore(URLName url) throws NoSuchProviderException {
return session.getStore(url);
}
public Store getStore(Provider provider) throws NoSuchProviderException {
return session.getStore(provider);
}
public Folder getFolder(URLName url) throws MessagingException {
return session.getFolder(url);
}
public Transport getTransport() throws NoSuchProviderException {
return new TransportImpl(session.getTransport());
}
public Transport getTransport(String protocol) throws NoSuchProviderException {
return new TransportImpl(session.getTransport(protocol));
}
public Transport getTransport(URLName url) throws NoSuchProviderException {
return new TransportImpl(session.getTransport(url));
}
public Transport getTransport(Provider provider) throws NoSuchProviderException {
return new TransportImpl(session.getTransport(provider));
}
public Transport getTransport(Address address) throws NoSuchProviderException {
return new TransportImpl(session.getTransport(address));
}
public void setPasswordAuthentication(URLName url, PasswordAuthentication pw) {
session.setPasswordAuthentication(url, pw);
}
public PasswordAuthentication getPasswordAuthentication(URLName url) {
return session.getPasswordAuthentication(url);
}
public PasswordAuthentication requestPasswordAuthentication(java.net.InetAddress addr, int port, String protocol, String prompt, String defaultUserName) {
return session.requestPasswordAuthentication(addr, port, protocol,
prompt, defaultUserName);
}
public Properties getProperties() {
return session.getProperties();
}
public String getProperty(String name) {
return session.getProperty(name);
}
public javax.mail.Session getWrappedSession() {
return session;
}
}
--- NEW FILE: TransportImpl.java ---
package alt.javax.mail;
import alt.javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Address;
import javax.mail.event.TransportListener;
public class TransportImpl extends ServiceImpl implements Transport {
private final javax.mail.Transport transport;
public TransportImpl(javax.mail.Transport transport){
super(transport);
this.transport = transport;
}
public void send(Message message) throws MessagingException{
transport.send(message.getRealMessage());
}
public void send(Message message, Address[] addresses)
throws MessagingException{
transport.send(message.getRealMessage(), addresses);
}
public void sendMessage(Message message, Address[] addresses)
throws MessagingException{
transport.sendMessage(message.getRealMessage(), addresses);
}
public void addTransportListener(TransportListener transportListener){
transport.addTransportListener(transportListener);
}
public void removeTransportListener(TransportListener transportListener){
transport.removeTransportListener(transportListener);
}
}
--- NEW FILE: MessageImpl.java ---
package alt.javax.mail;
import com.mockobjects.MockObject;
import javax.mail.MessagingException;
import javax.mail.Address;
import javax.mail.Flags;
import javax.mail.Multipart;
import java.util.Date;
import java.util.Enumeration;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
public class MessageImpl implements Message {
private final javax.mail.Message message;
public MessageImpl(javax.mail.Message message) {
this.message = message;
}
public javax.mail.Message getRealMessage() {
return message;
}
public final Address[] getFrom() throws MessagingException {
return message.getFrom();
}
public final void setFrom() throws MessagingException {
message.setFrom();
}
public final void setFrom(Address address) throws MessagingException {
message.setFrom(address);
}
public final void addFrom(Address[] addresses) throws MessagingException {
message.addFrom(addresses);
}
public final Address[] getRecipients(javax.mail.Message.RecipientType type) throws MessagingException {
return message.getRecipients(type);
}
public final void setRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException {
message.setRecipients(type, addresses);
}
public final void addRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException {
message.addRecipients(type, addresses);
}
public final String getSubject() throws MessagingException {
return message.getSubject();
}
public final void setSubject(String s) throws MessagingException {
message.setSubject(s);
}
public final Date getSentDate() throws MessagingException {
return message.getSentDate();
}
public final void setSentDate(Date date) throws MessagingException {
message.setSentDate(date);
}
public final Date getReceivedDate() throws MessagingException {
return message.getReceivedDate();
}
public final Flags getFlags() throws MessagingException {
return message.getFlags();
}
public final void setFlags(Flags flags, boolean b) throws MessagingException {
message.setFlags(flags, b);
}
public final Message reply(boolean b) throws MessagingException {
return new MessageImpl(message.reply(b));
}
public final void saveChanges() throws MessagingException {
message.saveChanges();
}
public final int getSize() throws MessagingException {
return message.getSize();
}
public final int getLineCount() throws MessagingException {
return message.getLineCount();
}
public final String getContentType() throws MessagingException {
return message.getContentType();
}
public final boolean isMimeType(String s) throws MessagingException {
return message.isMimeType(s);
}
public final String getDisposition() throws MessagingException {
return message.getDisposition();
}
public final void setDisposition(String s) throws MessagingException {
message.setDisposition(s);
}
public final String getDescription() throws MessagingException {
return message.getDescription();
}
public final void setDescription(String s) throws MessagingException {
message.setDescription(s);
}
public final String getFileName() throws MessagingException {
return message.getFileName();
}
public final void setFileName(String s) throws MessagingException {
message.setFileName(s);
}
public final InputStream getInputStream() throws IOException, MessagingException {
return message.getInputStream();
}
public final javax.activation.DataHandler getDataHandler() throws MessagingException {
return message.getDataHandler();
}
public final Object getContent() throws IOException, MessagingException {
return message.getContent();
}
public final void setDataHandler(javax.activation.DataHandler handler) throws MessagingException {
message.setDataHandler(handler);
}
public final void setContent(Object o, String s) throws MessagingException {
message.setContent(o, s);
}
public final void setText(String s) throws MessagingException {
message.setText(s);
}
public final void setContent(Multipart multipart) throws MessagingException {
message.setContent(multipart);
}
public final void writeTo(OutputStream stream) throws IOException, MessagingException {
message.writeTo(stream);
}
public final String[] getHeader(String s) throws MessagingException {
return message.getHeader(s);
}
public final void setHeader(String s, String s1) throws MessagingException {
message.setHeader(s, s1);
}
public final void addHeader(String s, String s1) throws MessagingException {
message.addHeader(s, s1);
}
public final void removeHeader(String s) throws MessagingException {
message.removeHeader(s);
}
public final Enumeration getAllHeaders() throws MessagingException {
return message.getAllHeaders();
}
public final Enumeration getMatchingHeaders(String[] strings) throws MessagingException {
return message.getAllHeaders();
}
public final Enumeration getNonMatchingHeaders(String[] strings) throws MessagingException {
return message.getNonMatchingHeaders(strings);
}
}
--- NEW FILE: ServiceImpl.java ---
package alt.javax.mail;
import javax.mail.MessagingException;
import javax.mail.URLName;
import javax.mail.event.ConnectionListener;
public class ServiceImpl implements Service {
private final javax.mail.Service service;
public ServiceImpl(javax.mail.Service service){
this.service = service;
}
public void connect() throws MessagingException{
service.connect();
}
public void connect(String host, String user, String password)
throws MessagingException{
service.connect(host, user, password);
}
public void connect(String host, int port, String user, String password)
throws MessagingException{
service.connect(host, port, user, password);
}
public boolean isConnected(){
return service.isConnected();
}
public void close() throws MessagingException{
service.close();
}
public URLName getURLName(){
return service.getURLName();
}
public void addConnectionListener(ConnectionListener connectionListener){
service.addConnectionListener(connectionListener);
}
public void removeConnectionListener(ConnectionListener connectionListener){
service.removeConnectionListener(connectionListener);
}
public String toString(){
return service.toString();
}
}
|