diff -r 3e0ff569f93e glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java --- a/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java Mon Nov 23 17:28:37 2009 +0100 +++ b/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java Mon Nov 23 20:20:13 2009 +0100 @@ -726,18 +726,6 @@ CreateDomain cd = new CreateDomain("anonymous", "", new File(f,"glassfish"), ip, this,true); // NOI18N cd.start(); } - - FileObject serverInstanceDir = FileUtil.getConfigFile("J2EE/InstalledServers"); // NOI18N - if (serverInstanceDir == null) { - FileObject root = FileUtil.getConfigRoot(); - serverInstanceDir = FileUtil.createFolder(root, "J2EE/InstalledServers"); // NOI18N - } - - if (serverInstanceDir != null) { - registerServerInstanceFO(serverInstanceDir, ip); - } else { - Logger.getLogger("glassfish-javaee").log(Level.INFO, "Cannot register the default Tomcat server. The //J2EE//InstalledServers folder cannot be found."); // NOI18N - } } } } catch (IOException ex) { @@ -747,22 +735,6 @@ } } - private static void registerServerInstanceFO(FileObject serverInstanceDir, - Map props) { - String name = FileUtil.findFreeFileName(serverInstanceDir, "gfv3_autoregistered_instance", null); // NOI18N - FileObject instanceFO; - try { - instanceFO = serverInstanceDir.createData(name); - for (Map.Entry entry : props.entrySet()) { - instanceFO.setAttribute(entry.getKey(), entry.getValue()); - } - instanceFO.setAttribute("registeredWithoutUI", "true"); // NOI18N - } catch (IOException e) { - Logger.getLogger("glassfish-javaee").log(Level.INFO, "Cannot register the default Tomcat server."); // NOI18N - Logger.getLogger("glassfish-javaee").log(Level.INFO, null, e); - } - } - String[] getNoPasswordCreatDomainCommand(String startScript, String jarLocation, String domainDir, String portBase, String uname, String domain) { List retVal = new ArrayList(); retVal.addAll(Arrays.asList(new String[] {startScript, diff -r 3e0ff569f93e j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerRegistry.java --- a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerRegistry.java Mon Nov 23 17:28:37 2009 +0100 +++ b/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/ServerRegistry.java Mon Nov 23 20:20:13 2009 +0100 @@ -62,6 +62,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import org.netbeans.modules.j2ee.deployment.config.J2eeModuleAccessor; import org.netbeans.modules.j2ee.deployment.devmodules.spi.InstanceListener; @@ -358,7 +359,7 @@ checkInstanceAlreadyExists(url); try { - addInstanceImpl(url, username, password, displayName, withoutUI, initialproperties); + addInstanceImpl(url, username, password, displayName, withoutUI, initialproperties, true); } catch (InstanceCreationException ice) { InstanceCreationException e = new InstanceCreationException(NbBundle.getMessage(ServerRegistry.class, "MSG_FailedToCreateInstance", displayName)); e.initCause(ice); @@ -415,7 +416,9 @@ * false otherwise. */ private synchronized void addInstanceImpl(String url, String username, - String password, String displayName, boolean withoutUI, Map initialProperties) throws InstanceCreationException { + String password, String displayName, boolean withoutUI, + Map initialProperties, boolean loadPlugins) throws InstanceCreationException { + if (instancesMap().containsKey(url)) { throw new InstanceCreationException("already exists"); } @@ -464,7 +467,22 @@ LOGGER.log(Level.INFO, null, e); } } - throw new InstanceCreationException(serversMap.size()+" handlers registered, no handlers for "+url); + + if (loadPlugins) { + // don't wait for FS event, try to load the plugin now + FileObject dir = FileUtil.getConfigFile(DIR_JSR88_PLUGINS); + if (dir != null) { + for (FileObject fo : dir.getChildren()) { + // if it is already registered this is noop + addPlugin(fo); + } + } + + addInstanceImpl(url, username, password, displayName, withoutUI, initialProperties, false); + return; + } + + throw new InstanceCreationException("No handlers for " + url); } private Map cleanInitialProperties(Map initialProperties) { @@ -488,14 +506,8 @@ String displayName = (String) fo.getAttribute(InstanceProperties.DISPLAY_NAME_ATTR); String withoutUI = (String) fo.getAttribute(InstanceProperties.REGISTERED_WITHOUT_UI); boolean withoutUIFlag = withoutUI == null ? false : Boolean.valueOf(withoutUI); - Map props = new HashMap(); - for(Enumeration e = fo.getAttributes(); e.hasMoreElements();) { - String name = e.nextElement(); - Object attr = fo.getAttribute(name); - props.put(name, attr == null ? null : attr.toString()); - } try { - addInstanceImpl(url, username, password, displayName, withoutUIFlag, props); + addInstanceImpl(url, username, password, displayName, withoutUIFlag, null, true); } catch (InstanceCreationException ice) { // yes... we are ignoring this.. because that }