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