Lines 91-96
Link Here
|
91 |
public static final Version JBOSS_5_0_1 = new Version("5.0.1"); // NOI18N |
91 |
public static final Version JBOSS_5_0_1 = new Version("5.0.1"); // NOI18N |
92 |
|
92 |
|
93 |
public static final Version JBOSS_6_0_0 = new Version("6.0.0"); // NOI18N |
93 |
public static final Version JBOSS_6_0_0 = new Version("6.0.0"); // NOI18N |
|
|
94 |
|
95 |
public static final Version JBOSS_7_0_0 = new Version("7.0.0"); // NOI18N |
94 |
|
96 |
|
95 |
private static final Logger LOGGER = Logger.getLogger(JBPluginUtils.class.getName()); |
97 |
private static final Logger LOGGER = Logger.getLogger(JBPluginUtils.class.getName()); |
96 |
|
98 |
|
Lines 98-103
Link Here
|
98 |
|
100 |
|
99 |
public static final String LIB = "lib" + File.separator; |
101 |
public static final String LIB = "lib" + File.separator; |
100 |
|
102 |
|
|
|
103 |
public static final String MODULES = "modules" + File.separator; |
104 |
|
101 |
public static final String CLIENT = "client" + File.separator; |
105 |
public static final String CLIENT = "client" + File.separator; |
102 |
|
106 |
|
103 |
public static final String COMMON = "common" + File.separator; |
107 |
public static final String COMMON = "common" + File.separator; |
Lines 195-200
Link Here
|
195 |
return domainRequirements6x; |
199 |
return domainRequirements6x; |
196 |
} |
200 |
} |
197 |
|
201 |
|
|
|
202 |
private static List<String> domainRequirements7x; |
203 |
|
204 |
private static synchronized List<String> getDomainRequirements7x() { |
205 |
if (domainRequirements7x == null) { |
206 |
domainRequirements7x = new ArrayList<String>(11); |
207 |
Collections.addAll(domainRequirements7x, |
208 |
"configuration", // NOI18N |
209 |
"deployments", // NOI18N |
210 |
"lib" // NOI18N |
211 |
); |
212 |
} |
213 |
return domainRequirements7x; |
214 |
} |
215 |
|
216 |
|
198 |
//--------------- checking for possible server directory ------------- |
217 |
//--------------- checking for possible server directory ------------- |
199 |
private static List<String> serverRequirements4x; |
218 |
private static List<String> serverRequirements4x; |
200 |
|
219 |
|
Lines 249-254
Link Here
|
249 |
return serverRequirements5And6x; |
268 |
return serverRequirements5And6x; |
250 |
} |
269 |
} |
251 |
|
270 |
|
|
|
271 |
private static List<String> serverRequirements7x; |
272 |
private static synchronized List<String> getServerRequirements7x() { |
273 |
if (serverRequirements7x == null) { |
274 |
serverRequirements7x = new ArrayList<String>(6); |
275 |
Collections.addAll(serverRequirements7x, |
276 |
"bin", // NOI18N |
277 |
"modules", // NOI18N |
278 |
"jboss-modules.jar"); // NOI18N |
279 |
} |
280 |
return serverRequirements7x; |
281 |
} |
282 |
|
252 |
//------------ getting exists servers--------------------------- |
283 |
//------------ getting exists servers--------------------------- |
253 |
/** |
284 |
/** |
254 |
* returns Hashmap |
285 |
* returns Hashmap |
Lines 262-275
Link Here
|
262 |
File serverDirectory = new File(serverLocation); |
293 |
File serverDirectory = new File(serverLocation); |
263 |
|
294 |
|
264 |
if (isGoodJBServerLocation(serverDirectory)) { |
295 |
if (isGoodJBServerLocation(serverDirectory)) { |
265 |
File file = new File(serverLocation + File.separator + "server"); // NOI18N |
296 |
Version version = getServerVersion(serverDirectory); |
266 |
|
297 |
File file; |
267 |
String[] files = file.list(new FilenameFilter(){ |
298 |
String[] files; |
|
|
299 |
if("7".equals(version.getMajorNumber())) { |
300 |
files = new String[]{"standalone", "domain"}; |
301 |
file = serverDirectory; |
302 |
} else { |
303 |
file = new File(serverLocation + File.separator + "server"); // NOI18N |
304 |
files = file.list(new FilenameFilter(){ |
305 |
@Override |
268 |
public boolean accept(File dir, String name){ |
306 |
public boolean accept(File dir, String name){ |
269 |
if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true; |
307 |
if ((new File(dir.getAbsolutePath()+File.separator+name)).isDirectory()) return true; |
270 |
return false; |
308 |
return false; |
271 |
} |
309 |
} |
272 |
}); |
310 |
}); |
|
|
311 |
} |
273 |
|
312 |
|
274 |
for(int i = 0; i<files.length; i++) { |
313 |
for(int i = 0; i<files.length; i++) { |
275 |
String path = file.getAbsolutePath() + File.separator + files[i]; |
314 |
String path = file.getAbsolutePath() + File.separator + files[i]; |
Lines 319-337
Link Here
|
319 |
return isGoodJBInstanceLocation(candidate, getDomainRequirements6x()); |
358 |
return isGoodJBInstanceLocation(candidate, getDomainRequirements6x()); |
320 |
} |
359 |
} |
321 |
|
360 |
|
|
|
361 |
private static boolean isGoodJBInstanceLocation7x(File serverDir, File candidate){ |
362 |
return isGoodJBInstanceLocation(candidate, getDomainRequirements7x()); |
363 |
} |
364 |
|
322 |
public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){ |
365 |
public static boolean isGoodJBInstanceLocation(File serverDir, File candidate){ |
323 |
Version version = getServerVersion(serverDir); |
366 |
Version version = getServerVersion(serverDir); |
324 |
if (version == null || (!"4".equals(version.getMajorNumber()) |
367 |
if (version == null || (!"4".equals(version.getMajorNumber()) |
325 |
&& !"5".equals(version.getMajorNumber()) // NOI18N |
368 |
&& !"5".equals(version.getMajorNumber()) // NOI18N |
326 |
&& !"6".equals(version.getMajorNumber()))) { // NOI18N |
369 |
&& !"6".equals(version.getMajorNumber()) // NOI18N |
|
|
370 |
&& !"7".equals(version.getMajorNumber()))) { // NOI18N |
327 |
return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate) |
371 |
return JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate) |
328 |
|| JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate) |
372 |
|| JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate) |
329 |
|| JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate); |
373 |
|| JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate) |
|
|
374 |
|| JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate); |
330 |
} |
375 |
} |
331 |
|
376 |
|
332 |
return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N |
377 |
return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation4x(serverDir, candidate)) // NOI18N |
333 |
|| ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N |
378 |
|| ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation5x(serverDir, candidate)) // NOI18N |
334 |
|| ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)); // NOI18N |
379 |
|| ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation6x(serverDir, candidate)) // NOI18N |
|
|
380 |
|| ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBInstanceLocation7x(serverDir, candidate)); // NOI18N |
335 |
} |
381 |
} |
336 |
|
382 |
|
337 |
private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){ |
383 |
private static boolean isGoodJBServerLocation(File candidate, List<String> requirements){ |
Lines 372-390
Link Here
|
372 |
return isGoodJBServerLocation(candidate, getServerRequirements5And6x()); |
418 |
return isGoodJBServerLocation(candidate, getServerRequirements5And6x()); |
373 |
} |
419 |
} |
374 |
|
420 |
|
|
|
421 |
private static boolean isGoodJBServerLocation7x(File candidate){ |
422 |
return isGoodJBServerLocation(candidate, getServerRequirements7x()); |
423 |
} |
424 |
|
375 |
public static boolean isGoodJBServerLocation(File candidate) { |
425 |
public static boolean isGoodJBServerLocation(File candidate) { |
376 |
Version version = getServerVersion(candidate); |
426 |
Version version = getServerVersion(candidate); |
377 |
if (version == null || (!"4".equals(version.getMajorNumber()) |
427 |
if (version == null || (!"4".equals(version.getMajorNumber()) |
378 |
&& !"5".equals(version.getMajorNumber()) |
428 |
&& !"5".equals(version.getMajorNumber()) |
379 |
&& !"6".equals(version.getMajorNumber()))) { // NOI18N |
429 |
&& !"6".equals(version.getMajorNumber()) |
|
|
430 |
&& !"7".equals(version.getMajorNumber()))) { // NOI18N |
380 |
return JBPluginUtils.isGoodJBServerLocation4x(candidate) |
431 |
return JBPluginUtils.isGoodJBServerLocation4x(candidate) |
381 |
|| JBPluginUtils.isGoodJBServerLocation5x(candidate) |
432 |
|| JBPluginUtils.isGoodJBServerLocation5x(candidate) |
382 |
|| JBPluginUtils.isGoodJBServerLocation6x(candidate); |
433 |
|| JBPluginUtils.isGoodJBServerLocation5x(candidate) |
|
|
434 |
|| JBPluginUtils.isGoodJBServerLocation7x(candidate); |
383 |
} |
435 |
} |
384 |
|
436 |
|
385 |
return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n |
437 |
return ("4".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation4x(candidate)) // NOI18n |
386 |
|| ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N |
438 |
|| ("5".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation5x(candidate)) // NOI18N |
387 |
|| ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)); // NOI18N |
439 |
|| ("6".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation6x(candidate)) // NOI18N |
|
|
440 |
|| ("7".equals(version.getMajorNumber()) && JBPluginUtils.isGoodJBServerLocation7x(candidate)); // NOI18N |
388 |
} |
441 |
} |
389 |
|
442 |
|
390 |
public static boolean isJB4(JBDeploymentManager dm) { |
443 |
public static boolean isJB4(JBDeploymentManager dm) { |
Lines 435-440
Link Here
|
435 |
* |
488 |
* |
436 |
*/ |
489 |
*/ |
437 |
public static String getDeployDir(String domainDir){ |
490 |
public static String getDeployDir(String domainDir){ |
|
|
491 |
Version version = JBPluginUtils.getServerVersion(new File(JBPluginProperties.getInstance().getInstallLocation())); |
492 |
if("7".equals(version.getMajorNumber())) { |
493 |
return domainDir + File.separator + "deployments"; //NOI18N |
494 |
} |
438 |
return domainDir + File.separator + "deploy"; //NOI18N |
495 |
return domainDir + File.separator + "deploy"; //NOI18N |
439 |
//todo: get real deploy path |
496 |
//todo: get real deploy path |
440 |
} |
497 |
} |
Lines 659-665
Link Here
|
659 |
assert serverPath != null : "Can't determine version with null server path"; // NOI18N |
716 |
assert serverPath != null : "Can't determine version with null server path"; // NOI18N |
660 |
|
717 |
|
661 |
File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N |
718 |
File systemJarFile = new File(serverPath, "lib/jboss-system.jar"); // NOI18N |
662 |
return getVersion(systemJarFile); |
719 |
Version version = getVersion(systemJarFile); |
|
|
720 |
if(version == null) { |
721 |
// check for JBoss AS 7 |
722 |
File serverDir = new File(serverPath, "modules/org/jboss/as/server/main"); |
723 |
for (File jarFile : serverDir.listFiles(new JarFileFilter())) { |
724 |
version = getVersion(jarFile); |
725 |
if(version != null) { |
726 |
break; |
727 |
} |
728 |
} |
729 |
} |
730 |
return version; |
731 |
} |
732 |
|
733 |
static class JarFileFilter implements FilenameFilter { |
734 |
|
735 |
@Override |
736 |
public boolean accept(File dir, String name) { |
737 |
return name.endsWith(".jar"); |
738 |
} |
663 |
} |
739 |
} |
664 |
|
740 |
|
665 |
private static Version getVersion(File systemJarFile) { |
741 |
private static Version getVersion(File systemJarFile) { |