1 19 20 package org.netbeans.modules.j2ee.deployment.plugins.api; 21 22 import java.io.File ; 23 import java.util.Collections ; 24 import java.util.HashSet ; 25 import java.util.Set ; 26 import javax.enterprise.deploy.model.DDBean ; 27 import javax.enterprise.deploy.model.DeployableObject ; 28 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 29 import javax.enterprise.deploy.spi.exceptions.ConfigurationException ; 30 import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException ; 31 import org.netbeans.api.project.FileOwnerQuery; 32 import org.netbeans.api.project.Project; 33 import org.netbeans.modules.j2ee.deployment.common.api.Datasource; 34 import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException; 35 import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; 36 import org.netbeans.modules.j2ee.deployment.config.ConfigSupportImpl; 37 import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; 38 import org.netbeans.modules.j2ee.deployment.impl.Server; 39 import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry; 40 import org.openide.filesystems.FileObject; 41 import org.openide.filesystems.FileUtil; 42 import org.openide.util.Lookup; 43 44 45 112 public abstract class ConfigurationSupport { 113 114 121 public abstract void setMappingInfo(DeploymentConfiguration config, 122 OriginalCMPMapping[] mappings); 123 124 130 public abstract void ensureResourceDefined(DeploymentConfiguration config, 131 DDBean bean); 132 133 140 public void ensureResourceDefined(DeploymentConfiguration config, 141 DDBean bean, String jndiName) { 142 } 143 144 156 public abstract String getWebContextRoot(DeploymentConfiguration config, 157 DeployableObject deplObj) 158 throws ConfigurationException ; 159 160 171 public abstract void setWebContextRoot(DeploymentConfiguration config, 172 DeployableObject deplObj, 173 String contextRoot) 174 throws ConfigurationException ; 175 176 197 public abstract void initConfiguration(DeploymentConfiguration config, 198 File [] files, 199 File resourceDir, 200 boolean keepUpdated) 201 throws ConfigurationException ; 202 203 210 public abstract void disposeConfiguration(DeploymentConfiguration config); 211 212 236 public static final void requestCreateConfiguration(FileObject fo, 237 String serverID) 238 throws ConfigurationException { 239 Project project = FileOwnerQuery.getOwner(fo); 240 if (project == null) { 241 throw new ConfigurationException ("File " + FileUtil.toFile(fo).getAbsolutePath() + " is not part of any project"); } 243 Lookup l = project.getLookup(); 244 J2eeModuleProvider moduleProvider = (J2eeModuleProvider)l.lookup(J2eeModuleProvider.class); 245 if (moduleProvider == null) { 246 throw new ConfigurationException ("Project " + project + " does not provide J2eeModuleProvider in its lookup"); } 248 Server server = ServerRegistry.getInstance().getServer(serverID); 249 ConfigSupportImpl conf = (ConfigSupportImpl)moduleProvider.getConfigSupport(); 250 conf.createDeploymentConfiguration(server); 251 } 252 253 261 public abstract void updateResourceDir(DeploymentConfiguration config, File resourceDir); 262 263 271 public Set <Datasource> getDatasources(DeploymentConfiguration config) { 272 return Collections.<Datasource>emptySet(); 273 } 274 275 282 public boolean isDatasourceCreationSupported() { 283 return false; 284 } 285 286 304 public Datasource createDatasource(DeploymentConfiguration config, String jndiName, String url, String username, String password, String driver) 305 throws OperationUnsupportedException , ConfigurationException , DatasourceAlreadyExistsException 306 { 307 throw new OperationUnsupportedException (""); } 309 } 310 | Popular Tags |