Index: apichanges.xml =================================================================== RCS file: /cvs/j2eeserver/apichanges.xml,v retrieving revision 1.16.6.3.2.7 diff -u -r1.16.6.3.2.7 apichanges.xml --- apichanges.xml 21 Aug 2006 14:30:52 -0000 1.16.6.3.2.7 +++ apichanges.xml 1 Sep 2006 14:23:54 -0000 @@ -86,6 +86,30 @@ + + + + Default server API residues removed. + + + + + + +

+ In the past, before the J2EE support was added to NetBeans the default server + concept had been used. This concept was then abandoned since it did not work + anymore. The problem could occur for example if the default server was Tomcat + then the EJB project which was set to use the default server could not be + deployed to it, etc. +

+
+ + + + + +
Index: src/org/netbeans/modules/j2ee/deployment/devmodules/api/Deployment.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/api/Deployment.java,v retrieving revision 1.21.6.1.2.3 diff -u -r1.21.6.1.2.3 Deployment.java --- src/org/netbeans/modules/j2ee/deployment/devmodules/api/Deployment.java 1 Jul 2006 05:16:11 -0000 1.21.6.1.2.3 +++ src/org/netbeans/modules/j2ee/deployment/devmodules/api/Deployment.java 1 Sep 2006 14:23:54 -0000 @@ -244,17 +244,6 @@ return null; } - public String getDefaultServerInstanceID () { - ServerString defInst = ServerRegistry.getInstance ().getDefaultInstance (); - if (defInst != null) { - ServerInstance si = defInst.getServerInstance(); - if (si != null) { - return si.getUrl (); - } - } - return null; - } - public String [] getInstancesOfServer (String id) { if (id != null) { Server server = ServerRegistry.getInstance().getServer(id); Index: src/org/netbeans/modules/j2ee/deployment/devmodules/spi/InstanceListener.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/InstanceListener.java,v retrieving revision 1.1.62.1 diff -u -r1.1.62.1 InstanceListener.java --- src/org/netbeans/modules/j2ee/deployment/devmodules/spi/InstanceListener.java 1 Jul 2006 05:16:13 -0000 1.1.62.1 +++ src/org/netbeans/modules/j2ee/deployment/devmodules/spi/InstanceListener.java 1 Sep 2006 14:23:54 -0000 @@ -31,14 +31,6 @@ public interface InstanceListener extends EventListener { /** - * Default server instance has been changed. - * - * @param oldServerInstanceID id of the old default server instance. - * @param newServerInstanceID id of the new default server instance. - */ - public void changeDefaultInstance(String oldServerInstanceID, String newServerInstanceID); - - /** * Server instance has been added. * * @param serverInstanceID id of the server instance that has been added. Index: src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java,v retrieving revision 1.47.30.3.2.5 diff -u -r1.47.30.3.2.5 J2eeModuleProvider.java --- src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java 21 Aug 2006 14:30:53 -0000 1.47.30.3.2.5 +++ src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java 1 Sep 2006 14:23:54 -0000 @@ -62,7 +62,6 @@ */ public abstract class J2eeModuleProvider { - private InstanceListener il; private ConfigSupportImpl configSupportImpl; List listeners = new ArrayList(); private ConfigFilesListener configFilesListener = null; @@ -77,10 +76,6 @@ 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 (); @@ -432,13 +427,6 @@ return new DefaultSourceMap(this); } - /** If the module wants to specify a target server instance for deployment - * it needs to override this method to return false. - */ - public boolean useDefaultServer () { - return true; - } - /** * Set ID of the server instance that will be used for deployment. * @@ -447,28 +435,38 @@ */ public abstract void setServerInstanceID(String severInstanceID); - /** Id of server isntance for deployment. The default implementation returns - * the default server instance selected in Server Registry. - * The return value may not be null. - * If modules override this method they also need to override {@link useDefaultServer}. + /** + * Id of server instance for deployment or null if the module has no server + * instance set. + * + * @return Id of server instance for deployment or null if the module has no server + * instance set. */ - public String getServerInstanceID () { - return ServerRegistry.getInstance ().getDefaultInstance ().getUrl (); - } + public abstract String getServerInstanceID(); /** - * Return InstanceProperties of the server instance - **/ + * Returns InstanceProperties of the server instance or null if the module has + * no server instance set or the given server instance does not exist. + * + * @return InstanceProperties of the server instance or null if the module has + * no server instance set or the given server instance does not exist. + */ public InstanceProperties getInstanceProperties(){ - return InstanceProperties.getInstanceProperties(getServerInstanceID()); + String serverInstanceID = getServerInstanceID(); + if (serverInstanceID == null) { + return null; + } + return InstanceProperties.getInstanceProperties(serverInstanceID); } - /** This method is used to determin type of target server. - * The return value must correspond to value returned from {@link getServerInstanceID}. + /** + * This method is used to determin type of target server. The return value + * must correspond to the value returned from {@link getServerInstanceID}. + * + * @return the target server type or null if the module has no target server + * type set. */ - public String getServerID () { - return ServerRegistry.getInstance ().getDefaultInstance ().getServer ().getShortName (); - } + public abstract String getServerID(); /** * Return name to be used in deployment of the module. @@ -602,46 +600,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.dispose(); - J2eeModuleProvider.this.configSupportImpl = null; - getConfigSupportImpl().ensureConfigurationReady(); - String ctx = getConfigSupportImpl().getWebContextRoot (); - if (ctx == null || ctx.equals ("")) { //NOI18N - getConfigSupportImpl().setWebContextRoot(oldCtxPath); - } - } else { - configSupportImpl.dispose(); - J2eeModuleProvider.this.configSupportImpl = null; - getConfigSupportImpl().ensureConfigurationReady(); - } - } - } - - public void instanceAdded (String instance) { - } - - public void instanceRemoved (String instance) { - } - - } - + private ConfigSupportImpl getConfigSupportImpl() { return (ConfigSupportImpl) getConfigSupport(); } Index: src/org/netbeans/modules/j2ee/deployment/plugins/api/InstanceProperties.java =================================================================== RCS file: /cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/plugins/api/InstanceProperties.java,v retrieving revision 1.16.10.1 diff -u -r1.16.10.1 InstanceProperties.java --- src/org/netbeans/modules/j2ee/deployment/plugins/api/InstanceProperties.java 1 Jul 2006 05:16:23 -0000 1.16.10.1 +++ src/org/netbeans/modules/j2ee/deployment/plugins/api/InstanceProperties.java 1 Sep 2006 14:23:55 -0000 @@ -150,13 +150,6 @@ public static String[] getInstanceList() { return ServerRegistry.getInstance().getInstanceURLs(); } - - /** - * Return default instance properties. - */ - public static InstanceProperties getDefaultInstance() { - return new InstancePropertiesImpl(ServerRegistry.getInstance().getDefaultInstance().getServerInstance()); - } /** * Set instance properties. @@ -189,26 +182,9 @@ public abstract java.util.Enumeration propertyNames() throws IllegalStateException; /** - * Is the target server the default J2EE server for deployment? - * @return true if the target server or admin server is the default. - */ - public abstract boolean isDefaultInstance(); - - /** * Return DeploymentManager associated with this instance. */ public abstract DeploymentManager getDeploymentManager(); - - /** - * Return default Target object for the target server from this instance, if any. - */ - public abstract Target getDefaultTarget(); - - /** - * Set the target server the default server. - * @param targetName name of the target server; null if admin server is also single target. - */ - public abstract void setAsDefaultServer(String targetName); /** * Ask the server instance to reset cached deployment manager, J2EE