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: * @(#)JbiUninstallComponentTask.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 an ant task for uninstalling a service engine or binding component
034: *
035: * @author Sun Microsystems, Inc.
036: */
037: public class JbiUninstallComponentTask extends JbiTargetTask {
038: /**
039: * success msg key
040: */
041: private static final String SUCCESS_STATUS_KEY = "jbi.ui.ant.uninstall.successful";
042: /**
043: * failure msg key
044: */
045: private static final String FAILED_STATUS_KEY = "jbi.ui.ant.uninstall.failed";
046:
047: /**
048: * Holds value of property KeepArchive.
049: */
050: private boolean mKeepArchive = false;
051:
052: /** Holds value of property componentName. */
053: private String mComponentName;
054:
055: /**
056: * Holds value of property force.
057: */
058: private boolean mForce = false;
059:
060: /**
061: * Getter for property forced.
062: * @return Value of property forced.
063: */
064: public boolean isForce() {
065:
066: return this .mForce;
067: }
068:
069: /**
070: * Setter for property forced.
071: * @param force New value of property forced.
072: */
073: public void setForce(boolean force) {
074:
075: this .mForce = force;
076: }
077:
078: /** Getter for property componentName.
079: * @return Value of property componentName.
080: *
081: */
082: public String getName() {
083: return this .mComponentName;
084: }
085:
086: /**
087: * Setter for property componentName.
088: * @param name component name.
089: */
090: public void setName(String name) {
091: this .mComponentName = name;
092: }
093:
094: /**
095: * Getter for property KeepArchive.
096: * @return Value of property KeepArchive.
097: */
098: public boolean isKeepArchive() {
099:
100: return this .mKeepArchive;
101: }
102:
103: /**
104: * Setter for property KeepArchive.
105: * @param keepArchive New value of property KeepArchive.
106: */
107: public void setKeepArchive(boolean keepArchive) {
108:
109: this .mKeepArchive = keepArchive;
110: }
111:
112: /** executes the uninstall component task. Ant Task framework calls this method to
113: * excute the task.
114: * @throws BuildException if error or exception occurs.
115: */
116: public void executeTask() throws BuildException {
117: String compName = getValidComponentName(getName());
118: String target = getValidTarget();
119: boolean force = isForce();
120:
121: boolean keepArchive = isKeepArchive();
122:
123: try {
124: String result;
125:
126: result = this .getJBIAdminCommands().uninstallComponent(
127: compName, force, keepArchive, target);
128:
129: printTaskSuccess(result);
130:
131: } catch (Exception ex) {
132: // throwTaskBuildException(ex);
133: processTaskException(ex);
134: }
135:
136: }
137:
138: /**
139: * returns i18n key. tasks implement this method.
140: * @return i18n key for the success status
141: */
142: protected String getTaskFailedStatusI18NKey() {
143: return FAILED_STATUS_KEY;
144: }
145:
146: /**
147: * returns i18n key. tasks implement this method.
148: * @return i18n key for the failed status
149: */
150: protected String getTaskSuccessStatusI18NKey() {
151: return SUCCESS_STATUS_KEY;
152: }
153:
154: }
|