Source Code Cross Referenced for MailetConfigImpl.java in  » Net » james-2.3.1 » org » apache » james » core » 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 » Net » james 2.3.1 » org.apache.james.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /****************************************************************
002:         * Licensed to the Apache Software Foundation (ASF) under one   *
003:         * or more contributor license agreements.  See the NOTICE file *
004:         * distributed with this work for additional information        *
005:         * regarding copyright ownership.  The ASF licenses this file   *
006:         * to you under the Apache License, Version 2.0 (the            *
007:         * "License"); you may not use this file except in compliance   *
008:         * with the License.  You may obtain a copy of the License at   *
009:         *                                                              *
010:         *   http://www.apache.org/licenses/LICENSE-2.0                 *
011:         *                                                              *
012:         * Unless required by applicable law or agreed to in writing,   *
013:         * software distributed under the License is distributed on an  *
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
015:         * KIND, either express or implied.  See the License for the    *
016:         * specific language governing permissions and limitations      *
017:         * under the License.                                           *
018:         ****************************************************************/package org.apache.james.core;
019:
020:        import org.apache.avalon.framework.configuration.Configuration;
021:        import org.apache.avalon.framework.configuration.ConfigurationException;
022:        import org.apache.mailet.MailetConfig;
023:        import org.apache.mailet.MailetContext;
024:
025:        import java.util.Iterator;
026:
027:        /**
028:         * Implements the configuration object for a Mailet.
029:         *
030:         * @version CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $
031:         */
032:        public class MailetConfigImpl implements  MailetConfig {
033:
034:            /**
035:             * The mailet MailetContext
036:             */
037:            private MailetContext mailetContext;
038:
039:            /**
040:             * The mailet name
041:             */
042:            private String name;
043:
044:            //This would probably be better.
045:            //Properties params = new Properties();
046:            //Instead, we're tied to the Configuration object
047:            /**
048:             * The mailet Avalon Configuration
049:             */
050:            private Configuration configuration;
051:
052:            /**
053:             * No argument constructor for this object.
054:             */
055:            public MailetConfigImpl() {
056:            }
057:
058:            /**
059:             * Get the value of an parameter stored in this MailetConfig.  Multi-valued
060:             * parameters are returned as a comma-delineated string.
061:             *
062:             * @param name the name of the parameter whose value is to be retrieved.
063:             *
064:             * @return the parameter value
065:             */
066:            public String getInitParameter(String name) {
067:                try {
068:                    String result = null;
069:
070:                    final Configuration[] values = configuration
071:                            .getChildren(name);
072:                    for (int i = 0; i < values.length; i++) {
073:                        if (result == null) {
074:                            result = "";
075:                        } else {
076:                            result += ",";
077:                        }
078:                        Configuration conf = values[i];
079:                        result += conf.getValue();
080:                    }
081:                    return result;
082:                } catch (ConfigurationException ce) {
083:                    throw new RuntimeException(
084:                            "Embedded configuration exception was: "
085:                                    + ce.getMessage());
086:                }
087:
088:            }
089:
090:            /**
091:             * Returns an iterator over the set of configuration parameter names.
092:             *
093:             * @return an iterator over the set of configuration parameter names.
094:             */
095:            public Iterator getInitParameterNames() {
096:                return new Iterator() {
097:                    Configuration[] children;
098:                    int count = 0;
099:                    {
100:                        children = configuration.getChildren();
101:                    }
102:
103:                    public boolean hasNext() {
104:                        return count < children.length;
105:                    }
106:
107:                    public Object next() {
108:                        return children[count++].getName();
109:                    }
110:
111:                    public void remove() {
112:                        throw new UnsupportedOperationException(
113:                                "remove not supported");
114:                    }
115:                };
116:            }
117:
118:            /**
119:             * Get the value of an (XML) attribute stored in this MailetConfig.
120:             *
121:             * @param name the name of the attribute whose value is to be retrieved.
122:             *
123:             * @return the attribute value or null if missing
124:             */
125:            public String getInitAttribute(String name) {
126:                return configuration.getAttribute(name, null);
127:            }
128:
129:            /**
130:             * Get the mailet's MailetContext object.
131:             *
132:             * @return the MailetContext for the mailet
133:             */
134:            public MailetContext getMailetContext() {
135:                return mailetContext;
136:            }
137:
138:            /**
139:             * Get the mailet's Avalon Configuration object.
140:             *
141:             * @return the Configuration for the mailet
142:             */
143:            public void setMailetContext(MailetContext newContext) {
144:                mailetContext = newContext;
145:            }
146:
147:            /**
148:             * Set the Avalon Configuration object for the mailet.
149:             *
150:             * @param newConfiguration the new Configuration for the mailet
151:             */
152:            public void setConfiguration(Configuration newConfiguration) {
153:                configuration = newConfiguration;
154:            }
155:
156:            /**
157:             * Get the name of the mailet.
158:             *
159:             * @return the name of the mailet
160:             */
161:            public String getMailetName() {
162:                return name;
163:            }
164:
165:            /**
166:             * Set the name for the mailet.
167:             *
168:             * @param newName the new name for the mailet
169:             */
170:            public void setMailetName(String newName) {
171:                name = newName;
172:            }
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.