View | Details | Raw Unified | Return to bug 200132 | Differences between
and this patch

Collapse All | Expand All

(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java (-1 / +33 lines)
 Lines 138-143    Link Here 
138
                // dom4j.jar library for JBoss Application Server 4.0.5
138
                // dom4j.jar library for JBoss Application Server 4.0.5
139
                domFile = new File(domainRoot, JBPluginUtils.LIB + "dom4j.jar"); // NOI18N
139
                domFile = new File(domainRoot, JBPluginUtils.LIB + "dom4j.jar"); // NOI18N
140
            }
140
            }
141
142
            String sep = File.separator;
143
            if (!domFile.exists() && "7".equals(JBVer.getMajorNumber())) {
144
                domFile = new File(serverRoot, JBPluginUtils.MODULES + "org" + sep + "dom4j" + sep + "main" + sep + "dom4j-1.6.1.jar"); // NOI18N
145
            }
141
            if (!domFile.exists()) {
146
            if (!domFile.exists()) {
142
                domFile = null;
147
                domFile = null;
143
                LOGGER.log(Level.INFO, "No dom4j.jar availabale on classpath"); // NOI18N
148
                LOGGER.log(Level.INFO, "No dom4j.jar availabale on classpath"); // NOI18N
 Lines 161-167    Link Here 
161
                urlList.add(domFile.toURI().toURL());
166
                urlList.add(domFile.toURI().toURL());
162
            }
167
            }
163
168
164
            if  (version5Above) {
169
            if ("7".equals(JBVer.getMajorNumber())) {
170
               
171
                File org = new File(serverRoot, JBPluginUtils.MODULES + "org");
172
                File jboss = new File(org, "jboss");
173
                File as = new File(jboss, "as");
174
                String versionString = JBVer.getMajorNumber()+"."+JBVer.getMinorNumber()+"."+JBVer.getMicroNumber()+"."+JBVer.getUpdate();
175
                
176
                if (domFile.exists()) {
177
                    urlList.add(domFile.toURI().toURL());
178
                }
179
                
180
                urlList.add(new File(serverRoot, "jboss-modules.jar").toURI().toURL());
181
                urlList.add(new File(serverRoot, "bin"+sep+"client"+sep+"jboss-client.jar").toURI().toURL());
182
                urlList.add(new File(jboss, "logging" + sep + "main" + sep + "jboss-logging-3.1.0.GA.jar").toURI().toURL());
183
                urlList.add(new File(jboss, "threads" + sep + "main" + sep + "jboss-threads-2.0.0.GA.jar").toURI().toURL());
184
                urlList.add(new File(jboss, "remoting3" + sep + "main" + sep + "jboss-remoting-3.2.3.GA.jar").toURI().toURL());
185
                urlList.add(new File(jboss, "xnio" + sep + "main" + sep + "xnio-api-3.0.3.GA.jar").toURI().toURL());
186
                urlList.add(new File(jboss, "msc" + sep + "main" + sep + "jboss-msc-1.0.2.GA.jar").toURI().toURL());
187
                urlList.add(new File(as, "ee" + sep + "deployment" + sep + "main" + sep + "jboss-as-ee-deployment-" + versionString + ".jar").toURI().toURL());
188
                urlList.add(new File(as, "naming" + sep + "main" + sep + "jboss-as-naming-" + versionString + ".jar").toURI().toURL());
189
                urlList.add(new File(as, "controller-client" + sep + "main" + sep + "jboss-as-controller-client-" + versionString + ".jar").toURI().toURL());
190
                urlList.add(new File(as, "protocol" + sep + "main" + sep + "jboss-as-protocol-" + versionString + ".jar").toURI().toURL());
191
            } else if (version5Above) {
165
                // get lient class path for Jboss 5.0
192
                // get lient class path for Jboss 5.0
166
                List<URL> clientClassUrls = JBPluginUtils.getJB5ClientClasspath(
193
                List<URL> clientClassUrls = JBPluginUtils.getJB5ClientClasspath(
167
                        serverRoot);
194
                        serverRoot);
 Lines 252-259    Link Here 
252
279
253
            jbossFactory = (DeploymentFactory) jbossFactories.get(jbossRoot);
280
            jbossFactory = (DeploymentFactory) jbossFactories.get(jbossRoot);
254
            if ( jbossFactory == null ) {
281
            if ( jbossFactory == null ) {
282
                Version version = JBPluginUtils.getServerVersion(new File(jbossRoot));
255
                URLClassLoader loader = getJBClassLoader(jbossRoot, domainRoot);
283
                URLClassLoader loader = getJBClassLoader(jbossRoot, domainRoot);
284
                if(version!= null && "7".equals(version.getMajorNumber())) {
285
                    jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.as.ee.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N
286
                } else {
256
                jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N
287
                jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N
288
                }
257
289
258
                jbossFactories.put(jbossRoot, jbossFactory);
290
                jbossFactories.put(jbossRoot, jbossFactory);
259
            }
291
            }
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/JBDeploymentManager.java (+18 lines)
 Lines 53-58    Link Here 
53
import java.io.IOException;
53
import java.io.IOException;
54
import java.io.InputStream;
54
import java.io.InputStream;
55
import java.net.URLClassLoader;
55
import java.net.URLClassLoader;
56
import java.util.HashMap;
56
import java.util.Locale;
57
import java.util.Locale;
57
import java.util.Properties;
58
import java.util.Properties;
58
import java.util.logging.Level;
59
import java.util.logging.Level;
 Lines 73-83    Link Here 
73
import javax.management.MBeanServerConnection;
74
import javax.management.MBeanServerConnection;
74
import javax.management.ObjectName;
75
import javax.management.ObjectName;
75
import javax.management.ReflectionException;
76
import javax.management.ReflectionException;
77
import javax.management.remote.JMXConnector;
78
import javax.management.remote.JMXConnectorFactory;
79
import javax.management.remote.JMXServiceURL;
76
import javax.naming.Context;
80
import javax.naming.Context;
77
import javax.naming.InitialContext;
81
import javax.naming.InitialContext;
78
import javax.naming.NamingException;
82
import javax.naming.NamingException;
79
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginProperties;
83
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginProperties;
80
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils;
84
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils;
85
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version;
81
86
82
/**
87
/**
83
 *
88
 *
 Lines 194-199    Link Here 
194
                System.setProperty(JAVA_SEC_AUTH_LOGIN_CONF, securityConf.getAbsolutePath()); // NOI18N
199
                System.setProperty(JAVA_SEC_AUTH_LOGIN_CONF, securityConf.getAbsolutePath()); // NOI18N
195
            }
200
            }
196
201
202
            Version version = props.getServerVersion();
203
            if(version != null && "7".equals(version.getMajorNumber())) {
204
                String host = "localhost";
205
                int port = 9999;  // management-native port
206
                String urlString = System.getProperty("jmx.service.url","service:jmx:remoting-jmx://" + host + ":" + port);
207
                JMXServiceURL serviceURL = new JMXServiceURL(urlString);
208
                Map environment = new HashMap();
209
                environment.put(Context.SECURITY_PRINCIPAL, props.getUsername());
210
                environment.put(Context.SECURITY_CREDENTIALS, props.getPassword());
211
                JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, environment);
212
                rmiServer = jmxConnector.getMBeanServerConnection();
213
            } else {
197
            // Gets naming context
214
            // Gets naming context
198
            InitialContext ctx = new InitialContext(env);
215
            InitialContext ctx = new InitialContext(env);
199
216
 Lines 210-215    Link Here 
210
            if (service != null) {
227
            if (service != null) {
211
                profileServiceProxy = new JBoss5ProfileServiceProxy(service);
228
                profileServiceProxy = new JBoss5ProfileServiceProxy(service);
212
            }
229
            }
230
            }
213
        } catch (NameNotFoundException ex) {
231
        } catch (NameNotFoundException ex) {
214
            LOGGER.log(Level.FINE, null, ex);
232
            LOGGER.log(Level.FINE, null, ex);
215
        } catch (NamingException ex) {
233
        } catch (NamingException ex) {
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBOutputSupport.java (-2 / +3 lines)
 Lines 309-318    Link Here 
309
                    || line.indexOf("Starting JBossAS") > -1) { // JBoss 6.0 message // NOI18N
309
                    || line.indexOf("Starting JBossAS") > -1) { // JBoss 6.0 message // NOI18N
310
                LOGGER.log(Level.FINER, "STARTING message fired"); // NOI18N
310
                LOGGER.log(Level.FINER, "STARTING message fired"); // NOI18N
311
                //fireStartProgressEvent(StateType.RUNNING, createProgressMessage("MSG_START_SERVER_IN_PROGRESS")); // NOI18N
311
                //fireStartProgressEvent(StateType.RUNNING, createProgressMessage("MSG_START_SERVER_IN_PROGRESS")); // NOI18N
312
            } else if ((line.indexOf("JBoss (MX MicroKernel)") > -1 // JBoss 4.x message // NOI18N
312
            } else if ( ((line.indexOf("JBoss (MX MicroKernel)") > -1 // JBoss 4.x message // NOI18N
313
                    || line.indexOf("JBoss (Microcontainer)") > -1 // JBoss 5.0 message // NOI18N
313
                    || line.indexOf("JBoss (Microcontainer)") > -1 // JBoss 5.0 message // NOI18N
314
                    || line.indexOf("JBossAS") > -1) // JBoss 6.0 message // NOI18N
314
                    || line.indexOf("JBossAS") > -1) // JBoss 6.0 message // NOI18N
315
                    && line.indexOf("Started in") > -1) { // NOI18N
315
                    && line.indexOf("Started in") > -1) 
316
                    || line.indexOf("JBoss AS") > -1 && line.indexOf("started in") > -1) { // NOI18N
316
                LOGGER.log(Level.FINER, "STARTED message fired"); // NOI18N
317
                LOGGER.log(Level.FINER, "STARTED message fired"); // NOI18N
317
318
318
                synchronized (JBOutputSupport.this) {
319
                synchronized (JBOutputSupport.this) {
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartRunnable.java (-3 / +13 lines)
 Lines 79-84    Link Here 
79
import org.openide.util.Utilities;
79
import org.openide.util.Utilities;
80
import org.openide.util.lookup.Lookups;
80
import org.openide.util.lookup.Lookups;
81
import org.openide.windows.InputOutput;
81
import org.openide.windows.InputOutput;
82
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version;
82
83
83
/**
84
/**
84
 *
85
 *
 Lines 100-107    Link Here 
100
101
101
    private final static String STARTUP_SH = File.separator + 
102
    private final static String STARTUP_SH = File.separator + 
102
            "bin" + File.separator + "run.sh";          // NOI18N
103
            "bin" + File.separator + "run.sh";          // NOI18N
104
    private final static String STANDALONE_SH = File.separator + 
105
            "bin" + File.separator + "standalone.sh";          // NOI18N
103
    private final static String STARTUP_BAT = File.separator + 
106
    private final static String STARTUP_BAT = File.separator + 
104
            "bin" + File.separator + RUN_FILE_NAME;     // NOI18N
107
            "bin" + File.separator + RUN_FILE_NAME;     // NOI18N
108
    private final static String STANDALONE_BAT = File.separator + 
109
            "bin" + File.separator + "standalone.bat";     // NOI18N
105
                             
110
                             
106
    private final static String CONF_BAT = File.separator + 
111
    private final static String CONF_BAT = File.separator + 
107
            "bin" + File.separator + CONF_FILE_NAME;    // NOI18N
112
            "bin" + File.separator + CONF_FILE_NAME;    // NOI18N
 Lines 316-322    Link Here 
316
321
317
        final String instanceName = ip.getProperty(JBPluginProperties.PROPERTY_SERVER);
322
        final String instanceName = ip.getProperty(JBPluginProperties.PROPERTY_SERVER);
318
        String args = ("all".equals(instanceName) ? "-b 127.0.0.1 " : "") + "-c " + instanceName; // NOI18N
323
        String args = ("all".equals(instanceName) ? "-b 127.0.0.1 " : "") + "-c " + instanceName; // NOI18N
319
        return new NbProcessDescriptor(serverRunFileName, args);
324
        return new NbProcessDescriptor(serverRunFileName, isJBoss7()? "" : args);
320
    }
325
    }
321
    
326
    
322
    private String getRunFileName( InstanceProperties ip, String[] envp ){
327
    private String getRunFileName( InstanceProperties ip, String[] envp ){
 Lines 351-363    Link Here 
351
            Logger.getLogger("global").log(Level.INFO, null, ioe);
356
            Logger.getLogger("global").log(Level.INFO, null, ioe);
352
357
353
            final String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
358
            final String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
354
            final String serverRunFileName = serverLocation + (Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
359
            final String serverRunFileName = serverLocation + (isJBoss7() ? Utilities.isWindows() ? STANDALONE_BAT : STANDALONE_SH : Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
355
            fireStartProgressEvent(StateType.FAILED, createProgressMessage("MSG_START_SERVER_FAILED_PD", serverRunFileName));
360
            fireStartProgressEvent(StateType.FAILED, createProgressMessage("MSG_START_SERVER_FAILED_PD", serverRunFileName));
356
361
357
            return null;
362
            return null;
358
        }
363
        }
359
    }
364
    }
360
    
365
    
366
    private boolean isJBoss7() {
367
        Version serverVersion = dm.getProperties().getServerVersion();
368
        return serverVersion!=null && "7".equals(serverVersion.getMajorNumber());
369
    }
370
    
361
    private InputOutput openConsole() {
371
    private InputOutput openConsole() {
362
        InputOutput io = UISupport.getServerIO(dm.getUrl());
372
        InputOutput io = UISupport.getServerIO(dm.getUrl());
363
        if (io == null) {
373
        if (io == null) {
 Lines 414-420    Link Here 
414
            String serverLocation = getProperties().getProperty(
424
            String serverLocation = getProperties().getProperty(
415
                    JBPluginProperties.PROPERTY_ROOT_DIR);
425
                    JBPluginProperties.PROPERTY_ROOT_DIR);
416
            String serverRunFileName = serverLocation + 
426
            String serverRunFileName = serverLocation + 
417
                (Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
427
                    (isJBoss7() ? Utilities.isWindows() ? STANDALONE_BAT : STANDALONE_SH : Utilities.isWindows() ? STARTUP_BAT : STARTUP_SH);
418
            if ( needChange ){
428
            if ( needChange ){
419
                String contentRun = readFile(serverRunFileName);
429
                String contentRun = readFile(serverRunFileName);
420
                String contentConf = readFile(serverLocation + CONF_BAT);
430
                String contentConf = readFile(serverLocation + CONF_BAT);
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStartServer.java (-3 / +14 lines)
 Lines 71-76    Link Here 
71
import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
71
import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
72
import javax.enterprise.deploy.spi.status.ClientConfiguration;
72
import javax.enterprise.deploy.spi.status.ClientConfiguration;
73
import javax.enterprise.deploy.spi.status.DeploymentStatus;
73
import javax.enterprise.deploy.spi.status.DeploymentStatus;
74
import org.netbeans.modules.j2ee.jboss4.ide.ui.JBPluginUtils.Version;
74
import org.openide.util.NbBundle;
75
import org.openide.util.NbBundle;
75
import org.netbeans.modules.j2ee.jboss4.nodes.Util;
76
import org.netbeans.modules.j2ee.jboss4.nodes.Util;
76
77
 Lines 237-244    Link Here 
237
                    result = false;
238
                    result = false;
238
                }
239
                }
239
240
240
                Object serverName = Util.getMBeanParameter(dm, "ServerName", "jboss.system:type=ServerConfig"); //NOI18N
241
                Object serverName;
241
                Object serverHome = Util.getMBeanParameter(dm, "ServerHomeLocation", "jboss.system:type=ServerConfig"); //NOI18N
242
                Object serverHome;
243
                Version version = dm.getProperties().getServerVersion();
244
                if(version != null && "7".equals(version.getMajorNumber())) {
245
                    serverHome = Util.getMBeanParameter(dm, "baseDir", "jboss.as:core-service=server-environment"); //NOI18N
246
                    serverName = Util.getMBeanParameter(dm, "launchType", "jboss.as:core-service=server-environment"); //NOI18N
247
                    if (serverName != null) {
248
                        serverName = serverName.toString().toLowerCase();
249
                    }
250
                }else {
251
                    serverName = Util.getMBeanParameter(dm, "ServerName", "jboss.system:type=ServerConfig"); //NOI18N
252
                    serverHome = Util.getMBeanParameter(dm, "ServerHomeLocation", "jboss.system:type=ServerConfig"); //NOI18N
242
                boolean isJBoss6 = serverHome != null;
253
                boolean isJBoss6 = serverHome != null;
243
                if (!isJBoss6) {
254
                if (!isJBoss6) {
244
                    serverHome = Util.getMBeanParameter(dm, "ServerHomeDir", "jboss.system:type=ServerConfig"); //NOI18N
255
                    serverHome = Util.getMBeanParameter(dm, "ServerHomeDir", "jboss.system:type=ServerConfig"); //NOI18N
 Lines 254-260    Link Here 
254
                } catch (URISyntaxException use) {
265
                } catch (URISyntaxException use) {
255
                    Logger.getLogger(JBStartServer.class.getName()).log(Level.WARNING, "error getting file from URI: " + serverHome, use); //NOI18N
266
                    Logger.getLogger(JBStartServer.class.getName()).log(Level.WARNING, "error getting file from URI: " + serverHome, use); //NOI18N
256
                }
267
                }
257
                
268
                }
258
                if (serverName == null || serverHome == null) {
269
                if (serverName == null || serverHome == null) {
259
                    result = false;
270
                    result = false;
260
                    return;
271
                    return;
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBStopRunnable.java (-3 / +14 lines)
 Lines 77-83    Link Here 
77
    private static final Logger LOGGER = Logger.getLogger(JBStopRunnable.class.getName());
77
    private static final Logger LOGGER = Logger.getLogger(JBStopRunnable.class.getName());
78
    
78
    
79
    private static final String SHUTDOWN_SH = "/bin/shutdown.sh"; // NOI18N
79
    private static final String SHUTDOWN_SH = "/bin/shutdown.sh"; // NOI18N
80
    private static final String JBOSS_CLI_SH = "/bin/jboss-cli.sh"; // NOI18N
80
    private static final String SHUTDOWN_BAT = "/bin/shutdown.bat"; // NOI18N
81
    private static final String SHUTDOWN_BAT = "/bin/shutdown.bat"; // NOI18N
82
    private static final String JBOSS_CLI_BAT = "/bin/jboss-cli.bat"; // NOI18N
81
83
82
    private static final int TIMEOUT = 300000;
84
    private static final int TIMEOUT = 300000;
83
    
85
    
 Lines 89-94    Link Here 
89
        this.startServer = startServer;
91
        this.startServer = startServer;
90
    }
92
    }
91
    
93
    
94
    private boolean isJBoss7() {
95
        JBPluginUtils.Version serverVersion = dm.getProperties().getServerVersion();
96
        return serverVersion!=null && "7".equals(serverVersion.getMajorNumber());
97
    }
98
    
92
    private String[] createEnvironment() {
99
    private String[] createEnvironment() {
93
        
100
        
94
        JBProperties properties = dm.getProperties();
101
        JBProperties properties = dm.getProperties();
 Lines 120-126    Link Here 
120
        String serverName = ip.getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
127
        String serverName = ip.getProperty(InstanceProperties.DISPLAY_NAME_ATTR);
121
128
122
        String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
129
        String serverLocation = ip.getProperty(JBPluginProperties.PROPERTY_ROOT_DIR);
123
        String serverStopFileName = serverLocation + (Utilities.isWindows() ? SHUTDOWN_BAT : SHUTDOWN_SH);
130
        String serverStopFileName = serverLocation + (isJBoss7() ? Utilities.isWindows() ? JBOSS_CLI_BAT : JBOSS_CLI_SH :Utilities.isWindows() ? SHUTDOWN_BAT : SHUTDOWN_SH);
124
131
125
        File serverStopFile = new File(serverStopFileName);
132
        File serverStopFile = new File(serverStopFileName);
126
        if (!serverStopFile.exists()){
133
        if (!serverStopFile.exists()){
 Lines 131-136    Link Here 
131
        JBProperties properties = dm.getProperties();
138
        JBProperties properties = dm.getProperties();
132
        StringBuilder additionalParams = new StringBuilder(32);
139
        StringBuilder additionalParams = new StringBuilder(32);
133
        int jnpPort = JBPluginUtils.getJnpPortNumber(ip.getProperty(JBPluginProperties.PROPERTY_SERVER_DIR));  
140
        int jnpPort = JBPluginUtils.getJnpPortNumber(ip.getProperty(JBPluginProperties.PROPERTY_SERVER_DIR));  
141
        NbProcessDescriptor pd;
142
        if(isJBoss7()) {
143
            pd = new NbProcessDescriptor(serverStopFileName, "--connect --command=:shutdown"); // NOI18N
144
        } else {
134
        if (dm.getProperties().getServerVersion().compareTo(JBPluginUtils.JBOSS_6_0_0) < 0) {
145
        if (dm.getProperties().getServerVersion().compareTo(JBPluginUtils.JBOSS_6_0_0) < 0) {
135
            additionalParams.append(" -s jnp://localhost:").append(jnpPort); // NOI18N
146
            additionalParams.append(" -s jnp://localhost:").append(jnpPort); // NOI18N
136
        } else {
147
        } else {
 Lines 150-158    Link Here 
150
161
151
        /* 2008-09-10 The usage of --halt doesn't solve the problem on Windows; it even creates another problem
162
        /* 2008-09-10 The usage of --halt doesn't solve the problem on Windows; it even creates another problem
152
                        of NB Profiler not being notified about the fact that the server was stopped */
163
                        of NB Profiler not being notified about the fact that the server was stopped */
153
        NbProcessDescriptor pd = new NbProcessDescriptor(
164
            pd = new NbProcessDescriptor(
154
                serverStopFileName, "--shutdown " + additionalParams); // NOI18N
165
                serverStopFileName, "--shutdown " + additionalParams); // NOI18N
155
166
        }
156
        Process stoppingProcess = null;
167
        Process stoppingProcess = null;
157
        try {
168
        try {
158
            String envp[] = createEnvironment();
169
            String envp[] = createEnvironment();
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/Bundle.properties (-2 / +2 lines)
 Lines 56-64    Link Here 
56
56
57
LBL_BrowseButton=Br&owse...
57
LBL_BrowseButton=Br&owse...
58
58
59
MSG_InvalidServerLocation=Provide a valid JBoss Application Server 6, 5 or 4 Location
59
MSG_InvalidServerLocation=Provide a valid JBoss Application Server 7, 6, 5 or 4 Location
60
60
61
MSG_SpecifyServerLocation=Please specify JBoss Application Server 6, 5 or 4 Location
61
MSG_SpecifyServerLocation=Please specify JBoss Application Server 7, 6, 5 or 4 Location
62
62
63
LBL_ChooserName=Choose JBoss Server Location
63
LBL_ChooserName=Choose JBoss Server Location
64
64
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBInstantiatingIterator.java (-4 / +7 lines)
 Lines 146-160    Link Here 
146
        Set result = new HashSet();
146
        Set result = new HashSet();
147
        
147
        
148
        String displayName =  (String)wizard.getProperty(PROP_DISPLAY_NAME);
148
        String displayName =  (String)wizard.getProperty(PROP_DISPLAY_NAME);
149
        
149
        JBPluginUtils.Version version = JBPluginUtils.getServerVersion(new File(installLocation));
150
        String url = JBDeploymentFactory.URI_PREFIX + host + ":" + port;    // NOI18N
150
        String url = JBDeploymentFactory.URI_PREFIX;
151
        if(version != null && "7".equals(version.getMajorNumber())){
152
            url += "//"+host + ":" + port+"?targetType=as7&serverPort="+port;    // NOI18N
153
        } else {
154
            url += host + ":" + port;    // NOI18N
155
        }
151
        if (server != null && !server.equals(""))                           // NOI18N
156
        if (server != null && !server.equals(""))                           // NOI18N
152
            url += "#" + server;                                            // NOI18N
157
            url += "#" + server;                                            // NOI18N
153
        url += "&"+ installLocation;                                        // NOI18N
158
        url += "&"+ installLocation;                                        // NOI18N
154
      
159
      
155
        try {
160
        try {
156
            JBPluginUtils.Version version = JBPluginUtils.getServerVersion(new File(installLocation));
157
158
            Map<String, String> initialProperties = new HashMap<String, String>();
161
            Map<String, String> initialProperties = new HashMap<String, String>();
159
            initialProperties.put(JBPluginProperties.PROPERTY_SERVER, server);
162
            initialProperties.put(JBPluginProperties.PROPERTY_SERVER, server);
160
            initialProperties.put(JBPluginProperties.PROPERTY_DEPLOY_DIR, deployDir);
163
            initialProperties.put(JBPluginProperties.PROPERTY_DEPLOY_DIR, deployDir);
(-)j2ee.jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java (-10 / +84 lines)
 Lines 98-103    Link Here 
98
98
99
    public static final String LIB = "lib" + File.separator;
99
    public static final String LIB = "lib" + File.separator;
100
100
101
    public static final String MODULES = "modules" + File.separator;
102
101
    public static final String CLIENT = "client" + File.separator;
103
    public static final String CLIENT = "client" + File.separator;
102
104
103
    public static final String COMMON = "common" + File.separator;
105
    public static final String COMMON = "common" + File.separator;
 Lines 195-200    Link Here 
195
        return domainRequirements6x;
197
        return domainRequirements6x;
196
    }
198
    }
197
199
200
    private static List<String> domainRequirements7x;
201
202
    private static synchronized List<String> getDomainRequirements7x() {
203
        if (domainRequirements7x == null) {
204
            domainRequirements7x = new ArrayList<String>(11);
205
            Collections.addAll(domainRequirements7x,
206
                    "configuration", // NOI18N
207
                    "deployments", // NOI18N
208
                    "lib" // NOI18N
209
                    );
210
        }
211
        return domainRequirements7x;
212
    }
213
214
198
    //--------------- checking for possible server directory -------------
215
    //--------------- checking for possible server directory -------------
199
    private static List<String> serverRequirements4x;
216
    private static List<String> serverRequirements4x;
200
217
 Lines 249-254    Link Here 
249
        return serverRequirements5And6x;
266
        return serverRequirements5And6x;
250
    }
267
    }
251
268
269
    private static List<String> serverRequirements7x;
270
    private static synchronized List<String> getServerRequirements7x() {
271
        if (serverRequirements7x == null) {
272
            serverRequirements7x = new ArrayList<String>(6);
273
            Collections.addAll(serverRequirements7x,
274
                    "bin", // NOI18N
275
                    "modules", // NOI18N
276
                    "jboss-modules.jar"); // NOI18N
277
        }
278
        return serverRequirements7x;
279
    }
280
252
    //------------  getting exists servers---------------------------
281
    //------------  getting exists servers---------------------------
253
    /**
282
    /**
254
     * returns Hashmap
283
     * returns Hashmap
 Lines 262-275    Link Here 
262
        File serverDirectory = new File(serverLocation);
291
        File serverDirectory = new File(serverLocation);
263
292
264
        if (isGoodJBServerLocation(serverDirectory)) {
293
        if (isGoodJBServerLocation(serverDirectory)) {
265
           File file = new File(serverLocation + File.separator + "server");  // NOI18N
294
            Version version = getServerVersion(serverDirectory);            
266
295
            File file;
267
            String[] files = file.list(new FilenameFilter(){
296
            String[] files;
297
            if("7".equals(version.getMajorNumber())) {
298
                files = new String[]{"standalone", "domain"};
299
                file = serverDirectory;
300
            } else {
301
                file = new File(serverLocation + File.separator + "server");  // NOI18N
302
                files = file.list(new FilenameFilter(){
303
                    @Override
268
                public boolean accept(File dir, String name){
304
                public boolean accept(File dir, String name){
269
                    if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true;
305
                    if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true;
270
                    return false;
306
                    return false;
271
                }
307
                }
272
            });
308
            });
309
            }
273
310
274
            for(int i = 0; i<files.length; i++) {
311
            for(int i = 0; i<files.length; i++) {
275
                String path = file.getAbsolutePath() + File.separator + files[i];
312
                String path = file.getAbsolutePath() + File.separator + files[i];
 Lines 319-337    Link Here 
319
        return isGoodJBInstanceLocation(candidate, getDomainRequirements6x());
356
        return isGoodJBInstanceLocation(candidate, getDomainRequirements6x());
320
    }
357
    }
321
358
359
    private static boolean isGoodJBInstanceLocation7x(File serverDir, File candidate){
360
        return isGoodJBInstanceLocation(candidate, getDomainRequirements7x());
361
    }
362
322
    public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){
363
    public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){
323
        Version version = getServerVersion(serverDir);
364
        Version version = getServerVersion(serverDir);
324
        if (version == null || (!"4".equals(version.getMajorNumber())
365
        if (version == null || (!"4".equals(version.getMajorNumber())
325
                && !"5".equals(version.getMajorNumber()) // NOI18N
366
                && !"5".equals(version.getMajorNumber()) // NOI18N
326
                && !"6".equals(version.getMajorNumber()))) { // NOI18N
367
                && !"6".equals(version.getMajorNumber()) // NOI18N
368
                && !"7".equals(version.getMajorNumber()))) { // NOI18N
327
            return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)
369
            return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)
328
                    || JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)
370
                    || JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)
329
                    || JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate);
371
                    || JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)
372
                    || JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate);
330
        }
373
        }
331
374
332
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N
375
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N
333
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N
376
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N
334
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)); // NOI18N
377
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)) // NOI18N
378
                || ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate)); // NOI18N
335
    }
379
    }
336
380
337
    private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){
381
    private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){
 Lines 372-390    Link Here 
372
        return isGoodJBServerLocation(candidate, getServerRequirements5And6x());
416
        return isGoodJBServerLocation(candidate, getServerRequirements5And6x());
373
    }
417
    }
374
418
419
    private static boolean isGoodJBServerLocation7x(File candidate){
420
        return isGoodJBServerLocation(candidate, getServerRequirements7x());
421
    }
422
375
    public static boolean isGoodJBServerLocation(File candidate) {
423
    public static boolean isGoodJBServerLocation(File candidate) {
376
        Version version = getServerVersion(candidate);
424
        Version version = getServerVersion(candidate);
377
        if (version == null || (!"4".equals(version.getMajorNumber())
425
        if (version == null || (!"4".equals(version.getMajorNumber())
378
                && !"5".equals(version.getMajorNumber())
426
                && !"5".equals(version.getMajorNumber())
379
                && !"6".equals(version.getMajorNumber()))) { // NOI18N
427
                && !"6".equals(version.getMajorNumber())
428
                && !"7".equals(version.getMajorNumber()))) { // NOI18N
380
            return JBPluginUtils.isGoodJBServerLocation4x(candidate)
429
            return JBPluginUtils.isGoodJBServerLocation4x(candidate)
381
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
430
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
382
                    || JBPluginUtils.isGoodJBServerLocation6x(candidate);
431
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
432
                    || JBPluginUtils.isGoodJBServerLocation7x(candidate);
383
        }
433
        }
384
434
385
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n
435
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n
386
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N
436
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N
387
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)); // NOI18N
437
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)) // NOI18N
438
                || ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation7x(candidate)); // NOI18N
388
    }
439
    }
389
440
390
    public static boolean isJB4(JBDeploymentManager dm) {
441
    public static boolean isJB4(JBDeploymentManager dm) {
 Lines 435-440    Link Here 
435
     *
486
     *
436
     */
487
     */
437
    public static String getDeployDir(String domainDir){
488
    public static String getDeployDir(String domainDir){
489
        Version version = JBPluginUtils.getServerVersion(new File(JBPluginProperties.getInstance().getInstallLocation()));
490
        if("7".equals(version.getMajorNumber())) {
491
            return domainDir + File.separator + "deployments"; //NOI18N
492
        }
438
        return domainDir + File.separator + "deploy"; //NOI18N
493
        return domainDir + File.separator + "deploy"; //NOI18N
439
        //todo: get real deploy path
494
        //todo: get real deploy path
440
    }
495
    }
 Lines 659-667    Link Here 
659
        assert serverPath != null : "Can't determine version with null server path"; // NOI18N
714
        assert serverPath != null : "Can't determine version with null server path"; // NOI18N
660
715
661
        File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N
716
        File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N
662
        return getVersion(systemJarFile);
717
        Version version = getVersion(systemJarFile);
718
        if(version == null) {
719
            // check for JBoss AS 7
720
            File serverDir = new File(serverPath, "modules/org/jboss/as/server/main");
721
            for (File jarFile : serverDir.listFiles(new JarFileFilter())) {
722
                version = getVersion(jarFile);
723
                if(version != null) {
724
                    break;
663
    }
725
    }
726
            }
727
        }
728
        return version;
729
    }
664
730
731
    static class JarFileFilter implements FilenameFilter {
732
733
        @Override
734
        public boolean accept(File dir, String name) {
735
            return name.endsWith(".jar");
736
        }
737
    }
738
665
    private static Version getVersion(File systemJarFile) {
739
    private static Version getVersion(File systemJarFile) {
666
        if (!systemJarFile.exists()) {
740
        if (!systemJarFile.exists()) {
667
            return null;
741
            return null;

Return to bug 200132
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo