001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.servicemix.jbi.management.task;
018
019 import org.apache.servicemix.jbi.framework.AdminCommandsServiceMBean;
020 import org.apache.tools.ant.Project;
021
022 /**
023 * ListSharedLibrariesTask
024 *
025 * @version $Revision:
026 */
027 public class ListSharedLibrariesTask extends JbiTask {
028
029 private String componentName;
030
031 private String sharedLibraryName;
032
033 private String xmlOutput;
034
035 /**
036 * @return the xmlOutput
037 */
038 public String isXmlOutput() {
039 return xmlOutput;
040 }
041
042 /**
043 * @param xmlOutput
044 * the xmlOutput to set
045 */
046 public void setXmlOutput(String xmlOutput) {
047 this.xmlOutput = xmlOutput;
048 }
049
050 /**
051 *
052 * @return component name
053 */
054 public String getComponentName() {
055 return componentName;
056 }
057
058 /**
059 *
060 * @param componentName
061 * The component name to set
062 */
063 public void setComponentName(String componentName) {
064 this.componentName = componentName;
065 }
066
067 /**
068 *
069 * @return shared library name
070 */
071 public String getSharedLibraryName() {
072 return sharedLibraryName;
073 }
074
075 /**
076 *
077 * @param sharedLibraryName
078 * the shared library name to set
079 */
080 public void setSharedLibraryName(String sharedLibraryName) {
081 this.sharedLibraryName = sharedLibraryName;
082 }
083
084 /**
085 * execute the task
086 *
087 * @throws BuildException
088 */
089 public void doExecute(AdminCommandsServiceMBean acs) throws Exception {
090 String result = acs.listSharedLibraries(getComponentName(), getSharedLibraryName());
091 if (xmlOutput != null) {
092 getProject().setProperty(xmlOutput, result);
093 }
094 log(result, Project.MSG_WARN);
095 }
096
097 }