1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

Support for some MailMessage classes

This commit is contained in:
Kevin Glynn 2011-05-24 12:16:42 +02:00
parent 3858580335
commit 6c56ad244e
7 changed files with 300 additions and 14 deletions

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is
@ -21,4 +21,18 @@
</Iterable>
<Properties>
</Properties>
<Methods>
<Method>
<Imports />
<Java>${this:16}.add(${arg})</Java>
<Params>
<Param>
<Type>T</Type>
<Name>arg</Name>
</Param>
</Params>
<Name>Add</Name>
<Return>System.Int32</Return>
</Method>
</Methods>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>0GSIDSLuObIy5A5XQeRnSw9e3SI=</DigestValue></Reference></SignedInfo><SignatureValue>Nzeb0hweQvI4sxmsPGrCOmTf96j0BFsTeTeXIZadBJsSj3Gh1cUusfgexifD4QasTkG5pmCLOBxCDafzMaFJR7E2A0mMm8+wuEZpPM61Y+curs5qIy1V1Nc1y1f6KNSKDXgoRYDMiLdm7uOtiVlPHGe+FspiAZnUsoKwAMl7qPA=</SignatureValue></Signature></Interface>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
-->
<Class xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:www.twigletsoftware.com:schemas:txtemplate:1:0">
<Imports>
<Import>java.util.ArrayList</Import>
</Imports>
<Java>ArrayList*[T*]</Java>
<Name>System.Collections.ObjectModel.Collection</Name>
<TypeParams>
<Name>T</Name>
</TypeParams>
<Uses />
<Inherits>
<Type>System.Collections.Generic.ICollection*[T]*</Type>
<Type>System.Object</Type>
</Inherits>
<Methods />
<Properties>
</Properties>
<Events />
<Indexers />
<Constructors />
<Fields />
<Casts />
<UnaryOps />
<BinaryOps />
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><DigestValue>Qww/3AmC65jUi40vinuaJOiwdCI=</DigestValue></Reference></SignedInfo><SignatureValue>QoSv3oQ7nNt+WOV1vM0XBGssMAfKPnJu6tki0/GdquFC46ThDY9hon609GvLOpua4pouhFJcSificYtoxbZV/FOzPBemk3N0iEPzCnpa0rs0vrZeWTraffJtNsRWu999gvL4/ODGhZc+LzwEFcyUZxrX03ITsMOuaPL2Ks9pJE0=</SignatureValue></Signature></Class>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is
@ -56,6 +56,13 @@
<Name>GetFullPath</Name>
<Return>System.String</Return>
</Method>
<Method>
<Java>System.getProperty("java.io.tempdir")</Java>
<Params>
</Params>
<Name>GetTempPath</Name>
<Return>System.String</Return>
</Method>
<Method>
<Imports>
<Import>CS2JNet.System.IO.PathSupport</Import>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is
@ -12,8 +12,24 @@
<Java>MailAddressCollection</Java>
<Name>System.Net.Mail.MailAddressCollection</Name>
<Uses />
<Inherits> <Type>System.Object</Type> </Inherits>
<Methods />
<Inherits>
<Type>System.Collections.ObjectModel.Collection*[System.Net.Mail.MailAddress]*</Type>
<Type>System.Object</Type>
</Inherits>
<Methods>
<Method>
<Imports />
<Java>${this:16}.add(${arg})</Java>
<Params>
<Param>
<Type>System.String</Type>
<Name>arg</Name>
</Param>
</Params>
<Name>Add</Name>
<Return>System.Int32</Return>
</Method>
</Methods>
<Properties>
<Property>
<Imports />

View File

@ -0,0 +1,110 @@
/*
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@twigletsoftware.com)
*/
package CS2JNet.System.Net.Mail;
/**
* @author keving
*
*/
public class MailAddress {
private String address, displayName, host, user;
private void parseAddress(String add) {
// TODO: parse address into fields
address = add;
}
public MailAddress(String inAddress) {
parseAddress(inAddress);
}
public MailAddress(String inAddress, String inDisplayName) {
parseAddress(inAddress);
if (inDisplayName != null && inDisplayName.length() > 0)
inAddress = inDisplayName;
}
// TODO:
//public MailAddress(String inAddress, Encoding enc) {
// parseAddress(inAddress);
// if (inDisplayName != null && inDisplayName.length() > 0)
// inAddress = inDisplayName;
//}
/**
* @param displayName the displayName to set
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
/**
* @return the displayName
*/
public String getDisplayName() {
return displayName;
}
/**
* @param host the host to set
*/
public void setHost(String host) {
this.host = host;
}
/**
* @return the host
*/
public String getHost() {
return host;
}
/**
* @param user the user to set
*/
public void setUser(String user) {
this.user = user;
}
/**
* @return the user
*/
public String getUser() {
return user;
}
/**
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* @return the address
*/
public String getAddress() {
return address;
}
}

View File

@ -0,0 +1,106 @@
/*
Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author(s):
Kevin Glynn (kevin.glynn@twigletsoftware.com)
*/
package CS2JNet.System.Net.Mail;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/**
* @author keving
*
*/
public class MailAddressCollection implements Collection<MailAddress> {
List<MailAddress> addresses = new ArrayList<MailAddress>();
@Override
public boolean add(MailAddress arg0) {
return addresses.add(arg0);
}
public boolean add(String arg0) {
return addresses.add(new MailAddress(arg0));
}
@Override
public boolean addAll(Collection<? extends MailAddress> arg0) {
return addresses.addAll(arg0);
}
@Override
public void clear() {
addresses.clear();
}
@Override
public boolean contains(Object arg0) {
return addresses.contains(arg0);
}
@Override
public boolean containsAll(Collection<?> arg0) {
return addresses.containsAll(arg0);
}
@Override
public boolean isEmpty() {
return addresses.isEmpty();
}
@Override
public Iterator<MailAddress> iterator() {
return addresses.iterator();
}
@Override
public boolean remove(Object arg0) {
return addresses.remove(arg0);
}
@Override
public boolean removeAll(Collection<?> arg0) {
return addresses.removeAll(arg0);
}
@Override
public boolean retainAll(Collection<?> arg0) {
return addresses.retainAll(arg0);
}
@Override
public int size() {
return addresses.size();
}
@Override
public Object[] toArray() {
return addresses.toArray();
}
@Override
public <T> T[] toArray(T[] arg0) {
return (T[]) addresses.toArray();
}
}

View File

@ -8,28 +8,28 @@ public class MailMessage
public MailMessage() throws Exception
{
_bcc = new ArrayList();
_cc = new ArrayList();
_to = new ArrayList();
_bcc = new MailAddressCollection();
_cc = new MailAddressCollection();
_to = new MailAddressCollection();
}
private ArrayList _bcc;
private ArrayList _cc;
private ArrayList _to;
private MailAddressCollection _bcc;
private MailAddressCollection _cc;
private MailAddressCollection _to;
private String _body;
private InternetAddress _from;
private String _subject;
public ArrayList getBcc() throws Exception
public MailAddressCollection getBcc() throws Exception
{
return _bcc;
}
public ArrayList getCC() throws Exception
public MailAddressCollection getCC() throws Exception
{
return _cc;
}
public ArrayList getTo() throws Exception
public MailAddressCollection getTo() throws Exception
{
return _to;
}