001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)JbiUndeployServiceAssemblyTask.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.ui.ant;
030:
031: import org.apache.tools.ant.BuildException;
032:
033: /** This class is a ant task for undeploying a service assembly.
034: *
035: * @author Sun Microsystems, Inc.
036: */
037: public class JbiUndeployServiceAssemblyTask extends JbiTargetTask {
038: /**
039: * success msg key
040: */
041: private static final String PARTIAL_SUCCESS_STATUS_KEY = "jbi.ui.ant.undeploy.partial.success";
042:
043: /**
044: * success msg key
045: */
046: private static final String SUCCESS_STATUS_KEY = "jbi.ui.ant.undeploy.successful";
047: /**
048: * failure msg key
049: */
050: private static final String FAILED_STATUS_KEY = "jbi.ui.ant.undeploy.failed";
051:
052: /**
053: * Holds value of property KeepArchive.
054: */
055: private boolean mKeepArchive = false;
056:
057: /** Holds value of property ServiceAssemblyName. */
058: private String mServiceAssemblyName;
059:
060: /**
061: * Holds value of property force.
062: */
063: private boolean mForce = false;
064:
065: /**
066: * Getter for property forced.
067: * @return Value of property forced.
068: */
069: public boolean isForce() {
070:
071: return this .mForce;
072: }
073:
074: /**
075: * Setter for property forced.
076: * @param force New value of property forced.
077: */
078: public void setForce(boolean force) {
079:
080: this .mForce = force;
081: }
082:
083: /** Getter for property ServiceAssemblyName.
084: * @return Value of property ServiceAssemblyName.
085: */
086: public String getName() {
087: return this .mServiceAssemblyName;
088: }
089:
090: /** Setter for property ServiceAssemblyName.
091: * @param name New value of property ServiceAssemblyName.
092: */
093: public void setName(String name) {
094: this .mServiceAssemblyName = name;
095: }
096:
097: /**
098: * Getter for property KeepArchive.
099: * @return Value of property KeepArchive.
100: */
101: public boolean isKeepArchive() {
102:
103: return this .mKeepArchive;
104: }
105:
106: /**
107: * Setter for property KeepArchive.
108: * @param keepArchive New value of property KeepArchive.
109: */
110: public void setKeepArchive(boolean keepArchive) {
111:
112: this .mKeepArchive = keepArchive;
113: }
114:
115: /** executes the undeploy service assembly task. Ant Task framework calls this method to
116: * excute the task.
117: * @throws BuildException if error or exception occurs.
118: */
119: public void executeTask() throws BuildException {
120:
121: String saName = getValidServiceAssemblyName(getName());
122: String target = getValidTarget();
123: boolean force = isForce();
124: boolean keepArchive = isKeepArchive();
125: String result = null;
126:
127: try {
128: result = this .getJBIAdminCommands()
129: .undeployServiceAssembly(saName, force,
130: keepArchive, target);
131: } catch (Exception ex) {
132: processTaskException(ex);
133: }
134:
135: processTaskResult(result);
136:
137: }
138:
139: /**
140: * returns i18n key. tasks implement this method.
141: * @return i18n key for the success status
142: */
143: protected String getTaskFailedStatusI18NKey() {
144: return FAILED_STATUS_KEY;
145: }
146:
147: /**
148: * returns i18n key. tasks implement this method.
149: * @return i18n key for the failed status
150: */
151: protected String getTaskSuccessStatusI18NKey() {
152: return SUCCESS_STATUS_KEY;
153: }
154:
155: /**
156: * return i18n key for the partial success
157: * @return i18n key for the partial success
158: */
159: protected String getTaskPartialSuccessStatusI18NKey() {
160: return PARTIAL_SUCCESS_STATUS_KEY;
161: }
162:
163: }
|