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: * @(#)JbiUninstallSharedLibraryTask.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 shared library.
034: *
035: * @author Sun Microsystems, Inc.
036: */
037: public class JbiUninstallSharedLibraryTask extends JbiTargetTask {
038: /**
039: * success msg key
040: */
041: private static final String SUCCESS_STATUS_KEY = "jbi.ui.ant.uninstall.slib.successful";
042: /**
043: * failure msg key
044: */
045: private static final String FAILED_STATUS_KEY = "jbi.ui.ant.uninstall.slib.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 mSharedLibraryName;
054:
055: /** Getter for property shared library name.
056: * @return Value of property shared library name.
057: *
058: */
059: public String getName() {
060: return this .mSharedLibraryName;
061: }
062:
063: /**
064: * Setter for property shared library name.
065: * @param name shared library name.
066: */
067: public void setName(String name) {
068: this .mSharedLibraryName = name;
069: }
070:
071: /**
072: * Getter for property KeepArchive.
073: * @return Value of property KeepArchive.
074: */
075: public boolean isKeepArchive() {
076:
077: return this .mKeepArchive;
078: }
079:
080: /**
081: * Setter for property KeepArchive.
082: * @param keepArchive New value of property KeepArchive.
083: */
084: public void setKeepArchive(boolean keepArchive) {
085:
086: this .mKeepArchive = keepArchive;
087: }
088:
089: /** executes the uninstall shared library task. Ant Task framework calls this method to
090: * excute the task.
091: * @throws BuildException if error or exception occurs.
092: */
093: public void executeTask() throws BuildException {
094: String slibName = getValidSharedLibraryName(getName());
095: String target = getValidTarget();
096: boolean keepArchive = isKeepArchive();
097: boolean force = false; //TODO remove when the common client api is cleaned up.
098:
099: try {
100: String result;
101:
102: result = this .getJBIAdminCommands().uninstallSharedLibrary(
103: slibName, force, keepArchive, target);
104:
105: printTaskSuccess(result);
106:
107: } catch (Exception ex) {
108: // throwTaskBuildException(ex);
109: processTaskException(ex);
110: }
111:
112: }
113:
114: /**
115: * returns i18n key. tasks implement this method.
116: * @return i18n key for the success status
117: */
118: protected String getTaskFailedStatusI18NKey() {
119: return FAILED_STATUS_KEY;
120: }
121:
122: /**
123: * returns i18n key. tasks implement this method.
124: * @return i18n key for the failed status
125: */
126: protected String getTaskSuccessStatusI18NKey() {
127: return SUCCESS_STATUS_KEY;
128: }
129:
130: }
|