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.

View | Details | Raw Unified | Return to bug 83934
Collapse All | Expand All

(-)apichanges.xml (+24 lines)
Lines 86-91 Link Here
86
    <!-- ACTUAL CHANGES BEGIN HERE: -->
86
    <!-- ACTUAL CHANGES BEGIN HERE: -->
87
87
88
    <changes>
88
    <changes>
89
        <change id="removeDefaultServerAPI">
90
            <api name="j2eeserver"/>
91
            <summary>
92
                Default server API residues removed.
93
            </summary>
94
            <version major="1" minor="21"/>
95
            <date day="31" month="8" year="2006"/>
96
            <author login="sherold"/>
97
            <compatibility binary="incompatible" source="incompatible" semantic="incompatible"/>
98
            <description>
99
                <p>
100
                    In the past, before the J2EE support was added to NetBeans the default server
101
                    concept had been used. This concept was then abandoned since it did not work
102
                    anymore. The problem could occur for example if the default server was Tomcat
103
                    then the EJB project which was set to use the default server could not be
104
                    deployed to it, etc.
105
                </p>
106
            </description>
107
            <class package="org.netbeans.modules.j2ee.deployment.devmodules.api" name="Deployment"/>
108
            <class package="org.netbeans.modules.j2ee.deployment.devmodules.spi" name="InstanceListener"/>
109
            <class package="org.netbeans.modules.j2ee.deployment.devmodules.spi" name="J2eeModuleProvider"/>
110
            <class package="org.netbeans.modules.j2ee.deployment.plugins.api" name="InstanceProperties"/>
111
            <issue number="83934"/>
112
        </change>
89
        <change id="ensureResourceDefinedUpdate">
113
        <change id="ensureResourceDefinedUpdate">
90
            <api name="j2eeserver"/>
114
            <api name="j2eeserver"/>
91
            <summary>
115
            <summary>
(-)src/org/netbeans/modules/j2ee/deployment/devmodules/api/Deployment.java (-11 lines)
Lines 244-260 Link Here
244
        return null;
244
        return null;
245
    }
245
    }
246
    
246
    
247
    public String getDefaultServerInstanceID () {
248
        ServerString defInst = ServerRegistry.getInstance ().getDefaultInstance ();
249
        if (defInst != null) {
250
            ServerInstance si = defInst.getServerInstance();
251
            if (si != null) {
252
                return si.getUrl ();
253
            }
254
        }
255
        return null;
256
    }
257
    
258
    public String [] getInstancesOfServer (String id) {
247
    public String [] getInstancesOfServer (String id) {
259
        if (id != null) {
248
        if (id != null) {
260
            Server server = ServerRegistry.getInstance().getServer(id);
249
            Server server = ServerRegistry.getInstance().getServer(id);
(-)src/org/netbeans/modules/j2ee/deployment/devmodules/spi/InstanceListener.java (-8 lines)
Lines 31-44 Link Here
31
public interface InstanceListener extends EventListener {
31
public interface InstanceListener extends EventListener {
32
        
32
        
33
        /**
33
        /**
34
         * Default server instance has been changed.
35
         *
36
         * @param oldServerInstanceID id of the old default server instance.
37
         * @param newServerInstanceID id of the new default server instance.
38
         */
39
        public void changeDefaultInstance(String oldServerInstanceID, String newServerInstanceID);
40
        
41
        /**
42
         * Server instance has been added.
34
         * Server instance has been added.
43
         *
35
         *
44
         * @param serverInstanceID id of the server instance that has been added.
36
         * @param serverInstanceID id of the server instance that has been added.
(-)src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java (-67 / +26 lines)
Lines 62-68 Link Here
62
 */
62
 */
63
public abstract class J2eeModuleProvider {
63
public abstract class J2eeModuleProvider {
64
    
64
    
65
    private InstanceListener il;
66
    private ConfigSupportImpl configSupportImpl;
65
    private ConfigSupportImpl configSupportImpl;
67
    List listeners = new ArrayList();
66
    List listeners = new ArrayList();
68
    private ConfigFilesListener configFilesListener = null;
67
    private ConfigFilesListener configFilesListener = null;
Lines 77-86 Link Here
77
    private PropertyChangeSupport supp = new PropertyChangeSupport(this);
76
    private PropertyChangeSupport supp = new PropertyChangeSupport(this);
78
    
77
    
79
    public J2eeModuleProvider () {
78
    public J2eeModuleProvider () {
80
        il = new IL ();
81
        ServerRegistry.getInstance ().addInstanceListener (
82
            (InstanceListener) WeakListeners.create(
83
                InstanceListener.class, il, ServerRegistry.getInstance ()));
84
    }
79
    }
85
    
80
    
86
    public abstract J2eeModule getJ2eeModule ();
81
    public abstract J2eeModule getJ2eeModule ();
Lines 432-444 Link Here
432
        return new DefaultSourceMap(this);
427
        return new DefaultSourceMap(this);
433
    }
428
    }
434
    
429
    
435
    /** If the module wants to specify a target server instance for deployment 
436
     * it needs to override this method to return false. 
437
     */
438
    public boolean useDefaultServer () {
439
        return true;
440
    }
441
    
442
    /**
430
    /**
443
     * Set ID of the server instance that will be used for deployment.
431
     * Set ID of the server instance that will be used for deployment.
444
     * 
432
     * 
Lines 447-474 Link Here
447
     */
435
     */
448
    public abstract void setServerInstanceID(String severInstanceID);
436
    public abstract void setServerInstanceID(String severInstanceID);
449
    
437
    
450
    /** Id of server isntance for deployment. The default implementation returns
438
    /** 
451
     * the default server instance selected in Server Registry. 
439
     * Id of server instance for deployment or null if the module has no server
452
     * The return value may not be null.
440
     * instance set.
453
     * If modules override this method they also need to override {@link useDefaultServer}.
441
     *
442
     * @return Id of server instance for deployment or null if the module has no server
443
     *         instance set.
454
     */
444
     */
455
    public String getServerInstanceID () {
445
    public abstract String getServerInstanceID();
456
        return ServerRegistry.getInstance ().getDefaultInstance ().getUrl ();
457
    }
458
    
446
    
459
    /**
447
    /**
460
     * Return InstanceProperties of the server instance
448
     * Returns InstanceProperties of the server instance or null if the module has
461
     **/
449
     * no server instance set or the given server instance does not exist.
450
     *
451
     * @return InstanceProperties of the server instance or null if the module has
452
     *         no server instance set or the given server instance does not exist.
453
     */
462
    public InstanceProperties getInstanceProperties(){
454
    public InstanceProperties getInstanceProperties(){
463
        return InstanceProperties.getInstanceProperties(getServerInstanceID());
455
        String serverInstanceID = getServerInstanceID();
456
        if (serverInstanceID == null) {
457
            return null;
458
        }
459
        return InstanceProperties.getInstanceProperties(serverInstanceID);
464
    }
460
    }
465
461
466
    /** This method is used to determin type of target server.
462
    /** 
467
     * The return value must correspond to value returned from {@link getServerInstanceID}.
463
     * This method is used to determin type of target server. The return value 
464
     * must correspond to the value returned from {@link getServerInstanceID}.
465
     *
466
     * @return the target server type or null if the module has no target server
467
     *         type set.
468
     */
468
     */
469
    public String getServerID () {
469
    public abstract String getServerID();
470
        return ServerRegistry.getInstance ().getDefaultInstance ().getServer ().getShortName ();
471
    }
472
    
470
    
473
    /**
471
    /**
474
     * Return name to be used in deployment of the module.
472
     * Return name to be used in deployment of the module.
Lines 602-647 Link Here
602
            return;
600
            return;
603
        configFilesListener = new ConfigFilesListener(this, listeners);
601
        configFilesListener = new ConfigFilesListener(this, listeners);
604
    }
602
    }
605
    
603
   
606
    private final class IL implements InstanceListener {
607
        
608
        public void changeDefaultInstance (String oldInst, String newInst) {
609
            ServerInstance oldServerInstance = ServerRegistry.getInstance().getServerInstance(oldInst);
610
            ServerInstance newServerInstance = ServerRegistry.getInstance().getServerInstance(newInst);
611
            ServerString oldInstance = oldServerInstance != null 
612
                                            ? new ServerString(oldServerInstance) 
613
                                            : null;
614
            ServerString newInstance = newServerInstance != null 
615
                                            ? new ServerString(newServerInstance) 
616
                                            : null;
617
            if (useDefaultServer () && newInstance != null 
618
                    && (oldInstance == null || !oldInstance.getPlugin().equals(newInstance.getPlugin()))) {
619
                if (J2eeModule.WAR.equals(getJ2eeModule().getModuleType())) {
620
                    String oldCtxPath = getConfigSupportImpl().getWebContextRoot();
621
                    oldCtxPath = "/"+J2eeModuleProvider.this.getDeploymentName(); //NOI18N
622
                    configSupportImpl.dispose();
623
                    J2eeModuleProvider.this.configSupportImpl = null;
624
                    getConfigSupportImpl().ensureConfigurationReady();
625
                    String ctx = getConfigSupportImpl().getWebContextRoot ();
626
                    if (ctx == null || ctx.equals ("")) { //NOI18N
627
                        getConfigSupportImpl().setWebContextRoot(oldCtxPath);
628
                    }
629
                } else {
630
                    configSupportImpl.dispose();
631
                    J2eeModuleProvider.this.configSupportImpl = null;
632
                    getConfigSupportImpl().ensureConfigurationReady();
633
                }
634
            }
635
        }
636
        
637
        public void instanceAdded (String instance) {
638
        }
639
        
640
        public void instanceRemoved (String instance) {
641
        }
642
        
643
    }
644
    
645
    private ConfigSupportImpl getConfigSupportImpl() {
604
    private ConfigSupportImpl getConfigSupportImpl() {
646
        return (ConfigSupportImpl) getConfigSupport();
605
        return (ConfigSupportImpl) getConfigSupport();
647
    }
606
    }
(-)src/org/netbeans/modules/j2ee/deployment/plugins/api/InstanceProperties.java (-24 lines)
Lines 150-162 Link Here
150
    public static String[] getInstanceList() {
150
    public static String[] getInstanceList() {
151
        return ServerRegistry.getInstance().getInstanceURLs();
151
        return ServerRegistry.getInstance().getInstanceURLs();
152
    }
152
    }
153
154
    /**
155
     * Return default instance properties.
156
     */
157
    public static InstanceProperties getDefaultInstance() {
158
        return new InstancePropertiesImpl(ServerRegistry.getInstance().getDefaultInstance().getServerInstance());
159
    }
160
    
153
    
161
    /**
154
    /**
162
     * Set instance properties.
155
     * Set instance properties.
Lines 189-214 Link Here
189
    public abstract java.util.Enumeration propertyNames() throws IllegalStateException;
182
    public abstract java.util.Enumeration propertyNames() throws IllegalStateException;
190
    
183
    
191
    /**
184
    /**
192
     * Is the target server the default J2EE server for deployment?
193
     * @return true if the target server or admin server is the default.
194
     */
195
    public abstract boolean isDefaultInstance();
196
    
197
    /**
198
     * Return DeploymentManager associated with this instance.
185
     * Return DeploymentManager associated with this instance.
199
     */
186
     */
200
    public abstract DeploymentManager getDeploymentManager();
187
    public abstract DeploymentManager getDeploymentManager();
201
    
202
    /**
203
     * Return default Target object for the target server from this instance, if any.
204
     */
205
    public abstract Target getDefaultTarget();
206
    
207
    /**
208
     * Set the target server the default server.
209
     * @param targetName name of the target server; null if admin server is also single target.
210
     */
211
    public abstract void setAsDefaultServer(String targetName);
212
    
188
    
213
    /**
189
    /**
214
     * Ask the server instance to reset cached deployment manager, J2EE
190
     * Ask the server instance to reset cached deployment manager, J2EE

Return to bug 83934