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: * @(#)JbiStartComponentTask.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 starting the service engine or binding component.
034: *
035: * @author Sun Microsystems, Inc.
036: */
037: public class JbiStartComponentTask extends JbiTargetTask {
038: /**
039: * success msg key
040: */
041: private static final String SUCCESS_STATUS_KEY = "jbi.ui.ant.start.successful";
042: /**
043: * failure msg key
044: */
045: private static final String FAILED_STATUS_KEY = "jbi.ui.ant.start.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 New value of property componentName.
061: */
062: public void setName(String name) {
063: this .mComponentName = name;
064: }
065:
066: /** executes the start component 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: String compName = getValidComponentName(getName());
072: String target = getValidTarget();
073: try {
074: String result;
075:
076: result = this .getJBIAdminCommands().startComponent(
077: compName, target);
078:
079: printTaskSuccess(result);
080:
081: } catch (Exception ex) {
082: // throwTaskBuildException(ex);
083: processTaskException(ex);
084: }
085:
086: }
087:
088: /**
089: * returns i18n key. tasks implement this method.
090: * @return i18n key for the success status
091: */
092: protected String getTaskFailedStatusI18NKey() {
093: return FAILED_STATUS_KEY;
094: }
095:
096: /**
097: * returns i18n key. tasks implement this method.
098: * @return i18n key for the failed status
099: */
100: protected String getTaskSuccessStatusI18NKey() {
101: return SUCCESS_STATUS_KEY;
102: }
103:
104: }
|