Index: apichanges.xml =================================================================== RCS file: /cvs/j2eeserver/apichanges.xml,v --- apichanges.xml 1 Jul 2006 05:16:03 -0000 1.16.6.3.2.6 +++ apichanges.xml 11 Aug 2006 12:05:03 -0000 @@ -86,6 +86,24 @@ + + + + Passing JNDI name for the resource definition callback + + + + + + +

+ Plugin needs to know JNDI name of the resource which the resource being + defined is coming from. +

+
+ + +
Index: nbproject/project.properties =================================================================== RCS file: /cvs/j2eeserver/nbproject/project.properties,v --- nbproject/project.properties 12 Jul 2006 15:09:17 -0000 1.9.34.9 +++ nbproject/project.properties 11 Aug 2006 12:05:03 -0000 @@ -17,7 +17,7 @@ is.autoload=true javac.source=1.5 -spec.version.base=1.19.20 +spec.version.base=1.20.20 javadoc.title=J2EE Server API javadoc.overview=${basedir}/api/doc/overview.html Index: src/org/netbeans/modules/j2ee/deployment/config/ConfigSupportImpl.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/config/ConfigSupportImpl.java,v --- src/org/netbeans/modules/j2ee/deployment/config/ConfigSupportImpl.java 1 Jul 2006 05:16:09 -0000 1.40.2.4.2.4 +++ src/org/netbeans/modules/j2ee/deployment/config/ConfigSupportImpl.java 11 Aug 2006 11:41:48 -0000 @@ -273,6 +273,30 @@ } public void ensureResourceDefinedForEjb(final String ejbname, final String ejbtype) { + if (ejbname == null || ejbtype == null) { + throw new NullPointerException(); + } + DDBean ejbBean = findDDBean(ejbname, ejbtype); + if (ejbBean != null) { + DeploymentConfiguration config = getDeploymentConfiguration(); + ConfigurationSupport serverConfig = server.getConfigurationSupport(); + serverConfig.ensureResourceDefined(config, ejbBean); + } + } + + public void ensureResourceDefinedForEjb(String ejbname, String ejbtype, String jndiName) { + if (ejbname == null || ejbtype == null || jndiName == null) { + throw new NullPointerException(); + } + DDBean ejbBean = findDDBean(ejbname, ejbtype); + if (ejbBean != null) { + DeploymentConfiguration config = getDeploymentConfiguration(); + ConfigurationSupport serverConfig = server.getConfigurationSupport(); + serverConfig.ensureResourceDefined(config, ejbBean, jndiName); + } + } + + private DDBean findDDBean(String ejbname, String ejbtype) { if (! J2eeModule.EJB.equals(provider.getJ2eeModule().getModuleType())) { throw new IllegalArgumentException("Trying to get config bean for ejb on non ejb module!"); //NONI18N } @@ -296,11 +320,10 @@ } Exception e = new Exception("Failed to lookup: "+ejbname+" type "+ejbtype); ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); - return; + return null; } - DeploymentConfiguration config = getDeploymentConfiguration(); - ConfigurationSupport serverConfig = server.getConfigurationSupport(); - serverConfig.ensureResourceDefined(config, ejbBean); + + return ejbBean; } public Set getDatasources() { Index: src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java,v --- src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java 1 Jul 2006 05:16:13 -0000 1.47.30.3.2.3 +++ src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java 28 Jul 2006 14:02:59 -0000 @@ -330,6 +330,15 @@ public void ensureResourceDefinedForEjb(String ejbname, String ejbtype); /** + * Ensure needed resources are automatically defined for the entity + * represented by given DDBean. + * @param ejbName the EJB name + * @param ejbType the DTD name for type of EJB: 'message-drive', 'entity', 'session'. + * @param jndiName the JNDI name of the resource where the EJB is stored + */ + public void ensureResourceDefinedForEjb(String ejbName, String ejbType, String jndiName); + + /** * Tests whether data source creation is supported. * * @return true if data source creation is supported, false otherwise. Index: src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java,v --- src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java 1 Jul 2006 05:16:23 -0000 1.2.42.2.2.3 +++ src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java 11 Aug 2006 11:41:49 -0000 @@ -131,6 +131,18 @@ DDBean bean); /** + * Ensure resource is defined for the specified DD bean (for example entity bean). + * + * @param config deployment configuration + * @param bean DD bean in question + * @param jndiName the JNDI name of the resource where the bean is stored + */ + public void ensureResourceDefined(DeploymentConfiguration config, + DDBean bean, String jndiName) + { + } + + /** * Return the context root (context path) defined for the module specified * by the deployable object. *