Source Code Cross Referenced for EditMailFactoryAction.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » service » mail » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.webapp.jonasadmin.service.mail 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: EditMailFactoryAction.java 9680 2006-10-06 12:08:33Z danesa $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.webapp.jonasadmin.service.mail;
027:
028:        import java.util.ArrayList;
029:        import java.util.Collections;
030:        import java.util.Enumeration;
031:        import java.util.Properties;
032:
033:        import javax.management.ObjectName;
034:
035:        import org.objectweb.jonas.jmx.JonasManagementRepr;
036:        import org.objectweb.jonas.jmx.JonasObjectName;
037:        import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
038:        import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItem;
039:        import org.objectweb.jonas.webapp.jonasadmin.service.ejb.EjbItemByNameComparator;
040:
041:        /**
042:         * Helper for actions for management of Mail Factories
043:         * @author Adriana Danes
044:         */
045:        public abstract class EditMailFactoryAction extends JonasBaseAction {
046:
047:            // Populate the MailFactory form
048:            void populate(ObjectName pObjectName, MailFactoryForm pForm,
049:                    String serverName) throws Exception {
050:                // Set configuration attributes
051:                // - get the jndi name
052:                pForm.setJndiName(getStringAttribute(pObjectName, "Name"));
053:                // - get authentication properties
054:                Properties authProps = (Properties) JonasManagementRepr
055:                        .getAttribute(pObjectName, "AuthenticationProperties",
056:                                serverName);
057:                String username = (String) authProps
058:                        .getProperty("mail.authentication.username");
059:                pForm.setUsername(username);
060:                String password = (String) authProps
061:                        .getProperty("mail.authentication.password");
062:                pForm.setPassword(password);
063:
064:                // - get the mail session properties
065:                Properties sessionProps = (Properties) JonasManagementRepr
066:                        .getAttribute(pObjectName, "SessionProperties",
067:                                serverName);
068:                StringBuffer bufSessionProps = new StringBuffer();
069:                String propName = null;
070:                String propValue;
071:                for (Enumeration propNames = sessionProps.propertyNames(); propNames
072:                        .hasMoreElements();) {
073:                    propName = (String) propNames.nextElement();
074:                    propValue = sessionProps.getProperty(propName);
075:                    bufSessionProps.append(propName);
076:                    bufSessionProps.append("=");
077:                    bufSessionProps.append(propValue);
078:                    bufSessionProps.append(",");
079:                    bufSessionProps.append("\n");
080:                }
081:                if (!sessionProps.isEmpty()) {
082:                    // delete the last 2 chars (, and \n)
083:                    bufSessionProps.delete(bufSessionProps.length() - 2,
084:                            bufSessionProps.length() - 1);
085:                } else {
086:                    // Actually no chars in sessionPropsBuf
087:                    bufSessionProps.append("mail.host=");
088:                }
089:                String sSessionProps = new String(bufSessionProps);
090:                pForm.setSessionProps(sSessionProps);
091:
092:                // Set list of EJBs which use this mail factory
093:                ArrayList al = new ArrayList();
094:                String[] asParam = new String[1];
095:                String[] asSignature = new String[1];
096:                asSignature[0] = "java.lang.String";
097:                asParam[0] = pForm.getJndiName();
098:                ObjectName oObjectName = JonasObjectName.ejbService();
099:                if (JonasManagementRepr.isRegistered(oObjectName, serverName) == true) {
100:                    java.util.Iterator it = ((java.util.Set) JonasManagementRepr
101:                            .invoke(oObjectName, "getMailFactoryDependence",
102:                                    asParam, asSignature, serverName))
103:                            .iterator();
104:                    while (it.hasNext()) {
105:                        al.add(new EjbItem((ObjectName) it.next(), serverName));
106:                    }
107:                    // Sort by name
108:                    Collections.sort(al, new EjbItemByNameComparator());
109:                }
110:
111:                // Set list in form
112:                pForm.setListUsedByEjb(al);
113:            }
114:
115:            // Set the specific properties of a MimePartDataSource
116:            void setMimePartProps(ObjectName pObjectName,
117:                    MailFactoryForm pForm, String serverName) throws Exception {
118:                Properties mimepartProps = (Properties) JonasManagementRepr
119:                        .getAttribute(pObjectName, "MimeMessageProperties",
120:                                serverName);
121:
122:                String to = (String) mimepartProps.getProperty("mail.to");
123:                pForm.setTo(to);
124:
125:                String subject = (String) mimepartProps
126:                        .getProperty("mail.subject");
127:                pForm.setSubject(subject);
128:
129:                String cc = (String) mimepartProps.getProperty("mail.cc");
130:                pForm.setCc(cc);
131:
132:                String bcc = (String) mimepartProps.getProperty("mail.bcc");
133:                pForm.setBcc(bcc);
134:            }
135:        }
www_.___j___ava__2__s_.__c___o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.