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 206196
Collapse All | Expand All

(-)a/glassfish.common/nbproject/project.xml (-1 / +1 lines)
Lines 54-60 Link Here
54
                    <compile-dependency/>
54
                    <compile-dependency/>
55
                    <run-dependency>
55
                    <run-dependency>
56
                        <release-version>0</release-version>
56
                        <release-version>0</release-version>
57
                        <specification-version>1.2</specification-version>
57
                        <specification-version>1.18</specification-version>
58
                    </run-dependency>
58
                    </run-dependency>
59
                </dependency>
59
                </dependency>
60
                <dependency>
60
                <dependency>
(-)a/glassfish.common/src/org/netbeans/modules/glassfish/common/StartTask.java (+17 lines)
Lines 62-67 Link Here
62
import java.util.logging.Level;
62
import java.util.logging.Level;
63
import java.util.logging.Logger;
63
import java.util.logging.Logger;
64
import javax.swing.SwingUtilities;
64
import javax.swing.SwingUtilities;
65
import org.netbeans.api.server.VMArguments;
65
import org.netbeans.modules.glassfish.spi.RegisteredDerbyServer;
66
import org.netbeans.modules.glassfish.spi.RegisteredDerbyServer;
66
import org.netbeans.modules.glassfish.spi.GlassfishModule;
67
import org.netbeans.modules.glassfish.spi.GlassfishModule;
67
import org.netbeans.modules.glassfish.spi.GlassfishModule.OperationState;
68
import org.netbeans.modules.glassfish.spi.GlassfishModule.OperationState;
Lines 696-704 Link Here
696
            throw new ProcessCreationException(ioe,
697
            throw new ProcessCreationException(ioe,
697
                    "MSG_START_SERVER_FAILED_INVALIDPORT", instanceName, debugPortString); //NOI18N
698
                    "MSG_START_SERVER_FAILED_INVALIDPORT", instanceName, debugPortString); //NOI18N
698
        }
699
        }
700
701
        for (VMArguments args : VMArguments.getVMArguments(getMode(ip.get(GlassfishModule.JVM_MODE)))) {
702
            for (String singleArg : args.getArguments()) {
703
                argumentBuf.append(' ').append(singleArg);
704
            }
705
        }
699
        return argumentBuf;
706
        return argumentBuf;
700
    }
707
    }
701
708
709
    private static VMArguments.StartMode getMode(String gfMode) {
710
        if (GlassfishModule.PROFILE_MODE.equals(gfMode)) {
711
            return VMArguments.StartMode.PROFILE;
712
        } else if (GlassfishModule.DEBUG_MODE.equals(gfMode)) {
713
            return VMArguments.StartMode.DEBUG;
714
        } else {
715
            return VMArguments.StartMode.NORMAL;
716
        }
717
    }
718
702
    private String selectDebugPort() throws IOException {
719
    private String selectDebugPort() throws IOException {
703
        int debugPort = 9009;
720
        int debugPort = 9009;
704
        ServerSocket t = null;
721
        ServerSocket t = null;
(-)a/j2ee.jboss4/nbproject/project.xml (+9 lines)
Lines 162-167 Link Here
162
                    </run-dependency>
162
                    </run-dependency>
163
                </dependency>
163
                </dependency>
164
                <dependency>
164
                <dependency>
165
                    <code-name-base>org.netbeans.modules.server</code-name-base>
166
                    <build-prerequisite/>
167
                    <compile-dependency/>
168
                    <run-dependency>
169
                        <release-version>0-1</release-version>
170
                        <specification-version>1.18</specification-version>
171
                    </run-dependency>
172
                </dependency>
173
                <dependency>
165
                    <code-name-base>org.openide.actions</code-name-base>
174
                    <code-name-base>org.openide.actions</code-name-base>
166
                    <build-prerequisite/>
175
                    <build-prerequisite/>
167
                    <compile-dependency/>
176
                    <compile-dependency/>
(-)a/j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java (-1 / +18 lines)
Lines 62-67 Link Here
62
import javax.enterprise.deploy.shared.CommandType;
62
import javax.enterprise.deploy.shared.CommandType;
63
import javax.enterprise.deploy.shared.StateType;
63
import javax.enterprise.deploy.shared.StateType;
64
import org.netbeans.api.java.platform.JavaPlatform;
64
import org.netbeans.api.java.platform.JavaPlatform;
65
import org.netbeans.api.server.VMArguments;
65
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
66
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
66
import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
67
import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
67
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
68
import org.netbeans.modules.j2ee.deployment.profiler.api.ProfilerServerSettings;
Lines 229-234 Link Here
229
            }
230
            }
230
        }
231
        }
231
232
233
        for (VMArguments args : VMArguments.getVMArguments(getMode(startServer.getMode()))) {
234
            for (String singleArg : args.getArguments()) {
235
                javaOptsBuilder.append(' ').append(singleArg);
236
            }
237
        }
238
232
        // create new environment for server
239
        // create new environment for server
233
        javaOpts = javaOptsBuilder.toString();
240
        javaOpts = javaOptsBuilder.toString();
234
        String javaHome = getJavaHome(platform);
241
        String javaHome = getJavaHome(platform);
Lines 241-247 Link Here
241
        };
248
        };
242
        return envp;
249
        return envp;
243
    }
250
    }
244
    
251
252
    private static VMArguments.StartMode getMode(JBStartServer.MODE jbMode) {
253
        if (JBStartServer.MODE.PROFILE.equals(jbMode)) {
254
            return VMArguments.StartMode.PROFILE;
255
        } else if (JBStartServer.MODE.DEBUG.equals(jbMode)) {
256
            return VMArguments.StartMode.DEBUG;
257
        } else {
258
            return VMArguments.StartMode.NORMAL;
259
        }
260
    }
261
245
    private boolean checkPorts(final InstanceProperties ip) {
262
    private boolean checkPorts(final InstanceProperties ip) {
246
263
247
        try {
264
        try {
(-)a/j2ee.weblogic9/nbproject/project.xml (+9 lines)
Lines 204-209 Link Here
204
                    </run-dependency>
204
                    </run-dependency>
205
                </dependency>
205
                </dependency>
206
                <dependency>
206
                <dependency>
207
                    <code-name-base>org.netbeans.modules.server</code-name-base>
208
                    <build-prerequisite/>
209
                    <compile-dependency/>
210
                    <run-dependency>
211
                        <release-version>0-1</release-version>
212
                        <specification-version>1.18</specification-version>
213
                    </run-dependency>
214
                </dependency>
215
                <dependency>
207
                    <code-name-base>org.openide.actions</code-name-base>
216
                    <code-name-base>org.openide.actions</code-name-base>
208
                    <build-prerequisite/>
217
                    <build-prerequisite/>
209
                    <compile-dependency/>
218
                    <compile-dependency/>
(-)a/j2ee.weblogic9/src/org/netbeans/modules/j2ee/weblogic9/optional/WLStartServer.java (-6 / +25 lines)
Lines 70-75 Link Here
70
import org.netbeans.api.extexecution.input.InputReaderTask;
70
import org.netbeans.api.extexecution.input.InputReaderTask;
71
import org.netbeans.api.extexecution.input.InputReaders;
71
import org.netbeans.api.extexecution.input.InputReaders;
72
import org.netbeans.api.java.platform.JavaPlatform;
72
import org.netbeans.api.java.platform.JavaPlatform;
73
import org.netbeans.api.server.VMArguments;
73
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
74
import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties;
74
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
75
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo;
75
import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
76
import org.netbeans.modules.j2ee.deployment.plugins.api.UISupport;
Lines 419-428 Link Here
419
                javaOptsBuilder.append( " " );                              // NOI18N
420
                javaOptsBuilder.append( " " );                              // NOI18N
420
                javaOptsBuilder.append( javaOpts.trim() );
421
                javaOptsBuilder.append( javaOpts.trim() );
421
            }
422
            }
422
            
423
423
            if ( profJvmArgs.length >0 ){
424
            for (VMArguments args : VMArguments.getVMArguments(VMArguments.StartMode.PROFILE)) {
425
                for (String singleArg : args.getArguments()) {
426
                    javaOptsBuilder.append(' ').append(singleArg);
427
                }
428
            }
429
            String toAdd = javaOptsBuilder.toString().trim();
430
            if (!toAdd.isEmpty()){
424
                result = result.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE, 
431
                result = result.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE, 
425
                    javaOptsBuilder.toString());
432
                    toAdd);
426
            }
433
            }
427
            return result;
434
            return result;
428
        }
435
        }
Lines 476-481 Link Here
476
            javaOptsBuilder.append("-Xdebug -Xnoagent -Djava.compiler=none ");  // NOI18N
483
            javaOptsBuilder.append("-Xdebug -Xnoagent -Djava.compiler=none ");  // NOI18N
477
            javaOptsBuilder.append("-Xrunjdwp:server=y,suspend=n,transport=dt_socket,address=");// NOI18N
484
            javaOptsBuilder.append("-Xrunjdwp:server=y,suspend=n,transport=dt_socket,address=");// NOI18N
478
            javaOptsBuilder.append( debugPort );
485
            javaOptsBuilder.append( debugPort );
486
            for (VMArguments args : VMArguments.getVMArguments(VMArguments.StartMode.DEBUG)) {
487
                for (String singleArg : args.getArguments()) {
488
                    javaOptsBuilder.append(' ').append(singleArg);
489
                }
490
            }
479
            ExternalProcessBuilder result = builder.addEnvironmentVariable(
491
            ExternalProcessBuilder result = builder.addEnvironmentVariable(
480
                    JAVA_OPTIONS_VARIABLE,
492
                    JAVA_OPTIONS_VARIABLE,
481
                    javaOptsBuilder.toString());   
493
                    javaOptsBuilder.toString());   
Lines 657-665 Link Here
657
        {
669
        {
658
            ExternalProcessBuilder result = builder;
670
            ExternalProcessBuilder result = builder;
659
            String javaOpts = dm.getInstanceProperties().getProperty(WLPluginProperties.JAVA_OPTS);
671
            String javaOpts = dm.getInstanceProperties().getProperty(WLPluginProperties.JAVA_OPTS);
660
            if ( javaOpts!= null && javaOpts.trim().length() >0 ){
672
            StringBuilder sb = new StringBuilder((javaOpts!= null && javaOpts.trim().length() > 0)
661
                result = builder.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE,          
673
                    ? javaOpts.trim() : "");
662
                        javaOpts.trim());
674
            for (VMArguments args : VMArguments.getVMArguments(VMArguments.StartMode.NORMAL)) {
675
                for (String singleArg : args.getArguments()) {
676
                    sb.append(' ').append(singleArg);
677
                }
678
            }
679
            if (sb.length() > 0) {
680
                result = builder.addEnvironmentVariable(JAVA_OPTIONS_VARIABLE,
681
                        sb.toString());
663
            }
682
            }
664
            return result;
683
            return result;
665
        }
684
        }
(-)a/server/apichanges.xml (+16 lines)
Lines 110-115 Link Here
110
    <!-- ACTUAL CHANGES BEGIN HERE: -->
110
    <!-- ACTUAL CHANGES BEGIN HERE: -->
111
111
112
    <changes>
112
    <changes>
113
        <change id="vm.arguments">
114
            <api name="common_server_api"/>
115
            <summary>SPI to allow passing additional arguments to server VM</summary>
116
            <version major="1" minor="18"/>
117
            <date day="22" month="12" year="2011"/>
118
            <author login="phejl"/>
119
            <compatibility addition="yes"/>
120
            <description>
121
                This API/SPI allow third party plugins (such as JRebel) to
122
                register providers of VM arguments. The server plugin may
123
                optionaly query such arguments and pass them to server VM.
124
            </description>
125
            <class package="org.netbeans.api.server" name="VMArguments"/>
126
            <class package="org.netbeans.spi.server" name="VMArgumentsProvider"/>
127
            <issue number="206196"/>
128
        </change>
113
        <change id="cloud">
129
        <change id="cloud">
114
            <api name="common_server_api"/>
130
            <api name="common_server_api"/>
115
            <summary>Establish layer to register cloud providers</summary>
131
            <summary>Establish layer to register cloud providers</summary>
(-)a/server/arch.xml (-2 / +24 lines)
Lines 60-66 Link Here
60
  </p>  
60
  </p>  
61
  <p>
61
  <p>
62
   Clients can provide its instances through the SPI. They can also provide
62
   Clients can provide its instances through the SPI. They can also provide
63
   wizards to define UI way for the server or cloud instance addition. It is done with
63
   wizards to define UI way for the server or cloud instance addition. There
64
   is also provider of VM arguments which can be registered in layer. It is done with
64
   <api group="layer" name="CommonServerLayerSPI" type="export" category="devel" url="@TOP@overview-summary.html"/>
65
   <api group="layer" name="CommonServerLayerSPI" type="export" category="devel" url="@TOP@overview-summary.html"/>
65
   where the SPIs implementation must be registered.
66
   where the SPIs implementation must be registered.
66
  </p>
67
  </p>
Lines 81-86 Link Here
81
            can extend the list of popup actions on Cloud node in
82
            can extend the list of popup actions on Cloud node in
82
            Services tab.
83
            Services tab.
83
      </api>
84
      </api>
85
      <api group="layer" name="VMArgumentsProvider" type="export" category="devel">
86
            By registering providers to <code>Servers/VMArgumentsProviders</code> you
87
            can register your additional VM arguments provider.
88
      </api>
84
      <api group="property" name="serverNodeHidden" type="export" category="friend">
89
      <api group="property" name="serverNodeHidden" type="export" category="friend">
85
            If the action registered in <code>Servers/Actions</code> or <code>Cloud/Actions</code> folder
90
            If the action registered in <code>Servers/Actions</code> or <code>Cloud/Actions</code> folder
86
            has <code>getValue("serverNodeHidden") == Boolean.TRUE</code>, then
91
            has <code>getValue("serverNodeHidden") == Boolean.TRUE</code>, then
Lines 236-242 Link Here
236
    can be used. It provides a way how to store and retrieve properties of
241
    can be used. It provides a way how to store and retrieve properties of
237
    the server instance.
242
    the server instance.
238
   </p>
243
   </p>
239
  </usecase>   
244
  </usecase>
245
  <usecase id="vm-arguments" name="Providing additional VM arguments">
246
   <p>
247
    The third party plugin may want to be able provide additional VM arguments
248
    for the server VM in a standardized way. In order to do so it will register
249
    a implementation of
250
    <a href="@TOP@org/netbeans/spi/server/VMArgumentsProvider.html">VMArgumentsProvider</a>
251
    to the layer folder Servers/VMArgumentProviders. The annotation
252
    <a href="@TOP@org/netbeans/spi/server/VMArgumentsProvider.Registration.html">VMArgumentsProvider.Registration</a>
253
    can be used for that.
254
   </p>
255
   <p>
256
    The clients (server plugin implementations) may query the providers via the
257
    API class
258
    <a href="@TOP@org/netbeans/api/server/VMArguments.html">VMArguments</a>
259
    and use the additional arguments for the VM.
260
   </p>
261
  </usecase>
240
 </answer>
262
 </answer>
241
263
242
264
(-)a/server/manifest.mf (-1 / +1 lines)
Lines 2-8 Link Here
2
OpenIDE-Module: org.netbeans.modules.server/0
2
OpenIDE-Module: org.netbeans.modules.server/0
3
OpenIDE-Module-Layer: org/netbeans/modules/server/resources/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/server/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/server/resources/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/server/resources/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.17
5
OpenIDE-Module-Specification-Version: 1.18
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
OpenIDE-Module-Provides: org.netbeans.modules.server
7
OpenIDE-Module-Provides: org.netbeans.modules.server
8
8
(-)a/server/nbproject/project.xml (-9 / +18 lines)
Lines 50-55 Link Here
50
            <code-name-base>org.netbeans.modules.server</code-name-base>
50
            <code-name-base>org.netbeans.modules.server</code-name-base>
51
            <module-dependencies>
51
            <module-dependencies>
52
                <dependency>
52
                <dependency>
53
                    <code-name-base>org.netbeans.api.annotations.common</code-name-base>
54
                    <build-prerequisite/>
55
                    <compile-dependency/>
56
                    <run-dependency>
57
                        <release-version>1</release-version>
58
                        <specification-version>1.13</specification-version>
59
                    </run-dependency>
60
                </dependency>
61
                <dependency>
62
                    <code-name-base>org.netbeans.core.ide</code-name-base>
63
                    <build-prerequisite/>
64
                    <compile-dependency/>
65
                    <run-dependency>
66
                        <release-version>1</release-version>
67
                        <specification-version>1.15</specification-version>
68
                    </run-dependency>
69
                </dependency>
70
                <dependency>
53
                    <code-name-base>org.openide.awt</code-name-base>
71
                    <code-name-base>org.openide.awt</code-name-base>
54
                    <build-prerequisite/>
72
                    <build-prerequisite/>
55
                    <compile-dependency/>
73
                    <compile-dependency/>
Lines 98-112 Link Here
98
                    </run-dependency>
116
                    </run-dependency>
99
                </dependency>
117
                </dependency>
100
                <dependency>
118
                <dependency>
101
                    <code-name-base>org.netbeans.core.ide</code-name-base>
102
                    <build-prerequisite/>
103
                    <compile-dependency/>
104
                    <run-dependency>
105
                        <release-version>1</release-version>
106
                        <specification-version>1.15</specification-version>
107
                    </run-dependency>
108
                </dependency>
109
                <dependency>
110
                    <code-name-base>org.openide.util</code-name-base>
119
                    <code-name-base>org.openide.util</code-name-base>
111
                    <build-prerequisite/>
120
                    <build-prerequisite/>
112
                    <compile-dependency/>
121
                    <compile-dependency/>
(-)a/server/src/org/netbeans/api/server/Bundle.properties (+4 lines)
Lines 43-45 Link Here
43
TXT_ServerManager=Servers
43
TXT_ServerManager=Servers
44
CTL_Close=Close
44
CTL_Close=Close
45
AD_Close=Close
45
AD_Close=Close
46
47
StartMode_Normal=Normal
48
StartMode_Debug=Debug
49
StartMode_Profile=Profile
(-)88a51a56d238 (+166 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.api.server;
43
44
import java.util.ArrayList;
45
import java.util.List;
46
import org.netbeans.api.annotations.common.NonNull;
47
import org.netbeans.modules.server.annotations.VMArgumentsRegistrationProcessor;
48
import org.netbeans.spi.server.VMArgumentsProvider;
49
import org.openide.util.Lookup;
50
import org.openide.util.NbBundle;
51
import org.openide.util.lookup.Lookups;
52
53
/**
54
 * The API class allowing clients, typically server plugins, to query additional
55
 * groups of arguments it may pass to VM.
56
 *
57
 * @author Petr Hejl
58
 * @since 1.18
59
 * @see VMArgumentsProvider
60
 */
61
public final class VMArguments {
62
63
    private final String description;
64
65
    private final List<String> arguments;
66
67
    private VMArguments(String description, List<String> arguments) {
68
        this.description = description;
69
        this.arguments = arguments;
70
    }
71
72
    /**
73
     * Returns the groups of arguments provided by all registered
74
     * {@link VMArgumentsProvider} for the given start mode.
75
     *
76
     * @param mode the VM mode the client is going to use
77
     * @return the groups of arguments provided by all registered
78
     *             {@link VMArgumentsProvider}
79
     */
80
    @NonNull
81
    public static List<VMArguments> getVMArguments(StartMode mode) {
82
        Lookup lkp = Lookups.forPath(VMArgumentsRegistrationProcessor.PATH);
83
        List<VMArguments> res = new ArrayList<VMArguments>();
84
        for (VMArgumentsProvider prov : lkp.lookupAll(VMArgumentsProvider.class)) {
85
            res.add(new VMArguments(prov.getDescription(), prov.getArguments(mode)));
86
        }
87
        return res;
88
    }
89
90
    /**
91
     * Returns the description of group of arguments.
92
     *
93
     * @return the description of group of arguments
94
     */
95
    @NonNull
96
    public String getDescription() {
97
        return description;
98
    }
99
100
    /**
101
     * The list of the VM arguments.
102
     *
103
     * @return list of the VM arguments
104
     */
105
    @NonNull
106
    public List<String> getArguments() {
107
        return arguments;
108
    }
109
110
    /**
111
     * Class representing the startup mode of the VM.
112
     */
113
    public static final class StartMode {
114
115
        /**
116
         * The normal startup mode.
117
         */
118
        public static final StartMode NORMAL = new StartMode(
119
                NbBundle.getMessage(VMArguments.class, "StartMode_Normal"));
120
121
        /**
122
         * The debug startup mode.
123
         */
124
        public static final StartMode DEBUG = new StartMode(
125
                NbBundle.getMessage(VMArguments.class, "StartMode_Debug"));
126
127
        /**
128
         * The profile startup mode.
129
         */
130
        public static final StartMode PROFILE = new StartMode(
131
                NbBundle.getMessage(VMArguments.class, "StartMode_Profile"));
132
133
        private final String mode;
134
135
        private StartMode(String mode) {
136
           this.mode = mode;
137
        }
138
139
        @Override
140
        public String toString() {
141
            return mode;
142
        }
143
144
        @Override
145
        public boolean equals(Object obj) {
146
            if (obj == null) {
147
                return false;
148
            }
149
            if (getClass() != obj.getClass()) {
150
                return false;
151
            }
152
            final StartMode other = (StartMode) obj;
153
            if ((this.mode == null) ? (other.mode != null) : !this.mode.equals(other.mode)) {
154
                return false;
155
            }
156
            return true;
157
        }
158
159
        @Override
160
        public int hashCode() {
161
            int hash = 3;
162
            hash = 29 * hash + (this.mode != null ? this.mode.hashCode() : 0);
163
            return hash;
164
        }
165
    }
166
}
(-)88a51a56d238 (+82 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.server.annotations;
43
44
import java.util.Set;
45
import javax.annotation.processing.Processor;
46
import javax.annotation.processing.RoundEnvironment;
47
import javax.annotation.processing.SupportedAnnotationTypes;
48
import javax.annotation.processing.SupportedSourceVersion;
49
import javax.lang.model.SourceVersion;
50
import javax.lang.model.element.Element;
51
import javax.lang.model.element.TypeElement;
52
import javax.lang.model.type.TypeMirror;
53
import org.netbeans.spi.server.VMArgumentsProvider;
54
import org.openide.filesystems.annotations.LayerBuilder.File;
55
import org.openide.filesystems.annotations.LayerGeneratingProcessor;
56
import org.openide.filesystems.annotations.LayerGenerationException;
57
import org.openide.util.lookup.ServiceProvider;
58
59
/**
60
 *
61
 * @author Petr Hejl
62
 */
63
@SupportedAnnotationTypes("org.netbeans.spi.server.VMArgumentsProvider.Registration")
64
@ServiceProvider(service = Processor.class)
65
@SupportedSourceVersion(SourceVersion.RELEASE_6)
66
public class VMArgumentsRegistrationProcessor extends LayerGeneratingProcessor {
67
68
    public static final String PATH = "Servers/VmArgumentProviders";
69
70
    @Override
71
    protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
72
        for (Element element : roundEnv.getElementsAnnotatedWith(
73
                VMArgumentsProvider.Registration.class)) {
74
75
            File f = layer(element).instanceFile(PATH, null, VMArgumentsProvider.class)
76
                    .intvalue("position", element.getAnnotation(VMArgumentsProvider.Registration.class).position());
77
            f.write();
78
        }
79
        return true;
80
    }
81
82
}
(-)88a51a56d238 (+96 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.spi.server;
43
44
import java.lang.annotation.ElementType;
45
import java.lang.annotation.Retention;
46
import java.lang.annotation.RetentionPolicy;
47
import java.lang.annotation.Target;
48
import java.util.List;
49
import org.netbeans.api.annotations.common.NonNull;
50
import org.netbeans.api.server.VMArguments;
51
52
/**
53
 * Provides the additional arguments to server VM. Typically the server plugin
54
 * implementor will query the arguments via API counterpart {@link VMArguments}.
55
 * Of course it is not mandatary for server plugin to use such arguments and
56
 * there is no way to force it.
57
 *
58
 * @author Petr Hejl
59
 * @since 1.18
60
 * @see VMArguments
61
 */
62
public interface VMArgumentsProvider {
63
64
    /**
65
     * Returns the description of the provider. For example this might be
66
     * "JRebel", "Profiler" etc.
67
     *
68
     * @return the description of the provider
69
     */
70
    @NonNull
71
    String getDescription();
72
73
    /**
74
     * Returns the list of arguments to pass to the server VM for the given
75
     * start mode.
76
     *
77
     * @param mode the VM mode the client is going to use
78
     * @return the list of arguments to pass to the server VM
79
     */
80
    @NonNull
81
    List<String> getArguments(VMArguments.StartMode mode);
82
83
    /**
84
     * Annotation used to properly register the SPI implementations.
85
     */
86
    @Retention(RetentionPolicy.SOURCE)
87
    @Target({ElementType.TYPE, ElementType.METHOD})
88
    public @interface Registration {
89
90
        /**
91
         * Position of the provider in the list of providers.
92
         */
93
        int position() default Integer.MAX_VALUE;
94
95
    }
96
}
(-)a/tomcat5/nbproject/project.xml (+9 lines)
Lines 213-218 Link Here
213
                    </run-dependency>
213
                    </run-dependency>
214
                </dependency>
214
                </dependency>
215
                <dependency>
215
                <dependency>
216
                    <code-name-base>org.netbeans.modules.server</code-name-base>
217
                    <build-prerequisite/>
218
                    <compile-dependency/>
219
                    <run-dependency>
220
                        <release-version>0-1</release-version>
221
                        <specification-version>1.18</specification-version>
222
                    </run-dependency>
223
                </dependency>
224
                <dependency>
216
                    <code-name-base>org.openide.actions</code-name-base>
225
                    <code-name-base>org.openide.actions</code-name-base>
217
                    <build-prerequisite/>
226
                    <build-prerequisite/>
218
                    <compile-dependency/>
227
                    <compile-dependency/>
(-)a/tomcat5/src/org/netbeans/modules/tomcat5/ide/StartTomcat.java (-1 / +20 lines)
Lines 54-59 Link Here
54
import java.io.InputStream;
54
import java.io.InputStream;
55
import java.util.Collections;
55
import java.util.Collections;
56
import java.util.HashMap;
56
import java.util.HashMap;
57
import java.util.List;
57
import java.util.Map;
58
import java.util.Map;
58
import java.util.logging.Level;
59
import java.util.logging.Level;
59
import java.util.logging.Logger;
60
import java.util.logging.Logger;
Lines 69-74 Link Here
69
import javax.enterprise.deploy.spi.status.ProgressListener;
70
import javax.enterprise.deploy.spi.status.ProgressListener;
70
import javax.enterprise.deploy.spi.status.ProgressObject;
71
import javax.enterprise.deploy.spi.status.ProgressObject;
71
import org.netbeans.api.java.platform.JavaPlatform;
72
import org.netbeans.api.java.platform.JavaPlatform;
73
import org.netbeans.api.server.VMArguments;
72
import org.netbeans.modules.tomcat5.progress.ProgressEventSupport;
74
import org.netbeans.modules.tomcat5.progress.ProgressEventSupport;
73
import org.netbeans.modules.tomcat5.progress.Status;
75
import org.netbeans.modules.tomcat5.progress.Status;
74
import org.netbeans.modules.tomcat5.util.LogManager;
76
import org.netbeans.modules.tomcat5.util.LogManager;
Lines 398-403 Link Here
398
                        }
400
                        }
399
                    }
401
                    }
400
                }
402
                }
403
404
                for (VMArguments args : VMArguments.getVMArguments(getMode(mode))) {
405
                    for (String singleArg : args.getArguments()) {
406
                        sb.append(' ').append(singleArg);
407
                    }
408
                }
401
                javaOpts = sb.toString();
409
                javaOpts = sb.toString();
402
            }
410
            }
403
            
411
            
Lines 573-579 Link Here
573
                                         StateType.FAILED);
581
                                         StateType.FAILED);
574
            }
582
            }
575
        }
583
        }
576
        
584
585
        private VMArguments.StartMode getMode(int mode) {
586
            switch (mode) {
587
                case MODE_PROFILE:
588
                    return VMArguments.StartMode.PROFILE;
589
                case MODE_DEBUG:
590
                    return VMArguments.StartMode.DEBUG;
591
                default:
592
                    return VMArguments.StartMode.NORMAL;
593
            }
594
        }
595
577
        /** Open JULI log and server output */
596
        /** Open JULI log and server output */
578
        private void openLogs() {
597
        private void openLogs() {
579
            LogManager logManager = tm.logManager();
598
            LogManager logManager = tm.logManager();

Return to bug 206196