1 19 20 24 25 package org.netbeans.modules.j2ee.sun.ws7.j2ee; 26 27 import java.io.File ; 28 29 import javax.enterprise.deploy.model.DDBean ; 30 import javax.enterprise.deploy.model.DeployableObject ; 31 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 32 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 33 34 import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; 35 import org.netbeans.modules.j2ee.deployment.plugins.api.ConfigurationSupport; 36 37 import org.netbeans.modules.j2ee.sun.share.configbean.EjbJarRoot; 38 import org.netbeans.modules.j2ee.sun.share.configbean.SunONEDeploymentConfiguration; 39 40 41 48 public class WS70ConfigurationSupportImpl extends ConfigurationSupport { 49 50 51 public WS70ConfigurationSupportImpl() { 52 } 53 54 55 58 public void initConfiguration(DeploymentConfiguration config, File [] files, File resourceDir, boolean keepUpdated) throws ConfigurationException { 59 checkConfiguration(config); 60 if(files == null || files.length == 0) { 61 throw new IllegalArgumentException ("Invalid value of the files argument."); 62 } 63 ((SunONEDeploymentConfiguration)config).init(files, resourceDir, keepUpdated); 64 } 65 66 67 70 public void disposeConfiguration(DeploymentConfiguration config) { 71 checkConfiguration(config); 72 ((SunONEDeploymentConfiguration)config).dispose(); 73 } 74 75 76 79 public void ensureResourceDefined(DeploymentConfiguration config, DDBean ddBean) { 80 checkConfiguration(config); 81 if(ddBean == null) { 82 throw new IllegalArgumentException ("DDBean parameter cannot be null."); 83 } 84 ((SunONEDeploymentConfiguration)config).ensureResourceDefined(ddBean); 85 } 86 87 88 91 public void setMappingInfo(DeploymentConfiguration config, OriginalCMPMapping[] mapping){ 92 checkConfiguration(config); 93 SunONEDeploymentConfiguration s1config = (SunONEDeploymentConfiguration) config; 94 EjbJarRoot ejbJarRoot = s1config.getEjbJarRoot(); 95 if(ejbJarRoot != null) { 96 ejbJarRoot.mapCmpBeans(mapping); 97 } 98 } 99 100 101 104 public String getWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj) throws ConfigurationException { 105 checkConfiguration(config); 106 assert config.getDeployableObject() == deplObj; 107 return ((SunONEDeploymentConfiguration)config).getContextRoot(); 108 } 109 110 111 114 public void setWebContextRoot(DeploymentConfiguration config, DeployableObject deplObj, String contextRoot) throws ConfigurationException { 115 checkConfiguration(config); 116 assert config.getDeployableObject() == deplObj; 117 ((SunONEDeploymentConfiguration)config).setContextRoot(contextRoot); 118 } 119 120 121 123 public void updateResourceDir(DeploymentConfiguration config, File resourceDir) { 124 checkConfiguration(config); 125 ((SunONEDeploymentConfiguration) config).updateResourceDir(resourceDir); 126 } 127 128 131 private void checkConfiguration(DeploymentConfiguration config) { 132 if(config == null) { 133 throw new IllegalArgumentException ("DeploymentConfiguration is null"); 134 } 135 if(!(config instanceof SunONEDeploymentConfiguration)) { 136 throw new IllegalArgumentException ("Wrong DeploymentConfiguration instance " + config.getClass().getName()); 137 } 138 } 139 } 140 141 | Popular Tags |