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