KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > connectors > ConnectorNamingEvent


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.connectors;
24
25 /**
26  * Class representing Connector Naming Event.<br>
27  * Can be used to represent different states. Eg: Object-Bind, Object-Rebind, Object-Remove
28  * @author Jagadish Ramu
29  */

30 public class ConnectorNamingEvent{
31
32     private String JavaDoc jndiName; //name of the object
33
private int eventType;
34     public static final int EVENT_OBJECT_REBIND = 0;
35
36
37     public ConnectorNamingEvent(String JavaDoc jndiName, int eventType){
38         this.jndiName=jndiName;
39         this.eventType= eventType;
40     }
41
42     /**
43      * To get JndiName of the object
44      * @return jndiName
45      */

46     public String JavaDoc getJndiName(){
47         return jndiName;
48     }
49
50     /**
51      * Info about the type of event that has occurred.
52      * @return eventType
53      */

54     public int getEventType(){
55         return eventType;
56     }
57
58     /**
59      * Returns the state of the object
60      * @return String
61      */

62     public String JavaDoc toString(){
63         StringBuffer JavaDoc objectState = new StringBuffer JavaDoc( "ConnectorNamingEvent : " +
64                 "{"+ jndiName +", " + getEventName(eventType) + "}" );
65
66         return objectState.toString();
67     }
68
69     /**
70      * returns the name of event type.
71      * @param eventType
72      * @return eventName
73      */

74     private String JavaDoc getEventName(int eventType){
75
76         String JavaDoc eventName = "Undefined";
77         switch(eventType){
78             case EVENT_OBJECT_REBIND :
79                 eventName= "OBJECT_REBIND_EVENT";
80                 break;
81             default:
82         }
83         return eventName;
84     }
85 }
86
Popular Tags