1 19 20 package org.netbeans.modules.tomcat5.config; 21 22 import java.io.File ; 23 import java.util.Set ; 24 import javax.enterprise.deploy.model.DDBean ; 25 import javax.enterprise.deploy.model.DeployableObject ; 26 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 27 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 28 import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException ; 29 import org.netbeans.modules.j2ee.deployment.common.api.Datasource; 30 import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException; 31 import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; 32 import org.netbeans.modules.j2ee.deployment.plugins.api.ConfigurationSupport; 33 import org.netbeans.modules.tomcat5.config.WebappConfiguration; 34 35 36 41 public class ConfigurationSupportImpl extends ConfigurationSupport { 42 43 public void setMappingInfo(DeploymentConfiguration config, OriginalCMPMapping[] mappings) { 44 } 45 46 public void ensureResourceDefined(DeploymentConfiguration config, DDBean bean) { 47 } 48 49 public String getWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj) 50 throws ConfigurationException { 51 if (!(config instanceof WebappConfiguration)) { 52 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 54 return ((WebappConfiguration)config).getContextPath(); 55 } 56 57 public void setWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj, String contextRoot) 58 throws ConfigurationException { 59 if (!(config instanceof WebappConfiguration)) { 60 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 62 ((WebappConfiguration)config).setContextPath(contextRoot); 63 } 64 65 public void initConfiguration(DeploymentConfiguration config, File [] files, 66 File resourceDir, boolean keepUpdated) throws ConfigurationException { 67 if (!(config instanceof WebappConfiguration)) { 68 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 70 if (files == null || files.length != 1) { 71 throw new IllegalArgumentException ("Invalid value of the files argument."); } 73 ((WebappConfiguration)config).init(files[0]); 74 } 75 76 public void disposeConfiguration(DeploymentConfiguration config) { 77 if (!(config instanceof WebappConfiguration)) { 78 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); } 80 } 81 82 public void updateResourceDir(DeploymentConfiguration config, File resourceDir) { 83 } 85 86 public Set <Datasource> getDatasources(DeploymentConfiguration config) { 87 return ((WebappConfiguration) config).getDatasources(); 88 } 89 90 public Datasource createDatasource(DeploymentConfiguration config, String jndiName, String url, String username, String password, String driver) 91 throws OperationUnsupportedException , ConfigurationException , DatasourceAlreadyExistsException { 92 return ((WebappConfiguration) config).createDatasource(jndiName, url, username, password, driver); 93 } 94 95 public boolean isDatasourceCreationSupported() { 96 return true; 97 } 98 } 99 | Popular Tags |