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: * @(#)JbiExportApplicationEnvTask.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 exporting the application environment
034: *
035: * @author Sun Microsystems, Inc.
036: */
037: public class JbiExportApplicationEnvTask extends JbiTargetTask {
038: /**
039: * success msg key
040: */
041: private static final String SUCCESS_STATUS_KEY = "jbi.ui.ant.export.app.env.successful";
042: /**
043: * failure msg key
044: */
045: private static final String FAILED_STATUS_KEY = "jbi.ui.ant.export.app.env.failed";
046:
047: /** Holds value of property serviceassemblyname. */
048: private String mServiceAssemblyName;
049:
050: /** Holds value of property configdir . */
051: private String mConfigDir;
052:
053: /** Getter for property serviceassemblyname
054: * @return Value of property serviceassemblyname.
055: *
056: */
057: public String getServiceAssemblyName() {
058: return this .mServiceAssemblyName;
059: }
060:
061: /**
062: * Setter for property serviceassemblyName.
063: * @param serviceAssemblyName service assembly name.
064: */
065: public void setServiceAssemblyName(String serviceAssemblyName) {
066: this .mServiceAssemblyName = serviceAssemblyName;
067: }
068:
069: /** Getter for property configdir
070: * @return Value of property configdir.
071: *
072: */
073: public String getConfigDir() {
074: return this .mConfigDir;
075: }
076:
077: /**
078: * Setter for property configDir.
079: * @param configDir the export direcotry for the config files.
080: */
081: public void setConfigDir(String configDir) {
082: this .mConfigDir = configDir;
083: }
084:
085: /** executes the stop componentnt task. Ant Task framework calls this method to
086: * excute the task.
087: * @throws BuildException if error or exception occurs.
088: */
089: public void executeTask() throws BuildException {
090:
091: String target = getValidTarget();
092:
093: try {
094: String appName = "" + getServiceAssemblyName();
095: String configDir = "" + getConfigDir();
096:
097: this .logDebug("appName: " + appName + " target: " + target
098: + " getConfigDir: " + configDir);
099: String result = this .getJBIAdminCommands()
100: .exportApplicationConfiguration(appName, target,
101: configDir);
102: this .logDebug("Result: " + result);
103:
104: String returnMsg = getI18NBundle().getMessage(
105: "jbi.ui.ant.export.app.env.return.msg",
106: new String[] { configDir });
107: printTaskSuccess(returnMsg);
108:
109: } catch (Exception ex) {
110: processTaskException(ex);
111: }
112:
113: }
114:
115: /**
116: * returns i18n key. tasks implement this method.
117: * @return i18n key for the success status
118: */
119: protected String getTaskFailedStatusI18NKey() {
120: return FAILED_STATUS_KEY;
121: }
122:
123: /**
124: * returns i18n key. tasks implement this method.
125: * @return i18n key for the failed status
126: */
127: protected String getTaskSuccessStatusI18NKey() {
128: return SUCCESS_STATUS_KEY;
129: }
130: }
|