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: * @(#)JbiStopComponentTask.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 stopping the service engine or binding component.
034: *
035: * @author Sun Microsystems, Inc.
036: */
037: public class JbiStopComponentTask extends JbiTargetTask {
038: /**
039: * success msg key
040: */
041: private static final String SUCCESS_STATUS_KEY = "jbi.ui.ant.stop.successful";
042: /**
043: * failure msg key
044: */
045: private static final String FAILED_STATUS_KEY = "jbi.ui.ant.stop.failed";
046:
047: /** Holds value of property componentName. */
048: private String mComponentName;
049:
050: /** Getter for property componentName.
051: * @return Value of property componentName.
052: *
053: */
054: public String getName() {
055: return this .mComponentName;
056: }
057:
058: /**
059: * Setter for property componentName.
060: * @param name component name.
061: */
062: public void setName(String name) {
063: this .mComponentName = name;
064: }
065:
066: /** executes the stop componentnt task. Ant Task framework calls this method to
067: * excute the task.
068: * @throws BuildException if error or exception occurs.
069: */
070: public void executeTask() throws BuildException {
071:
072: String compName = getValidComponentName(getName());
073: String target = getValidTarget();
074:
075: try {
076: String result;
077:
078: result = this .getJBIAdminCommands().stopComponent(compName,
079: target);
080:
081: printTaskSuccess(result);
082:
083: } catch (Exception ex) {
084: // throwTaskBuildException(ex);
085: processTaskException(ex);
086: }
087:
088: }
089:
090: /**
091: * returns i18n key. tasks implement this method.
092: * @return i18n key for the success status
093: */
094: protected String getTaskFailedStatusI18NKey() {
095: return FAILED_STATUS_KEY;
096: }
097:
098: /**
099: * returns i18n key. tasks implement this method.
100: * @return i18n key for the failed status
101: */
102: protected String getTaskSuccessStatusI18NKey() {
103: return SUCCESS_STATUS_KEY;
104: }
105:
106: }
|