KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > AppListenerDescriptorImpl


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 package com.sun.enterprise.deployment;
24
25 import com.sun.enterprise.deployment.web.AppListenerDescriptor;
26
27 /**
28  * Objects exhibiting this interface represent an event listener descriptor.
29  * This represents the <listener-class> XML element defined in the
30  * Servlet 2.3 spec.
31  * @author Vivek Nagar
32  */

33
34 public class AppListenerDescriptorImpl implements AppListenerDescriptor,
35                         java.io.Serializable JavaDoc
36 {
37     private String JavaDoc listenerClass;
38     
39     /** The default constructor.
40     */

41     public AppListenerDescriptorImpl() {
42     }
43     
44     /**
45      * Create an instance of the descriptor with the specified listener class.
46      * @param the listener class name.
47      */

48     public AppListenerDescriptorImpl(String JavaDoc clz) {
49     this.listenerClass = clz;
50     }
51     
52     /**
53      * Return the listener class.
54      * @return the listener class name or empty string if none.
55      */

56     public String JavaDoc getListener() {
57     if (this.listenerClass == null) {
58         this.listenerClass = "";
59     }
60     return this.listenerClass;
61     }
62     
63     /**
64      * Sets the listener class.
65      * @param the listener class name.
66      */

67     public void setListener(String JavaDoc clz) {
68     this.listenerClass = clz;
69     }
70
71     /**
72      * Test for equals
73      */

74     public boolean equals(Object JavaDoc obj) {
75     return (obj instanceof AppListenerDescriptorImpl)?
76         this.getListener().equals(
77         ((AppListenerDescriptorImpl)obj).getListener()) :
78         super.equals(obj);
79     }
80
81     /**
82      * A formatted version of the state as a String.
83      */

84     public void print(StringBuffer JavaDoc toStringBuffer) {
85         toStringBuffer.append("Listener Class ").append(this.getListener());
86     }
87 }
88
89
Popular Tags