1 19 20 package org.netbeans.modules.j2ee.weblogic9.config; 21 22 import java.io.File ; 23 import javax.enterprise.deploy.model.DDBean ; 24 import javax.enterprise.deploy.model.DeployableObject ; 25 import javax.enterprise.deploy.shared.ModuleType ; 26 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 27 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 28 import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; 29 import org.netbeans.modules.j2ee.deployment.plugins.api.ConfigurationSupport; 30 31 32 37 public class ConfigurationSupportImpl extends ConfigurationSupport { 38 39 public void setMappingInfo(DeploymentConfiguration config, OriginalCMPMapping[] mappings) { 40 } 41 42 public void ensureResourceDefined(DeploymentConfiguration config, DDBean bean) { 43 } 44 45 public String getWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj) 46 throws ConfigurationException { 47 if (config.getDeployableObject().getType() != ModuleType.WAR) { 48 throw new ConfigurationException ("This operation is supported only by the WAR modules"); } 50 if (!(config instanceof WarDeploymentConfiguration)) { 51 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 53 return ((WarDeploymentConfiguration)config).getContextPath(); 54 } 55 56 public void setWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj, String contextRoot) 57 throws ConfigurationException { 58 if (config.getDeployableObject().getType() != ModuleType.WAR) { 59 throw new ConfigurationException ("This operation is supported only by the WAR modules."); } 61 if (!(config instanceof WarDeploymentConfiguration)) { 62 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 64 ((WarDeploymentConfiguration)config).setContextPath(contextRoot); 65 } 66 67 public void initConfiguration(DeploymentConfiguration config, File [] files, 68 File resourceDir, boolean keepUpdated) throws ConfigurationException { 69 if (!(config instanceof WLDeploymentConfiguration)) { 70 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 72 if (files == null || files.length != 1) { 73 throw new IllegalArgumentException ("Invalid value of the files argument."); } 75 ModuleType type = config.getDeployableObject().getType(); 76 if (type == ModuleType.WAR) { 77 ((WarDeploymentConfiguration)config).init(files[0]); 78 } else if (type == ModuleType.EAR) { 79 ((EarDeploymentConfiguration)config).init(files[0]); 80 } else if (type == ModuleType.EJB) { 81 ((EjbDeploymentConfiguration)config).init(files[0]); 82 } else { 83 assert true : "Unsupported module type: " + type.toString(); } 85 } 86 87 public void disposeConfiguration(DeploymentConfiguration config) { 88 if (!(config instanceof WLDeploymentConfiguration)) { 89 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 91 } 92 93 public void updateResourceDir(DeploymentConfiguration config, File resourceDir) { 94 } 96 } 97 | Popular Tags |