This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 37953

Summary: no way to set the default server externally (e.g. from installer)
Product: serverplugins Reporter: Pavel Buzek <pbuzek>
Component: InfrastructureAssignee: Nam Nguyen <nnguyen>
Status: RESOLVED FIXED    
Severity: blocker    
Priority: P3    
Version: 3.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: TASK Exception Reporter:

Description Pavel Buzek 2003-12-10 06:23:10 UTC
If there are multiple plugins installed in IDE
there can only be one default server. Since the
plugins are independen on each other none of them
can decide what is the default server. It is
required to make it possible to set the default
server externally (e.g. to read it from a file).
Comment 1 Nam Nguyen 2003-12-10 07:06:54 UTC
I plan to have the default instance defined at this location in 
<NB installation dir>/system/services/J2EE/DefaultInstance.xml.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server-string PUBLIC "-//org_netbeans_modules_j2ee//DTD
ServerString 1.0//EN"
                              
"nbres:/org/netbeans/modules/j2ee/deployment/impl/server-string.dtd">
<server-string plugin="J2EESDK" url="deployer:Sun:S1AS::localhost:4848">
    <target name="localhost:4848"/>
</server-string>
Comment 2 Nam Nguyen 2003-12-11 23:22:46 UTC
There will be one default-server.xml per plugin.  In addition, we will
have an entry in install.properties indicating user choice during
installation:

j2eeserver.default=system/services/J2EE/<Server-Plugin Name>
This way add after-installation flexibility, adminitrator can also
change the default instance definition, e.g. admin portnumber, by
editing the file.
Comment 3 Nam Nguyen 2003-12-11 23:39:17 UTC
Each plugin need to check into CVS the ServerString xml file and make
sure ant default build step put a copy of it into
<netbeans>/system/services/J2EE/<user-friendly-filename>
The <user-friendly-filename> could be conveniently used by the
installer to show on chooser UI.

The j2eeserver, on first registry access will try to read property
'j2eeserver.default' from the installation/system/installer.properties
for the relative path to user choice.  If the file exist and
consistent,  read in to registetry.  Else, just read from the layer
file.  If no default specified, the default server is determined by
first one registered.
Comment 4 Nam Nguyen 2004-01-26 23:36:22 UTC
Implemented as proposed, except that the default instance file format
will be java properties file format for easier handle by installer, in
case future installer need to persist input from users.  The
recommended locations to put the default instance files is:

j2eeserver.default=system/J2EE/InstalledServers/<Server-Plugin Name>

Tested on installation having both tomcat and s1as plugins (with s1as
plugin picked as default without any intervention).  Deposit a file in
netbeans/system/J2EE/InstalledServers/Tomcat5 and have this line in
netbeans/system/install.properties:
j2eeserver.default=system/J2EE/InstalledServers/Tomcat5
will make Tomcat5 as preferred default instance over S1AS.