Index: j2eeserver/apichanges.xml =================================================================== RCS file: /cvs/j2eeserver/apichanges.xml,v retrieving revision 1.23 diff -u -r1.23 apichanges.xml --- j2eeserver/apichanges.xml 13 Oct 2006 13:08:52 -0000 1.23 +++ j2eeserver/apichanges.xml 28 Mar 2007 11:10:40 -0000 @@ -86,6 +86,66 @@ + + + + Removing dependency of configuration releated part of the J2EE Server API on JSR-88. + Splitting up the plugin API to API and SPI. + + + + + + +

+ The initial motivation for the J2EE Server API changes is migration to Retouche, a new + NetBeans Java infrastructure. The new Java infrastructure does not supply the old deployment + descriptor model with fine-grained change notification events anymore and thus a new Merged + deployment descriptor model infrastructure was created instead. +

+

+ Since the architecture of the new Merged deployment descriptor model is essentially different + from the old deployment descriptor model infrastructure, the model can no longer be wrapped in + the JSR-88 DDBean wrapper, which was a basis of all the server specific deployment configuration + APIs, the deployment configuration related part of the J2EE Server API had to be redesigned. +

+

+ Because the redesign already introduced big incompatible changes, we took advantage of it to + fix couple of API issues, which required incompatible changes. First, the server plug-in part + of the API was split into API and SPI. So far, there was no clear distinction between API and + SPI and it was not obvious what a server plug-in writer is required to implement. Second, + throws ConfigurationException clause was added to all the server-specific configuration + related methods to inform the client about a problem which might have occurred when reading or + writing to server-specific configuration files. +

+

+ For further description refer to the issue. +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
Index: j2eeserver/nbproject/project.properties =================================================================== RCS file: /cvs/j2eeserver/nbproject/project.properties,v retrieving revision 1.14 retrieving revision 1.14.6.1 diff -u -r1.14 -r1.14.6.1 --- j2eeserver/nbproject/project.properties 20 Oct 2006 10:20:24 -0000 1.14 +++ j2eeserver/nbproject/project.properties 27 Mar 2007 09:29:10 -0000 1.14.6.1 @@ -17,7 +17,7 @@ is.autoload=true javac.source=1.5 -spec.version.base=1.21.0 +spec.version.base=1.23.0 javadoc.overview=${basedir}/api/doc/overview.html javadoc.arch=${basedir}/arch.xml Index: j2eeserver/nbproject/project.xml =================================================================== RCS file: /cvs/j2eeserver/nbproject/project.xml,v retrieving revision 1.18 retrieving revision 1.18.4.2 diff -u -r1.18 -r1.18.4.2 --- j2eeserver/nbproject/project.xml 9 Nov 2006 16:54:03 -0000 1.18 +++ j2eeserver/nbproject/project.xml 10 Feb 2007 13:05:09 -0000 1.18.4.2 @@ -24,7 +24,7 @@ org.netbeans.modules.j2eeserver - org.netbeans.modules.schema2beans + org.netbeans.api.debugger @@ -32,13 +32,15 @@ - org.openide.loaders + org.netbeans.api.debugger.jpda - + + 2 + - org.netbeans.modules.settings + org.netbeans.api.java @@ -46,7 +48,7 @@ - org.netbeans.modules.projectapi + org.netbeans.api.progress @@ -62,63 +64,64 @@ - org.netbeans.modules.j2eeapis + org.netbeans.modules.j2ee.dd 1 + 1.9 - org.openide.filesystems + org.netbeans.modules.j2eeapis - 6.2 + 1 - org.openide.util + org.netbeans.modules.java.platform - 6.2 + 1 - org.openide.modules + org.netbeans.modules.project.libraries - 6.2 + 1 - org.openide.nodes + org.netbeans.modules.projectapi - 6.2 + 1 - org.openide.explorer + org.netbeans.modules.schema2beans - 6.8 + 1 - org.openide.awt + org.netbeans.modules.settings - 6.2 + 1 - org.openide.dialogs + org.openide.actions @@ -126,7 +129,7 @@ - org.openide.windows + org.openide.awt @@ -134,7 +137,7 @@ - org.openide.text + org.openide.dialogs @@ -142,90 +145,97 @@ - org.openide.actions + org.openide.explorer - 6.2 + 6.8 - org.netbeans.api.java + org.openide.filesystems - 1 + 6.2 - org.netbeans.modules.project.libraries + org.openide.io - - 1 - + - org.netbeans.api.debugger + org.openide.loaders + + + + + + org.openide.modules - 1 + 6.2 - org.netbeans.api.debugger.jpda + org.openide.nodes - 2 + 6.2 - org.netbeans.api.progress + org.openide.text - 1 + 6.2 - org.openide.io + org.openide.util - + + 6.2 + - org.netbeans.modules.java.platform + org.openide.windows - 1 + 6.2 - - - unit - - org.netbeans.modules.j2eeserver - - - - - org.netbeans.modules.progress.ui - - - - - qa-functional - + + + unit + + org.netbeans.modules.j2eeserver + + + + + org.netbeans.modules.progress.ui + + + + qa-functional + + org.netbeans.modules.j2ee.deployment.common.api org.netbeans.modules.j2ee.deployment.devmodules.api org.netbeans.modules.j2ee.deployment.devmodules.spi org.netbeans.modules.j2ee.deployment.plugins.api - org.netbeans.modules.j2ee.deployment.common.api + org.netbeans.modules.j2ee.deployment.plugins.spi + org.netbeans.modules.j2ee.deployment.plugins.spi.config org.netbeans.modules.j2ee.deployment.profiler.api org.netbeans.modules.j2ee.deployment.profiler.spi Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/ConfigurationException.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/ConfigurationException.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/ConfigurationException.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/ConfigurationException.java 23 Mar 2007 20:29:51 -0000 1.1.2.2 @@ -0,0 +1,52 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.common.api; + +/** + * ConfigurationException occurs if there is a problem with the server-specific + * configuration. + * + * @author sherold + * + * @since 1.23 + */ +public class ConfigurationException extends Exception { + + /** + * Constructs a new ConfigurationException with a message describing the error. + * + * @param message describing the error. The message should be localized so that + * it can be displayed to the user. + */ + public ConfigurationException(String message) { + super(message); + } + + /** + * Constructs a new ConfigurationException with a message and cause of the error. + * + * @param message describing the error. The message should be localized so that + * it can be displayed to the user. + * @param cause the cause of the error. + */ + public ConfigurationException(String message, Throwable cause) { + super(message, cause); + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/SourceFileMap.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/SourceFileMap.java,v retrieving revision 1.9 retrieving revision 1.9.10.1 diff -u -r1.9 -r1.9.10.1 --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/SourceFileMap.java 30 Jun 2006 20:44:48 -0000 1.9 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/common/api/SourceFileMap.java 7 Dec 2006 17:11:40 -0000 1.9.10.1 @@ -21,12 +21,10 @@ import java.io.File; import javax.enterprise.deploy.model.DDBean; -import javax.enterprise.deploy.model.DeployableObject; import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.project.Project; -import org.netbeans.modules.j2ee.deployment.config.DDCommon; -import org.netbeans.modules.j2ee.deployment.config.DeployableObjectImpl; -import org.netbeans.modules.j2ee.deployment.config.StandardDDImpl; +import org.netbeans.modules.j2ee.deployment.config.J2eeModuleAccessor; +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; import org.openide.filesystems.FileObject; import org.openide.util.Lookup; @@ -124,26 +122,10 @@ * * @param ddbean An instance of ddbean to establish mapping context. */ - public static final SourceFileMap findSourceMap(DDBean ddbean) { - if (ddbean instanceof DDCommon) { - DDCommon dd = (DDCommon) ddbean; - return dd.getModuleProvider().getSourceFileMap(); - } else if (ddbean instanceof StandardDDImpl) { - StandardDDImpl dd = (StandardDDImpl) ddbean; - return dd.getModuleProvider().getSourceFileMap(); + public static final SourceFileMap findSourceMap(J2eeModule j2eeModule) { + if (j2eeModule == null) { + throw new NullPointerException(); } - return null; - } - - /** - * Returns a source file map for the module, or null if none can be identified. - * - * @param ddbean An instance of ddbean to establish mapping context. - */ - public static final SourceFileMap findSourceMap(DeployableObject deployable) { - if (deployable instanceof DeployableObjectImpl) { - return ((DeployableObjectImpl)deployable).getProvider().getSourceFileMap(); - } - return null; + return J2eeModuleAccessor.DEFAULT.getJ2eeModuleProvider(j2eeModule).getSourceFileMap(); } } Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/AntDeploymentHelper.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/AntDeploymentHelper.java,v retrieving revision 1.2 retrieving revision 1.2.6.1 diff -u -r1.2 -r1.2.6.1 --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/AntDeploymentHelper.java 12 Oct 2006 14:42:44 -0000 1.2 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/AntDeploymentHelper.java 7 Dec 2006 17:11:44 -0000 1.2.6.1 @@ -24,10 +24,9 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import javax.enterprise.deploy.shared.ModuleType; import org.netbeans.modules.j2ee.deployment.impl.ServerInstance; import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry; -import org.netbeans.modules.j2ee.deployment.plugins.api.AntDeploymentProvider; +import org.netbeans.modules.j2ee.deployment.plugins.spi.AntDeploymentProvider; import org.openide.filesystems.FileLock; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeApplication.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeApplication.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeApplication.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeApplication.java 23 Mar 2007 20:29:52 -0000 1.1.2.1 @@ -0,0 +1,80 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.devmodules.api; + +import org.netbeans.modules.j2ee.deployment.config.J2eeApplicationAccessor; +import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeApplicationImplementation; + +/** + * Abstraction of J2EE Application. Provides access to basic server-neutral properties + * of the application: J2EE version, module type, deployment descriptor and its child + * modules. + *

+ * It is not possible to instantiate this class directly. Implementators have to + * implement the {@link J2eeApplicationImplementation} first and then use the + * {@link J2eeModuleFactory} to create a J2eeApplication instance. + * + * @author Pavel Buzek + */ +public class J2eeApplication extends J2eeModule { + + private final J2eeApplicationImplementation impl; + + private J2eeApplication(J2eeApplicationImplementation impl) { + super(impl); + this.impl = impl; + } + + /** + * Returns a list of all the J2EEModules which this J2eeApplication contains. + * + * @return list of all the child J2EEModules + */ + public J2eeModule[] getModules() { + return impl.getModules(); + } + + /** + * Registers the specified ModuleListener for notification about the module + * changes. + * + * @param listener ModuleListener + */ + public void addModuleListener(ModuleListener listener) { + impl.addModuleListener(listener); + } + + /** + * Unregister the specified ModuleListener. + * + * @param listener ModuleListener + */ + public void removeModuleListener(ModuleListener listener) { + impl.removeModuleListener(listener); + } + + static { + J2eeApplicationAccessor.DEFAULT = new J2eeApplicationAccessor() { + public J2eeApplication createJ2eeApplication(J2eeApplicationImplementation impl) { + return new J2eeApplication(impl); + } + }; + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModule.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModule.java,v retrieving revision 1.9 retrieving revision 1.9.6.4 diff -u -r1.9 -r1.9.6.4 --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModule.java 12 Oct 2006 14:42:44 -0000 1.9 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModule.java 27 Mar 2007 09:29:10 -0000 1.9.6.4 @@ -13,23 +13,35 @@ * "Portions Copyrighted [year] [name of copyright owner]" * * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.j2ee.deployment.devmodules.api; +import java.beans.PropertyChangeListener; +import java.io.File; +import org.netbeans.modules.j2ee.dd.api.common.RootInterface; +import org.netbeans.modules.j2ee.deployment.common.api.SourceFileMap; +import org.netbeans.modules.j2ee.deployment.config.J2eeModuleAccessor; +import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleImplementation; +import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; import org.netbeans.modules.schema2beans.BaseBean; import javax.enterprise.deploy.shared.ModuleType; import org.openide.filesystems.FileObject; import java.util.Iterator; -/** Abstraction of J2EE module. Provides access to basic properties +/** + * Abstraction of J2EE module. Provides access to basic server-neutral properties * of the modules: J2EE version, module type, deployment descriptor. - * + *

+ * It is not possible to instantiate this class directly. Implementators have to + * implement the {@link J2eeModuleImplementation} first and then use the + * {@link J2eeModuleFactory} to create a J2eeModule instance. + * * @author Pavel Buzek */ -public interface J2eeModule { +public class J2eeModule { /** MIME type for ContentDescriptor of build targets that have J2eeModule in lookup. * This can be used to search implementations of targets providing J2eeModule @@ -74,26 +86,63 @@ public static final String CONNECTOR_XML = "META-INF/ra.xml"; public static final String CLIENT_XML = "META-INF/application-client.xml"; - /** Returns module specification version */ - public String getModuleVersion(); - /** Returns module type */ - public Object getModuleType(); + /** + * Enterprise resorce directory property + */ + public static final String PROP_RESOURCE_DIRECTORY = "resourceDir"; // NOI18N + + /** + * Module version property + */ + public static final String PROP_MODULE_VERSION = "moduleVersion"; // NOI18N + + private J2eeModuleProvider j2eeModuleProvider; + + public interface RootedEntry { + FileObject getFileObject (); + String getRelativePath (); + } - /** Returns the location of the module within the application archive. */ - public abstract String getUrl (); + private final J2eeModuleImplementation impl; - /** Sets the location of the modules within the application archive. - * For example, a web module could be at "/wbmodule1.war" within the ear - * file. For standalone module the URL cannot be set to a different value - * then "/" + J2eeModule(J2eeModuleImplementation impl) { + this.impl = impl; + } + + /** + * Returns module specification version. + * + * @return module specification version. */ - public void setUrl (String url); + public String getModuleVersion() { + return impl.getModuleVersion(); + } + + /** + * Returns module type. + * + * @return module type. + */ + public Object getModuleType() { + return impl.getModuleType(); + } + + /** + * Returns the location of the module within the application archive. + * + * @return location of the module within the application archive. + */ + public String getUrl() { + return impl.getUrl(); + } /** Returns the archive file for the module of null if the archive file * does not exist (for example, has not been compiled yet). */ - public FileObject getArchive () throws java.io.IOException; + public FileObject getArchive() throws java.io.IOException { + return impl.getArchive(); + } /** Returns the contents of the archive, in copyable form. * Used for incremental deployment. @@ -102,7 +151,9 @@ * j2ee application, the result should not contain module archives. * @return Iterator through {@link RootedEntry}s */ - public Iterator getArchiveContents() throws java.io.IOException; + public Iterator getArchiveContents() throws java.io.IOException { + return impl.getArchiveContents(); + } /** This call is used in in-place deployment. * Returns the directory staging the contents of the archive @@ -111,7 +162,9 @@ * @return FileObject for the content directory, return null if the * module doesn't have a build directory, like an binary archive project */ - public FileObject getContentDirectory() throws java.io.IOException; + public FileObject getContentDirectory() throws java.io.IOException { + return impl.getContentDirectory(); + } /** Returns a live bean representing the final deployment descriptor * that will be used for deploment of the module. This can be @@ -123,24 +176,74 @@ * Location must be prefixed by /META-INF or /WEB-INF as appropriate. * @return a live bean representing the final DD */ - public BaseBean getDeploymentDescriptor(String location); - - public interface RootedEntry { - FileObject getFileObject (); - String getRelativePath (); + public RootInterface getDeploymentDescriptor(String location) { + return impl.getDeploymentDescriptor(location); } - /** Add module change listener. - * @param listener on version change + /** + * Returns the module resource directory or null if the module has no resource + * directory. + * + * @return the module resource directory or null if the module has no resource + * directory. */ - public void addVersionListener(VersionListener listener); + public File getResourceDirectory() { + return impl.getResourceDirectory(); + } - /** Remove module version change listener. - * @param listener on version change + /** + * Returns source deployment configuration file path for the given deployment + * configuration file name. + * + * @param name file name of the deployment configuration file, WEB-INF/sun-web.xml + * for example. + * + * @return absolute path to the deployment configuration file, or null if the + * specified file name is not known to this J2eeModule. */ - public void removeVersionListener(VersionListener listener); + public File getDeploymentConfigurationFile(String name) { + return impl.getDeploymentConfigurationFile(name); + } + + /** + * Add a PropertyChangeListener to the listener list. + * + * @param listener PropertyChangeListener + */ + public void addPropertyChangeListener(PropertyChangeListener listener) { + impl.addPropertyChangeListener(listener); + } + + /** + * Remove a PropertyChangeListener from the listener list. + * + * @param listener PropertyChangeListener + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + impl.removePropertyChangeListener(listener); + } + + synchronized J2eeModuleProvider getJ2eeModuleProvider() { + return j2eeModuleProvider; + } + + synchronized void setJ2eeModuleProvider(J2eeModuleProvider j2eeModuleProvider) { + this.j2eeModuleProvider = j2eeModuleProvider; + } - public interface VersionListener { - void versionChanged(String oldVersion, String newVersion); + static { + J2eeModuleAccessor.DEFAULT = new J2eeModuleAccessor() { + public J2eeModule createJ2eeModule(J2eeModuleImplementation impl) { + return new J2eeModule(impl); + } + + public J2eeModuleProvider getJ2eeModuleProvider(J2eeModule j2eeModule) { + return j2eeModule.getJ2eeModuleProvider(); + } + + public void setJ2eeModuleProvider(J2eeModule j2eeModule, J2eeModuleProvider j2eeModuleProvider) { + j2eeModule.setJ2eeModuleProvider(j2eeModuleProvider); + } + }; } } Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModuleContainer.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModuleContainer.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModuleContainer.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eeModuleContainer.java 30 Jun 2006 20:44:49 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,33 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.devmodules.api; - -/** Abstraction of container of J2EE modules, such as J2EE Application - * - * @author Pavel Buzek - */ -public interface J2eeModuleContainer extends J2eeModule { - - public J2eeModule[] getModules(ModuleListener ml); - - public void addModuleListener(ModuleListener ml); - - public void removeModuleListener(ModuleListener ml); -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatform.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatform.java,v retrieving revision 1.10 retrieving revision 1.10.6.1 diff -u -r1.10 -r1.10.6.1 --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatform.java 12 Oct 2006 14:42:44 -0000 1.10 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/J2eePlatform.java 7 Dec 2006 17:11:45 -0000 1.10.6.1 @@ -31,7 +31,7 @@ import java.util.Set; import org.netbeans.api.java.platform.JavaPlatform; import org.netbeans.modules.j2ee.deployment.impl.ServerInstance; -import org.netbeans.modules.j2ee.deployment.plugins.api.J2eePlatformImpl; +import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformImpl; import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider; import org.netbeans.spi.project.libraries.LibraryImplementation; import org.openide.filesystems.FileObject; Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/JSPServletFinder.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/JSPServletFinder.java,v retrieving revision 1.6 retrieving revision 1.6.10.2 diff -u -r1.6 -r1.6.10.2 --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/JSPServletFinder.java 30 Jun 2006 20:44:49 -0000 1.6 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/JSPServletFinder.java 9 Feb 2007 17:00:46 -0000 1.6.10.2 @@ -23,12 +23,13 @@ import java.io.File; import org.netbeans.api.project.FileOwnerQuery; import org.netbeans.api.project.Project; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; import org.netbeans.modules.j2ee.deployment.impl.ServerInstance; import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry; import org.netbeans.modules.j2ee.deployment.impl.ServerString; -import org.netbeans.modules.j2ee.deployment.plugins.api.FindJSPServlet; -import org.netbeans.modules.j2ee.deployment.plugins.api.OldJSPDebug; +import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet; +import org.netbeans.modules.j2ee.deployment.plugins.spi.OldJSPDebug; import org.openide.filesystems.FileObject; /** @@ -72,7 +73,11 @@ private String getWebURL() { J2eeModuleProvider provider = (J2eeModuleProvider) project.getLookup ().lookup (J2eeModuleProvider.class); - return provider.getConfigSupport().getWebContextRoot(); + try { + return provider.getConfigSupport().getWebContextRoot(); + } catch (ConfigurationException e) { + return null; + } } /** Returns the FindJSPServlet class associated with this JSPServletFinder. Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeAppProvider.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeAppProvider.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeAppProvider.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeAppProvider.java 12 Oct 2006 14:42:44 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,62 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ -package org.netbeans.modules.j2ee.deployment.devmodules.spi; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; -import org.netbeans.modules.j2ee.deployment.common.api.Datasource; - -/* - * J2eeAppProvider.java - * - * Created on January 8, 2004, 2:35 PM - * @author nn136682 - */ -public abstract class J2eeAppProvider extends J2eeModuleProvider { - - /** - * Returns the provider for the child module specified by given URI. - * @param uri the child module URI within the J2EE application. - * @return J2eeModuleProvider object - */ - public abstract J2eeModuleProvider getChildModuleProvider(String uri); - - /** - * Returns list of providers of every child J2EE module of this J2EE app. - * @return array of J2eeModuleProvider objects. - */ - public abstract J2eeModuleProvider[] getChildModuleProviders(); - - /** - * Overrides the J2eeModuleProvider's implementation so that - * the data sources from the child modules are returned - */ - public Set getModuleDatasources() { - - Set projectDS = new HashSet(); - - for (J2eeModuleProvider modProvider : getChildModuleProviders()) { - projectDS.addAll(modProvider.getModuleDatasources()); - } - - return projectDS; - } - -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationImplementation.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationImplementation.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationImplementation.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationImplementation.java 23 Mar 2007 20:29:54 -0000 1.1.2.1 @@ -0,0 +1,57 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.devmodules.spi; + +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; +import org.netbeans.modules.j2ee.deployment.devmodules.api.ModuleListener; + +/** + * Base SPI interface for {@link J2eeApplication}. Implementation of this interface + * is used to create {@link J2eeApplication} instance using the {@link J2eeModuleFactory}. + * + * @author sherold + * + * @since 1.23 + */ +public interface J2eeApplicationImplementation extends J2eeModuleImplementation { + + /** + * Returns a list of all the J2EEModules which this J2eeApplication contains. + * + * @return list of all the child J2EEModules + */ + J2eeModule[] getModules(); + + /** + * Registers the specified ModuleListener for notification about the module + * changes. + * + * @param listener ModuleListener + */ + void addModuleListener(ModuleListener listener); + + /** + * Unregister the specified ModuleListener. + * + * @param listener ModuleListener + */ + void removeModuleListener(ModuleListener listener); + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationProvider.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationProvider.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationProvider.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeApplicationProvider.java 23 Mar 2007 20:29:54 -0000 1.1.2.1 @@ -0,0 +1,71 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ +package org.netbeans.modules.j2ee.deployment.devmodules.spi; + +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; +import org.netbeans.modules.j2ee.deployment.common.api.Datasource; + +/** + * This interface must be implemented by J2EE Application support and an instance + * added into project lookup. + * + * @author sherold + * + * @since 1.23 + */ +public abstract class J2eeApplicationProvider extends J2eeModuleProvider { + + /** + * Returns the provider for the child module specified by given URI. + * + * @param uri the child module URI within the J2EE application. + * + * @return J2eeModuleProvider object + */ + public abstract J2eeModuleProvider getChildModuleProvider(String uri); + + /** + * Returns list of providers of every child J2EE module of this J2EE app. + * + * @return array of J2eeModuleProvider objects. + */ + public abstract J2eeModuleProvider[] getChildModuleProviders(); + + /** + * Overrides the J2eeModuleProvider's implementation so that + * the data sources from the child modules are returned + * + * @throws ConfigurationException when an error occured while retrieving + * module data sources. + */ + public Set getModuleDatasources() throws ConfigurationException { + + Set projectDS = new HashSet(); + + for (J2eeModuleProvider modProvider : getChildModuleProviders()) { + projectDS.addAll(modProvider.getModuleDatasources()); + } + + return projectDS; + } + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleFactory.java 23 Mar 2007 20:29:54 -0000 1.1.2.3 @@ -0,0 +1,70 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.devmodules.spi; + +import org.netbeans.modules.j2ee.deployment.config.J2eeModuleAccessor; +import org.netbeans.modules.j2ee.deployment.config.J2eeApplicationAccessor; +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeApplication; + +/** + * A factory class to create {@link J2eeModule} and {@link J2eeApplication} + * instances. You are not permitted to create them directly; instead you implement + * {@link J2eeModuleImplementation} or {@link J2eeApplicationImplementation} + * and use this factory. + * + * + * @author sherold + * @since 1.23 + */ +public class J2eeModuleFactory { + + /** Creates a new instance of J2eeModuleFactory */ + private J2eeModuleFactory() { + } + + /** + * Creates a J2eeModule for the specified J2eeModuleImplementation. + * + * @param impl the J2eeModule SPI object + * + * @return J2eeModule API instance. + */ + public static J2eeModule createJ2eeModule(J2eeModuleImplementation impl) { + if (impl == null) { + throw new NullPointerException(); + } + return J2eeModuleAccessor.DEFAULT.createJ2eeModule(impl); + } + + /** + * Creates a J2eeApplication for the specified J2eeApplicationImplementation. + * + * + * @param impl the J2eeApplication SPI object + * @return J2eJ2eeApplicationI instance. + */ + public static J2eeApplication createJ2eeApplication(J2eeApplicationImplementation impl) { + if (impl == null) { + throw new NullPointerException(); + } + return J2eeApplicationAccessor.DEFAULT.createJ2eeApplication(impl); + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleImplementation.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleImplementation.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleImplementation.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleImplementation.java 23 Mar 2007 20:29:54 -0000 1.1.2.3 @@ -0,0 +1,129 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.devmodules.spi; + +import java.beans.PropertyChangeListener; +import java.io.File; +import java.util.Iterator; +import org.netbeans.modules.j2ee.dd.api.common.RootInterface; +import org.openide.filesystems.FileObject; + +/** + * Base SPI interface for {@link J2eeModule}. Implementation of this interface + * is used to create {@link J2eeModule} instance using the {@link J2eeModuleFactory}. + * + * @author sherold + * + * @since 1.23 + */ +public interface J2eeModuleImplementation { + + /** + * Returns module specification version. + * + * @return module specification version. + */ + String getModuleVersion(); + + /** + * Returns module type. + * + * @return module type. + */ + Object getModuleType(); + + /** + * Returns the location of the module within the application archive. + * + * TODO: this does not belong here.. it has to be moved to J2eeApplication + */ + abstract String getUrl (); + + /** Returns the archive file for the module of null if the archive file + * does not exist (for example, has not been compiled yet). + */ + FileObject getArchive () throws java.io.IOException; + + /** Returns the contents of the archive, in copyable form. + * Used for incremental deployment. + * Currently uses its own {@link RootedEntry} interface. + * If the J2eeModule instance describes a + * j2ee application, the result should not contain module archives. + * @return Iterator through {@link RootedEntry}s + */ + Iterator getArchiveContents() throws java.io.IOException; + + /** This call is used in in-place deployment. + * Returns the directory staging the contents of the archive + * This directory is the one from which the content entries returned + * by {@link #getArchiveContents} came from. + * @return FileObject for the content directory, return null if the + * module doesn't have a build directory, like an binary archive project + */ + FileObject getContentDirectory() throws java.io.IOException; + + /** Returns a live bean representing the final deployment descriptor + * that will be used for deploment of the module. This can be + * taken from sources, constructed on fly or a combination of these + * but it needs to be available even if the module has not been built yet. + * + * @param location Parameterized by location because of possibility of multiple + * deployment descriptors for a single module (jsp.xml, webservices.xml, etc). + * Location must be prefixed by /META-INF or /WEB-INF as appropriate. + * @return a live bean representing the final DD + */ + RootInterface getDeploymentDescriptor(String location); + + /** + * Returns the module resource directory, or null if the module has no resource + * directory. + * + * @return the module resource directory, or null if the module has no resource + * directory. + */ + File getResourceDirectory(); + + /** + * Returns source deployment configuration file path for the given deployment + * configuration file name. + * + * @param name file name of the deployment configuration file, WEB-INF/sun-web.xml + * for example. + * + * @return absolute path to the deployment configuration file, or null if the + * specified file name is not known to this J2eeModule. + */ + File getDeploymentConfigurationFile(String name); + + /** + * Add a PropertyChangeListener to the listener list. + * + * @param listener PropertyChangeListener + */ + void addPropertyChangeListener(PropertyChangeListener listener); + + /** + * Remove a PropertyChangeListener from the listener list. + * + * @param listener PropertyChangeListener + */ + void removePropertyChangeListener(PropertyChangeListener listener); + +} Index: j2eeserver/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 retrieving revision 1.54 retrieving revision 1.54.6.5 diff -u -r1.54 -r1.54.6.5 --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java 12 Oct 2006 14:42:44 -0000 1.54 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java 27 Mar 2007 09:29:11 -0000 1.54.6.5 @@ -28,7 +28,7 @@ import java.util.Map; import java.util.Set; import javax.enterprise.deploy.spi.Target; -import javax.enterprise.deploy.spi.exceptions.ConfigurationException; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException; import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; import org.netbeans.modules.j2ee.deployment.common.api.ValidationException; @@ -45,8 +45,8 @@ import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties; import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo; import org.netbeans.modules.j2ee.deployment.common.api.SourceFileMap; -import org.netbeans.modules.j2ee.deployment.plugins.api.StartServer; -import org.netbeans.modules.j2ee.deployment.plugins.api.VerifierSupport; +import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer; +import org.netbeans.modules.j2ee.deployment.plugins.spi.VerifierSupport; import org.openide.ErrorManager; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; @@ -62,25 +62,11 @@ */ public abstract class J2eeModuleProvider { - private InstanceListener il; private ConfigSupportImpl configSupportImpl; - List listeners = new ArrayList(); + final List listeners = new ArrayList(); private ConfigFilesListener configFilesListener = null; - /** - * Enterprise resorce directory property - * - * @since 1.12 - */ - public static final String PROP_ENTERPRISE_RESOURCE_DIRECTORY = "resourceDir"; // NOI18N - - private PropertyChangeSupport supp = new PropertyChangeSupport(this); - public J2eeModuleProvider () { - il = new IL (); - ServerRegistry.getInstance ().addInstanceListener ( - (InstanceListener) WeakListeners.create( - InstanceListener.class, il, ServerRegistry.getInstance ())); } public abstract J2eeModule getJ2eeModule (); @@ -144,10 +130,13 @@ * Gets the data sources deployed on the target server instance. * * @return set of data sources - * + * + * @throws ConfigurationException reports problems in retrieving data source + * definitions. + * * @since 1.15 */ - public Set getServerDatasources() { + public Set getServerDatasources() throws ConfigurationException { ServerInstance si = ServerRegistry.getInstance ().getServerInstance (getServerInstanceID ()); Set deployedDS = Collections.emptySet(); if (si != null) { @@ -164,10 +153,12 @@ * Gets the data sources saved in the module. * * @return set of data sources - * + * + * @throws ConfigurationException reports problems in retrieving data source + * definitions. * @since 1.15 */ - public Set getModuleDatasources() { + public Set getModuleDatasources() throws ConfigurationException { Set projectDS = getConfigSupport().getDatasources(); return projectDS; } @@ -200,7 +191,7 @@ * @since 1.15 */ public final Datasource createDatasource(String jndiName, String url, String username, String password, String driver) - throws DatasourceAlreadyExistsException { + throws DatasourceAlreadyExistsException, ConfigurationException { //check whether the ds is not already on the server Set deployedDS = getServerDatasources(); @@ -246,40 +237,6 @@ /** - * Register a listener which will be notified when some of the properties - * change. - * - * @param l listener which should be added. - * @since 1.12 - */ - public final void addPropertyChangeListener(PropertyChangeListener l) { - supp.addPropertyChangeListener(l); - } - - /** - * Remove a listener registered previously. - * - * @param l listener which should be removed. - * @since 1.12 - */ - public final void removePropertyChangeListener(PropertyChangeListener l) { - supp.removePropertyChangeListener(l); - } - - - /** - * Fire PropertyChange to all registered PropertyChangeListeners. - * - * @param propName property name. - * @param oldValue old value. - * @param newValue new value. - * @since 1.12 - */ - protected final void firePropertyChange(String propName, Object oldValue, Object newValue) { - supp.firePropertyChange(propName, oldValue, newValue); - } - - /** * Configuration support to allow development module code to access well-known * configuration propeties, such as web context root, cmp mapping info... * The setters and getters work with server specific data on the server returned by @@ -298,18 +255,23 @@ public boolean ensureConfigurationReady(); /** - * Save configuration. This is mainly for wizard actions that could - * initiate changes in configuration. These changes should be saved - * explicitly by wizard, not implicitly by plugin, in order to avoid - * possible side-effect. - */ - //public void saveConfiguration() throws IOException; - - /** - * Set/get web module context root. + * Set web module context root. + * + * @param contextRoot web module context root. + * @throws ConfigurationException reports errors in setting the web context + * root. + */ + public void setWebContextRoot(String contextRoot) throws ConfigurationException; + + /** + * Get web module context root. + * + * @return web module context root. + * + * @throws ConfigurationException reports errors in setting the web context + * root. */ - public void setWebContextRoot(String contextRoot); - public String getWebContextRoot(); + public String getWebContextRoot() throws ConfigurationException; /** * Return a list of file names for current server specific deployment @@ -326,17 +288,10 @@ /** * Push the CMP and CMR mapping info to the server configuraion. * This call is typically used by CMP mapping wizard. + * + * @throws ConfigurationException reports errors in setting the CMP mapping. */ - public void setCMPMappingInfo(OriginalCMPMapping[] mappings); - /** - * Ensure needed resources are automatically defined for the entity - * represented by given DDBean. - * @param ejbname the ejb name - * @param ejbtype dtd name for type of ejb: 'message-drive', 'entity', 'session'. - * @deprecated replaced with ensureResourceDefinedForEjb with JNDI name attribute - */ - @Deprecated - public void ensureResourceDefinedForEjb(String ejbname, String ejbtype); + public void setCMPMappingInfo(OriginalCMPMapping[] mappings) throws ConfigurationException; /** * Ensure needed resources are automatically defined for the entity @@ -344,8 +299,11 @@ * @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 + * + * @throws ConfigurationException reports errors in setting the EJB resource. */ - public void ensureResourceDefinedForEjb(String ejbName, String ejbType, String jndiName); + public void ensureResourceDefinedForEjb(String ejbName, String ejbType, String jndiName) + throws ConfigurationException; /** * Tests whether data source creation is supported. @@ -361,9 +319,12 @@ * * @return set of data sources * + * @throws ConfigurationException reports errors in retrieving the data sources. + * * @since 1.15 + * */ - public Set getDatasources(); + public Set getDatasources() throws ConfigurationException; /** * Creates and saves data source in the module if it does not exist yet in the module. @@ -375,43 +336,19 @@ * @param username database user * @param password user's password * @param driver fully qualified name of database driver class + * * @return created data source - * @exception OperationUnsupportedException if operation is not supported - * @exception DatasourceAlreadyExistsException if conflicting data source is found + * + * @throws OperationUnsupportedException if operation is not supported + * @throws DatasourceAlreadyExistsException if conflicting data source is found + * @throws ConfigurationException reports errors in creating the data source. * * @since 1.15 */ public Datasource createDatasource(String jndiName, String url, String username, String password, String driver) - throws OperationUnsupportedException, DatasourceAlreadyExistsException; + throws OperationUnsupportedException, DatasourceAlreadyExistsException, ConfigurationException; } - - /** - * Returns source deployment configuration file path for the given deployment - * configuration file name. - * - * @param name file name of the deployement configuration file. - * @return non-null absolute path to the deployment configuration file. - */ - abstract public File getDeploymentConfigurationFile(String name); - - /** - * Finds source deployment configuration file object for the given deployment - * configuration file name. - * - * @param name file name of the deployement configuration file. - * @return FileObject of the configuration descriptor file; null if the file does not exists. - * - */ - abstract public FileObject findDeploymentConfigurationFile (String name); - - /** - * Returns directory containing definition for enterprise resources needed for - * the module execution; return null if not supported - */ - public File getEnterpriseResourceDirectory() { - return null; - } - + /** * Returns list of root directories for source files including configuration files. * Examples: file objects for src/java, src/conf. @@ -602,58 +539,7 @@ return; configFilesListener = new ConfigFilesListener(this, listeners); } - - private final class IL implements InstanceListener { - - public void changeDefaultInstance (String oldInst, String newInst) { - ServerInstance oldServerInstance = ServerRegistry.getInstance().getServerInstance(oldInst); - ServerInstance newServerInstance = ServerRegistry.getInstance().getServerInstance(newInst); - ServerString oldInstance = oldServerInstance != null - ? new ServerString(oldServerInstance) - : null; - ServerString newInstance = newServerInstance != null - ? new ServerString(newServerInstance) - : null; - if (useDefaultServer () && newInstance != null - && (oldInstance == null || !oldInstance.getPlugin().equals(newInstance.getPlugin()))) { - if (J2eeModule.WAR.equals(getJ2eeModule().getModuleType())) { - String oldCtxPath = getConfigSupportImpl().getWebContextRoot(); - oldCtxPath = "/"+J2eeModuleProvider.this.getDeploymentName(); //NOI18N - ConfigSupportImpl oldConSupp; - synchronized (J2eeModuleProvider.this) { - oldConSupp = configSupportImpl; - configSupportImpl = null; - } - if (oldConSupp != null) { - oldConSupp.dispose(); - } - getConfigSupportImpl().ensureConfigurationReady(); - String ctx = getConfigSupportImpl().getWebContextRoot (); - if (ctx == null || ctx.equals ("")) { //NOI18N - getConfigSupportImpl().setWebContextRoot(oldCtxPath); - } - } else { - ConfigSupportImpl oldConSupp; - synchronized (J2eeModuleProvider.this) { - oldConSupp = configSupportImpl; - configSupportImpl = null; - } - if (oldConSupp != null) { - oldConSupp.dispose(); - } - getConfigSupportImpl().ensureConfigurationReady(); - } - } - } - - public void instanceAdded (String instance) { - } - public void instanceRemoved (String instance) { - } - - } - private ConfigSupportImpl getConfigSupportImpl() { return (ConfigSupportImpl) getConfigSupport(); } Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/AntDeploymentProvider.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/AntDeploymentProvider.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/AntDeploymentProvider.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/AntDeploymentProvider.java 12 Oct 2006 14:42:48 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,62 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; - -/** - * This interface represents a "provider" for the Ant deployment. - *

- * The j2eeserver uses {@link OptionalDeploymentManagerFactory} to optains an - * instance of the AntDeploymentProvider from the server integration plugin. - * - * @author sherold - * - * @since 1.18 - */ -public interface AntDeploymentProvider { - - /** - * Generates the Ant deployment build script for the given module type to - * the specified output stream. - *

- * See {@link org.netbeans.modules.j2ee.deployment.devmodules.api.AntDeploymentHelper#writeDeploymentScript(File,Object,String)} - * for what targets and properties is the Ant deployment build script required - * to define and what predefined properties it might use. - * - * @param os the output stream the deployment build script should be generated - * to. - * @param moduleType the module type the build script should handle. Use the - * constants defined in the {@link J2eeModule}. - * @throws IOException if a problem during generating the build script occurs. - */ - void writeDeploymentScript(OutputStream os, Object moduleType) throws IOException; - - /** - * Return the server instance specific deployment properties file used by - * the deployment build script generated by the {@link #writeDeploymentScript(OutputStream,Object)}. - * - * @return the deployment properties file. - */ - File getDeploymentPropertiesFile(); -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/ConfigurationSupport.java 12 Oct 2006 14:42:48 -0000 1.6 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,309 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import java.io.File; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; -import javax.enterprise.deploy.model.DDBean; -import javax.enterprise.deploy.model.DeployableObject; -import javax.enterprise.deploy.spi.DeploymentConfiguration; -import javax.enterprise.deploy.spi.exceptions.ConfigurationException; -import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException; -import org.netbeans.api.project.FileOwnerQuery; -import org.netbeans.api.project.Project; -import org.netbeans.modules.j2ee.deployment.common.api.Datasource; -import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException; -import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; -import org.netbeans.modules.j2ee.deployment.config.ConfigSupportImpl; -import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; -import org.netbeans.modules.j2ee.deployment.impl.Server; -import org.netbeans.modules.j2ee.deployment.impl.ServerRegistry; -import org.openide.filesystems.FileObject; -import org.openide.filesystems.FileUtil; -import org.openide.util.Lookup; - - -/** - *

- * ConfigurationSupport provides support for server specific configuration. It - * supplements the JSR-88 DeploymentConfiguration class of life cycle management - * and some additional module change notifications. - *

- * - *

- * The life cycle of the DeploymentConfiguration object. - *

- * - *

- * When a new project is created or an existing one is opened, the j2eeserver - * will create a DeploymentConfiguration object for the project target server by - * calling DeploymentManager.createConfiguration(). After the configuration is - * created, the j2eeserver will initialize it by calling ConfigurationSupport.initConfiguration(). - * In this moment, plugin should make sure that the server specific deployment - * descriptors exist and create them, if they do not. From now on the server specific - * deployment descriptors for the target server should be ready to respond to the - * module changes. - *

- * - *

- * In case that the project target server is changed, the old server is notified - * by calling ConfigurationSupport.disposeConfiguration() that the old - * DeploymentConfiguration will be disposed, which means that the j2eeserver will - * release the reference to it and the configuration will be no longer receiving - * notifications of the module changes. The server specific deployment descriptors for - * the old server will thus stop responding to the module changes. - *

- * - *

- * The life cycle for the new target server is the same as if an existing project - * is opened, see above. - *

- * - *

- * In case that the target server plugin needs to have access to the initilized - * deployment configuration before the j2eeserver created and initilized it by - * itself, the plugin can request the j2eeserver to create and initilize it by - * calling ConfigurationSupport.requestCreateConfiguration(). This may happen - * for example when the IDE is started and if the server specific deployment - * descriptor was left open in the editor before the IDE was shutdown the last time. - * After calling ConfigurationSupport.requestCreateConfiguration() the life cycle - * is the same as if the j2eeserver created and initialized the deployment - * configuration during project opening by itself. - *

- * - *

- * In case that other than target server plugin needs to have access to the initilized - * deployment configuration, the plugin can request the j2eeserver to create and - * initilize the configuration by calling ConfigurationSupport.requestCreateConfiguration(). - * The j2eeserver will create the configuration by calling DeploymentManager.createConfiguration() - * and will initilize it by calling ConfigurationSupport.initConfiguration(), however, - * with the keepUpdated=false parameter. This will tell the plugin that its server - * specific deployment descriptors should not respond to the module changes. In - * fact, the deployment configuration will not be receiving module change events - * in this case. Since the j2eeserver will not even keep a reference to this - * configuration, the ConfigurationSupport.disposeConfiguration() will never be - * called for this configuration, there is also no reason for it. - *

- * - * - * @author sherold - * - * @since 1.8 - */ -public abstract class ConfigurationSupport { - - /** - * Setting the CMP and CMR mapping info to the given configuration for the EJB by the given name. - * This call will be called after CMP wizard created all CMP beans (all new ejb events fired). - * - * @param config The configuration to push the CMP mapping to - * @param mappings All the mapping info needed to be pushed in one batch. - */ - public abstract void setMappingInfo(DeploymentConfiguration config, - OriginalCMPMapping[] mappings); - - /** - * Ensure resource is defined for the specified DD bean (for example entity bean). - * - * @param config deployment configuration - * @param bean DD bean in question - */ - public abstract void ensureResourceDefined(DeploymentConfiguration config, - 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. - * - * @param config deployment configuration - * @param deplObj deployable object that specifies the module - * - * @return context root - * - * @throws ConfigurationException reports errors in getting the web context - * root - */ - public abstract String getWebContextRoot(DeploymentConfiguration config, - DeployableObject deplObj) - throws ConfigurationException; - - /** - * Set the web context root (context path) for the module specified by the - * deployable object. - * - * @param config deployment configuration - * @param deplObj deployable object that specifies the module - * @param contextRoot context root to be set - * - * @throws ConfigurationException reports errors in setting the web context - * root - */ - public abstract void setWebContextRoot(DeploymentConfiguration config, - DeployableObject deplObj, - String contextRoot) - throws ConfigurationException; - - /** - * Initialize the specified deployment configuration. If keepUpdated is true - * ensure the server specific deployment descriptors are created if they do - * not exist and that they are ready to respond to the module changes. If - * keepUpdated is false, the module changes should not be reflected in the - * server specific deployment descriptors. - * - * @param config the deployment configuration that should be initialized. - * @param files server specific deployment configuration files. - * @param resourceDir directory containing definition for enterprise resources - * needed for the module execution or null if not supported. - * @param ensureCreated if keepUpdated is true ensure the server specific - * deployment descriptors are created if they do not - * exist and that they are ready to respond to the module - * changes. If keepUpdated is false, the module changes - * should not be reflected in the server specific deployment - * descriptors. - * - * @throws ConfigurationException reports errors in deployment configuration - * initialization. - */ - public abstract void initConfiguration(DeploymentConfiguration config, - File[] files, - File resourceDir, - boolean keepUpdated) - throws ConfigurationException; - - /** - * The specified deployment configuration instance is about to be disposed, - * which means that the j2eeserver will release the reference to it and the - * configuration will be no longer receiving notifications of the module changes. - * - * @param config deployment configuration which is about to be disposed. - */ - public abstract void disposeConfiguration(DeploymentConfiguration config); - - /** - *

- * Request the j2eeserver to create and initialize the deployment configuration - * for the specified server and module the given server specific deployment - * descriptor file belongs to. If the deployment configuration has already - * been created nothing will happen, otherwise a new instance will be created - * by calling DeploymentManager.createConfiguration() and then initialized by - * calling ConfigurationSupport.initConfiguration(). - *

- * - *

- * The j2eeserver creates and initializes the deployment configuration for the - * server that is set as a target server for the given module. In some cases, - * however, the data object representing the server specific deployment descriptor - * may require access to the initialized deployment configuration even before - * the configuration is created and initialized by the j2eeserver itself. This - * may happen for instance when the server specific deployment descriptor is - * being reopened during the IDE startup if it was left open before the IDE - * was shut down the last time. - *

- * - * @param fo server specific deployment descriptor file object - * @param serverID server (plugin) ID - */ - public static final void requestCreateConfiguration(FileObject fo, - String serverID) - throws ConfigurationException { - Project project = FileOwnerQuery.getOwner(fo); - if (project == null) { - throw new ConfigurationException("File " + FileUtil.toFile(fo).getAbsolutePath() + " is not part of any project"); // NOI18N - } - Lookup l = project.getLookup(); - J2eeModuleProvider moduleProvider = (J2eeModuleProvider)l.lookup(J2eeModuleProvider.class); - if (moduleProvider == null) { - throw new ConfigurationException("Project " + project + " does not provide J2eeModuleProvider in its lookup"); // NOI18N - } - Server server = ServerRegistry.getInstance().getServer(serverID); - ConfigSupportImpl conf = (ConfigSupportImpl)moduleProvider.getConfigSupport(); - conf.createDeploymentConfiguration(server); - } - - /** - * Update the enterprise resource directory for the specified deployment - * configuration. - * - * @param config deployment configuration - * @param resourceDir new enterprise resource directory. - * @since 1.12 - */ - public abstract void updateResourceDir(DeploymentConfiguration config, File resourceDir); - - /** - * Gets the data sources saved in the module. - * - * @param config deployment configuration - * @return a set of data sources. The default implementation returns an empty set. - * - * @since 1.15 - */ - public Set getDatasources(DeploymentConfiguration config) { - return Collections.emptySet(); - } - - /** - * Tests whether data source creation is supported. - * - * @return true if data source creation is supported. The default implementation returns false. - * - * @since 1.15 - */ - public boolean isDatasourceCreationSupported() { - return false; - } - - /** - * Creates and saves data source in the module if it does not exist yet in the module. - * Data source is considered to be existing when JNDI name of the found data source and the one - * just created equal. - * - * @param config deployment configuration - * @param jndiName name of data source - * @param url database URL - * @param username database user - * @param password user's password - * @param driver fully qualified name of the database driver class - * @return created data source - * @exception OperationUnsupportedException if operation is not supported - * @exception ConfigurationException if data source configuration file is not parseable - * @exception DatasourceAlreadyExistsException if conflicting data source is found - * - * @since 1.15 - */ - public Datasource createDatasource(DeploymentConfiguration config, String jndiName, String url, String username, String password, String driver) - throws OperationUnsupportedException, ConfigurationException, DatasourceAlreadyExistsException - { - throw new OperationUnsupportedException(""); // NOI18N - } -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/DatasourceManager.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/DatasourceManager.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/DatasourceManager.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/DatasourceManager.java 12 Oct 2006 14:42:48 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,53 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import java.util.Set; -import javax.enterprise.deploy.spi.exceptions.ConfigurationException; -import org.netbeans.modules.j2ee.deployment.common.api.Datasource; -import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException; - -/** - * DatasourceManager is responsible for retrieving data sources deployed on the server and - * deploying data sources onto the server. - * - * @author Libor Kotouc - * - * @since 1.15 - */ -public interface DatasourceManager { - - /** - * Retrieves the data sources deployed on the server - * - * @return the set of data sources deployed on the server - */ - Set getDatasources(); - - /** - * Deploys given set of data sources. - * - * @exception ConfigurationException if there is some problem with data source configuration - * @exception DatasourceAlreadyExistsException if module data source(s) are conflicting - * with data source(s) already deployed on the server - */ - void deployDatasources(Set datasources) - throws ConfigurationException, DatasourceAlreadyExistsException; -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FileJ2eeModuleQuery.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FileJ2eeModuleQuery.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FileJ2eeModuleQuery.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FileJ2eeModuleQuery.java 9 Feb 2007 17:00:54 -0000 1.1.2.1 @@ -0,0 +1,64 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.api; + +import org.netbeans.api.project.FileOwnerQuery; +import org.netbeans.api.project.Project; +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; +import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; +import org.openide.filesystems.FileObject; + +/** + * Finds the J2EE module for a file. + * + * @author sherold + */ +public class FileJ2eeModuleQuery { + + /** Creates a new instance of FileJ2eeModuleQuery */ + private FileJ2eeModuleQuery() { + } + + /** + * Finds a J2EE module which owns the specified file. + * + * @param fileObject the file + * + * @return J2EE module which owns the specified file, or null if there is no + * J2EE module containing it. + */ + public static J2eeModule getJ2eeModule(FileObject fileObject) { + if (fileObject == null) { + throw new NullPointerException("FileObject parameter cannot be null."); // NOI18N + } + + Project project = FileOwnerQuery.getOwner(fileObject); + if (project == null) { + return null; + } + + J2eeModuleProvider j2eeModuleProvider = project.getLookup().lookup(J2eeModuleProvider.class); + if (j2eeModuleProvider == null) { + return null; + } + + return j2eeModuleProvider.getJ2eeModule(); + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FindJSPServlet.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FindJSPServlet.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FindJSPServlet.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/FindJSPServlet.java 30 Jun 2006 20:44:55 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,63 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import java.io.File; - -/** This interface allows plugins to specify the location of servlets generated - * for JSPs. - * - * @author Petr Jiricka - */ -public interface FindJSPServlet { - - /** Returns the temporary directory where the server writes servlets generated - * from JSPs. The servlets placed in this directory must honor the Java - * directory naming conventions, i.e. the servlet must be placed in subdirectories - * of this directory corresponding to the servlet package name. - * @param moduleContextPath web module for which the temporary directory is requested. - * @return the root temp directory containing servlets generated from JSPs for this module. - */ - public File getServletTempDirectory(String moduleContextPath); - - /** Returns the resource path of the servlet generated for a particular JSP, relatively - * to the main temporary directory. - * @param moduleContextPath context path of web module in which the JSP is located. - * @param jspResourcePath the path of the JSP for which the servlet is requested, e.g. - * "pages/login.jsp". Never starts with a '/'. - * @return the resource name of the servlet generated for the JSP in the module, e.g. - * "org/apache/jsps/pages/login$jsp.java". Must never start with a '/'. - * The servlet file itself does not need to exist at this point - - * if this particular page was not compiled yet. - */ - public String getServletResourcePath(String moduleContextPath, String jspResourcePath); - - /** Returns the encoding of the generated servlet file. - * @param moduleContextPath context path of web module in which the JSP is located. - * @param jspResourcePath the path of the JSP for which the servlet is requested, e.g. - * "pages/login.jsp". Never starts with a '/'. - * @return the encoding of the servlet generated for the JSP in the module, - * e.g. "UTF8". - * The servlet file itself does not need to exist at this point - - * if this particular page was not compiled yet. - */ - public String getServletEncoding(String moduleContextPath, String jspResourcePath); - -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/IncrementalDeployment.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/IncrementalDeployment.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/IncrementalDeployment.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/IncrementalDeployment.java 30 Jun 2006 20:44:55 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,157 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -/* - * IncrementalDeployment.java - * - * Created on November 14, 2003, 9:13 AM - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import org.netbeans.modules.j2ee.deployment.plugins.api.AppChangeDescriptor; -import javax.enterprise.deploy.spi.Target; -import javax.enterprise.deploy.spi.TargetModuleID; -import javax.enterprise.deploy.spi.status.ProgressObject; -import javax.enterprise.deploy.model.DeployableObject; -import javax.enterprise.deploy.spi.DeploymentConfiguration; - -import java.io.File; - -/** - * This interface replaces DeploymentManager calls deploy and redeploy during - * directory-based deployment. The calling sequence is as following: - *

- * Initially, j2eeserver will call getDirectoryForNewApplication() - * to request destination directory to deliver the being deployed application or - * stand-alone module. In case of J2EE applications, getDirectoryForNewModule() - * will be called for each child module. - *

- * After done with copying of files over to the destination, initialDeploy() will - * be called to signal the copying is done. Processing of the returned ProgressObject - * is the same as in DeploymentManager.distribute() call. - *

- * Subsequent deployments are incremental. For each root and child module the IDE will ask plugin - * for destination directory by calling getDirectoryForModule(). After delivering - * the changed files for all modules, the IDE then call incrementalDeploy with - * the description of what have changed since previous deployment. - *

- * For in-place file deployment, where the file copying step is skipped, method - * getDirectoryForNewApplication or getDirectoryForNewModule calls - * return null. - *

- * J2eeserver optain an instance of IncrementalDeployment from server integration plugin by - * calling {@link OptionalDeploymentManagerFactory} to optain an instance of IncrementalDeployment - * for each {@link javax.enterprise.deploy.spi.DeploymentManager} instance. - *

- * @author George Finklang - */ -public abstract class IncrementalDeployment { - - /** - * First time deployment file distribution. Before this method is called - * the module content files should be ready in the destination location. - * - * @param target target of deployment - * @param app the app to deploy - * @param configuration server specific data for deployment - * @param dir the destination directory for the given deploy app - * @return the object for feedback on progress of deployment - */ - public abstract ProgressObject initialDeploy(Target target, DeployableObject app, DeploymentConfiguration configuration, File dir); - - /** - * Before this method is called, the on-disk representation of TargetModuleID - * is updated. - * @param module the TargetModuleID of the deployed application or stand-alone module. - * @param changes AppChangeDescriptor describing what in the application changed. - * @return the ProgressObject providing feedback on deployment progress. - **/ - public abstract ProgressObject incrementalDeploy(TargetModuleID module, AppChangeDescriptor changes); - - /** - * Whether the deployable object could be file deployed to the specified target - * @param target target in question - * @param deployable the deployable object in question - * @return true if it is possible to do file deployment - */ - public abstract boolean canFileDeploy(Target target, DeployableObject deployable); - - /** - * Return absolute path which the IDE will write the specified app or - * stand-alone module content to. - * @param target target server of the deployment - * @param app the app or stand-alone module to deploy - * @param configuration server specific data for deployment - * @return absolute path root directory for the specified app or - * null if server can accept the deployment from an arbitrary directory. - */ - public abstract File getDirectoryForNewApplication(Target target, DeployableObject app, DeploymentConfiguration configuration); - - /** - * Return absolute path the IDE will write the app or stand-alone module content to. - * Note: to use deployment name, implementation nees to override this. - * - * @param deploymentName name to use in deployment - * @param target target server of the deployment - * @param configuration server specific data for deployment - * @return absolute path root directory for the specified app or null if server can accept the deployment from an arbitrary directory. - */ - public File getDirectoryForNewApplication(String deploymentName, Target target, DeploymentConfiguration configuration) { - return getDirectoryForNewApplication(target, configuration.getDeployableObject(), configuration); - } - - /** - * Return absolute path to which the IDE will write the specified module content. - * @param appDir the root directory of containing application - * @param uri the URI of child module within the app - * @param module the child module object to deploy - * @param configuration server specific data for deployment - * @return absolute path root directory for the specified module. - */ - public abstract File getDirectoryForNewModule(File appDir, String uri, DeployableObject module, DeploymentConfiguration configuration); - - /** - * Return absolute path to which the IDE will write the content changes of specified module. - * @param module id for the target module. - * @return absolute path root directory for the specified module. - */ - public abstract File getDirectoryForModule(TargetModuleID module); - - /** - * Get the URI pointing to location of child module inside a application archive. - * - * @param module TargetModuleID of the child module - * @return its relative path within application archive, returns null by - * default (for standalone module) - */ - public String getModuleUrl(TargetModuleID module) { - return null; - } - - /** - * Inform the plugin that the specified module is being deployed. Notification - * is sent even if there is really nothing needed to be deployed. - * - * @param module module which is being deployed. - */ - public void notifyDeployment(TargetModuleID module) { - //do nothing, override if needed - } -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformFactory.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformFactory.java 30 Jun 2006 20:44:56 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,42 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import javax.enterprise.deploy.spi.DeploymentManager; -import org.netbeans.modules.j2ee.deployment.plugins.api.J2eePlatformImpl; - -/** - * Mandatory factory class for producing {@link J2eePlatformImpl}. Plugin is - * required to register instance of this class in module layer in the - * J2EE/DeploymentPlugins/{plugin_name} folder. - * - * @author Stepan Herold - * @since 1.5 - */ -public abstract class J2eePlatformFactory { - - /** - * Return J2eePlatformImpl for the given DeploymentManager. - * - * @param dm DeploymentManager. - */ - public abstract J2eePlatformImpl getJ2eePlatformImpl(DeploymentManager dm); - -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformImpl.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformImpl.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformImpl.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/J2eePlatformImpl.java 12 Oct 2006 14:42:49 -0000 1.6 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,216 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - - -import java.awt.Image; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.io.File; -import java.util.Collections; -import java.util.Set; -import org.netbeans.api.java.platform.JavaPlatform; -import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform; -import org.netbeans.spi.project.libraries.LibraryImplementation; - -/** - * Base SPI interface for J2eePlatform. The J2eePlatform describes the target - * environment J2EE applications are build against and subsequently deployed to. - * Each server instance defines its own J2EE platform. - * - * @author Stepan Herold - * @since 1.5 - */ -public abstract class J2eePlatformImpl { - - /** Display name property */ - public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N - /** Libraries property */ - public static final String PROP_LIBRARIES = "libraries"; //NOI18N - /** Platform roots property */ - public static final String PROP_PLATFORM_ROOTS = "platformRoots"; //NOI18N - - private PropertyChangeSupport supp; - - /** - * Return platform's libraries. - * - * @return platform's libraries. - */ - public abstract LibraryImplementation[] getLibraries(); - - /** - * Return platform's display name. - * - * @return platform's display name. - */ - public abstract String getDisplayName(); - - /** - * Return an icon describing the platform. This will be mostly the icon - * used for server instance nodes - * - * @return an icon describing the platform - * @since 1.6 - */ - public abstract Image getIcon(); - - /** - * Return platform's root directories. This will be mostly server's installation - * directory. - * - * @return platform's root directories. - */ - public abstract File[] getPlatformRoots(); - - /** - * Return classpath for the specified tool. Use the tool constants declared - * in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform}. - * - * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}. - * @return classpath for the specified tool. - */ - public abstract File[] getToolClasspathEntries(String toolName); - - /** - * Specifies whether a tool of the given name is supported by this platform. - * Use the tool constants declared in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform}. - * - * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME} - * . - * @return true if platform supports tool of the given name, - * false otherwise. - */ - public abstract boolean isToolSupported(String toolName); - - /** - * Return a list of supported J2EE specification versions. Use J2EE specification - * versions defined in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule} - * class. - * - * @return list of supported J2EE specification versions. - */ - public abstract Set/**/ getSupportedSpecVersions(); - - /** - * Return a list of supported J2EE specification versions for - * a given module type. - * - * Implement this method if the server supports different versions - * of spec for different types of modules. - * If this method is not implemented by the plugin the IDE - * will use the non parametrized version of - * getSupportedSpecVersions. - * - * @param moduleType one of the constants defined in - * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule} - * @return list of supported J2EE specification versions. - */ - public Set getSupportedSpecVersions(Object moduleType) { - return getSupportedSpecVersions(); - } - - /** - * Return a list of supported J2EE module types. Use module types defined in the - * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule} - * class. - * - * @return list of supported J2EE module types. - */ - public abstract Set/**/ getSupportedModuleTypes(); - - /** - * Return a set of J2SE platform versions this J2EE platform can run with. - * Versions should be specified as strings i.g. ("1.3", "1.4", etc.) - * - * @since 1.9 - */ - public abstract Set/**/ getSupportedJavaPlatformVersions(); - - /** - * Return server J2SE platform or null if the platform is unknown, not - * registered in the IDE. - * - * @return server J2SE platform or null if the platform is unknown, not - * registered in the IDE. - * - * @since 1.9 - */ - public abstract JavaPlatform getJavaPlatform(); - - /** - * Register a listener which will be notified when some of the platform's properties - * change. - * - * @param l listener which should be added. - */ - public final void addPropertyChangeListener(PropertyChangeListener l) { - synchronized (this) { - if (supp == null) - supp = new PropertyChangeSupport(this); - } - supp.addPropertyChangeListener(l); - } - - /** - * Remove a listener registered previously. - * - * @param l listener which should be removed. - */ - public final void removePropertyChangeListener(PropertyChangeListener l) { - if (supp != null) - supp.removePropertyChangeListener(l); - } - - - /** - * Fire PropertyChange to all registered PropertyChangeListeners. - * - * @param propName property name. - * @param oldValue old value. - * @param newValue new value. - */ - public final void firePropertyChange(String propName, Object oldValue, Object newValue) { - if (supp != null) - supp.firePropertyChange(propName, oldValue, newValue); - } - - /** - * Returns the property value for the specified tool. - *

- * The property value uses Ant property format and therefore may contain - * references to another properties defined either by the client of this API - * or by the tool itself. - *

- * The properties the client may be requited to define are as follows - * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#CLIENT_PROP_DIST_ARCHIVE} - * - * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}. - * @param propertyName tool property name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_PROP_MAIN_CLASS}. - * - * @return property value or null, if the property is not defined for the - * specified tool. - * - * @since 1.16 - */ - public String getToolProperty(String toolName, String propertyName) { - return null; - } -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OldJSPDebug.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OldJSPDebug.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OldJSPDebug.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OldJSPDebug.java 30 Jun 2006 20:44:56 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,196 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import java.io.IOException; -import java.util.Map; -import javax.enterprise.deploy.spi.TargetModuleID; - -/** This interface should be implemented by plugins that want to support JSP - * source level debugging, but do not support JSR 45. - * The prerequisite for the JSP debugging support (without JSR 45) is the support - * for finding a generated servlet, represented by the FindJSPServlet interface. - * - * @author Petr Jiricka - */ -public interface OldJSPDebug extends FindJSPServlet { - - /** Creates a servlet <-> JSP mapping for a given JSP. May be null if the server is not running - * or the page has not been compiled. Also may be null if the server plugin does not support - * creation of the line mapping information. - * @param module web module in which the JSP is located. - * @param jspResourcePath the path of the JSP for which the mapping is requested, e.g. - * "pages/login.jsp". Never starts with a '/'. - * @return JspSourceMapper for this JSP. - */ - public JspSourceMapper getSourceMapper(TargetModuleID module, String jspResourcePath); - - /** Provides common interface for JSP <----> Java mappings */ - public interface JspSourceMapper { - - /** Converts the JSP file name (from the string int the servlet comments into - * the Forte4J resource name) - */ - public interface NameConverter { - /** Converts the JSP name (from the string int the servlet comments into - * the Forte4J resource name) - *@param name - JSP name to convert - */ - String convert(String name) throws IOException; - } - - /** - * Get the value of primaryJspFileName. - * @return Value of primaryJspFileName. - */ - String getPrimaryJspFileName(); - - /** - * Set the value of primaryJspFileName. - * @param v Value to assign to primaryJspFileName. - */ - public void setPrimaryJspFileName(String v); - - /** - * Returns the number of entries in this source mapper. This number is 0, if no entries were made. - * @return The number of entries in this source mapper. This number is 0, if no entries were made. - */ - int size(); - - /** - * Returns whether the JSP page is empty - * @return Whether the JSP page is empty - */ - boolean isEmpty(); - - - /* * - * Converts a position in the JAVA_CODE to a JSP_CODE range. - * @param jspFileName JSP file name to get forward mapping for - * @param range Range to convert - - // Range javaToJsp(String jspFile, Position position ); - - /* * - * Convert a range in the JSP_CODE to a JAVA_CODE range. - * @param jspFileName JSP file name to get forward mapping for - * @param range Range to convert - */ - - // Range jspToJava(String jspFile, Range range); - - /** - * Returns Java Servlet line number for the given line number of the primary (not "included") JSP file - * @param line unmangled (JSP) line number - * @return The mangled (Servlet) line number - */ - int mangle(int line); - - /** - * Returns Java Servlet line number for the given line/column number of the primary (not "included") JSP file - * @param line unmangled (JSP) line number - * @param col unmangled (JSP) column number - * @return The mangled (Servlet) line number - */ - int mangle(int line, int col); - - /** - * Returns Java Servlet line number for the given line number of the given JSP - * @param jspFile - */ - int mangle(String jspFile, int line); - - /** - * Returns Java Servlet line/column number for the given line number of the given JSP - * @param jspFileName Name of the JSP file to map - * @param line unmangled (JSP) line number - * @param col unmangled (JSP) column number - * @return The mangled (Servlet) line number - */ - int mangle(String jspFileName, int line, int col); - - /** - * Returns primary (not "included") JSP file line number for the given line number in the generated Java Servlet - * @param line mangled (Servlet) line number - * @return The unmangled (JSP) line number - */ - int unmangle(int line); - - /** - * Returns primary (not "included") JSP file line/column number for the given line number - * in the generated Java Servlet - * @param line mangled (Servlet) line number - * @param col mangled (Servlet) column number - * @return The unmangled (JSP) line number - */ - int unmangle(int line, int col); - - /** - * Returns JSP file line/column number for the given line number in the generated Java Servlet - * @param jspFileName JSP file name - * @param line mangled (Servlet) line number - * @param col mangled (Servlet) column number - * @return The unmangled (JSP) line number - */ - int unmangle(String jspFileName, int line, int col); - - /** - * Returns the type of the generated Servlet line/column - * @param line mangled (Servlet) line number - * @param col mangled (Servlet) column number - * @return The type of the generated Servlet line/column - */ - String getJavaLineType(int line, int col); - - /** - * Returns the JSP file name for the given line/column in the generated Servlet - * @param line mangled (Servlet) line number - * @param col mangled (Servlet) column number - * @return The JSP file name for the given line/column in the generated Servlet - */ - public String getJspFileName(int line, int col) throws IOException; - - - /** - * Returns whether the giver Servlet line/column is a part of dynamic (Java) code in the JSP page - * @param line mangled (Servlet) line number - * @param col mangled (Servlet) column number - * @return Whether the giver Servlet line/column is a part of dynamic (Java) code in the JSP page - */ - boolean isJavaCodeInJspPage(int line, int col); - - /** @return a Map of all JSP file names comprising the generated Java servlet */ - Map getFileNames(); - - /** - * Returns whether the primary JSP page has included files (HTML, JSP etc) - *@return Whether the primary JSP page has included files (HTML, JSP etc) - */ - public boolean hasIncludeFiles(); - - /** - * Returns whether the given name is a proper JSP file name - * @param name given name - *@return whether the given name is a proper JSP file name - */ - public boolean isProperJspFileName(String name); - } - -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OptionalDeploymentManagerFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OptionalDeploymentManagerFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OptionalDeploymentManagerFactory.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/OptionalDeploymentManagerFactory.java 12 Oct 2006 14:42:49 -0000 1.6 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,94 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import javax.enterprise.deploy.spi.DeploymentManager; -import org.openide.WizardDescriptor; - -/** - * Factory for optional deployment functionality that a plugin can provide. - * Plugins need to register an instance of this class in module layer in folder - * J2EE/DeploymentPlugins/{plugin_name}. - * - * @author Pavel Buzek - */ -public abstract class OptionalDeploymentManagerFactory { - - /** - * Create StartServer for given DeploymentManager. - * The instance returned by this method will be cached by the j2eeserver. - */ - public abstract StartServer getStartServer (DeploymentManager dm); - - /** - * Create IncrementalDeployment for given DeploymentManager. - * The instance returned by this method will be cached by the j2eeserver. - */ - public abstract IncrementalDeployment getIncrementalDeployment (DeploymentManager dm); - - /** - * Create FindJSPServlet for given DeploymentManager. - * The instance returned by this method will be cached by the j2eeserver. - */ - public abstract FindJSPServlet getFindJSPServlet (DeploymentManager dm); - - /** - * Create TargetModuleIDResolver for the given DeploymentManager. - * The instance returned by this method will be cached by the j2eeserver. - */ - public TargetModuleIDResolver getTargetModuleIDResolver(DeploymentManager dm) { - return null; - } - - /** - * Create the wizard iterator to be used in the Add Server Instance wizard - */ - public WizardDescriptor.InstantiatingIterator getAddInstanceIterator() { - return null; - } - - /** - * Creates an Ant deployment provider for the specified deployment manager. - * - * @param dm deployment manager. - * @return an instance of the AntDeploymentProvider if Ant deployment - * is supported for the specified deployment manager, null otherwise. - * @since 1.18 - */ - public AntDeploymentProvider getAntDeploymentProvider(DeploymentManager dm) { - return null; - } - - /** - * Creates a DatasourceManager for the given deployment manager - * or null if data source management is not supported - * - * @param dm the deployment manager - * - * @return a data source manager or null if data source management - * is not supported - * - * @since 1.15 - */ - public DatasourceManager getDatasourceManager(DeploymentManager dm) { - return null; - } -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/RegistryNodeFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/RegistryNodeFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/RegistryNodeFactory.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/RegistryNodeFactory.java 30 Jun 2006 20:44:56 -0000 1.4 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,58 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - - -import org.openide.nodes.Node; -import org.openide.util.Lookup; - -/** - * This interface allows plugin to create all the registry nodes - * (other than the root node) as {@link org.openide.nodes.Node} subclasses, - * and use {@link org.openide.nodes.FilterNode} to generate the display, - * adding infrastructure actions in, and exposing certain infrastructure to - * the plugins for use in constructing nodes. - * Use a look-like infrastructure so migration to looks can happen easier. - * Plugins need to register an instance of this class in module layer in folder - * J2EE/DeploymentPlugins/{plugin_name}. - * - * @see org.openide.nodes.Node - * @see org.openide.nodes.FilterNode - * - * @author George Finklang - */ -public interface RegistryNodeFactory { - - /** - * Return node representing the admin server. Children of this node are filtered. - * Start/Stop/Remove/SetAsDefault actions will be added by FilterNode if appropriate. - * @param lookup will contain DeploymentFactory, DeploymentManager, Management objects. - * @return admin server node. - */ - public Node getManagerNode(Lookup lookup); - - /** - * Provide node representing Deployment API Target object. - * Start/Stop/SetAsDefault actions will be added by FilterNode if appropriate. - * @param lookup will contain DeploymentFactory, DeploymentManager, Target, Management objects. - * @return target server node - */ - public Node getTargetNode(Lookup lookup); -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/StartServer.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/StartServer.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/StartServer.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/StartServer.java 30 Jun 2006 20:44:56 -0000 1.10 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,249 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import javax.enterprise.deploy.spi.Target; -import javax.enterprise.deploy.spi.status.ProgressObject; -import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings; - -/** - * Server lifecycle services from the IDE. J2eeserver will use these - * services to automatically start or stop admin server and managed (virtual) - * target servers (in debug mode) during deployment or debugging execution. - * - * @see OptionalDeploymentManagerFactory - * @author George FinKlang - * @author nn136682 - * @version 1.0 - */ -public abstract class StartServer { - - /** - * Returns true if the admin server is also the given target server (share the same vm). - * Start/stopping/debug apply to both servers. When the given target server is null, - * service should return true when admin server is also some target. - * @param target the target server in question; could be null. - * @return true when admin is also target server - */ - public abstract boolean isAlsoTargetServer(Target target); - - /** - * Returns true if the admin server can be started through this spi. - */ - public abstract boolean supportsStartDeploymentManager(); - - /** - * Returns if the plugin can start/stop single target servers. - * This should be overwritten as needed. - * @param target the target server in question, could be null in which - * case the answer should probably be false. - * @return true if this plugin can currently handle state management for - * the specific target. - * @since 1.6 - */ - public boolean supportsStartTarget(Target target) { - return false; - } - - /** - * Can be the specified target server started in the debug mode? If the - * target is also an admin server can be the admin server started in the - * debug mode? - * - * @param target the target server in question, null implies the case where - * target is also an admin server. - * - * @return true if the target server can be started in the debug mode, false - * otherwise. The default return value is false. - * - * @since 1.7 - */ - public boolean supportsStartDebugging(Target target) { - return false; - } - - /** - * Can be the specified target server started in profile mode? If the - * target is also an admin server can be the admin server started in - * profile mode? - * - * @param target the target server in question, null implies the case where - * target is also an admin server. - * - * @return true if the target server can be started in profile mode, false - * otherwise. The default return value is false. - * - * @since 1.9 - */ - public boolean supportsStartProfiling(Target target) { - return false; - } - - /** - * Starts the admin server. Note that this means that the DeploymentManager - * was originally created disconnected. After calling this, the DeploymentManager - * will be connected, so any old cached DeploymentManager will be discarded. - * All diagnostics should be communicated through ProgressObject without exceptions thrown. - * - * @return ProgressObject object used to monitor start server progress - */ - public abstract ProgressObject startDeploymentManager(); - - /** - * Stops the admin server. The DeploymentManager object will be disconnected. - * All diagnostic should be communicated through ServerProgres with no - * exceptions thrown. - * @return ServerProgress object used to monitor start server progress - */ - public abstract ProgressObject stopDeploymentManager(); - - /** Optional method. This implementation does nothing. - * - * Stops the admin server. The DeploymentManager object will be disconnected. - * The call should terminate immediately and not wait for the server to stop. - *

- * This will be used at IDE shutdown so that the server shutdown does not block the IDE. - *
- */ - public void stopDeploymentManagerSilently() { - //do nothing - } - - /** See {@link stopDeploymentManagerSilently} - * @return override and return true if stopDeploymentManagerSilently is implemented - */ - public boolean canStopDeploymentManagerSilently () { - return false; - } - - /** - * Returns true if the admin server should be started before server deployment configuration. - */ - public abstract boolean needsStartForConfigure(); - - /** - * Returns true if the admin server should be started before asking for - * target list. - */ - public abstract boolean needsStartForTargetList(); - - /** - * Returns true if the admin server should be started before admininistrative configuration. - */ - public abstract boolean needsStartForAdminConfig(); - - /** - * Returns true if this admin server is running. - */ - public abstract boolean isRunning(); - - /** - * Returns the running state of a specific target. This should be - * overwritten by plugins which support multiple target servers via - * one admin server. - * @param target the target server in question; null value implies - * the query is against the admin server. - * @return true if the server is question is running. - * @since 1.6 - */ - public boolean isRunning(Target target) { - if (target == null || isAlsoTargetServer(target)) { - return isRunning(); - } - - return false; - } - - /** - * Returns true if the given target is in debug mode. - */ - public abstract boolean isDebuggable(Target target); - - /** - * Starts the target server asynchronously and reports the status - * through the returned ProgressObject. This should be - * overwritten by plugins which support the state management of - * different target servers. - * @param target a non-null target server to be started - * @return a ProgressObject which is used to communicate the - * progess/state of this action. Should not be null when supportsStartTarget - * returns true on same target. - * @since 1.6 - */ - public ProgressObject startTarget(Target target) { - return null; - } - - /** - * Stops the target server asynchronously and reports the status - * through the returned ProgressObject. This should be - * overwritten by plugins which support the state management of - * different target servers. - * @param target a non-null target server to be stopped - * @return a ProgressObject which is used to communicate the - * progess/state of this action. Should not be null when supportsStartTarget - * return true on the same target. - * @since 1.6 - */ - public ProgressObject stopTarget(Target target) { - return null; - } - - /** - * Start or restart the target in debug mode. - * If target is also domain admin, the amdin is restarted in debug mode. - * All diagnostic should be communicated through ServerProgres with no exceptions thrown. - * @param target the target server - * @return ServerProgress object to monitor progress on start operation - */ - public abstract ProgressObject startDebugging(Target target); - - /** - * Start the target in profile mode, null target implies the admin server. - * - * @param target the target server in question, null target implies - * the admin server. - * @param settings profiler server settings. - * - * @return ServerProgress object to monitor progress on start operation. - * - * @since 1.9 - */ - public ProgressObject startProfiling(Target target, ProfilerServerSettings settings) { - throw new UnsupportedOperationException("Starting in profile mode is not supported by this server."); // NIO18N - } - - /** - * Returns the host/port necessary for connecting to the server's debug information. - */ - public abstract ServerDebugInfo getDebugInfo(Target target); - - /** - * Returns true if target server needs a restart for last configuration changes to - * take effect. Implementation should override when communication about this - * server state is needed. - * - * @param target target server; null implies the case where target is also admin server. - */ - public boolean needsRestart(Target target) { - return false; - } -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/TargetModuleIDResolver.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/TargetModuleIDResolver.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/TargetModuleIDResolver.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/TargetModuleIDResolver.java 30 Jun 2006 20:44:56 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,60 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -/** - * - * AutoUndeploySupport.java - * - * Created on February 12, 2004, 3:57 PM - * @author nn136682 - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import javax.enterprise.deploy.spi.TargetModuleID; -import javax.enterprise.deploy.spi.Target; - -/** - * Service provided by plugin for lookup TargetModuleID. - * This service basically help J2EE framework identify the target modules - * needs to be undeployed before a safe full deployment can happen. - */ -public abstract class TargetModuleIDResolver { - - public static final String KEY_CONTEXT_ROOT = "contextRoot"; - public static final String KEY_CONTENT_DIR = "contentDirs"; - public static final TargetModuleID[] EMPTY_TMID_ARRAY = new TargetModuleID[0]; - private static String[] lookupKeys = null; - - public final String[] getLookupKeys() { - if (lookupKeys == null) { - lookupKeys = new String[] { - KEY_CONTEXT_ROOT, KEY_CONTENT_DIR - }; - } - return lookupKeys; - } - - /** - * Return the list of TargetModuleIDs that could match the given lookup info. - * @param targetModuleInfo lookup info, keyed by list returned by #getLookupKeys - * @return array of root TargetModuleIDs. - */ - public abstract TargetModuleID[] lookupTargetModuleID(java.util.Map targetModuleInfo, Target[] targetList); -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/VerifierSupport.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/VerifierSupport.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/VerifierSupport.java --- j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/VerifierSupport.java 30 Jun 2006 20:44:57 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,53 +0,0 @@ -/* - * The contents of this file are subject to the terms of the Common Development - * and Distribution License (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at http://www.netbeans.org/cddl.html - * or http://www.netbeans.org/cddl.txt. - * - * When distributing Covered Code, include this CDDL Header Notice in each file - * and include the License file at http://www.netbeans.org/cddl.txt. - * If applicable, add the following below the CDDL Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - * - * The Original Software is NetBeans. The Initial Developer of the Original - * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun - * Microsystems, Inc. All Rights Reserved. - */ - -package org.netbeans.modules.j2ee.deployment.plugins.api; - -import java.io.OutputStream; -import org.netbeans.modules.j2ee.deployment.common.api.ValidationException; -import org.openide.filesystems.FileObject; - -/** - * Verifier service to be implmeneted by Server Integration Plugin. - * Instance of this service needs to be declared in plugin module layer.xml. - * - * @author nn136682 - */ -public abstract class VerifierSupport { - - /** - * Whether the verifier support this module type; default to supports all types. - */ - public boolean supportsModuleType(Object moduleType) { - return true; - } - - /** - * Verify the provided target J2EE module or application, including both - * standard J2EE and platform specific deployment info. The provided - * service could include invoking its own specific UI displaying of verification - * result. In this case, the service could have limited or no output to logger stream. - * - * @param target The an archive, directory or file to verify. - * @param logger Log stream to write verification output to. - * @exception ValidationException if the target fails the validation. - */ - public abstract void verify(FileObject target, OutputStream logger) throws ValidationException; - -} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/AntDeploymentProvider.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/AntDeploymentProvider.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/AntDeploymentProvider.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/AntDeploymentProvider.java 7 Dec 2006 17:12:00 -0000 1.1.2.1 @@ -0,0 +1,62 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; + +/** + * This interface represents a "provider" for the Ant deployment. + *

+ * The j2eeserver uses {@link OptionalDeploymentManagerFactory} to optains an + * instance of the AntDeploymentProvider from the server integration plugin. + * + * @author sherold + * + * @since 1.18 + */ +public interface AntDeploymentProvider { + + /** + * Generates the Ant deployment build script for the given module type to + * the specified output stream. + *

+ * See {@link org.netbeans.modules.j2ee.deployment.devmodules.api.AntDeploymentHelper#writeDeploymentScript(File,Object,String)} + * for what targets and properties is the Ant deployment build script required + * to define and what predefined properties it might use. + * + * @param os the output stream the deployment build script should be generated + * to. + * @param moduleType the module type the build script should handle. Use the + * constants defined in the {@link J2eeModule}. + * @throws IOException if a problem during generating the build script occurs. + */ + void writeDeploymentScript(OutputStream os, Object moduleType) throws IOException; + + /** + * Return the server instance specific deployment properties file used by + * the deployment build script generated by the {@link #writeDeploymentScript(OutputStream,Object)}. + * + * @return the deployment properties file. + */ + File getDeploymentPropertiesFile(); +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/DatasourceManager.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/DatasourceManager.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/DatasourceManager.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/DatasourceManager.java 7 Mar 2007 14:51:49 -0000 1.1.2.3 @@ -0,0 +1,56 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import java.util.Set; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; +import org.netbeans.modules.j2ee.deployment.common.api.Datasource; +import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException; + +/** + * DatasourceManager is responsible for retrieving data sources deployed on the server and + * deploying data sources onto the server. + * + * @author Libor Kotouc + * + * @since 1.15 + */ +public interface DatasourceManager { + + /** + * Retrieves the data sources deployed on the server + * + * @return the set of data sources deployed on the server + * + * @throws ConfigurationException reports problems in retrieving data source + * definitions. + */ + Set getDatasources() throws ConfigurationException; + + /** + * Deploys given set of data sources. + * + * @exception ConfigurationException if there is some problem with data source configuration + * @exception DatasourceAlreadyExistsException if module data source(s) are conflicting + * with data source(s) already deployed on the server + */ + void deployDatasources(Set datasources) + throws ConfigurationException, DatasourceAlreadyExistsException; +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/FindJSPServlet.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/FindJSPServlet.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/FindJSPServlet.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/FindJSPServlet.java 7 Dec 2006 17:12:01 -0000 1.2.2.1 @@ -0,0 +1,63 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import java.io.File; + +/** This interface allows plugins to specify the location of servlets generated + * for JSPs. + * + * @author Petr Jiricka + */ +public interface FindJSPServlet { + + /** Returns the temporary directory where the server writes servlets generated + * from JSPs. The servlets placed in this directory must honor the Java + * directory naming conventions, i.e. the servlet must be placed in subdirectories + * of this directory corresponding to the servlet package name. + * @param moduleContextPath web module for which the temporary directory is requested. + * @return the root temp directory containing servlets generated from JSPs for this module. + */ + public File getServletTempDirectory(String moduleContextPath); + + /** Returns the resource path of the servlet generated for a particular JSP, relatively + * to the main temporary directory. + * @param moduleContextPath context path of web module in which the JSP is located. + * @param jspResourcePath the path of the JSP for which the servlet is requested, e.g. + * "pages/login.jsp". Never starts with a '/'. + * @return the resource name of the servlet generated for the JSP in the module, e.g. + * "org/apache/jsps/pages/login$jsp.java". Must never start with a '/'. + * The servlet file itself does not need to exist at this point - + * if this particular page was not compiled yet. + */ + public String getServletResourcePath(String moduleContextPath, String jspResourcePath); + + /** Returns the encoding of the generated servlet file. + * @param moduleContextPath context path of web module in which the JSP is located. + * @param jspResourcePath the path of the JSP for which the servlet is requested, e.g. + * "pages/login.jsp". Never starts with a '/'. + * @return the encoding of the servlet generated for the JSP in the module, + * e.g. "UTF8". + * The servlet file itself does not need to exist at this point - + * if this particular page was not compiled yet. + */ + public String getServletEncoding(String moduleContextPath, String jspResourcePath); + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/IncrementalDeployment.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/IncrementalDeployment.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/IncrementalDeployment.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/IncrementalDeployment.java 7 Dec 2006 17:12:01 -0000 1.6.2.1 @@ -0,0 +1,156 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +/* + * IncrementalDeployment.java + * + * Created on November 14, 2003, 9:13 AM + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import org.netbeans.modules.j2ee.deployment.plugins.api.AppChangeDescriptor; +import javax.enterprise.deploy.spi.Target; +import javax.enterprise.deploy.spi.TargetModuleID; +import javax.enterprise.deploy.spi.status.ProgressObject; +import java.io.File; +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; +import org.netbeans.modules.j2ee.deployment.plugins.spi.config.ModuleConfiguration; + +/** + * This interface replaces DeploymentManager calls deploy and redeploy during + * directory-based deployment. The calling sequence is as following: + *

+ * Initially, j2eeserver will call getDirectoryForNewApplication() + * to request destination directory to deliver the being deployed application or + * stand-alone module. In case of J2EE applications, getDirectoryForNewModule() + * will be called for each child module. + *

+ * After done with copying of files over to the destination, initialDeploy() will + * be called to signal the copying is done. Processing of the returned ProgressObject + * is the same as in DeploymentManager.distribute() call. + *

+ * Subsequent deployments are incremental. For each root and child module the IDE will ask plugin + * for destination directory by calling getDirectoryForModule(). After delivering + * the changed files for all modules, the IDE then call incrementalDeploy with + * the description of what have changed since previous deployment. + *

+ * For in-place file deployment, where the file copying step is skipped, method + * getDirectoryForNewApplication or getDirectoryForNewModule calls + * return null. + *

+ * J2eeserver optain an instance of IncrementalDeployment from server integration plugin by + * calling {@link OptionalDeploymentManagerFactory} to optain an instance of IncrementalDeployment + * for each {@link javax.enterprise.deploy.spi.DeploymentManager} instance. + *

+ * @author George Finklang + */ +public abstract class IncrementalDeployment { + + /** + * First time deployment file distribution. Before this method is called + * the module content files should be ready in the destination location. + * + * @param target target of deployment + * @param app the app to deploy + * @param configuration server specific data for deployment + * @param dir the destination directory for the given deploy app + * @return the object for feedback on progress of deployment + */ + public abstract ProgressObject initialDeploy(Target target, J2eeModule app, ModuleConfiguration configuration, File dir); + + /** + * Before this method is called, the on-disk representation of TargetModuleID + * is updated. + * @param module the TargetModuleID of the deployed application or stand-alone module. + * @param changes AppChangeDescriptor describing what in the application changed. + * @return the ProgressObject providing feedback on deployment progress. + **/ + public abstract ProgressObject incrementalDeploy(TargetModuleID module, AppChangeDescriptor changes); + + /** + * Whether the deployable object could be file deployed to the specified target + * @param target target in question + * @param deployable the deployable object in question + * @return true if it is possible to do file deployment + */ + public abstract boolean canFileDeploy(Target target, J2eeModule deployable); + + /** + * Return absolute path which the IDE will write the specified app or + * stand-alone module content to. + * @param target target server of the deployment + * @param app the app or stand-alone module to deploy + * @param configuration server specific data for deployment + * @return absolute path root directory for the specified app or + * null if server can accept the deployment from an arbitrary directory. + */ + public abstract File getDirectoryForNewApplication(Target target, J2eeModule app, ModuleConfiguration configuration); + + /** + * Return absolute path the IDE will write the app or stand-alone module content to. + * Note: to use deployment name, implementation nees to override this. + * + * @param deploymentName name to use in deployment + * @param target target server of the deployment + * @param configuration server specific data for deployment + * @return absolute path root directory for the specified app or null if server can accept the deployment from an arbitrary directory. + */ + public File getDirectoryForNewApplication(String deploymentName, Target target, ModuleConfiguration configuration) { + return getDirectoryForNewApplication(target, configuration.getJ2eeModule(), configuration); + } + + /** + * Return absolute path to which the IDE will write the specified module content. + * @param appDir the root directory of containing application + * @param uri the URI of child module within the app + * @param module the child module object to deploy + * @param configuration server specific data for deployment + * @return absolute path root directory for the specified module. + */ + public abstract File getDirectoryForNewModule(File appDir, String uri, J2eeModule module, ModuleConfiguration configuration); + + /** + * Return absolute path to which the IDE will write the content changes of specified module. + * @param module id for the target module. + * @return absolute path root directory for the specified module. + */ + public abstract File getDirectoryForModule(TargetModuleID module); + + /** + * Get the URI pointing to location of child module inside a application archive. + * + * @param module TargetModuleID of the child module + * @return its relative path within application archive, returns null by + * default (for standalone module) + */ + public String getModuleUrl(TargetModuleID module) { + return null; + } + + /** + * Inform the plugin that the specified module is being deployed. Notification + * is sent even if there is really nothing needed to be deployed. + * + * @param module module which is being deployed. + */ + public void notifyDeployment(TargetModuleID module) { + //do nothing, override if needed + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformFactory.java 7 Dec 2006 17:12:02 -0000 1.1.2.1 @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import javax.enterprise.deploy.spi.DeploymentManager; +import org.netbeans.modules.j2ee.deployment.plugins.spi.J2eePlatformImpl; + +/** + * Mandatory factory class for producing {@link J2eePlatformImpl}. Plugin is + * required to register instance of this class in module layer in the + * J2EE/DeploymentPlugins/{plugin_name} folder. + * + * @author Stepan Herold + * @since 1.5 + */ +public abstract class J2eePlatformFactory { + + /** + * Return J2eePlatformImpl for the given DeploymentManager. + * + * @param dm DeploymentManager. + */ + public abstract J2eePlatformImpl getJ2eePlatformImpl(DeploymentManager dm); + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformImpl.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformImpl.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformImpl.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/J2eePlatformImpl.java 7 Dec 2006 17:12:02 -0000 1.1.2.1 @@ -0,0 +1,214 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + + +import java.awt.Image; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.io.File; +import java.util.Set; +import org.netbeans.api.java.platform.JavaPlatform; +import org.netbeans.spi.project.libraries.LibraryImplementation; + +/** + * Base SPI interface for J2eePlatform. The J2eePlatform describes the target + * environment J2EE applications are build against and subsequently deployed to. + * Each server instance defines its own J2EE platform. + * + * @author Stepan Herold + * @since 1.5 + */ +public abstract class J2eePlatformImpl { + + /** Display name property */ + public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N + /** Libraries property */ + public static final String PROP_LIBRARIES = "libraries"; //NOI18N + /** Platform roots property */ + public static final String PROP_PLATFORM_ROOTS = "platformRoots"; //NOI18N + + private PropertyChangeSupport supp; + + /** + * Return platform's libraries. + * + * @return platform's libraries. + */ + public abstract LibraryImplementation[] getLibraries(); + + /** + * Return platform's display name. + * + * @return platform's display name. + */ + public abstract String getDisplayName(); + + /** + * Return an icon describing the platform. This will be mostly the icon + * used for server instance nodes + * + * @return an icon describing the platform + * @since 1.6 + */ + public abstract Image getIcon(); + + /** + * Return platform's root directories. This will be mostly server's installation + * directory. + * + * @return platform's root directories. + */ + public abstract File[] getPlatformRoots(); + + /** + * Return classpath for the specified tool. Use the tool constants declared + * in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform}. + * + * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}. + * @return classpath for the specified tool. + */ + public abstract File[] getToolClasspathEntries(String toolName); + + /** + * Specifies whether a tool of the given name is supported by this platform. + * Use the tool constants declared in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform}. + * + * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME} + * . + * @return true if platform supports tool of the given name, + * false otherwise. + */ + public abstract boolean isToolSupported(String toolName); + + /** + * Return a list of supported J2EE specification versions. Use J2EE specification + * versions defined in the {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule} + * class. + * + * @return list of supported J2EE specification versions. + */ + public abstract Set/**/ getSupportedSpecVersions(); + + /** + * Return a list of supported J2EE specification versions for + * a given module type. + * + * Implement this method if the server supports different versions + * of spec for different types of modules. + * If this method is not implemented by the plugin the IDE + * will use the non parametrized version of + * getSupportedSpecVersions. + * + * @param moduleType one of the constants defined in + * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule} + * @return list of supported J2EE specification versions. + */ + public Set getSupportedSpecVersions(Object moduleType) { + return getSupportedSpecVersions(); + } + + /** + * Return a list of supported J2EE module types. Use module types defined in the + * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule} + * class. + * + * @return list of supported J2EE module types. + */ + public abstract Set/**/ getSupportedModuleTypes(); + + /** + * Return a set of J2SE platform versions this J2EE platform can run with. + * Versions should be specified as strings i.g. ("1.3", "1.4", etc.) + * + * @since 1.9 + */ + public abstract Set/**/ getSupportedJavaPlatformVersions(); + + /** + * Return server J2SE platform or null if the platform is unknown, not + * registered in the IDE. + * + * @return server J2SE platform or null if the platform is unknown, not + * registered in the IDE. + * + * @since 1.9 + */ + public abstract JavaPlatform getJavaPlatform(); + + /** + * Register a listener which will be notified when some of the platform's properties + * change. + * + * @param l listener which should be added. + */ + public final void addPropertyChangeListener(PropertyChangeListener l) { + synchronized (this) { + if (supp == null) + supp = new PropertyChangeSupport(this); + } + supp.addPropertyChangeListener(l); + } + + /** + * Remove a listener registered previously. + * + * @param l listener which should be removed. + */ + public final void removePropertyChangeListener(PropertyChangeListener l) { + if (supp != null) + supp.removePropertyChangeListener(l); + } + + + /** + * Fire PropertyChange to all registered PropertyChangeListeners. + * + * @param propName property name. + * @param oldValue old value. + * @param newValue new value. + */ + public final void firePropertyChange(String propName, Object oldValue, Object newValue) { + if (supp != null) + supp.firePropertyChange(propName, oldValue, newValue); + } + + /** + * Returns the property value for the specified tool. + *

+ * The property value uses Ant property format and therefore may contain + * references to another properties defined either by the client of this API + * or by the tool itself. + *

+ * The properties the client may be requited to define are as follows + * {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#CLIENT_PROP_DIST_ARCHIVE} + * + * @param toolName tool name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_APP_CLIENT_RUNTIME}. + * @param propertyName tool property name, for example {@link org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform#TOOL_PROP_MAIN_CLASS}. + * + * @return property value or null, if the property is not defined for the + * specified tool. + * + * @since 1.16 + */ + public String getToolProperty(String toolName, String propertyName) { + return null; + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OldJSPDebug.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OldJSPDebug.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OldJSPDebug.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OldJSPDebug.java 7 Dec 2006 17:12:03 -0000 1.2.2.1 @@ -0,0 +1,196 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import java.io.IOException; +import java.util.Map; +import javax.enterprise.deploy.spi.TargetModuleID; + +/** This interface should be implemented by plugins that want to support JSP + * source level debugging, but do not support JSR 45. + * The prerequisite for the JSP debugging support (without JSR 45) is the support + * for finding a generated servlet, represented by the FindJSPServlet interface. + * + * @author Petr Jiricka + */ +public interface OldJSPDebug extends FindJSPServlet { + + /** Creates a servlet <-> JSP mapping for a given JSP. May be null if the server is not running + * or the page has not been compiled. Also may be null if the server plugin does not support + * creation of the line mapping information. + * @param module web module in which the JSP is located. + * @param jspResourcePath the path of the JSP for which the mapping is requested, e.g. + * "pages/login.jsp". Never starts with a '/'. + * @return JspSourceMapper for this JSP. + */ + public JspSourceMapper getSourceMapper(TargetModuleID module, String jspResourcePath); + + /** Provides common interface for JSP <----> Java mappings */ + public interface JspSourceMapper { + + /** Converts the JSP file name (from the string int the servlet comments into + * the Forte4J resource name) + */ + public interface NameConverter { + /** Converts the JSP name (from the string int the servlet comments into + * the Forte4J resource name) + *@param name - JSP name to convert + */ + String convert(String name) throws IOException; + } + + /** + * Get the value of primaryJspFileName. + * @return Value of primaryJspFileName. + */ + String getPrimaryJspFileName(); + + /** + * Set the value of primaryJspFileName. + * @param v Value to assign to primaryJspFileName. + */ + public void setPrimaryJspFileName(String v); + + /** + * Returns the number of entries in this source mapper. This number is 0, if no entries were made. + * @return The number of entries in this source mapper. This number is 0, if no entries were made. + */ + int size(); + + /** + * Returns whether the JSP page is empty + * @return Whether the JSP page is empty + */ + boolean isEmpty(); + + + /* * + * Converts a position in the JAVA_CODE to a JSP_CODE range. + * @param jspFileName JSP file name to get forward mapping for + * @param range Range to convert + + // Range javaToJsp(String jspFile, Position position ); + + /* * + * Convert a range in the JSP_CODE to a JAVA_CODE range. + * @param jspFileName JSP file name to get forward mapping for + * @param range Range to convert + */ + + // Range jspToJava(String jspFile, Range range); + + /** + * Returns Java Servlet line number for the given line number of the primary (not "included") JSP file + * @param line unmangled (JSP) line number + * @return The mangled (Servlet) line number + */ + int mangle(int line); + + /** + * Returns Java Servlet line number for the given line/column number of the primary (not "included") JSP file + * @param line unmangled (JSP) line number + * @param col unmangled (JSP) column number + * @return The mangled (Servlet) line number + */ + int mangle(int line, int col); + + /** + * Returns Java Servlet line number for the given line number of the given JSP + * @param jspFile + */ + int mangle(String jspFile, int line); + + /** + * Returns Java Servlet line/column number for the given line number of the given JSP + * @param jspFileName Name of the JSP file to map + * @param line unmangled (JSP) line number + * @param col unmangled (JSP) column number + * @return The mangled (Servlet) line number + */ + int mangle(String jspFileName, int line, int col); + + /** + * Returns primary (not "included") JSP file line number for the given line number in the generated Java Servlet + * @param line mangled (Servlet) line number + * @return The unmangled (JSP) line number + */ + int unmangle(int line); + + /** + * Returns primary (not "included") JSP file line/column number for the given line number + * in the generated Java Servlet + * @param line mangled (Servlet) line number + * @param col mangled (Servlet) column number + * @return The unmangled (JSP) line number + */ + int unmangle(int line, int col); + + /** + * Returns JSP file line/column number for the given line number in the generated Java Servlet + * @param jspFileName JSP file name + * @param line mangled (Servlet) line number + * @param col mangled (Servlet) column number + * @return The unmangled (JSP) line number + */ + int unmangle(String jspFileName, int line, int col); + + /** + * Returns the type of the generated Servlet line/column + * @param line mangled (Servlet) line number + * @param col mangled (Servlet) column number + * @return The type of the generated Servlet line/column + */ + String getJavaLineType(int line, int col); + + /** + * Returns the JSP file name for the given line/column in the generated Servlet + * @param line mangled (Servlet) line number + * @param col mangled (Servlet) column number + * @return The JSP file name for the given line/column in the generated Servlet + */ + public String getJspFileName(int line, int col) throws IOException; + + + /** + * Returns whether the giver Servlet line/column is a part of dynamic (Java) code in the JSP page + * @param line mangled (Servlet) line number + * @param col mangled (Servlet) column number + * @return Whether the giver Servlet line/column is a part of dynamic (Java) code in the JSP page + */ + boolean isJavaCodeInJspPage(int line, int col); + + /** @return a Map of all JSP file names comprising the generated Java servlet */ + Map getFileNames(); + + /** + * Returns whether the primary JSP page has included files (HTML, JSP etc) + *@return Whether the primary JSP page has included files (HTML, JSP etc) + */ + public boolean hasIncludeFiles(); + + /** + * Returns whether the given name is a proper JSP file name + * @param name given name + *@return whether the given name is a proper JSP file name + */ + public boolean isProperJspFileName(String name); + } + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OptionalDeploymentManagerFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OptionalDeploymentManagerFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OptionalDeploymentManagerFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/OptionalDeploymentManagerFactory.java 21 Mar 2007 23:38:17 -0000 1.1.2.3 @@ -0,0 +1,96 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import javax.enterprise.deploy.spi.DeploymentManager; +import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer; +import org.netbeans.modules.j2ee.deployment.plugins.spi.TargetModuleIDResolver; +import org.openide.WizardDescriptor; + +/** + * Factory for optional deployment functionality that a plugin can provide. + * Plugins need to register an instance of this class in module layer in folder + * J2EE/DeploymentPlugins/{plugin_name}. + * + * @author Pavel Buzek + */ +public abstract class OptionalDeploymentManagerFactory { + + /** + * Create StartServer for given DeploymentManager. + * The instance returned by this method will be cached by the j2eeserver. + */ + public abstract StartServer getStartServer (DeploymentManager dm); + + /** + * Create IncrementalDeployment for given DeploymentManager. + * The instance returned by this method will be cached by the j2eeserver. + */ + public abstract IncrementalDeployment getIncrementalDeployment (DeploymentManager dm); + + /** + * Create FindJSPServlet for given DeploymentManager. + * The instance returned by this method will be cached by the j2eeserver. + */ + public abstract FindJSPServlet getFindJSPServlet (DeploymentManager dm); + + /** + * Create TargetModuleIDResolver for the given DeploymentManager. + * The instance returned by this method will be cached by the j2eeserver. + */ + public TargetModuleIDResolver getTargetModuleIDResolver(DeploymentManager dm) { + return null; + } + + /** + * Create the wizard iterator to be used in the Add Server Instance wizard + */ + public WizardDescriptor.InstantiatingIterator getAddInstanceIterator() { + return null; + } + + /** + * Creates an Ant deployment provider for the specified deployment manager. + * + * @param dm deployment manager. + * @return an instance of the AntDeploymentProvider if Ant deployment + * is supported for the specified deployment manager, null otherwise. + * @since 1.18 + */ + public AntDeploymentProvider getAntDeploymentProvider(DeploymentManager dm) { + return null; + } + + /** + * Creates a DatasourceManager for the given deployment manager + * or null if data source management is not supported + * + * @param dm the deployment manager + * + * @return a data source manager or null if data source management + * is not supported + * + * @since 1.15 + */ + public DatasourceManager getDatasourceManager(DeploymentManager dm) { + return null; + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/RegistryNodeFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/RegistryNodeFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/RegistryNodeFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/RegistryNodeFactory.java 7 Dec 2006 17:12:04 -0000 1.2.2.1 @@ -0,0 +1,58 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + + +import org.openide.nodes.Node; +import org.openide.util.Lookup; + +/** + * This interface allows plugin to create all the registry nodes + * (other than the root node) as {@link org.openide.nodes.Node} subclasses, + * and use {@link org.openide.nodes.FilterNode} to generate the display, + * adding infrastructure actions in, and exposing certain infrastructure to + * the plugins for use in constructing nodes. + * Use a look-like infrastructure so migration to looks can happen easier. + * Plugins need to register an instance of this class in module layer in folder + * J2EE/DeploymentPlugins/{plugin_name}. + * + * @see org.openide.nodes.Node + * @see org.openide.nodes.FilterNode + * + * @author George Finklang + */ +public interface RegistryNodeFactory { + + /** + * Return node representing the admin server. Children of this node are filtered. + * Start/Stop/Remove/SetAsDefault actions will be added by FilterNode if appropriate. + * @param lookup will contain DeploymentFactory, DeploymentManager, Management objects. + * @return admin server node. + */ + public Node getManagerNode(Lookup lookup); + + /** + * Provide node representing Deployment API Target object. + * Start/Stop/SetAsDefault actions will be added by FilterNode if appropriate. + * @param lookup will contain DeploymentFactory, DeploymentManager, Target, Management objects. + * @return target server node + */ + public Node getTargetNode(Lookup lookup); +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/StartServer.java 7 Dec 2006 17:12:04 -0000 1.6.2.1 @@ -0,0 +1,250 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import javax.enterprise.deploy.spi.Target; +import javax.enterprise.deploy.spi.status.ProgressObject; +import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo; +import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings; + +/** + * Server lifecycle services from the IDE. J2eeserver will use these + * services to automatically start or stop admin server and managed (virtual) + * target servers (in debug mode) during deployment or debugging execution. + * + * @see OptionalDeploymentManagerFactory + * @author George FinKlang + * @author nn136682 + * @version 1.0 + */ +public abstract class StartServer { + + /** + * Returns true if the admin server is also the given target server (share the same vm). + * Start/stopping/debug apply to both servers. When the given target server is null, + * service should return true when admin server is also some target. + * @param target the target server in question; could be null. + * @return true when admin is also target server + */ + public abstract boolean isAlsoTargetServer(Target target); + + /** + * Returns true if the admin server can be started through this spi. + */ + public abstract boolean supportsStartDeploymentManager(); + + /** + * Returns if the plugin can start/stop single target servers. + * This should be overwritten as needed. + * @param target the target server in question, could be null in which + * case the answer should probably be false. + * @return true if this plugin can currently handle state management for + * the specific target. + * @since 1.6 + */ + public boolean supportsStartTarget(Target target) { + return false; + } + + /** + * Can be the specified target server started in the debug mode? If the + * target is also an admin server can be the admin server started in the + * debug mode? + * + * @param target the target server in question, null implies the case where + * target is also an admin server. + * + * @return true if the target server can be started in the debug mode, false + * otherwise. The default return value is false. + * + * @since 1.7 + */ + public boolean supportsStartDebugging(Target target) { + return false; + } + + /** + * Can be the specified target server started in profile mode? If the + * target is also an admin server can be the admin server started in + * profile mode? + * + * @param target the target server in question, null implies the case where + * target is also an admin server. + * + * @return true if the target server can be started in profile mode, false + * otherwise. The default return value is false. + * + * @since 1.9 + */ + public boolean supportsStartProfiling(Target target) { + return false; + } + + /** + * Starts the admin server. Note that this means that the DeploymentManager + * was originally created disconnected. After calling this, the DeploymentManager + * will be connected, so any old cached DeploymentManager will be discarded. + * All diagnostics should be communicated through ProgressObject without exceptions thrown. + * + * @return ProgressObject object used to monitor start server progress + */ + public abstract ProgressObject startDeploymentManager(); + + /** + * Stops the admin server. The DeploymentManager object will be disconnected. + * All diagnostic should be communicated through ServerProgres with no + * exceptions thrown. + * @return ServerProgress object used to monitor start server progress + */ + public abstract ProgressObject stopDeploymentManager(); + + /** Optional method. This implementation does nothing. + * + * Stops the admin server. The DeploymentManager object will be disconnected. + * The call should terminate immediately and not wait for the server to stop. + *

+ * This will be used at IDE shutdown so that the server shutdown does not block the IDE. + *
+ */ + public void stopDeploymentManagerSilently() { + //do nothing + } + + /** See {@link stopDeploymentManagerSilently} + * @return override and return true if stopDeploymentManagerSilently is implemented + */ + public boolean canStopDeploymentManagerSilently () { + return false; + } + + /** + * Returns true if the admin server should be started before server deployment configuration. + */ + public abstract boolean needsStartForConfigure(); + + /** + * Returns true if the admin server should be started before asking for + * target list. + */ + public abstract boolean needsStartForTargetList(); + + /** + * Returns true if the admin server should be started before admininistrative configuration. + */ + public abstract boolean needsStartForAdminConfig(); + + /** + * Returns true if this admin server is running. + */ + public abstract boolean isRunning(); + + /** + * Returns the running state of a specific target. This should be + * overwritten by plugins which support multiple target servers via + * one admin server. + * @param target the target server in question; null value implies + * the query is against the admin server. + * @return true if the server is question is running. + * @since 1.6 + */ + public boolean isRunning(Target target) { + if (target == null || isAlsoTargetServer(target)) { + return isRunning(); + } + + return false; + } + + /** + * Returns true if the given target is in debug mode. + */ + public abstract boolean isDebuggable(Target target); + + /** + * Starts the target server asynchronously and reports the status + * through the returned ProgressObject. This should be + * overwritten by plugins which support the state management of + * different target servers. + * @param target a non-null target server to be started + * @return a ProgressObject which is used to communicate the + * progess/state of this action. Should not be null when supportsStartTarget + * returns true on same target. + * @since 1.6 + */ + public ProgressObject startTarget(Target target) { + return null; + } + + /** + * Stops the target server asynchronously and reports the status + * through the returned ProgressObject. This should be + * overwritten by plugins which support the state management of + * different target servers. + * @param target a non-null target server to be stopped + * @return a ProgressObject which is used to communicate the + * progess/state of this action. Should not be null when supportsStartTarget + * return true on the same target. + * @since 1.6 + */ + public ProgressObject stopTarget(Target target) { + return null; + } + + /** + * Start or restart the target in debug mode. + * If target is also domain admin, the amdin is restarted in debug mode. + * All diagnostic should be communicated through ServerProgres with no exceptions thrown. + * @param target the target server + * @return ServerProgress object to monitor progress on start operation + */ + public abstract ProgressObject startDebugging(Target target); + + /** + * Start the target in profile mode, null target implies the admin server. + * + * @param target the target server in question, null target implies + * the admin server. + * @param settings profiler server settings. + * + * @return ServerProgress object to monitor progress on start operation. + * + * @since 1.9 + */ + public ProgressObject startProfiling(Target target, ProfilerServerSettings settings) { + throw new UnsupportedOperationException("Starting in profile mode is not supported by this server."); // NIO18N + } + + /** + * Returns the host/port necessary for connecting to the server's debug information. + */ + public abstract ServerDebugInfo getDebugInfo(Target target); + + /** + * Returns true if target server needs a restart for last configuration changes to + * take effect. Implementation should override when communication about this + * server state is needed. + * + * @param target target server; null implies the case where target is also admin server. + */ + public boolean needsRestart(Target target) { + return false; + } +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/TargetModuleIDResolver.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/TargetModuleIDResolver.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/TargetModuleIDResolver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/TargetModuleIDResolver.java 7 Dec 2006 17:12:05 -0000 1.1.2.1 @@ -0,0 +1,60 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +/** + * + * AutoUndeploySupport.java + * + * Created on February 12, 2004, 3:57 PM + * @author nn136682 + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import javax.enterprise.deploy.spi.TargetModuleID; +import javax.enterprise.deploy.spi.Target; + +/** + * Service provided by plugin for lookup TargetModuleID. + * This service basically help J2EE framework identify the target modules + * needs to be undeployed before a safe full deployment can happen. + */ +public abstract class TargetModuleIDResolver { + + public static final String KEY_CONTEXT_ROOT = "contextRoot"; + public static final String KEY_CONTENT_DIR = "contentDirs"; + public static final TargetModuleID[] EMPTY_TMID_ARRAY = new TargetModuleID[0]; + private static String[] lookupKeys = null; + + public final String[] getLookupKeys() { + if (lookupKeys == null) { + lookupKeys = new String[] { + KEY_CONTEXT_ROOT, KEY_CONTENT_DIR + }; + } + return lookupKeys; + } + + /** + * Return the list of TargetModuleIDs that could match the given lookup info. + * @param targetModuleInfo lookup info, keyed by list returned by #getLookupKeys + * @return array of root TargetModuleIDs. + */ + public abstract TargetModuleID[] lookupTargetModuleID(java.util.Map targetModuleInfo, Target[] targetList); +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/VerifierSupport.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/VerifierSupport.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/VerifierSupport.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/VerifierSupport.java 7 Dec 2006 17:12:05 -0000 1.1.2.1 @@ -0,0 +1,53 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi; + +import java.io.OutputStream; +import org.netbeans.modules.j2ee.deployment.common.api.ValidationException; +import org.openide.filesystems.FileObject; + +/** + * Verifier service to be implmeneted by Server Integration Plugin. + * Instance of this service needs to be declared in plugin module layer.xml. + * + * @author nn136682 + */ +public abstract class VerifierSupport { + + /** + * Whether the verifier support this module type; default to supports all types. + */ + public boolean supportsModuleType(Object moduleType) { + return true; + } + + /** + * Verify the provided target J2EE module or application, including both + * standard J2EE and platform specific deployment info. The provided + * service could include invoking its own specific UI displaying of verification + * result. In this case, the service could have limited or no output to logger stream. + * + * @param target The an archive, directory or file to verify. + * @param logger Log stream to write verification output to. + * @exception ValidationException if the target fails the validation. + */ + public abstract void verify(FileObject target, OutputStream logger) throws ValidationException; + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ContextRootConfiguration.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ContextRootConfiguration.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ContextRootConfiguration.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ContextRootConfiguration.java 23 Mar 2007 20:29:56 -0000 1.1.2.1 @@ -0,0 +1,55 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.config; + +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; + +/** + * Configuration useful for setting and getting the web module context root. + *

+ * Implementation of this interface should be registered in the {@link ModuleConfiguration} + * lookup. + * + * @since 1.23 + * @author sherold + */ +public interface ContextRootConfiguration { + + /** + * Return the web module context root. + * + * @return web module context root. + * + * @throws ConfigurationException reports errors in getting the web context + * root. + */ + String getContextRoot() throws ConfigurationException; + + /** + * Set the web context root. + * + * @param contextRoot context root to be set. + * + * @throws ConfigurationException reports errors in setting the web context + * root. + */ + void setContextRoot(String contextRoot) throws ConfigurationException; + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DatasourceConfiguration.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DatasourceConfiguration.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DatasourceConfiguration.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DatasourceConfiguration.java 23 Mar 2007 20:29:56 -0000 1.1.2.1 @@ -0,0 +1,74 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.config; + +import java.util.Set; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; +import org.netbeans.modules.j2ee.deployment.common.api.Datasource; +import org.netbeans.modules.j2ee.deployment.common.api.DatasourceAlreadyExistsException; + +/** + * Configuration useful for managing module data sources. + *

+ * Implementation of this interface should be registered in the {@link ModuleConfiguration} + * lookup. + * + * @since 1.23 + * @author sherold + */ +public interface DatasourceConfiguration { + + /** + * Returns the data sources defined in the module. + * + * @return a set of data sources defined in the module. + * + * @throws ConfigurationException reports problems in retrieving data source + * definitions. + */ + Set getDatasources() throws ConfigurationException; + + /** + * Returns true if data source creation is supported, false otherwise. + * + * @return true if data source creation is supported, false otherwise. + */ + boolean supportsCreateDatasource(); + + /** + * Creates the data source definition in the module. + * + * @param jndiName data source JNDI name. + * @param url database URL. + * @param username database user. + * @param password user's password. + * @param driver fully qualified name of the database driver class. + * + * @return created data source. + * + * @throws UnsupportedOperationException if operation is not supported. + * @throws ConfigurationException reports problems in creating data source + * definition. + * @throws DatasourceAlreadyExistsException if a data source with the same + * JNDI name already exists. + */ + Datasource createDatasource(String jndiName, String url, String username, String password, String driver) + throws UnsupportedOperationException, ConfigurationException, DatasourceAlreadyExistsException; +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DeploymentPlanConfiguration.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DeploymentPlanConfiguration.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DeploymentPlanConfiguration.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/DeploymentPlanConfiguration.java 27 Mar 2007 09:29:11 -0000 1.1.2.2 @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.config; + +import java.io.OutputStream; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; + +/** + * Configuration useful for creating the deployment plan file. The + * deployment plan file is created when the JSR-88 based deployment is used. + *

+ * Implementation of this interface should be registered in the {@link ModuleConfiguration} + * lookup. + * + * @since 1.23 + * @author sherold + */ +public interface DeploymentPlanConfiguration { + + /** + * Write the deployment plan file to the specified output stream. + * + * @param outputStream the deployment paln file should be written to. + * @throws ConfigurationException if an error during saving the deployment + * plan configuration occurs. + */ + void save(OutputStream outputStream) throws ConfigurationException; + +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/EjbResourceConfiguration.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/EjbResourceConfiguration.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/EjbResourceConfiguration.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/EjbResourceConfiguration.java 27 Mar 2007 09:29:11 -0000 1.1.2.2 @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.config; + +import java.io.File; +import org.netbeans.modules.j2ee.dd.api.common.ComponentInterface; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; + +/** + * Configuration for EJB resources. + *

+ * Implementation of this interface should be registered in the {@link ModuleConfiguration} + * lookup. + * + * @since 1.23 + * @author sherold + */ +public interface EjbResourceConfiguration { + + /** + * Ensure resource is defined for the specified EJB (for example entity bean). + * + * @param ejb EJB in question + * @param jndiName the JNDI name of the resource where the EJB is stored. + * + * @throws ConfigurationException reports errors in setting the EJB resource. + */ + void ensureResourceDefined(ComponentInterface ejb, String jndiName) throws ConfigurationException; +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/MappingConfiguration.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/MappingConfiguration.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/MappingConfiguration.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/MappingConfiguration.java 27 Mar 2007 09:29:12 -0000 1.1.2.2 @@ -0,0 +1,45 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.config; + +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; +import org.netbeans.modules.j2ee.deployment.common.api.OriginalCMPMapping; + +/** + * Configuration CMP mapping. + *

+ * Implementation of this interface should be registered in the {@link ModuleConfiguration} + * lookup. + * + * @since 1.23 + * @author sherold + */ +public interface MappingConfiguration { + + + /** + * Sets the CMP mapping info for the EJB by the given name. + * + * @param mappings All the mapping info needed to be pushed in one batch. + * + * @throws ConfigurationException reports errors in setting the CMP mapping info. + */ + void setMappingInfo(OriginalCMPMapping[] mappings) throws ConfigurationException; +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfiguration.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfiguration.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfiguration.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfiguration.java 23 Mar 2007 20:29:58 -0000 1.1.2.3 @@ -0,0 +1,65 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.config; + +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; +import org.openide.util.Lookup; + +/** + * An interface that defines a container for all the server-specific configuration + * information for a single top-level J2EE module. The ModuleConfiguration object + * could represent a single stand-alone module or a J2EE application that contains + * several sub-modules. The ModuleConfiguration object contains in its lookup a set + * of configurations that are used for managing the server-specific settings. + * + * @since 1.23 + * @author sherold + */ +public interface ModuleConfiguration extends Lookup.Provider { + + /** + * Returns lookup associated with the object. This lookup should contain + * implementations of all the supported configurations. + *

+ * The configuration are: {@link ContextRootConfiguration}, {@link DatasourceConfiguration}, + * {@link MappingConfiguration}, {@link EjbResourceConfiguration}, {@link DeploymentPlanConfiguration} + *

+ * Implementators are advised to use {@link org.openide.util.lookup.Lookups#fixed} + * to implement this method. + * + * @return lookup associated with the object containing all the supported + * ConfigurationProvider implementations. + */ + Lookup getLookup(); + + /** + * Returns a J2EE module associated with this ModuleConfiguration instance. + * + * @return a J2EE module associated with this ModuleConfiguration instance. + */ + J2eeModule getJ2eeModule(); + + /** + * The j2eeserver calls this method when it is done using this ModuleConfiguration + * instance. The server plug-in should free all the associated resources - + * listeners for example. + */ + void dispose(); +} Index: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfigurationFactory.java =================================================================== RCS file: j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfigurationFactory.java diff -N j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfigurationFactory.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/spi/config/ModuleConfigurationFactory.java 23 Mar 2007 20:29:58 -0000 1.1.2.3 @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + +package org.netbeans.modules.j2ee.deployment.plugins.spi.config; + +import java.io.File; +import org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException; +import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; + +/** + * Factory for creating {@link ModuleConfiguration}. Plugin is required to register + * instance of this class in module layer in the J2EE/DeploymentPlugins/{plugin_name} + * folder. + * + * @since 1.23 + * @author sherold + */ +public interface ModuleConfigurationFactory { + + /** + * Creates a {@link ModuleConfiguration} instance associated with the specified + * J2EE module. + * + * @param j2eeModule J2EE module the created ModuleConfigucation should be + * associated with. + * + * @return ModuleConfigucation associated with the specified J2EE module. + */ + ModuleConfiguration create(J2eeModule j2eeModule) throws ConfigurationException; +}