KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jndi > browser > model > mail > SessionProxy


1 /*
2  * EJTools, the Enterprise Java Tools
3  *
4  * Distributable under LGPL license.
5  * See terms of license at www.gnu.org.
6  */

7 package org.ejtools.jndi.browser.model.mail;
8
9 import java.util.Properties JavaDoc;
10
11 import javax.mail.Provider JavaDoc;
12 import javax.mail.Session JavaDoc;
13 import javax.naming.Context JavaDoc;
14 import javax.rmi.PortableRemoteObject JavaDoc;
15
16 import org.ejtools.jndi.browser.model.JNDIContext;
17
18 /**
19  * Describe a mail session.
20  *
21  * @author letiemble
22  * @created 13 décembre 2001
23  * @version $Revision: 1.2 $
24  * @todo Javadoc to complete
25  * @javabean:class displayName="Mail Session"
26  * shortDescription="Mail Session"
27  * @javabean:icons color16="/toolbarButtonGraphics/development/JavaMailResource16.gif"
28  * @javabean:property name="name"
29  * class="java.lang.String"
30  * displayName="Name"
31  * shortDescription="Name of the entry"
32  * @javabean:property name="className"
33  * class="java.lang.String"
34  * displayName="Class"
35  * shortDescription="Class of the entry"
36  * @javabean:property name="properties"
37  * class="java.util.Properties"
38  * displayName="Properties"
39  * shortDescription="Properties of the session"
40  * @javabean:property name="providers"
41  * class="javax.mail.Provider"
42  * displayName="Providers"
43  * shortDescription="Providers of the session"
44  */

45 public class SessionProxy extends JNDIContext
46 {
47    /** Description of the Field */
48    protected Session JavaDoc session;
49
50
51    /**
52     * Constructor for the SessionProxy object
53     *
54     * @param context Description of the Parameter
55     * @param jndiName Description of the Parameter
56     * @exception Exception Description of the Exception
57     */

58    public SessionProxy(Context JavaDoc context, String JavaDoc jndiName)
59       throws Exception JavaDoc
60    {
61       // Try to narrow to an EJBHome class
62
Object JavaDoc o = context.lookup(jndiName);
63       session = (Session JavaDoc) PortableRemoteObject.narrow(o, Session JavaDoc.class);
64
65       this.setName(jndiName);
66       this.setClassName(session.getClass().getName());
67    }
68
69
70    /**
71     * Gets the properties attribute of the SessionProxy object
72     *
73     * @return The properties value
74     */

75    public Properties JavaDoc getProperties()
76    {
77       return session.getProperties();
78    }
79
80
81    /**
82     * Gets the providers attribute of the SessionProxy object
83     *
84     * @return The providers value
85     */

86    public Provider JavaDoc[] getProviders()
87    {
88       return session.getProviders();
89    }
90 }
91
Popular Tags