FileDocCategorySizeDatePackage
AppclientModulesManager.javaAPI DocGlassfish v2 API12979Fri May 04 22:34:58 BST 2007com.sun.enterprise.instance

AppclientModulesManager

public class AppclientModulesManager extends ModulesManager
Provides access to app client information per server instance.

Fields Summary
Constructors Summary
public AppclientModulesManager(InstanceEnvironment env)

        super(env, true);
    
public AppclientModulesManager(InstanceEnvironment env, boolean useBackupServerXml)

        super(env, useBackupServerXml);
        
        //FIXME: HACK START
	AppclientModule[] jArray = ((Applications)configBean).getAppclientModule();
	if(jArray!=null) {
            for(int i=0;i<jArray.length;i++) {
                jArray[i].setConfigContext(configContext);
		//jArray[i].setXPath(ServerXPathHelper.getAppIdXpathExpression(jArray[i].getName()));
		jArray[i].setXPath(ServerXPathHelper.getAppClientModuleIdXpathExpression(jArray[i].getName()));
            }
	}
	//FIXME: HACK END
    
Methods Summary
public com.sun.enterprise.config.serverbeans.AppclientModule[]getAllApps()
Returns an array of all applications deployed with the server.

        AppclientModule[] apps = ((Applications)this.configBean).getAppclientModule();
        if(apps == null) return new AppclientModule[0];
        
        ArrayList list = new ArrayList();
        for (int i=0; i<apps.length; i++) {            
            // add the modules to the list if it is referenced
            // by this server
            if ( isReferenced(apps[i].getName()) ) {
                list.add(apps[i]);
            }
        }
        // returns an array of modules referenced by this server
        AppclientModule[] refList = new AppclientModule[list.size()];
        return ( (AppclientModule[]) list.toArray(refList) );      
	
private com.sun.enterprise.config.serverbeans.AppclientModulegetAppclientModule(java.lang.String appId)


        AppclientModule app = (AppclientModule)
            ((Applications)this.configBean).getAppclientModuleByName(appId);

        if(app == null)
			throw new ConfigException(
                Localizer.getValue(ExceptionType.APP_NOT_EXIST));
        return app;
        
    
public java.lang.StringgetDescription(java.lang.String id)

        return getAppclientModule(id).getDescription();
    
public com.sun.enterprise.deployment.ApplicationgetDescriptor(java.lang.String modId, java.lang.ClassLoader cl, java.lang.String modDir, boolean validateXml)
Returns the deployment descriptor object for the connector module in the specified directory.

param
modId web module id
param
modDir The directory containing the web module
param
validateXml use validating parser when true
param
verify true indicates that verifier option is ON
return
the deployment descriptor object for this web module
throws
ConfigException if unable to load the deployment descriptor

	 
        Application application = getRegisteredDescriptor(modId);
        if (application!=null) {
            application.setClassLoader(cl);
            return application;
        }             
	 try {
	     AppClientArchivist appClientArchivist = new AppClientArchivist();
	     appClientArchivist.setXMLValidation(validateXml);
             appClientArchivist.setClassLoader(cl);
	     
	     FileArchive archive = openDDArchive(modId, modDir);
             
             // Try to load the app from the serialized descriptor file.
             SerializedDescriptorHelper.Loader sdLoader =
                     SerializedDescriptorHelper.load(modId, this);
             Application deserializedApplication = sdLoader.getApplication();
             if (deserializedApplication != null) {
                 application = deserializedApplication;
             } else {
                application = ApplicationArchivist.openArchive(modId, appClientArchivist, archive, true);
             }
	     application.setClassLoader(cl);
             application.setGeneratedXMLDirectory(getGeneratedXMLLocation(modId));
             registerDescriptor(modId, application);
             
            // If needed, save this app in serialized form for faster loading next time.
            sdLoader.store(application);
            
            return application;	     
	 } catch (IOException ioe) {
	     throw new ConfigException(Localizer.getValue(
	     ExceptionType.IO_ERROR_LOADING_DD, modId), ioe);
	 } catch (Throwable t) {
	     throw new ConfigException(Localizer.getValue(
	     ExceptionType.FAIL_DD_LOAD, modId), t);
	 }
     
public java.lang.StringgetGeneratedXMLLocation(java.lang.String name)

        ModuleEnvironment menv = instanceEnvironment.getModuleEnvironment(name,
                                                     DeployableObjectType.CAR); 
        return menv.getModuleGeneratedXMLPath();
    
public java.lang.StringgetLocation(java.lang.String appId)

        AppclientModule app = (AppclientModule)
        ((Applications)this.configBean).getAppclientModuleByName(appId);
        return resolvePath(app.getLocation());
    
public javax.enterprise.deploy.shared.ModuleTypegetModuleType()

return
the module type this class is managing

        return ModuleType.CAR;
    
public java.lang.StringgetStubLocation(java.lang.String name)

        ModuleEnvironment menv = instanceEnvironment.getModuleEnvironment(name,
                                                     DeployableObjectType.CAR); 
        return menv.getModuleStubPath();
    
public booleanisEnabled(java.lang.String appId)
There is no persistent state store in domain.xml Hence, return true always.

        return true;
    
public booleanisJavaWebStartEnabled(java.lang.String appId)
Reports whether Java Web Start access is enabled for the specified app client.

param
appId the module ID of the app client to check
return
boolean indicating whether access is permitted

        AppclientModule app = (AppclientModule) ((Applications)this.configBean).getAppclientModuleByName(appId);
        return app.isJavaWebStartEnabled();
    
protected booleanisRegistered(java.lang.String appId, com.sun.enterprise.config.ConfigBean bean)

        ConfigBean cb = null;
        try {
            cb = ((Applications)bean).getAppclientModuleByName(appId);
        } catch(Exception cn) {
        }
        
        if(cb != null) return true;
        return false;
    
public booleanisSystem(java.lang.String appId)
Checks whether this application is a system app appclients are always non-system apps

return
false

        return false;
    
public booleanisSystemAdmin(java.lang.String appId)
Checks whether this application is a system admin app appclients are always non-system apps

return
false

        return false;
    
public booleanisSystemPredeployed(java.lang.String appId)

        return false;
    
public java.util.ListlistIds()
Returns a list of all applications deployed with the server.

        ArrayList arr = new ArrayList();
        AppclientModule[] apps = ((Applications)this.configBean).getAppclientModule();
        if(apps == null) return arr;
            
        for (int i=0;i<apps.length;i++) {
            String name = apps[i].getName();
            // adds the web module to the list if 
            // it is referenced by this server             
            if ( isReferenced(name) ) {
                arr.add(name);
            }
        }        
        return arr;
    
public voidremove(java.lang.String appId)
Removes the application information from the configuration file.

param
appId a unique identifier for the application

        AppclientModule backJa = (AppclientModule)
            ((Applications)configBean).getAppclientModuleByName(appId);
        ((Applications)configBean).removeAppclientModule(backJa);
    
public voidsetDescription(java.lang.String id, java.lang.String desc)

        getAppclientModule(id).setDescription(desc);
    
public voidsetEnable(java.lang.String appId, boolean enabled)
Identifies whether an application is enabled or disabled. Appclients do not need to have a persistent enable state Hence, this method does nothing for now.

param
appId unique idenitifier for the application
param
isEnabled flag for enabling or disabling the application

        //Enabled is not persisted for appclients.
    
public voidsetLocation(java.lang.String appId, java.lang.String location)
Set the location for an App

param
appId unique idenitifier for the application
param
location

        getAppclientModule(appId).setLocation(location);
    
public voidsetOptionalAttributes(java.lang.String appId, java.util.Properties optionalAttributes)
Set the optional attributes for an App This method is required by the base class. Since there are no optional attributes for appclient don't do anything in this method

param
appId unique idenitifier for the application
param
optionalAttributes - pairs tag/value to set

                //Not required for appclient.