/*  
 * JBoss, Home of Professional Open Source
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.varia.deployment;

import java.net.URL;

import javax.management.ObjectName;

import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.SubDeployerExtMBean;
import org.jboss.mx.util.ObjectNameFactory;

/**
 * MBean interface.
 */
public interface BeanShellSubDeployerMBean extends SubDeployerExtMBean
{
   /** The default ObjectName */
   public static final ObjectName OBJECT_NAME =
      ObjectNameFactory.create("jboss.system:service=BeanShellSubDeployer");

   /**
    * Create a bsh deployment given the script content and name.
    * This creates a temp file using File.createTempFile(scriptName, ".bsh")
    * and then deploys this script via the main deployer.
    * 
    * @param bshScript the bsh script content
    * @param scriptName the bsh script name to use
    * @return the URL of the temporary file used as the deployment script
    * @throws DeploymentException thrown on failure to create the bsh script or deploy it.
    */
   URL createScriptDeployment(String bshScript, String scriptName) throws DeploymentException;

}
