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

(-)org/netbeans/modules/j2ee/jboss4/JBDeploymentFactory.java (-3 / +31 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(jboss, "logging" + sep + "main" + sep + "jboss-logging-3.1.0.GA.jar").toURI().toURL());
181
                urlList.add(new File(jboss, "threads" + sep + "main" + sep + "jboss-threads-2.0.0.GA.jar").toURI().toURL());
182
                urlList.add(new File(jboss, "remoting3" + sep + "main" + sep + "jboss-remoting-3.2.3.GA.jar").toURI().toURL());
183
                urlList.add(new File(jboss, "xnio" + sep + "main" + sep + "xnio-api-3.0.3.GA.jar").toURI().toURL());
184
                urlList.add(new File(as, "ee" + sep + "deployment" + sep + "main" + sep + "jboss-as-ee-deployment-" + versionString + ".jar").toURI().toURL());
185
                urlList.add(new File(as, "controller-client" + sep + "main" + sep + "jboss-as-controller-client-" + versionString + ".jar").toURI().toURL());
186
                urlList.add(new File(as, "protocol" + sep + "main" + sep + "jboss-as-protocol-" + versionString + ".jar").toURI().toURL());
187
            } else if (version5Above) {
165
                // get lient class path for Jboss 5.0
188
                // get lient class path for Jboss 5.0
166
                List<URL> clientClassUrls = JBPluginUtils.getJB5ClientClasspath(
189
                List<URL> clientClassUrls = JBPluginUtils.getJB5ClientClasspath(
167
                        serverRoot);
190
                        serverRoot);
Lines 252-259 Link Here
252
275
253
            jbossFactory = (DeploymentFactory) jbossFactories.get(jbossRoot);
276
            jbossFactory = (DeploymentFactory) jbossFactories.get(jbossRoot);
254
            if ( jbossFactory == null ) {
277
            if ( jbossFactory == null ) {
278
                Version version = JBPluginUtils.getServerVersion(new File(jbossRoot));
255
                URLClassLoader loader = getJBClassLoader(jbossRoot, domainRoot);
279
                URLClassLoader loader = getJBClassLoader(jbossRoot, domainRoot);
280
                if(version!= null && "7".equals(version.getMajorNumber())) {
281
                    jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.as.ee.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N
282
                } else {
256
                jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N
283
                jbossFactory = (DeploymentFactory) loader.loadClass("org.jboss.deployment.spi.factories.DeploymentFactoryImpl").newInstance();//NOI18N
284
                }
257
285
258
                jbossFactories.put(jbossRoot, jbossFactory);
286
                jbossFactories.put(jbossRoot, jbossFactory);
259
            }
287
            }
Lines 285-292 Link Here
285
            String jbURI = uri;
313
            String jbURI = uri;
286
            try {
314
            try {
287
                jbURI = uri.substring(0, uri.indexOf("&")); // NOI18N
315
                jbURI = uri.substring(0, uri.indexOf("&")); // NOI18N
288
            }
316
                System.err.println("jbURI = " + jbURI);
289
            catch (Exception e) {
317
            } catch (Exception e) {
290
                LOGGER.log(Level.INFO, null, e);
318
                LOGGER.log(Level.INFO, null, e);
291
            }
319
            }
292
320
(-)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
(-)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);
(-)org/netbeans/modules/j2ee/jboss4/ide/ui/JBPluginUtils.java (-10 / +85 lines)
Lines 53-58 Link Here
53
import java.net.ServerSocket;
53
import java.net.ServerSocket;
54
import java.net.URL;
54
import java.net.URL;
55
import java.util.ArrayList;
55
import java.util.ArrayList;
56
import java.util.Arrays;
56
import java.util.Collections;
57
import java.util.Collections;
57
import java.util.Hashtable;
58
import java.util.Hashtable;
58
import java.util.List;
59
import java.util.List;
Lines 98-103 Link Here
98
99
99
    public static final String LIB = "lib" + File.separator;
100
    public static final String LIB = "lib" + File.separator;
100
101
102
    public static final String MODULES = "modules" + File.separator;
103
101
    public static final String CLIENT = "client" + File.separator;
104
    public static final String CLIENT = "client" + File.separator;
102
105
103
    public static final String COMMON = "common" + File.separator;
106
    public static final String COMMON = "common" + File.separator;
Lines 195-200 Link Here
195
        return domainRequirements6x;
198
        return domainRequirements6x;
196
    }
199
    }
197
200
201
    private static List<String> domainRequirements7x;
202
203
    private static synchronized List<String> getDomainRequirements7x() {
204
        if (domainRequirements7x == null) {
205
            domainRequirements7x = new ArrayList<String>(11);
206
            Collections.addAll(domainRequirements7x,
207
                    "configuration", // NOI18N
208
                    "deployments", // NOI18N
209
                    "lib" // NOI18N
210
                    );
211
        }
212
        return domainRequirements7x;
213
    }
214
215
198
    //--------------- checking for possible server directory -------------
216
    //--------------- checking for possible server directory -------------
199
    private static List<String> serverRequirements4x;
217
    private static List<String> serverRequirements4x;
200
218
Lines 249-254 Link Here
249
        return serverRequirements5And6x;
267
        return serverRequirements5And6x;
250
    }
268
    }
251
269
270
    private static List<String> serverRequirements7x;
271
    private static synchronized List<String> getServerRequirements7x() {
272
        if (serverRequirements7x == null) {
273
            serverRequirements7x = new ArrayList<String>(6);
274
            Collections.addAll(serverRequirements7x,
275
                    "bin", // NOI18N
276
                    "modules", // NOI18N
277
                    "jboss-modules.jar"); // NOI18N
278
        }
279
        return serverRequirements7x;
280
    }
281
252
    //------------  getting exists servers---------------------------
282
    //------------  getting exists servers---------------------------
253
    /**
283
    /**
254
     * returns Hashmap
284
     * returns Hashmap
Lines 262-275 Link Here
262
        File serverDirectory = new File(serverLocation);
292
        File serverDirectory = new File(serverLocation);
263
293
264
        if (isGoodJBServerLocation(serverDirectory)) {
294
        if (isGoodJBServerLocation(serverDirectory)) {
265
           File file = new File(serverLocation + File.separator + "server");  // NOI18N
295
            Version version = getServerVersion(serverDirectory);            
266
296
            File file;
267
            String[] files = file.list(new FilenameFilter(){
297
            String[] files;
298
            if("7".equals(version.getMajorNumber())) {
299
                files = new String[]{"standalone", "domain"};
300
                file = serverDirectory;
301
            } else {
302
                file = new File(serverLocation + File.separator + "server");  // NOI18N
303
                files = file.list(new FilenameFilter(){
304
                    @Override
268
                public boolean accept(File dir, String name){
305
                public boolean accept(File dir, String name){
269
                    if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true;
306
                    if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true;
270
                    return false;
307
                    return false;
271
                }
308
                }
272
            });
309
            });
310
            }
273
311
274
            for(int i = 0; i<files.length; i++) {
312
            for(int i = 0; i<files.length; i++) {
275
                String path = file.getAbsolutePath() + File.separator + files[i];
313
                String path = file.getAbsolutePath() + File.separator + files[i];
Lines 319-337 Link Here
319
        return isGoodJBInstanceLocation(candidate, getDomainRequirements6x());
357
        return isGoodJBInstanceLocation(candidate, getDomainRequirements6x());
320
    }
358
    }
321
359
360
    private static boolean isGoodJBInstanceLocation7x(File serverDir, File candidate){
361
        return isGoodJBInstanceLocation(candidate, getDomainRequirements7x());
362
    }
363
322
    public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){
364
    public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){
323
        Version version = getServerVersion(serverDir);
365
        Version version = getServerVersion(serverDir);
324
        if (version == null || (!"4".equals(version.getMajorNumber())
366
        if (version == null || (!"4".equals(version.getMajorNumber())
325
                && !"5".equals(version.getMajorNumber()) // NOI18N
367
                && !"5".equals(version.getMajorNumber()) // NOI18N
326
                && !"6".equals(version.getMajorNumber()))) { // NOI18N
368
                && !"6".equals(version.getMajorNumber()) // NOI18N
369
                && !"7".equals(version.getMajorNumber()))) { // NOI18N
327
            return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)
370
            return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)
328
                    || JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)
371
                    || JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)
329
                    || JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate);
372
                    || JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)
373
                    || JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate);
330
        }
374
        }
331
375
332
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N
376
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N
333
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N
377
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N
334
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)); // NOI18N
378
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)) // NOI18N
379
                || ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate)); // NOI18N
335
    }
380
    }
336
381
337
    private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){
382
    private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){
Lines 372-390 Link Here
372
        return isGoodJBServerLocation(candidate, getServerRequirements5And6x());
417
        return isGoodJBServerLocation(candidate, getServerRequirements5And6x());
373
    }
418
    }
374
419
420
    private static boolean isGoodJBServerLocation7x(File candidate){
421
        return isGoodJBServerLocation(candidate, getServerRequirements7x());
422
    }
423
375
    public static boolean isGoodJBServerLocation(File candidate) {
424
    public static boolean isGoodJBServerLocation(File candidate) {
376
        Version version = getServerVersion(candidate);
425
        Version version = getServerVersion(candidate);
377
        if (version == null || (!"4".equals(version.getMajorNumber())
426
        if (version == null || (!"4".equals(version.getMajorNumber())
378
                && !"5".equals(version.getMajorNumber())
427
                && !"5".equals(version.getMajorNumber())
379
                && !"6".equals(version.getMajorNumber()))) { // NOI18N
428
                && !"6".equals(version.getMajorNumber())
429
                && !"7".equals(version.getMajorNumber()))) { // NOI18N
380
            return JBPluginUtils.isGoodJBServerLocation4x(candidate)
430
            return JBPluginUtils.isGoodJBServerLocation4x(candidate)
381
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
431
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
382
                    || JBPluginUtils.isGoodJBServerLocation6x(candidate);
432
                    || JBPluginUtils.isGoodJBServerLocation5x(candidate)
433
                    || JBPluginUtils.isGoodJBServerLocation7x(candidate);
383
        }
434
        }
384
435
385
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n
436
        return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n
386
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N
437
                || ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N
387
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)); // NOI18N
438
                || ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)) // NOI18N
439
                || ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation7x(candidate)); // NOI18N
388
    }
440
    }
389
441
390
    public static boolean isJB4(JBDeploymentManager dm) {
442
    public static boolean isJB4(JBDeploymentManager dm) {
Lines 435-440 Link Here
435
     *
487
     *
436
     */
488
     */
437
    public static String getDeployDir(String domainDir){
489
    public static String getDeployDir(String domainDir){
490
        Version version = JBPluginUtils.getServerVersion(new File(JBPluginProperties.getInstance().getInstallLocation()));
491
        if("7".equals(version.getMajorNumber())) {
492
            return domainDir + File.separator + "deployments"; //NOI18N
493
        }
438
        return domainDir + File.separator + "deploy"; //NOI18N
494
        return domainDir + File.separator + "deploy"; //NOI18N
439
        //todo: get real deploy path
495
        //todo: get real deploy path
440
    }
496
    }
Lines 659-667 Link Here
659
        assert serverPath != null : "Can't determine version with null server path"; // NOI18N
715
        assert serverPath != null : "Can't determine version with null server path"; // NOI18N
660
716
661
        File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N
717
        File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N
662
        return getVersion(systemJarFile);
718
        Version version = getVersion(systemJarFile);
719
        if(version == null) {
720
            // check for JBoss AS 7
721
            File serverDir = new File(serverPath, "modules/org/jboss/as/server/main");
722
            for (File jarFile : serverDir.listFiles(new JarFileFilter())) {
723
                version = getVersion(jarFile);
724
                if(version != null) {
725
                    break;
663
    }
726
    }
727
            }
728
        }
729
        return version;
730
    }
664
731
732
    static class JarFileFilter implements FilenameFilter {
733
734
        @Override
735
        public boolean accept(File dir, String name) {
736
            return name.endsWith(".jar");
737
        }
738
    }
739
665
    private static Version getVersion(File systemJarFile) {
740
    private static Version getVersion(File systemJarFile) {
666
        if (!systemJarFile.exists()) {
741
        if (!systemJarFile.exists()) {
667
            return null;
742
            return null;

Return to bug 200132