KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > event > ApplicationDeployEvent


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  * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
26  *
27  * Copyright 2001-2002 by iPlanet/Sun Microsystems, Inc.,
28  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
29  * All rights reserved.
30  */

31 package com.sun.enterprise.admin.event;
32
33 import com.sun.enterprise.admin.event.BaseDeployEvent;
34 import com.sun.enterprise.server.Constants;
35
36 /**
37  * Application deployment event. This event is generated whenever a J2EE
38  * application is deployed, undeployed or redeployed.
39  */

40 public class ApplicationDeployEvent extends BaseDeployEvent {
41
42     /**
43      * Event type
44      */

45     static final String JavaDoc eventType = ApplicationDeployEvent.class.getName();
46
47     /**
48      * Indicates whether this ApplicationDeployEvent is forced
49      */

50     private boolean forceDeploy = false;
51
52     /**
53      * Indicates whether what load action this ApplicationDeployEvent is for
54      */

55     private int loadUnloadAction;
56
57     /**
58      * Create a new ApplicationDeployEvent for the specified instance,
59      * application and action code.
60      *
61      * @param instance name of the server instance to which application has
62      * been deployed, undeployed, redployed, enabled or disabled.
63      * @param appName name of the application that has been deployed, undeployed
64      * or redeployed
65      * @param actionCode what happened to the application, the valid values are
66      * BaseDeployEvent.DEPLOY, BaseDeployEvent.REDEPLOY,
67      * BaseDeployEvent.UNDEPLOY, BaseDeployEvent.ENABLE or
68      * BaseDeployEvent.DISABLE
69      */

70     public ApplicationDeployEvent(String JavaDoc instance, String JavaDoc appName,
71             String JavaDoc actionCode) {
72         super(eventType, instance, BaseDeployEvent.APPLICATION, appName,
73              actionCode);
74     }
75     
76     /**
77      * Creates a new ApplicationDeployEvent for the specified instance,
78      * application, action code and cascade values
79      */

80     public ApplicationDeployEvent(String JavaDoc instance, String JavaDoc appName,
81             String JavaDoc actionCode, boolean cascade) {
82         super(eventType, instance, BaseDeployEvent.APPLICATION, appName,
83              actionCode, cascade);
84     }
85     /**
86      * Creates a new ApplicationDeployEvent for the specified instance,
87      * application, cascade and forceDeploy values
88      */

89     public ApplicationDeployEvent(String JavaDoc instance, String JavaDoc appName,
90             String JavaDoc actionCode, boolean cascade, boolean forceDeploy) {
91         super(eventType, instance, BaseDeployEvent.APPLICATION, appName,
92              actionCode, cascade);
93         //set ForceDeploy locally
94
setForceDeploy(forceDeploy);
95     }
96
97     /**
98      * Creates a new ApplicationDeployEvent for the specified instance,
99      * application, cascade and forceDeploy, loadUnloadAction values
100      */

101     public ApplicationDeployEvent(String JavaDoc instance, String JavaDoc appName,
102         String JavaDoc actionCode, boolean cascade, boolean forceDeploy,
103         int loadUnloadAction) {
104         super(eventType, instance, BaseDeployEvent.APPLICATION, appName,
105              actionCode, cascade);
106         //set loadUnloadAction locally
107
setForceDeploy(forceDeploy);
108         setLoadUnloadAction(loadUnloadAction);
109     }
110
111     public void setForceDeploy(boolean forceDeploy) {
112         this.forceDeploy = forceDeploy;
113     }
114
115     public boolean getForceDeploy(){
116         return this.forceDeploy;
117     }
118
119     public void setLoadUnloadAction(int loadUnloadAction) {
120         this.loadUnloadAction = loadUnloadAction;
121     }
122
123     public int getLoadUnloadAction(){
124         return this.loadUnloadAction;
125     }
126
127     /**
128      * Get name of the application that was affected by deployment action.
129      */

130     public String JavaDoc getApplicationName() {
131         return getJ2EEComponentName();
132     }
133
134     public String JavaDoc toString() {
135         return "ApplicationDeployEvent -- " + this.getAction() + " " + this.getApplicationName();
136     }
137 }
138
Popular Tags