Package org.servicemix.jbi.management.task

Source Code of org.servicemix.jbi.management.task.StopAssemblyTask

/**
* <a href="http://servicemix.org">ServiceMix: The open source ESB</a>
*
* Copyright 2005 RAJD Consultancy Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**/

package org.servicemix.jbi.management.task;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tools.ant.BuildException;

import javax.jbi.management.DeploymentServiceMBean;

import java.io.IOException;

/**
* Stop a Service Assembly
*
* @version $Revision: 657 $
*/
public class StopAssemblyTask extends JbiTask {
    private static final Log log = LogFactory.getLog(StopAssemblyTask.class);
    private String assemblyName; //assemblyName

    /**
     * @return Returns the assemblyName.
     */
    public String getAssemblyName() {
        return assemblyName;
    }

    /**
     * @param assemblyName The assemblyName to set.
     */
    public void setAssemblyName(String assemblyName) {
        this.assemblyName = assemblyName;
    }

    /**
     * execute the task
     *
     * @throws BuildException
     */
    public void execute() throws BuildException {
        if (assemblyName == null) {
            throw new BuildException("null assemblyName");
        }
        try {
            DeploymentServiceMBean is = getDeploymentService();
            is.stop(getAssemblyName());
        }
        catch (IOException e) {
            log.error("Caught an exception stopping assembly", e);
            throw new BuildException(e);
        }
        catch (Exception e) {
            log.error("Caught an exception stopping assembly", e);
            throw new BuildException(e);
        }
    }
}
TOP

Related Classes of org.servicemix.jbi.management.task.StopAssemblyTask

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.