FileDocCategorySizeDatePackage
AutoDirReDeployer.javaAPI DocGlassfish v2 API5835Fri May 04 22:34:30 BST 2007com.sun.enterprise.deployment.autodeploy

AutoDirReDeployer

public class AutoDirReDeployer extends AutoDeployer

Fields Summary
private com.sun.enterprise.deployment.backend.DeploymentRequest
req
private static com.sun.enterprise.util.i18n.StringManager
localStrings
Constructors Summary
public AutoDirReDeployer(com.sun.enterprise.deployment.backend.DeploymentRequest req)

		if(req == null)
			throw new IllegalArgumentException("nullarg");
		
		this.req = req;
	
Methods Summary
private java.lang.StringgetString(java.lang.String s)

		return localStrings.getString("enterprise.deployment.AutoDirRedeploy." + s);
	
protected java.util.PropertiesgetUndeployActionProperties(java.lang.String name)

        DeploymentProperties dProps = 
            (DeploymentProperties)super.getUndeployActionProperties(name);
        dProps.setReload(true);
        return (Properties)dProps;
    
booleaninvokeDeploymentService(java.io.File deployablefile, java.lang.String action, java.lang.Object[] params, java.lang.String[] signature)
I had to override this method because of a bunch of AutoDeployer-specific error handling that isn't appropriate here

                boolean status = false;
		try 
		{
			Object result = getMBeanServer().invoke(getMBeanName(), action, params, signature);
                        int returnStatus = parseResult(result);
                        if (returnStatus == DeploymentStatus.SUCCESS ||
                            returnStatus == DeploymentStatus.WARNING) {
                            status = true;
                        } else {
                            status = false;
                        }
		} 
		catch(AutoDeploymentException de)
		{
			throw de;
		}
		catch(Exception e) 
		{
			String msg = "Error in AutoReDeployer.invokeDeploymentService";
			throw new AutoDeploymentException(msg, e);
		} 
		return status;
    
public booleanredeploy()

                boolean status = false;
                int deployResult = DEPLOY_FAILURE;
		try
		{
			init();
			verify();
			File source	= req.getFileSource().getFile();
			String name	= req.getName();

        		deployResult = deploy(source, null, name);
		}
		catch(AutoDeploymentException ade)
		{
			throw ade;
		}
		catch(Exception e)
		{
			throw new AutoDeploymentException("Error in AutoDirReDeployer.redeploy", e);
		}
                status = (deployResult == DEPLOY_SUCCESS);
                return status;
	
private voidverify()

		// make sure we have valid info.

		// first -- only ejb modules and J2EE Apps are supported 
		if(!req.isApplication() && !req.isEjbModule() && !req.isWebModule())
			throw new AutoDeploymentException(getString("wrongType"));

		// make sure it is a directory.  Don't worry about NPE here!
		if(!FileUtils.safeIsDirectory(req.getFileSource().getFile()))
			throw new AutoDeploymentException(getString("notDir") + req.getFileSource().getFile().getAbsolutePath());
			
		// check that there is a valid name.
		if(!StringUtils.ok(req.getName()))
			throw new AutoDeploymentException(getString("noName"));