KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > util > J2EEModuleCallBackImpl


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 /*
25  * J2EEModuleCallBackImpl.java
26  *
27  * Created on April 29, 2002, 6:26 PM
28  */

29
30 package com.sun.enterprise.management.util;
31
32 import com.sun.enterprise.management.model.J2EEDeployedObjectMdl;
33 import com.sun.enterprise.management.util.J2EEModuleCallBack;
34
35 import javax.management.MBeanException JavaDoc;
36
37 /**
38  *
39  * @author prakash
40  * @version
41  */

42 public class J2EEModuleCallBackImpl implements J2EEModuleCallBack {
43
44     private String JavaDoc name;
45     private String JavaDoc parentName;
46     private String JavaDoc deploymentDescriptor;
47     private String JavaDoc serverName;
48     private J2EEManagementObjectManager mgmtObjectManager;
49     private StartStopCallback sscb;
50
51     public J2EEModuleCallBackImpl(String JavaDoc nm, String JavaDoc pName, String JavaDoc dd,
52                 J2EEManagementObjectManager mgmtObjectManager) {
53         this.name = nm;
54         this.parentName = pName;
55         this.deploymentDescriptor = dd;
56     this.mgmtObjectManager = mgmtObjectManager;
57     }
58
59     public J2EEModuleCallBackImpl(String JavaDoc nm, String JavaDoc pName, String JavaDoc serverName, String JavaDoc dd,
60                                 J2EEManagementObjectManager mgmtObjectManager) {
61         this.name = nm;
62         this.parentName = pName;
63         this.deploymentDescriptor = dd;
64         this.serverName = serverName;
65         this.mgmtObjectManager = mgmtObjectManager;
66     }
67
68     public J2EEModuleCallBackImpl(String JavaDoc nm, String JavaDoc pName, String JavaDoc serverName, String JavaDoc dd,
69                                 StartStopCallback sscb) {
70         this.name = nm;
71         this.parentName = pName;
72         this.deploymentDescriptor = dd;
73         this.serverName = serverName;
74         this.sscb = sscb;
75     }
76
77     public String JavaDoc getDeploymentDescriptor() {
78         return this.deploymentDescriptor;
79     }
80
81     /* Invokes the start method of StartStop callback */
82     public void start(Object JavaDoc module) {
83         try {
84             sscb.startModule((J2EEDeployedObjectMdl)module);
85         } catch (Exception JavaDoc ex) {
86             throw new RuntimeException JavaDoc(ex);
87         }
88     }
89
90     /* Invokes the stop method of StartStop callback */
91     public void stop(Object JavaDoc module) {
92         try {
93             sscb.stopModule((J2EEDeployedObjectMdl)module);
94         } catch (Exception JavaDoc ex) {
95             throw new RuntimeException JavaDoc(ex);
96         }
97     }
98
99     
100     public String JavaDoc getName() {
101         return this.name;
102     }
103     
104     public String JavaDoc getParentName() {
105         return this.parentName;
106     }
107
108     public String JavaDoc getServerName() {
109         return this.serverName;
110     }
111     
112 }
113
Popular Tags