• R/O
  • HTTP
  • SSH
  • HTTPS

BetaProject: 提交

Mail送信先確認プログラムβプロジェクト


Commit MetaInfo

修訂fe7e76aeb05d451764aa0cb32bd69fbd5a457268 (tree)
時間2005-11-05 04:45:28
作者Takuya Ono <Takuya Ono>
CommiterTakuya Ono

Log Message

This commit was manufactured by cvs2svn to create tag 'Rlease0_2'.

Change Summary

  • delete: BetaProject.jpr
  • delete: CodeStyleProfile.xml
  • delete: deploy/mdc.jar
  • delete: src/mdc.deploy
  • delete: src/org/jent/checksmtp/Application.java
  • delete: src/org/jent/checksmtp/ApplicationProperties.java
  • delete: src/org/jent/checksmtp/LDAPSearch.java
  • delete: src/org/jent/checksmtp/Processer.java
  • delete: src/org/jent/checksmtp/SMTPclient.java
  • delete: src/org/jent/checksmtp/SetupFrame.java
  • delete: src/org/jent/checksmtp/SetupFrame_AboutBoxPanel1.java
  • delete: src/org/jent/checksmtp/SmtpBufferedWriter.java
  • delete: src/org/jent/checksmtp/SocketProxy.java
  • delete: src/org/jent/checksmtp/ToListDialog.java

差異

--- a/BetaProject.jpr
+++ /dev/null
@@ -1,115 +0,0 @@
1-<?xml version = '1.0' encoding = 'UTF-8'?>
2-<jpr:project xmlns:jpr="http://xmlns.oracle.com/ide/project">
3- <hash n="component-versions">
4- <value n="oracle.adf.dt.migration.ProjectMigrator" v="10.1.3.0.3"/>
5- <value n="oracle.adfdt.controller.jsf.addin.JSFProjectMigrator" v="10.1.3.0.3"/>
6- <value n="oracle.adfdt.controller.struts.addin.db.ADFStrutsProjectMigrator" v="10.1.3.0.3"/>
7- <value n="oracle.adfdt.controller.struts.addin.StrutsProjectMigrator" v="10.1.3.0.2;10.1.3.0.3"/>
8- <value n="oracle.bm.commonIde.ProjectUpgrader" v="10.1.3.0.3"/>
9- <value n="oracle.ide.model.Project" v="10.1.3.0.2;10.1.3.0.3"/>
10- <value n="oracle.ide.model.ResourcePathsMigrator" v="10.1.3.0.3"/>
11- <value n="oracle.jbo.dt.jclient.migrator.JCProjectMigrator" v="10.1.3.0.3"/>
12- <value n="oracle.jbo.dt.jdevx.ui.appnav.APProjectMigrator" v="10.1.3.0.3"/>
13- <value n="oracle.jdeveloper.dbmodeler.migration.ProjectMigratorHelper" v="10.1.3.0.3"/>
14- <value n="oracle.jdeveloper.offlinedb.migration.OfflineDBProjectMigrator" v="10.1.3.0.2;10.1.3.0.3"/>
15- <value n="oracle.jdevimpl.jsp.JspMigrator" v="10.1.3.0.2;10.1.3.0.3"/>
16- <value n="oracle.jdevimpl.runner.RunConfigurationsMigrator" v="10.1.3.0.3"/>
17- <value n="oracle.jdevimpl.webservices.WebServicesMigratorHelper" v="10.1.3.0.2;10.1.3.0.3"/>
18- <value n="oracle.toplink.addin.migration.TopLinkProjectMigrator" v="10.1.3.0.3"/>
19- </hash>
20- <list n="contentSets">
21- <string v="oracle.jdeveloper.model.PathsConfiguration/javaContentSet"/>
22- <string v="oracle.jdeveloper.model.J2eeSettings/webContentSet"/>
23- <string v="oracle.bm.commonIde.data.project.ModelerProjectSettings/modelersContentSet"/>
24- <string v="oracle.jdeveloper.offlinedb.model.OfflineDBProjectSettings/offlineDBContentSet"/>
25- <string v="oracle.ide.model.ResourcePaths/resourcesContentSet"/>
26- <string v="oracle.toplink.addin.TopLinkProjectSettings/toplinkContentSet"/>
27- </list>
28- <value n="defaultPackage" v="mypackage"/>
29- <hash n="oracle.adf.dt.settings.ADFMSettings">
30- <value n="metafilepackage" v="mypackage"/>
31- </hash>
32- <hash n="oracle.bm.commonIde.data.project.ModelerProjectSettings">
33- <hash n="modelersContentSet">
34- <list n="pattern-filters">
35- <string v="+**"/>
36- </list>
37- <list n="url-path">
38- <url path="model/"/>
39- </list>
40- </hash>
41- <value n="modelersVersion" v="10.13"/>
42- </hash>
43- <hash n="oracle.ide.model.ResourcePaths">
44- <hash n="resourcesContentSet">
45- <list n="pattern-filters">
46- <string v="+*"/>
47- </list>
48- <list n="url-path">
49- <url path="."/>
50- </list>
51- </hash>
52- </hash>
53- <hash n="oracle.jdeveloper.model.J2eeSettings">
54- <value n="j2eeWebAppName" v="BetaProject"/>
55- <value n="j2eeWebContextRoot" v="BetaProject"/>
56- <hash n="webContentSet">
57- <list n="url-path">
58- <url path="public_html/"/>
59- </list>
60- </hash>
61- </hash>
62- <hash n="oracle.jdeveloper.model.PathsConfiguration">
63- <hash n="javaContentSet">
64- <list n="pattern-filters">
65- <string v="+**"/>
66- </list>
67- <list n="url-path">
68- <url path="src/"/>
69- </list>
70- </hash>
71- </hash>
72- <hash n="oracle.jdeveloper.offlinedb.model.OfflineDBProjectSettings">
73- <hash n="offlineDBContentSet">
74- <list n="pattern-filters">
75- <string v="+**"/>
76- </list>
77- <list n="url-path">
78- <url path="database/"/>
79- </list>
80- </hash>
81- </hash>
82- <hash n="oracle.jdeveloper.runner.RunConfigurations">
83- <hash n="runConfigurationDefinitions">
84- <hash n="Default">
85- <value n="custom" v="false"/>
86- <value n="name" v="Default"/>
87- <url n="targetURL" path="src/org/jent/checksmtp/Application.java"/>
88- <value n="VMName" v="server"/>
89- </hash>
90- </hash>
91- <list n="runConfigurationList">
92- <string v="Default"/>
93- </list>
94- </hash>
95- <hash n="oracle.jdevimpl.config.JProjectLibraries">
96- <hash n="jdkReference">
97- <url n="id" path="../../../system/oracle.jdeveloper.10.1.3.34.12/1.5.0_05.jdk"/>
98- <value n="isJDK" v="true"/>
99- <value n="jdkVersion" v="1.5.0_05"/>
100- </hash>
101- </hash>
102- <hash n="oracle.jdevimpl.config.JProjectPaths">
103- <url n="outputDirectory" path="classes/"/>
104- </hash>
105- <hash n="oracle.toplink.addin.TopLinkProjectSettings">
106- <hash n="toplinkContentSet">
107- <list n="pattern-filters">
108- <string v="+**"/>
109- </list>
110- <list n="url-path">
111- <url path="toplink/"/>
112- </list>
113- </hash>
114- </hash>
115-</jpr:project>
--- a/CodeStyleProfile.xml
+++ /dev/null
@@ -1,76 +0,0 @@
1-<?xml version = '1.0' encoding = 'UTF-8'?>
2-<profile xmlns="http://xmlns.oracle.com/jdeveloper/10130/coding-style-profile">
3- <value n="blanklines.after_last_member" v="0"/>
4- <value n="blanklines.before_field" v="1"/>
5- <value n="blanklines.before_first_class" v="0"/>
6- <value n="blanklines.before_first_member" v="0"/>
7- <value n="blanklines.before_member_class" v="1"/>
8- <value n="blanklines.before_method" v="1"/>
9- <value n="blanklines.empty_anonymous" v="0"/>
10- <value n="blanklines.empty_block" v="0"/>
11- <value n="blanklines.empty_class" v="0"/>
12- <value n="blanklines.empty_method" v="0"/>
13- <value n="blanklines.imports_after" v="1"/>
14- <value n="blanklines.package_after" v="1"/>
15- <value n="blanklines.preserve_count" v="2"/>
16- <value n="field.prefix"/>
17- <value n="field.suffix"/>
18- <value n="import.group_imports" v="true"/>
19- <value n="import.group_package_depth" v="2"/>
20- <value n="import.inner_class_name" v="false"/>
21- <value n="import.narrow_threshold" v="-1"/>
22- <value n="indent.block_children" v="true"/>
23- <value n="indent.class_members" v="true"/>
24- <value n="indent.control_blocks" v="false"/>
25- <value n="indent.num_spaces" v="2"/>
26- <value n="indent.replace_with_tabs" v="false"/>
27- <value n="indent.switch_case" v="false"/>
28- <value n="indent.tab_size" v="8"/>
29- <value n="local.variable.prefix"/>
30- <value n="local.variable.suffix"/>
31- <value n="newline.array_braces" v="false"/>
32- <value n="newline.block_braces" v="false"/>
33- <value n="newline.catch" v="false"/>
34- <value n="newline.class_braces" v="false"/>
35- <value n="newline.else" v="false"/>
36- <value n="newline.extends" v="false"/>
37- <value n="newline.finally" v="false"/>
38- <value n="newline.implements" v="false"/>
39- <value n="newline.method_braces" v="false"/>
40- <value n="newline.throws" v="false"/>
41- <value n="newline.while" v="false"/>
42- <value n="parameter.prefix"/>
43- <value n="parameter.suffix"/>
44- <value n="profile.name" v="Java Code Indent=2"/>
45- <value n="space.arguments_before" v="false"/>
46- <value n="space.assign_around" v="true"/>
47- <value n="space.binaryop_around" v="true"/>
48- <value n="space.brace_before" v="true"/>
49- <value n="space.brackets_within" v="false"/>
50- <value n="space.colon_after" v="true"/>
51- <value n="space.colon_before" v="true"/>
52- <value n="space.comma_after" v="true"/>
53- <value n="space.comma_before" v="false"/>
54- <value n="space.keyword_after" v="true"/>
55- <value n="space.parameters_before" v="false"/>
56- <value n="space.parens_within" v="false"/>
57- <value n="space.question_after" v="true"/>
58- <value n="space.question_before" v="true"/>
59- <value n="space.semicolon_after" v="true"/>
60- <value n="space.semicolon_before" v="false"/>
61- <value n="space.typecast_after" v="false"/>
62- <value n="static.field.prefix"/>
63- <value n="static.field.suffix"/>
64- <value n="wrap.align" v="true"/>
65- <value n="wrap.array_constant" v="1"/>
66- <value n="wrap.binary_operator" v="1"/>
67- <value n="wrap.dot_chain" v="1"/>
68- <value n="wrap.extends" v="1"/>
69- <value n="wrap.for_statement" v="1"/>
70- <value n="wrap.invoke_arguments" v="1"/>
71- <value n="wrap.line_width" v="80"/>
72- <value n="wrap.modifiers" v="1"/>
73- <value n="wrap.parameter_list" v="1"/>
74- <value n="wrap.ques_operator" v="1"/>
75- <value n="wrap.throws" v="1"/>
76-</profile>
Binary files a/deploy/mdc.jar and /dev/null differ
--- a/src/mdc.deploy
+++ /dev/null
@@ -1,36 +0,0 @@
1-<?xml version = '1.0' encoding = 'UTF-8'?>
2-<simple-archive-deployment nselem="simple-archive-deployment" class="oracle.jdeveloper.deploy.jar.ArchiveProfile" xmlns="http://xmlns.oracle.com/jdeveloper/10130/deploy/jar">
3- <archiveOptions>
4- <additionalManifests/>
5- <compressed>true</compressed>
6- <hasManifest>true</hasManifest>
7- <mainClass>org.jent.checksmtp.Application</mainClass>
8- </archiveOptions>
9- <fileGroups>
10- <groups>
11- <Item class="oracle.jdeveloper.deploy.common.PackagingFileGroup" internalName="project-output">
12- <contributors>
13- <Item type="2"/>
14- <Item type="7"/>
15- </contributors>
16- <displayName>Project Output</displayName>
17- <filters>
18- <rules>
19- <Item type="1" pattern="**/CVS/"/>
20- <Item type="1" pattern="**.cdi"/>
21- <Item type="1" pattern="**.contrib"/>
22- <Item type="1" pattern="**.keep"/>
23- <Item type="1" pattern="**.rvi"/>
24- <Item type="1" pattern=".jsps/"/>
25- <Item type="1" pattern=".tags/"/>
26- <Item type="1" pattern=".dtags/"/>
27- <Item type="0" pattern="**"/>
28- </rules>
29- </filters>
30- <targetWithinJar/>
31- </Item>
32- </groups>
33- </fileGroups>
34- <jarURL path="../deploy/mdc.jar"/>
35- <profileDeps/>
36-</simple-archive-deployment>
--- a/src/org/jent/checksmtp/Application.java
+++ /dev/null
@@ -1,47 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.awt.Dimension;
4-import java.awt.Frame;
5-import java.awt.Toolkit;
6-import java.awt.event.WindowAdapter;
7-import java.awt.event.WindowEvent;
8-
9-import javax.swing.UIManager;
10-
11-
12-public class Application {
13- public Application() {
14- Frame frame = new SetupFrame();
15- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
16- Dimension frameSize = frame.getSize();
17-
18- if (frameSize.height > screenSize.height) {
19- frameSize.height = screenSize.height;
20- }
21-
22- if (frameSize.width > screenSize.width) {
23- frameSize.width = screenSize.width;
24- }
25-
26- frame.setLocation((screenSize.width - frameSize.width) / 2,
27- (screenSize.height - frameSize.height) / 2);
28- frame.addWindowListener(new WindowAdapter() {
29- public void windowClosing(WindowEvent e) {
30- System.exit(0);
31- }
32- });
33- frame.setVisible(true);
34- }
35-
36- public static void main(String[] args) {
37- try {
38- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
39- } catch (Exception e) {
40- e.printStackTrace();
41- }
42-
43- new SMTPclient();
44-
45- //new Application();
46- }
47-}
--- a/src/org/jent/checksmtp/ApplicationProperties.java
+++ /dev/null
@@ -1,178 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.io.File;
4-import java.io.FileInputStream;
5-import java.io.FileNotFoundException;
6-import java.io.FileOutputStream;
7-import java.io.IOException;
8-
9-import java.util.Properties;
10-
11-
12-/**
13- * <P>This class hold application properties.</P>
14- * <P>"$user.home/.checksmtp.properties" was used to stored data file.</P>
15- * <H3>Properties</H3>
16- * <DL>
17- * <DT> -.port <DD>Service port number. (Default:8725)
18- * <DT> -.enableRemoteConnect <DD>Permit connect from remote host. (Default:false)
19- * <DT> -.serverHost <DD>STMP Server host name. (Default:mail)
20- * <DT> -.serverPort <DD>STMP Server port. (Default:25)
21- * <DT> -.ladp <DD>If "true" use LDAP search. (Default:false)
22- * <DT> -.ldap.providerUrl <DD>LDAP Provider URL (Default:ldap://localhost:389
23- * <DT> -.ldap.baseDn <DD>LDAP Search root (Default:C=JP)
24- * <DT> -.ldap.isSjis<DD>Addhoc patch: When LDAP Server use SJIS, this propertiy set "true" (Default:false)
25- * <DT> -.ldap.attribues<DD>LDAP Search attribues separate by space (Defaut:cn)
26- * </DL>
27- */
28-public class ApplicationProperties
29-{
30- private static final String PREFIX = "org.jent.checksmtp";
31- private static final String SMTP_PORT = PREFIX + ".port";
32- private static final String SMTP_ENEBLE_REMOTE_CONNECT = PREFIX + ".enableRemoteConnect";
33- private static final String SMTP_SERVER_HOST = PREFIX + ".serverHost";
34- private static final String SMTP_SERVER_PORT = PREFIX + ".serverPort";
35- private static final String LDAP_PREFIX = PREFIX + ".ldap";
36- private static final String LDAP_PROVIDER_URL = LDAP_PREFIX + ".providerUrl";
37- private static final String LDAP_ROOT = LDAP_PREFIX + ".baseDn";
38- private static final String LDAP_IS_SJIS = LDAP_PREFIX + ".isSjis";
39- private static final String LDAP_IS_ATTRIBUTES = LDAP_PREFIX + ".attributes";
40-
41- private static final String PROPERTIES_FILENAME = ".checksmtp.properties";
42-
43- private static Properties applicationProperties = new Properties();
44-
45- private static String fileName = PROPERTIES_FILENAME;
46-
47- static {
48- try
49- {
50- //InputStream is = ApplicationProperties.class.getClassLoader().getResourceAsStream("checksmtp.properties");
51- fileName = System.getProperty("user.home") + File.separator + PROPERTIES_FILENAME;
52- FileInputStream is = new FileInputStream(fileName);
53- applicationProperties.load(is);
54- is.close();
55- }
56- catch (IOException e)
57- {
58- System.err.println("No checksmtp.properties in " + fileName);
59- }
60- }
61-
62- private ApplicationProperties()
63- {
64- }
65-
66- /**
67- * Application Properties Save
68- */
69- public static void save()
70- {
71- FileOutputStream fos;
72- try
73- {
74- fos = new FileOutputStream(fileName);
75- applicationProperties.store(fos, "Appliction Properties");
76- fos.close();
77- }
78- catch (IOException e)
79- {
80- System.err.println(fileName + "was occrred save error.");
81- e.printStackTrace();
82- }
83- }
84-
85- public static String getSmtpServerHost()
86- {
87- return applicationProperties.getProperty(SMTP_SERVER_HOST, "mail");
88- }
89-
90- public static void setSmtpServerHost(String obj)
91- {
92- applicationProperties.setProperty(SMTP_SERVER_HOST, obj);
93- }
94-
95- public static int getSmtpServerPort()
96- {
97- return Integer.parseInt(applicationProperties.getProperty(SMTP_SERVER_PORT, "25"));
98- }
99-
100- public static void setSmtpServerPort(int port)
101- {
102- applicationProperties.setProperty(SMTP_SERVER_PORT, new Integer(port).toString());
103- }
104-
105- public static int getSmtpPort()
106- {
107- return Integer.parseInt(applicationProperties.getProperty(SMTP_PORT, "8725"));
108- }
109-
110- public static void setSmtpPort(int port)
111- {
112- applicationProperties.setProperty(SMTP_PORT, new Integer(port).toString());
113- }
114-
115- public static boolean getSmtpEnebleRemoteConnect()
116- {
117- String str = applicationProperties.getProperty(SMTP_ENEBLE_REMOTE_CONNECT);
118- return new Boolean(str).booleanValue();
119- }
120-
121- public static void setSmtpEnableRemoteConnect(boolean obj)
122- {
123- applicationProperties.setProperty(SMTP_ENEBLE_REMOTE_CONNECT, Boolean.toString(obj));
124- }
125-
126- public static String getLdapProviderURL()
127- {
128- return applicationProperties.getProperty(LDAP_PROVIDER_URL, "ldap://localhost:389");
129- }
130-
131- public static void setLdapProviderURL(String obj)
132- {
133- applicationProperties.setProperty(LDAP_PROVIDER_URL, obj);
134- }
135-
136- public static String getLdapRoot()
137- {
138- return applicationProperties.getProperty(LDAP_ROOT, "C=JP");
139- }
140-
141- public static void setLdapRoot(String obj)
142- {
143- applicationProperties.setProperty(LDAP_ROOT, obj);
144- }
145-
146- public static boolean getLdapIsSjis()
147- {
148- return new Boolean(applicationProperties.getProperty(LDAP_IS_SJIS)).booleanValue();
149- }
150-
151- public static void setLdapRoot(boolean obj)
152- {
153- applicationProperties.setProperty(LDAP_IS_SJIS, Boolean.toString(obj));
154- }
155-
156- public static boolean getLdap()
157- {
158- String str = applicationProperties.getProperty(LDAP_PREFIX);
159- Boolean flg = new Boolean(str);
160- return flg.booleanValue();
161- }
162-
163- public static void setLdap(boolean obj)
164- {
165- applicationProperties.setProperty(LDAP_PREFIX, Boolean.toString(obj));
166- }
167-
168- public static String getLdapAttributes()
169- {
170- return applicationProperties.getProperty(LDAP_IS_ATTRIBUTES, "cn");
171- }
172-
173- public static void setLdapAttributes(String obj)
174- {
175- applicationProperties.setProperty(LDAP_IS_ATTRIBUTES, obj);
176- }
177-
178-}
--- a/src/org/jent/checksmtp/LDAPSearch.java
+++ /dev/null
@@ -1,150 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.io.UnsupportedEncodingException;
4-
5-import java.util.Properties;
6-import java.util.regex.Pattern;
7-
8-import javax.naming.Context;
9-import javax.naming.NameNotFoundException;
10-import javax.naming.NamingEnumeration;
11-import javax.naming.NamingException;
12-import javax.naming.TimeLimitExceededException;
13-import javax.naming.directory.Attribute;
14-import javax.naming.directory.InitialDirContext;
15-import javax.naming.directory.SearchControls;
16-import javax.naming.directory.SearchResult;
17-
18-
19-public class LDAPSearch {
20- static private InitialDirContext ctx = null;
21- static private String lastProviderUrl = null;
22-
23- private LDAPSearch() {
24- }
25-
26- static synchronized private void init() {
27- if ( ApplicationProperties.getLdap() ) {
28- //not initialized ctx or LDAP Provider URL was changed.
29- if ( ctx==null
30- || (!lastProviderUrl.equals(ApplicationProperties.getLdapProviderURL())) ) {
31- try {
32- if ( ctx != null ) { close(); }
33- System.out.println("init LDAP connection.");
34- //InitialDirContext
35- lastProviderUrl = ApplicationProperties.getLdapProviderURL();
36- Properties env = new Properties();
37- env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
38- "com.sun.jndi.ldap.LdapCtxFactory");
39- env.put(Context.PROVIDER_URL, lastProviderUrl);
40-
41- ctx = new InitialDirContext(env);
42- } catch (NamingException e) {
43- System.err.println("LDAPSearch init error.");
44- lastProviderUrl = null;
45- e.printStackTrace();
46- }
47- }
48- }
49- }
50-
51- /**
52- * LDAP connection close.
53- * <P>LDAP connection open is automatical.</P>
54- * <P>If you hope aboid LDAP Server cconnection timeout close, you call close().</P>
55- */
56- public static synchronized void close()
57- {
58- try
59- {
60- if (ctx != null)
61- {
62- System.out.println("close LDAP connection.");
63- ctx.close();
64- ctx = null;
65- }
66- }
67- catch (NamingException e)
68- {
69- System.err.println("LDAPSearch init error.");
70- e.printStackTrace();
71- }
72- }
73-
74- public static String search(String mail) {
75- String ans = "";
76-
77- if (!ApplicationProperties.getLdap()) {
78- return ans;
79- }
80- if ( ctx==null
81- || ( (lastProviderUrl != null)
82- && (!lastProviderUrl.equals(ApplicationProperties.getLdapProviderURL()))
83- )
84- ) {
85- init();
86- }
87-
88- Pattern pattern = Pattern.compile("[ \t]+"); //Attributes separate by space.
89- String[] attrNames = pattern.split(ApplicationProperties.getLdapAttributes());
90-
91- System.err.println("LDAP Serarch= " + mail + " " + attrNames[0]);
92-
93- SearchControls ctrl = new SearchControls();
94- ctrl.setSearchScope(ctrl.SUBTREE_SCOPE);
95- ctrl.setTimeLimit(5000); //5sec
96- ctrl.setCountLimit(3); //I want to get only 1 recodes.
97- ctrl.setReturningAttributes(attrNames);
98-
99- try {
100- NamingEnumeration mailList = ctx.search(ApplicationProperties.getLdapRoot(),
101- "(mail=" + mail + ")", ctrl);
102-
103- while ( mailList.hasMore() ) {
104- SearchResult sr = (SearchResult) mailList.next();
105-
106- //System.out.println("SearchResult=" + sr);
107- for (int i = 0; i < attrNames.length; i++) {
108- Attribute attr = sr.getAttributes().get(attrNames[i]);
109- String str;
110-
111- if (attr == null) {
112- str = "";
113- } else {
114- str = (String) attr.get();
115- }
116- if (str == null) { str = ""; }
117-
118- if (ApplicationProperties.getLdapIsSjis()) {
119- str = new String(str.getBytes("ISO-8859-1"), "UTF-8");
120- }
121- if (i != 0) { ans += " "; }
122- ans += str;
123- }
124- System.err.println("ANS=" + ans);
125- }
126- mailList.close();
127- } catch (TimeLimitExceededException tlEx) {
128- System.out.println("LDAP Search Time Limit.");
129- //IGNORE Exception
130- } catch (NameNotFoundException nnfEx) {
131- System.out.println("LDAP Search Name Not Found.");
132- //IGNORE Exception
133- } catch (NamingException e) {
134- System.err.println("LDAP Search Error.");
135- e.printStackTrace();
136- //ctx reflesh
137- close();
138- } catch (UnsupportedEncodingException ueEx) {
139- UnsupportedEncodingException e = ueEx;
140- System.err.println("LDAP SJIS Error.");
141- e.printStackTrace();
142- } catch (NullPointerException npEx) { //for failsafe.
143- NullPointerException e = npEx;
144- System.err.println("LDAP Unexpected Error.");
145- e.printStackTrace();
146- }
147-
148- return ans;
149- }
150-}
--- a/src/org/jent/checksmtp/Processer.java
+++ /dev/null
@@ -1,284 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.io.BufferedReader;
4-import java.io.IOException;
5-import java.io.InputStream;
6-import java.io.InputStreamReader;
7-import java.io.OutputStream;
8-
9-/*
10- * Socket accept proceed
11- */
12-import java.io.OutputStreamWriter;
13-import java.io.PrintWriter;
14-
15-import java.net.Socket;
16-
17-import java.util.ArrayList;
18-import java.util.ListIterator;
19-import java.util.regex.Pattern;
20-
21-
22-public class Processer implements Runnable {
23- private Socket client;
24-
25- //Conform status.
26- private final int RESULT_UNKNOWN = 0;
27- private final int RESULT_OK = 1;
28- private final int RESULT_NG = 2;
29- private int result = RESULT_UNKNOWN;
30-
31- //SMTP result code
32- private final int R354StartInput = 354;
33- private final int R221ServiceClosing = 221;
34- private final int R451RequestedActionAbort = 451;
35- private final int R502CommandNotImplemented = 502;
36-
37- //SMTP command
38- private final String COMMAND_RCPT_TO = "RCPT TO:";
39- private final String COMMAND_DATA = "DATA";
40- private final String COMMAND_RESET = "RSET";
41- private final String COMMAND_TURN = "TURN";
42-
43- //private final String COMMAND_NOOP = "NOOP";
44- //private final String COMAMND_QUIT = "QUIT";
45- public Processer(Socket client) {
46- this.client = client;
47- }
48-
49- public void run() {
50- InputStream serverInput;
51- OutputStream serverOutput;
52- InputStream clientInput;
53- OutputStream clientOutput;
54-
55- BufferedReader serverReader;
56- PrintWriter serverWriter;
57- BufferedReader clientReader;
58- PrintWriter clientWriter;
59-
60- Socket server = null;
61-
62- try {
63- //Connect to SMTP Server host
64- String servername = ApplicationProperties.getSmtpServerHost();
65-
66- //SMTP Server port
67- int serverport = ApplicationProperties.getSmtpServerPort();
68-
69- //Connection to true SMTP server.
70- server = new Socket(servername, serverport);
71- serverInput = server.getInputStream();
72- serverOutput = server.getOutputStream();
73- clientInput = client.getInputStream();
74- clientOutput = client.getOutputStream();
75-
76- serverReader = new BufferedReader(new InputStreamReader(
77- server.getInputStream()));
78- serverWriter = new PrintWriter(new SmtpBufferedWriter(
79- new OutputStreamWriter(server.getOutputStream(),
80- "ISO-8859-1")), true);
81- clientReader = new BufferedReader(new InputStreamReader(
82- client.getInputStream()));
83- clientWriter = new PrintWriter(new SmtpBufferedWriter(
84- new OutputStreamWriter(client.getOutputStream(),
85- "ISO-8859-1")), true);
86-
87- smtpStart(serverReader, clientWriter, clientReader, serverWriter);
88-
89- //for SMTP Server connection test
90- //SocketProxy forServer = new SocketProxy(clientInput, serverOutput, 0);
91- //SocketProxy forClient = new SocketProxy(serverInput, clientOutput, 1);
92- //Thread forServerThread = new Thread(forServer);
93- //Thread forClientThread = new Thread(forClient);
94- //forServerThread.start();
95- ////Use this ThreadforClientThread.run();
96- server.close();
97- server = null;
98- client.close();
99- client = null;
100- } catch (IOException e) {
101- System.err.println("Execption occurred in Processer.");
102- e.printStackTrace();
103- } finally {
104- //for failsafe Socket close.
105- if (server != null) {
106- try {
107- server.close();
108- } catch (IOException ioEx ) {
109- //IGNORE close Exception
110- }
111- }
112- if (client != null) {
113- try {
114- client.close();
115- } catch (IOException ioEx ) {
116- //IGNORE close Exception
117- }
118- }
119- //LDAP Connection close.
120- LDAPSearch.close();
121- }
122- }
123-
124- private int getCode(String s) {
125- return Integer.parseInt(s.substring(0, 3));
126- }
127-
128- private boolean isContinue(String s) {
129- if ('-' == s.charAt(3)) {
130- return true;
131- }
132-
133- return false;
134- }
135-
136- private boolean isRcptTo(String s) {
137- if (s.startsWith(COMMAND_RCPT_TO)) {
138- return true;
139- }
140-
141- return false;
142- }
143-
144- private boolean isData(String s) {
145- if (s.startsWith(COMMAND_DATA)) {
146- return true;
147- }
148-
149- return false;
150- }
151-
152- private boolean isTurn(String s) {
153- if (s.startsWith(COMMAND_TURN)) {
154- return true;
155- }
156-
157- return false;
158- }
159-
160- public void sayOK() {
161- result = RESULT_OK;
162- notifyResult();
163- }
164-
165- public void sayNG() {
166- result = RESULT_NG;
167- notifyResult();
168- }
169-
170- private synchronized void notifyResult() {
171- notify();
172- }
173-
174- private void smtpStart(BufferedReader serverReader,
175- PrintWriter clientWriter, BufferedReader clientReader,
176- PrintWriter serverWriter) {
177- String line;
178-
179- try {
180- ArrayList toList = new ArrayList();
181-
182- while (true) {
183- //Server responce
184- line = serverReader.readLine();
185- clientWriter.println(line);
186- System.out.println(line);
187-
188- if (isContinue(line)) {
189- continue; //Server responce continue
190- }
191-
192- //Client request
193- if (R221ServiceClosing == getCode(line)) {
194- break; //end of session.
195- } else if (R354StartInput == getCode(line)) {
196- System.out.println("Send mail data.");
197-
198- while (true) {
199- line = clientReader.readLine();
200- serverWriter.println(line);
201-
202- if (line.equals(".")) {
203- break; //end of mail dara.
204- }
205- }
206- } else {
207- while (true) {
208- line = clientReader.readLine();
209-
210- if (isRcptTo(line)) {
211- //stored To: address.
212- toList.add(formatToAddress(line));
213- } else if (isTurn(line)) {
214- System.err.println("'TURN' is unsupported command.");
215- clientWriter.println(R502CommandNotImplemented);
216-
217- continue; //read next client request.
218- } else if (isData(line)) {
219- //Client want to send data. Check out toList.
220- ListIterator iterater = toList.listIterator();
221-
222- while (iterater.hasNext()) {
223- System.out.println("ADDRESS CHECK:" + iterater.next());
224- }
225-
226- //checkout toList
227- new ToListDialog(this, toList);
228-
229- while (result == RESULT_UNKNOWN) {
230- try {
231- synchronized (this) {
232- wait();
233- }
234- } catch (InterruptedException e) {
235- System.err.println("Dialg wait interrupted");
236- e.printStackTrace();
237- }
238- }
239-
240- if (result == RESULT_NG) {
241- System.out.println("CANCEL sending mail.");
242- serverWriter.println(COMMAND_RESET);
243- line = serverReader.readLine(); //Server MUST retrun "250 OK"
244- System.out.println(COMMAND_RESET + ":ANSER is " + line);
245- clientWriter.println(R451RequestedActionAbort);
246-
247- continue; //I think Client QUIT or Retry.
248- }
249- }
250-
251- break; // client read while(true);
252- }
253-
254- serverWriter.println(line);
255- System.out.println(line);
256- }
257- }
258- } catch (IOException e) {
259- e.printStackTrace();
260- }
261-
262- System.out.println("End of Session.");
263- }
264-
265- private String formatToAddress(String line) {
266- System.out.println("FIND To: " + line);
267-
268- //Splitting Mail address.
269- String str = line.substring(COMMAND_RCPT_TO.length() + 1);
270- Pattern pattern = Pattern.compile("[< >]+");
271- String[] address = pattern.split(str); // 0<1>2 3
272- int i;
273-
274- for (i = 0; i < address.length; i++) {
275- if (!address[i].equals("")) {
276- break;
277- }
278- }
279-
280- //Search LDAP
281- str = address[i] + " " + LDAPSearch.search(address[i]);
282- return str;
283- }
284-}
--- a/src/org/jent/checksmtp/SMTPclient.java
+++ /dev/null
@@ -1,59 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.io.IOException;
4-
5-import java.net.InetAddress;
6-import java.net.ServerSocket;
7-import java.net.Socket;
8-
9-
10-public class SMTPclient implements Runnable {
11- public SMTPclient() {
12- Thread thread = new Thread(this);
13- thread.start();
14- }
15-
16- public void run() {
17- while (true) {
18- ServerSocket server = null;
19-
20- try {
21- // Server Port
22- int serverport = ApplicationProperties.getSmtpPort();
23- System.err.println("Open SMTP waiting port. " + serverport);
24-
25- try {
26- if ( ApplicationProperties.getSmtpEnebleRemoteConnect() ) {
27- System.out.println("Enable remote connection.");
28- server = new ServerSocket(serverport, 10);
29- } else {
30- server = new ServerSocket(serverport, 10,
31- InetAddress.getByAddress(
32- new byte[] { 127, 0, 0, 1 }));
33- }
34- } catch (IOException e) {
35- e.printStackTrace(); //Unexpected!!
36- }
37-
38- while (true) {
39- // Wait connect from mail client
40- Socket client = server.accept();
41- System.err.println("Accept new STMP socket.");
42-
43- Processer processer = new Processer(client);
44- Thread clientThread = new Thread(processer);
45- clientThread.start();
46- }
47- } catch (IOException e) {
48- e.printStackTrace();
49- System.err.println("Continure waiting SMTP client.");
50-
51- try {
52- server.close();
53- } catch (IOException ioe) {
54- //IGNORE close Exception
55- }
56- }
57- }
58- }
59-}
--- a/src/org/jent/checksmtp/SetupFrame.java
+++ /dev/null
@@ -1,36 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.awt.BorderLayout;
4-import java.awt.Dimension;
5-import java.awt.event.ActionEvent;
6-import java.awt.event.ActionListener;
7-
8-import javax.swing.JFrame;
9-import javax.swing.JLabel;
10-import javax.swing.JOptionPane;
11-import javax.swing.JPanel;
12-
13-
14-public class SetupFrame extends JFrame {
15- private JLabel statusBar = new JLabel();
16- private JPanel panelCenter = new JPanel();
17- private BorderLayout layoutMain = new BorderLayout();
18-
19- public SetupFrame() {
20- try {
21- jbInit();
22- } catch (Exception e) {
23- e.printStackTrace();
24- }
25- }
26-
27- private void jbInit() throws Exception {
28- this.getContentPane().setLayout(layoutMain);
29- panelCenter.setLayout(null);
30- this.setSize(new Dimension(400, 300));
31- this.setTitle("Setup");
32- statusBar.setText("");
33- this.getContentPane().add(statusBar, BorderLayout.SOUTH);
34- this.getContentPane().add(panelCenter, BorderLayout.CENTER);
35- }
36-}
--- a/src/org/jent/checksmtp/SetupFrame_AboutBoxPanel1.java
+++ /dev/null
@@ -1,53 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.awt.GridBagConstraints;
4-import java.awt.GridBagLayout;
5-import java.awt.Insets;
6-
7-import javax.swing.BorderFactory;
8-import javax.swing.JLabel;
9-import javax.swing.JPanel;
10-import javax.swing.border.Border;
11-
12-
13-public class SetupFrame_AboutBoxPanel1 extends JPanel {
14- private Border border = BorderFactory.createEtchedBorder();
15- private GridBagLayout layoutMain = new GridBagLayout();
16- private JLabel labelCompany = new JLabel();
17- private JLabel labelCopyright = new JLabel();
18- private JLabel labelAuthor = new JLabel();
19- private JLabel labelTitle = new JLabel();
20-
21- public SetupFrame_AboutBoxPanel1() {
22- try {
23- jbInit();
24- } catch (Exception e) {
25- e.printStackTrace();
26- }
27- }
28-
29- private void jbInit() throws Exception {
30- this.setLayout(layoutMain);
31- this.setBorder(border);
32- labelTitle.setText("Title");
33- labelAuthor.setText("Author");
34- labelCopyright.setText("Copyright");
35- labelCompany.setText("Company");
36- this.add(labelTitle,
37- new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
38- GridBagConstraints.WEST, GridBagConstraints.NONE,
39- new Insets(5, 15, 0, 15), 0, 0));
40- this.add(labelAuthor,
41- new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
42- GridBagConstraints.WEST, GridBagConstraints.NONE,
43- new Insets(0, 15, 0, 15), 0, 0));
44- this.add(labelCopyright,
45- new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
46- GridBagConstraints.WEST, GridBagConstraints.NONE,
47- new Insets(0, 15, 0, 15), 0, 0));
48- this.add(labelCompany,
49- new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
50- GridBagConstraints.WEST, GridBagConstraints.NONE,
51- new Insets(0, 15, 5, 15), 0, 0));
52- }
53-}
--- a/src/org/jent/checksmtp/SmtpBufferedWriter.java
+++ /dev/null
@@ -1,42 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.io.BufferedWriter;
4-import java.io.IOException;
5-import java.io.Writer;
6-
7-
8-/**
9- * BufferedWriter for SMTP.
10- * BufferedWriter is use line.separator properties.
11- * SMTP connection use CRLF in end of line.
12- */
13-public class SmtpBufferedWriter extends BufferedWriter {
14- private final String CRLF = "\r\n";
15- private final String LF = "\n";
16- private Writer out;
17-
18- public SmtpBufferedWriter(Writer out) {
19- super(out);
20- this.out = out;
21- }
22-
23- public SmtpBufferedWriter(Writer out, int sz) {
24- super(out, sz);
25- this.out = out;
26- }
27-
28- public void newLine() throws IOException {
29- out.write(CRLF);
30- }
31-
32- /**
33- * @param str
34- * @throws IOException
35- */
36- public void write(String str) throws IOException {
37- if (str.equals(LF)) {
38- str = CRLF;
39- }
40- write(str, 0, str.length());
41- }
42-}
--- a/src/org/jent/checksmtp/SocketProxy.java
+++ /dev/null
@@ -1,39 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.io.IOException;
4-import java.io.InputStream;
5-import java.io.OutputStream;
6-
7-
8-/**
9- * Socket data proxy
10- */
11-public class SocketProxy implements Runnable {
12- InputStream is;
13- OutputStream os;
14- int mode = 0;
15-
16- public SocketProxy(InputStream is, OutputStream os, int mode) {
17- this.is = is;
18- this.os = os;
19- this.mode = mode;
20- }
21-
22- public void run() {
23- System.err.println("Start SocketProxy mode=" + mode + ":" + this);
24-
25- int ch;
26-
27- try {
28- while ((ch = is.read()) > 0) {
29- os.write(ch);
30- System.out.write(ch);
31- }
32- } catch (IOException e) {
33- System.err.println("Exception occured in SocketProxy mode=" + mode);
34- e.printStackTrace();
35- }
36-
37- System.err.println("End SocketProxy mode=" + mode + ":" + this);
38- }
39-}
--- a/src/org/jent/checksmtp/ToListDialog.java
+++ /dev/null
@@ -1,105 +0,0 @@
1-package org.jent.checksmtp;
2-
3-import java.awt.Dimension;
4-import java.awt.Frame;
5-import java.awt.Rectangle;
6-import java.awt.event.ActionEvent;
7-import java.awt.event.ActionListener;
8-import java.awt.event.WindowEvent;
9-
10-import java.util.ArrayList;
11-
12-import javax.swing.JButton;
13-import javax.swing.JDialog;
14-import javax.swing.JList;
15-import javax.swing.JScrollPane;
16-
17-
18-public class ToListDialog extends JDialog {
19- private JButton jButton1 = new JButton();
20- private JButton jButton2 = new JButton();
21- private JList jList1 = new JList();
22- private JScrollPane scrollPane = new JScrollPane(); //add
23- private ArrayList toList = null;
24- private Processer processer = null;
25-
26- public ToListDialog() {
27- this(null, "", false);
28- }
29-
30- public ToListDialog(Frame parent, String title, boolean modal) {
31- super(parent, title, modal);
32-
33- try {
34- jbInit();
35- } catch (Exception e) {
36- e.printStackTrace();
37- }
38- }
39-
40- public ToListDialog(Processer processer, ArrayList toList) {
41- this(null, "TO Check", false);
42- this.toList = toList;
43- this.processer = processer;
44-
45- if (toList != null) {
46- jList1.setListData(toList.toArray());
47-
48- //jList1.update();
49- jList1.setVisible(true);
50- }
51-
52- this.setVisible(true);
53- }
54-
55- private void jbInit() throws Exception {
56- jButton2.addActionListener(new ActionListener() {
57- public void actionPerformed(ActionEvent e) {
58- jButton2_actionPerformed(e);
59- }
60- });
61- this.setSize(new Dimension(584, 300));
62- this.getContentPane().setLayout(null);
63- this.setTitle("Conform Mail Destination");
64- this.addWindowListener(new java.awt.event.WindowAdapter() {
65- public void windowClosing(WindowEvent e) {
66- this_windowClosing(e);
67- }
68- });
69- jButton1.setText("OK");
70- jButton1.setBounds(new Rectangle(100, 240, 140, 25));
71- jButton1.addActionListener(new ActionListener() {
72- public void actionPerformed(ActionEvent e) {
73- jButton1_actionPerformed(e);
74- }
75- });
76- jButton2.setText("CANCEL");
77- jButton2.setBounds(new Rectangle(325, 240, 145, 25));
78- jList1.setBounds(new Rectangle(25, 25, 455, 200));
79- jList1.setSize(new Dimension(500, 200));
80- jList1.setToolTipText("null");
81- jList1.setValueIsAdjusting(true);
82- scrollPane.setBounds(new Rectangle(10, 5, 555, 225));
83- scrollPane.getViewport().setView(jList1); //add
84-
85- //this.getContentPane().add(jList1, null);
86- this.getContentPane().add(scrollPane, null);
87- this.getContentPane().add(jButton2, null);
88- this.getContentPane().add(jButton1, null);
89- }
90-
91- private void jButton1_actionPerformed(ActionEvent e) {
92- //push OK
93- processer.sayOK();
94- this.dispose();
95- }
96-
97- private void jButton2_actionPerformed(ActionEvent e) {
98- processer.sayNG();
99- this.dispose();
100- }
101-
102- private void this_windowClosing(WindowEvent e) {
103- processer.sayNG();
104- }
105-}
Show on old repository browser