KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > server > core > mbean > config > ManagedJavaMailResource


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.admin.server.core.mbean.config;
25
26 //JMX imports
27
import javax.management.*;
28
29 //Config imports
30
import com.sun.enterprise.config.ConfigException;
31 import com.sun.enterprise.config.serverbeans.ServerTags;
32 import com.sun.enterprise.config.serverbeans.ServerXPathHelper;
33 import com.sun.enterprise.config.ConfigContext;
34 import com.sun.enterprise.config.serverbeans.MailResource;
35 import com.sun.enterprise.config.serverbeans.ElementProperty;
36 import com.sun.enterprise.config.ConfigBeansFactory;
37
38 //Admin imports
39
import com.sun.enterprise.admin.util.ArgChecker;
40 import com.sun.enterprise.admin.util.StringValidator;
41 import com.sun.enterprise.admin.common.constant.ConfigAttributeName;
42 import com.sun.enterprise.admin.common.exception.MBeanConfigException;
43 import com.sun.enterprise.admin.common.ObjectNames;
44
45 /**
46     Represents a JavaMail resource.
47
48     ObjectName of this MBean is:
49     ias:instance-name=<instance-name>, name=<jndiName>, component=mail-resource
50 */

51 public class ManagedJavaMailResource extends ConfigMBeanBase implements ConfigAttributeName.MailResource
52 {
53     private static final String JavaDoc[][] MAPLIST =
54     {
55         {kJndiName, ATTRIBUTE + ServerTags.JNDI_NAME},
56 // {kEnabled, ATTRIBUTE + ServerTags.ENABLED},
57
{kStoreProtocol, ATTRIBUTE + ServerTags.STORE_PROTOCOL},
58         {kStoreProtocolClass, ATTRIBUTE + ServerTags.STORE_PROTOCOL_CLASS},
59         {kTransportProtocol, ATTRIBUTE + ServerTags.TRANSPORT_PROTOCOL},
60         {kTransportProtocolClass, ATTRIBUTE + ServerTags.TRANSPORT_PROTOCOL_CLASS},
61         {kHost, ATTRIBUTE + ServerTags.HOST},
62         {kUser, ATTRIBUTE + ServerTags.USER},
63         {kFrom, ATTRIBUTE + ServerTags.FROM},
64         {kDebug, ATTRIBUTE + ServerTags.DEBUG},
65         {kDescription, ATTRIBUTE + PSEUDO_ATTR_DESCRIPTION}
66
67     };
68
69     private static final String JavaDoc[] ATTRIBUTES =
70     {
71         kJndiName + " ,String, R",
72 // kEnabled + " ,boolean, RW",
73
kStoreProtocol + " ,String, RW",
74         kStoreProtocolClass + " ,String, RW",
75         kTransportProtocol + " ,String, RW",
76         kTransportProtocolClass + " ,String, RW",
77         kHost + " ,String, RW",
78         kUser + " ,String, RW",
79         kFrom + " ,String, RW",
80         kDebug + " ,boolean, RW",
81         kDescription + " ,String, RW",
82     };
83
84     private static final String JavaDoc[] OPERATIONS = null;
85
86     /**
87         Default constructor sets MBean description tables
88     */

89     public ManagedJavaMailResource() throws MBeanConfigException
90     {
91         this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS);
92     }
93
94     /**
95         Constructs Config MBean for java mail Resource.
96         @param instanceName The server instance name.
97         @param jndiName JNDI name associated with given resource
98     */

99     public ManagedJavaMailResource(String JavaDoc instanceName,
100                                    String JavaDoc jndiName)
101         throws MBeanConfigException
102     {
103         this(); //set description tables
104
initialize(ObjectNames.kMailResourceType, new String JavaDoc[]{instanceName, jndiName});
105     }
106
107 }
108
Popular Tags