FileDocCategorySizeDatePackage
DeploymentProperties.javaAPI DocGlassfish v2 API20415Fri May 04 22:31:58 BST 2007com.sun.enterprise.deployment.util

DeploymentProperties

public class DeploymentProperties extends Properties
This properties are used to transfer information between deployment clients and server
author
Sandhya E

Fields Summary
static final long
serialVersionUID
public static final String
WSDL_TARGET_HINT
public static final String
TARGET
public static final String
REDEPLOY
public static final String
DEFAULT_REDEPLOY
public static final String
FORCE
public static final String
DEFAULT_FORCE
public static final String
RELOAD
public static final String
DEFAULT_RELOAD
public static final String
CASCADE
public static final String
DEFAULT_CASCADE
public static final String
VERIFY
public static final String
DEFAULT_VERIFY
public static final String
VIRTUAL_SERVERS
public static final String
DEFAULT_VIRTUAL_SERVERS
public static final String
PRECOMPILE_JSP
public static final String
DEFAULT_PRECOMPILE_JSP
public static final String
GENERATE_RMI_STUBS
public static final String
DEFAULT_GENERATE_RMI_STUBS
public static final String
AVAILABILITY_ENABLED
public static final String
DEFAULT_AVAILABILITY_ENABLED
public static final String
ENABLE
public static final String
DEFAULT_ENABLE
public static final String
CONTEXT_ROOT
public static final String
ARCHIVE_NAME
public static final String
NAME
public static final String
TYPE
public static final String
DESCRIPTION
public static final String
CLIENTJARREQUESTED
public static final String
UPLOAD
public static final String
EXTERNALLY_MANAGED
public static final String
MODULE_ID
public static final String
KEY_PREFIX
public static final String
DEPLOY_OPTION_FORCE_KEY
public static final String
DEPLOY_OPTION_CASCADE_KEY
public static final String
DEPLOY_OPTION_VERIFY_KEY
public static final String
DEPLOY_OPTION_VIRTUAL_SERVERS_KEY
public static final String
DEPLOY_OPTION_PRECOMPILE_JSP_KEY
public static final String
DEPLOY_OPTION_ENABLE_KEY
public static final String
DEPLOY_OPTION_CONTEXT_ROOT_KEY
public static final String
DEPLOY_OPTION_NAME_KEY
public static final String
DEPLOY_OPTION_DESCRIPTION_KEY
public static final String
DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY
public static final String
DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY
public static final String
DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY
public static final String
DEPLOY_OPTION_LIBRARIES_KEY
public static final String
DEFAULT_JAVA_WEB_START_ENABLED
public static final String
DEFAULT_UPLOAD
public static final String
DEFAULT_EXTERNALLY_MANAGED
public static final String
RESOURCE_ACTION
public static final String
RESOURCE_TARGET_LIST
public static final String
RES_DEPLOYMENT
public static final String
RES_CREATE_REF
public static final String
RES_DELETE_REF
public static final String
RES_UNDEPLOYMENT
public static final String
RES_REDEPLOYMENT
public static final String
RES_NO_OP
static Map
keyMap
Constructors Summary
public DeploymentProperties()


      
        super();
    
public DeploymentProperties(Properties props)

        super();
	putAll(props);
    
public DeploymentProperties(Map map)

        super();
        if (map == null) {
            return;
        }
        Properties props = new Properties();
        for (Iterator itr = map.keySet().iterator(); itr.hasNext();) {
            String mapKey = (String) itr.next();
            String mapValue = (String) map.get(mapKey);
            String propsKey = (String) keyMap.get(mapKey);
            if (mapValue != null) {
                // for public keys, we need to convert
                if (propsKey != null) {
                    props.put(propsKey, mapValue);
                }
                // for internal keys and new keys, we just add it 
                // without conversion
                else {
                    props.put(mapKey, mapValue);
                }
            }
        }
        putAll(props);
    
Methods Summary
public java.lang.StringgetArchiveName()

        return getProperty(ARCHIVE_NAME, null);
    
public booleangetAvailabilityEnabled()

        return Boolean.valueOf(getProperty(AVAILABILITY_ENABLED,DEFAULT_AVAILABILITY_ENABLED)).booleanValue();
    
public booleangetCascade()

        return Boolean.valueOf(getProperty(CASCADE,DEFAULT_CASCADE)).booleanValue();
    
public java.lang.StringgetContextRoot()

        return getProperty(CONTEXT_ROOT, null);
    
private java.lang.StringgetDefaultComponentName(java.lang.String filePath)

        final String fileName = new File(filePath).getName();
        int toIndex = fileName.lastIndexOf('.");
        if (toIndex < 0) {
            toIndex = fileName.length();
        }
        final String name = fileName.substring(0, toIndex);
        //FIXME check for blank string
        return name;
    
public java.lang.StringgetDefaultContextRoot(java.lang.String filePath)

        return getDefaultComponentName(filePath);
    
public java.lang.StringgetDescription()

        return getProperty(DESCRIPTION, "");
    
public booleangetEnable()

        return Boolean.valueOf(getProperty(ENABLE,DEFAULT_ENABLE)).booleanValue();
    
public booleangetExternallyManaged()

        return Boolean.valueOf(getProperty(EXTERNALLY_MANAGED, DEFAULT_EXTERNALLY_MANAGED)).booleanValue();
    
public booleangetForce()

        return Boolean.valueOf(getProperty(FORCE,DEFAULT_FORCE)).booleanValue();
    
public booleangetGenerateRMIStubs()

        return Boolean.valueOf(getProperty(GENERATE_RMI_STUBS,DEFAULT_GENERATE_RMI_STUBS)).booleanValue();
    
public booleangetJavaWebStartEnabled()

        return Boolean.valueOf(getProperty(DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY, DEFAULT_JAVA_WEB_START_ENABLED)).booleanValue();
    
public java.lang.StringgetLibraries()

        return getProperty(DEPLOY_OPTION_LIBRARIES_KEY, null );
    
public java.lang.StringgetName(java.lang.String filePath)

        return getProperty(NAME, getDefaultComponentName(filePath));
    
public booleangetPrecompileJSP()

        return Boolean.valueOf(getProperty(PRECOMPILE_JSP,DEFAULT_PRECOMPILE_JSP)).booleanValue();
    
public java.util.PropertiesgetPropertiesForInvoke()

        return (Properties)this;
    
public booleangetRedeploy()

        return Boolean.valueOf(getProperty(REDEPLOY, DEFAULT_REDEPLOY)).booleanValue();
    
public booleangetReload()

        return Boolean.valueOf(getProperty(RELOAD,DEFAULT_RELOAD)).booleanValue();
    
public java.lang.StringgetResourceAction()

        return getProperty(RESOURCE_ACTION, null );
    
public java.lang.StringgetResourceTargetList()

        return getProperty(RESOURCE_TARGET_LIST, null );
    
public java.lang.StringgetTarget()

        return getProperty(TARGET, null);
    
public javax.enterprise.deploy.shared.ModuleTypegetType()

        String t = getProperty(TYPE, null);
        if ( t != null ) {
            return ModuleType.getModuleType((Integer.valueOf(t)).intValue());
        }
        return null;
    
public booleangetUpload()

        return Boolean.valueOf(getProperty(UPLOAD, DEFAULT_UPLOAD)).booleanValue();
    
public booleangetVerify()

        return Boolean.valueOf(getProperty(VERIFY,DEFAULT_VERIFY)).booleanValue();
    
public java.lang.StringgetVirtualServers()

        return getProperty(VIRTUAL_SERVERS , DEFAULT_VIRTUAL_SERVERS);
    
public java.lang.StringgetWsdlTargetHint()
This set of get and set for WSDL_TARGET_HINT is to enable back generate WSDL with the host and port info of the actual server target in case only one target has been specified by the client; Refer to bug ID 6157923 for more details

        return getProperty(WSDL_TARGET_HINT, null);
    
private static voidinitializeKeyMap()

        keyMap = new HashMap();
//        keyMap.put(REDEPLOY, DEPLOY_OPTION_REDEPLOY_KEY);
//        keyMap.put(DEPLOY_OPTION_REDEPLOY_KEY, REDEPLOY);
        keyMap.put(FORCE, DEPLOY_OPTION_FORCE_KEY);
        keyMap.put(DEPLOY_OPTION_FORCE_KEY, FORCE);
        keyMap.put(CASCADE, DEPLOY_OPTION_CASCADE_KEY);
        keyMap.put(DEPLOY_OPTION_CASCADE_KEY, CASCADE);
        keyMap.put(VERIFY, DEPLOY_OPTION_VERIFY_KEY);
        keyMap.put(DEPLOY_OPTION_VERIFY_KEY, VERIFY);
        keyMap.put(VIRTUAL_SERVERS, DEPLOY_OPTION_VIRTUAL_SERVERS_KEY);
        keyMap.put(DEPLOY_OPTION_VIRTUAL_SERVERS_KEY, VIRTUAL_SERVERS);
        keyMap.put(PRECOMPILE_JSP, DEPLOY_OPTION_PRECOMPILE_JSP_KEY);
        keyMap.put(DEPLOY_OPTION_PRECOMPILE_JSP_KEY, PRECOMPILE_JSP);
        keyMap.put(ENABLE, DEPLOY_OPTION_ENABLE_KEY);
        keyMap.put(DEPLOY_OPTION_ENABLE_KEY, ENABLE);
        keyMap.put(CONTEXT_ROOT, DEPLOY_OPTION_CONTEXT_ROOT_KEY);
        keyMap.put(DEPLOY_OPTION_CONTEXT_ROOT_KEY, CONTEXT_ROOT);
        keyMap.put(NAME, DEPLOY_OPTION_NAME_KEY);
        keyMap.put(DEPLOY_OPTION_NAME_KEY, NAME);
        keyMap.put(DESCRIPTION, DEPLOY_OPTION_DESCRIPTION_KEY);
        keyMap.put(DEPLOY_OPTION_DESCRIPTION_KEY, DESCRIPTION);
        keyMap.put(GENERATE_RMI_STUBS, DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY);
        keyMap.put(DEPLOY_OPTION_GENERATE_RMI_STUBS_KEY, GENERATE_RMI_STUBS);
        keyMap.put(AVAILABILITY_ENABLED, DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY);
        keyMap.put(DEPLOY_OPTION_AVAILABILITY_ENABLED_KEY, AVAILABILITY_ENABLED);
    
public static java.util.MappropsToMap(java.util.Properties dProps)

        Map map = new HashMap();
        if (dProps == null) {
            return map;
        }
        for (Iterator itr = dProps.keySet().iterator(); itr.hasNext();) {
            String propsKey = (String) itr.next();
            String propsValue = (String) dProps.get(propsKey);
            String mapKey = (String) keyMap.get(propsKey);
            if (propsValue != null) {
                // for public keys, we need to convert
                if (mapKey != null) {
                    map.put(mapKey, propsValue);
                // for internal keys and new keys, we just add it 
                // without conversion
                } else {
                    map.put(propsKey, propsValue);
                }
            }
        }
        return map;
    
public java.util.Propertiesprune()

        /*Properties propsCopy = props.clone();*/
        remove(FORCE);
        remove(RELOAD);
        remove(CONTEXT_ROOT);
        remove(PRECOMPILE_JSP);
        remove(VERIFY);
        remove(ENABLE);
        remove(VIRTUAL_SERVERS);
        remove(NAME);
        remove(TYPE);
        remove(ARCHIVE_NAME);
        remove(CASCADE);
        remove(REDEPLOY);
        remove(GENERATE_RMI_STUBS);
        remove(AVAILABILITY_ENABLED);
        remove(DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY);  
        remove(DEPLOY_OPTION_LIBRARIES_KEY);
        remove(RESOURCE_ACTION);
        remove(RESOURCE_TARGET_LIST);
        remove(UPLOAD);
        remove(EXTERNALLY_MANAGED);
        return this;
    
public voidsetArchiveName(java.lang.String archiveName)

        if(archiveName != null)
            setProperty(ARCHIVE_NAME, archiveName);
    
public voidsetAvailabilityEnabled(boolean availabilityEnabled)

        setProperty(AVAILABILITY_ENABLED,
                    Boolean.valueOf(availabilityEnabled).toString());
    
public voidsetCascade(boolean cascade)

        setProperty(CASCADE, Boolean.valueOf(cascade).toString());
    
public voidsetContextRoot(java.lang.String contextRoot)

        if(contextRoot != null)
            setProperty(CONTEXT_ROOT, contextRoot);
    
public voidsetDescription(java.lang.String description)

        if(description != null)
            setProperty(DESCRIPTION, description);
    
public voidsetEnable(boolean enable)

        setProperty(ENABLE, Boolean.valueOf(enable).toString());
    
public voidsetExternallyManaged(boolean isExternallyManaged)

        setProperty(EXTERNALLY_MANAGED, Boolean.toString(isExternallyManaged));
    
public voidsetForce(boolean force)

        setProperty(FORCE, Boolean.valueOf(force).toString());
    
public voidsetGenerateRMIStubs(boolean generateRMIStubs)

        setProperty(GENERATE_RMI_STUBS,
                    Boolean.valueOf(generateRMIStubs).toString());
    
public voidsetJavaWebStartEnabled(boolean javaWebStartEnabled)

        setProperty(DEPLOY_OPTION_JAVA_WEB_START_ENABLED_KEY,
                    Boolean.valueOf(javaWebStartEnabled).toString()); 
    
public voidsetLibraries(java.lang.String libraries)

        if(libraries != null) {
            setProperty(DEPLOY_OPTION_LIBRARIES_KEY, libraries);
        }
    
public voidsetName(java.lang.String name)

        if(name != null)
            setProperty(NAME, name);
    
public voidsetPrecompileJSP(boolean precompileJSP)

        setProperty(PRECOMPILE_JSP, Boolean.valueOf(precompileJSP).toString());
    
public voidsetRedeploy(boolean redeploy)

        setProperty(REDEPLOY, Boolean.valueOf(redeploy).toString());
    
public voidsetReload(boolean reload)

        setProperty(RELOAD, Boolean.valueOf(reload).toString());
    
public voidsetResourceAction(java.lang.String resourceAction)

        if(resourceAction != null) {
            setProperty(RESOURCE_ACTION, resourceAction);
        }
    
public voidsetResourceTargetList(java.lang.String resTargetList)

        if(resTargetList != null) {
            setProperty(RESOURCE_TARGET_LIST, resTargetList);
        }
    
public voidsetTarget(java.lang.String target)

        if (target != null)
            setProperty(TARGET, target);
    
public voidsetType(javax.enterprise.deploy.shared.ModuleType type)

        if (type != null) {
            setProperty(TYPE, String.valueOf(type.getValue()));
        }
    
public voidsetUpload(boolean uploadEnabled)

        setProperty(UPLOAD, Boolean.toString(uploadEnabled));
    
public voidsetVerify(boolean verify)

        setProperty(VERIFY, Boolean.valueOf(verify).toString());
    
public voidsetVirtualServers(java.lang.String virtualServers)

        if(virtualServers != null)
	        setProperty(VIRTUAL_SERVERS, virtualServers);
    
public voidsetWsdlTargetHint(java.lang.String target)

        if(target != null) {
            setProperty(WSDL_TARGET_HINT, target);
        }