KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > server > ondemand > entry > ServerEntryHelper


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.server.ondemand.entry;
25
26 import com.sun.enterprise.deployment.Descriptor;
27 import com.sun.enterprise.server.ondemand.OnDemandServer;
28 import javax.management.ObjectName JavaDoc;
29
30 /**
31  * Helper class that can be used by entrypoints to generate
32  * entry events.
33  *
34  * @author Binod PG
35  */

36 public class ServerEntryHelper {
37
38     public static void generateJndiEntryContext(String JavaDoc jndiName) {
39         sendEvent (new EntryContext(jndiName, EntryPoint.JNDI));
40     }
41
42     public static void generatePortEntryContext(Integer JavaDoc port) {
43         sendEvent (new EntryContext(port, EntryPoint.PORT));
44     }
45
46     public static void generateAppLoaderEntryContext(Descriptor desc) {
47         sendEvent (new EntryContext(desc, EntryPoint.APPLOADER));
48     }
49
50     public static void generateStartUpEntryContext(Boolean JavaDoc obj) {
51         sendEvent (new EntryContext(obj, EntryPoint.STARTUP));
52     }
53
54     public static void generateMbeanEntryContext(ObjectName JavaDoc name) {
55         sendEvent (new EntryContext(name, EntryPoint.MBEAN));
56     }
57
58     // Send the event to the listener registered in ondemand server.
59
public static void sendEvent(EntryContext context) {
60         ServerEntryListener listener = OnDemandServer.getServerEntryListener();
61         if (listener != null) {
62             listener.notifyEntry(context);
63         }
64     }
65
66     public static boolean isNotifiedByPortEntryContext(Integer JavaDoc port) {
67         return isNotified(new EntryContext(port, EntryPoint.PORT));
68     }
69
70     public static boolean isNotified(EntryContext context) {
71         ServerEntryListener listener = OnDemandServer.getServerEntryListener();
72         return listener.isNotified(context);
73     }
74     
75 }
76
Popular Tags