1 19 package org.netbeans.modules.j2ee.websphere6.config; 20 21 import java.io.File ; 22 import javax.enterprise.deploy.model.DDBean ; 23 import javax.enterprise.deploy.model.DeployableObject ; 24 import javax.enterprise.deploy.shared.ModuleType ; 25 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 26 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 27 import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; 28 import org.netbeans.modules.j2ee.deployment.plugins.api.ConfigurationSupport; 29 30 35 public class ConfigurationSupportImpl extends ConfigurationSupport { 36 public void setMappingInfo(DeploymentConfiguration config, OriginalCMPMapping[] mappings) { 37 } 38 39 public void ensureResourceDefined(DeploymentConfiguration config, DDBean bean) { 40 } 41 42 public String getWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj) 43 throws ConfigurationException { 44 45 if (config.getDeployableObject().getType() != ModuleType.WAR) { 46 throw new ConfigurationException ("This operation is supported only by the WAR modules"); } 48 49 if (!(config instanceof WarDeploymentConfiguration)) { 50 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 52 return ((WarDeploymentConfiguration)config).getContextPath(); 53 54 55 } 56 57 public void setWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj, String contextRoot) 58 throws ConfigurationException { 59 if (config.getDeployableObject().getType() != ModuleType.WAR) { 60 throw new ConfigurationException ("This operation is supported only by the WAR modules."); } 62 63 if (!(config instanceof WarDeploymentConfiguration)) { 64 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 66 ((WarDeploymentConfiguration)config).setContextPath(contextRoot); 67 68 } 69 70 public void initConfiguration(DeploymentConfiguration config, File [] files, 71 File resourceDir, boolean keepUpdated) throws ConfigurationException { 72 73 74 if (config==null) { 78 return; 79 } 80 if (!(config instanceof WSDeploymentConfiguration)) { 81 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 83 84 ModuleType type = config.getDeployableObject().getType(); 85 if (type == ModuleType.WAR) { 86 ((WarDeploymentConfiguration)config).init(files); 87 } else if (type == ModuleType.EAR) { 88 ((EarDeploymentConfiguration)config).init(files); 89 } else if (type == ModuleType.EJB) { 90 ((EjbDeploymentConfiguration)config).init(files); 91 } else { 92 assert true : "Unsupported module type: " + type.toString(); } 94 } 95 96 public void disposeConfiguration(DeploymentConfiguration config) { 97 98 if (!(config instanceof WSDeploymentConfiguration)) { 99 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 101 102 } 103 104 public void updateResourceDir(DeploymentConfiguration config, File resourceDir) { 105 } 107 } 108 109 | Popular Tags |