Author: rob.stryker(a)jboss.com
Date: 2011-12-13 11:17:16 -0500 (Tue, 13 Dec 2011)
New Revision: 37272
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java
Log:
JBIDE-9725 - commit to ensure eap6 runtimes can be created
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java 2011-12-13
16:01:15 UTC (rev 37271)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java 2011-12-13
16:17:16 UTC (rev 37272)
@@ -18,6 +18,7 @@
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.IWTPConstants;
public class JBossServerType implements IJBossToolingConstants {
@@ -76,6 +77,17 @@
JBOSS_AS_PATH + File.separatorChar + BIN_PATH+ File.separatorChar + TWIDDLE_JAR_NAME,
new String[]{V4_2,V4_3,V5_0,V5_1}, new EAPServerTypeCondition());
+ public static final JBossServerType EAP6 = new JBossServerType(
+ "EAP", //$NON-NLS-1$
+ "Enterprise Application Platform", //$NON-NLS-1$
+ "modules" + File.separatorChar + //$NON-NLS-1$
+ "org" + File.separatorChar + //$NON-NLS-1$
+ "jboss" + File.separatorChar + //$NON-NLS-1$
+ "as" + File.separatorChar + //$NON-NLS-1$
+ "server" + File.separatorChar + //$NON-NLS-1$
+ "main", //$NON-NLS-1$
+ new String[]{V6_0}, new EAP6ServerTypeCondition());
+
public static final JBossServerType SOAP = new JBossServerType(
"SOA-P",//$NON-NLS-1$
"SOA Platform",//$NON-NLS-1$
@@ -144,7 +156,22 @@
return this.condition.isServerRoot(location);
}
+ private static final String IMPLEMENTATION_TITLE = "Implementation-Title";
//$NON-NLS-1$
+ private static final String JBEAP_RELEASE_VERSION =
"JBossEAP-Release-Version"; //$NON-NLS-1$
+
public static boolean isEAP(File systemJarFile) {
+ String title = getJarProperty(systemJarFile, IMPLEMENTATION_TITLE);
+ return title != null && title.contains("EAP"); //$NON-NLS-1$
+ }
+
+ public static boolean isEAP6(File systemJarFile) {
+ String value = getJarProperty(systemJarFile, JBEAP_RELEASE_VERSION);
+ if( value != null && value.trim().startsWith("6.")) //$NON-NLS-1$
+ return true;
+ return false;
+ }
+
+ public static String getJarProperty(File systemJarFile, String propertyName) {
if (systemJarFile.canRead()) {
ZipFile jar = null;
try {
@@ -152,8 +179,8 @@
ZipEntry manifest = jar.getEntry("META-INF/MANIFEST.MF");//$NON-NLS-1$
Properties props = new Properties();
props.load(jar.getInputStream(manifest));
- String title = (String) props.get("Implementation-Title");//$NON-NLS-1$
- return title != null && title.contains("EAP"); //$NON-NLS-1$
+ String value = (String) props.get(propertyName);
+ return value;
} catch (IOException e) {
// ignore
} finally {
@@ -166,7 +193,7 @@
}
}
}
- return false;
+ return null;
}
public static final JBossServerType[] KNOWN_TYPES = {AS, EAP, SOAP, SOAP_STD, EWP,
EPP};
@@ -183,6 +210,30 @@
}
}
+ public static class EAP6ServerTypeCondition implements Condition {
+ public boolean isServerRoot(File location) {
+ String mainFolder = new StringBuilder(location.getAbsolutePath())
+ .append(File.separator)
+ .append("modules").append(File.separator) //$NON-NLS-1$
+ .append("org").append(File.separator) //$NON-NLS-1$
+ .append("jboss").append(File.separator) //$NON-NLS-1$
+ .append("as").append(File.separator) //$NON-NLS-1$
+ .append("server").append(File.separator) //$NON-NLS-1$
+ .append("main").append(File.separator) //$NON-NLS-1$
+ .toString();
+ File f = new File(mainFolder);
+ if( f.exists() ) {
+ File[] children = f.listFiles();
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i].getName().endsWith(IWTPConstants.EXT_JAR)) {
+ return isEAP6(children[i]);
+ }
+ }
+ }
+ return false;
+ }
+ }
+
public static class EAPStandaloneServerTypeCondition implements Condition {
public boolean isServerRoot(File location) {
File asSystemJar = new File(location, JBossServerType.EAP_STD.getSystemJarPath());
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java 2011-12-13
16:01:15 UTC (rev 37271)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java 2011-12-13
16:17:16 UTC (rev 37272)
@@ -46,6 +46,8 @@
public JBossServerType getServerType(File location) {
if(JBossServerType.AS.isServerRoot(location)) {
return JBossServerType.AS;
+ } else if(JBossServerType.EAP6.isServerRoot(location)) {
+ return JBossServerType.EAP6;
} else if(JBossServerType.AS7.isServerRoot(location)) {
return JBossServerType.AS7;
} else if(JBossServerType.EAP_STD.isServerRoot(location)) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java 2011-12-13
16:01:15 UTC (rev 37271)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java 2011-12-13
16:17:16 UTC (rev 37272)
@@ -102,6 +102,8 @@
return createAS7Runtime(path, loader);
if( type == JBossServerType.EAP)
return createEAPRuntime(path, loader);
+ if( type == JBossServerType.EAP6)
+ return createEAP6Runtime(path, loader);
if( type == JBossServerType.SOAP)
return createSOAPRuntime(path, loader);
return null;
@@ -117,6 +119,16 @@
return null;
}
+ private static IRuntimeWorkingCopy createEAP6Runtime(IPath path, ServerBeanLoader
loader) {
+ String runtimeTypeId = IJBossToolingConstants.EAP_60;
+ try {
+ IRuntimeWorkingCopy wc = createRuntimeWorkingCopy(runtimeTypeId, path.toOSString(),
IJBossRuntimeResourceConstants.DEFAULT_CONFIGURATION);
+ return launchRuntimeWizard(wc);
+ } catch( CoreException ce) {
+ }
+ return null;
+ }
+
private static IRuntimeWorkingCopy createASRuntime(IPath path, ServerBeanLoader loader)
{
String version = new ServerBeanLoader().getFullServerVersion(new File(path.toFile(),
JBossServerType.AS.getSystemJarPath()));
String runtimeTypeId = null;