Author: snjeza
Date: 2011-02-16 10:10:30 -0500 (Wed, 16 Feb 2011)
New Revision: 29176
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/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
Log:
JBIDE-8344 Runtime detection creates invalid runtime for EAP 4.3.0.GA_CP03
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-02-16
14:39:55 UTC (rev 29175)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/JBossServerType.java 2011-02-16
15:10:30 UTC (rev 29176)
@@ -11,6 +11,11 @@
package org.jboss.ide.eclipse.as.core.server.bean;
import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
@@ -49,6 +54,12 @@
BIN_PATH+File.separatorChar + TWIDDLE_JAR_NAME,
new String[]{V6_0,V5_1, V5_0, V4_2, V4_0, V3_2}, new ASServerTypeCondition());
+ public static final JBossServerType EAP_STD = new JBossServerType(
+ "EAP_STD",//$NON-NLS-1$
+ "Enterprise Application Platform",//$NON-NLS-1$
+ BIN_PATH+ File.separatorChar + TWIDDLE_JAR_NAME,
+ new String[]{V4_2,V4_3,V5_0,V5_1}, new EAPStandaloneServerTypeCondition());
+
public static final JBossServerType EAP = new JBossServerType(
"EAP",//$NON-NLS-1$
"Enterprise Application Platform",//$NON-NLS-1$
@@ -123,6 +134,31 @@
return this.condition.isServerRoot(location);
}
+ public static boolean isEAP(File systemJarFile) {
+ if (systemJarFile.canRead()) {
+ ZipFile jar = null;
+ try {
+ jar = new ZipFile(systemJarFile);
+ 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$
+ } catch (IOException e) {
+ // ignore
+ } finally {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+ return false;
+ }
+
public static final JBossServerType[] KNOWN_TYPES = {AS, EAP, SOAP, SOAP_STD, EWP,
EPP};
static interface Condition {
@@ -137,11 +173,24 @@
}
}
+ public static class EAPStandaloneServerTypeCondition implements Condition {
+ public boolean isServerRoot(File location) {
+ File asSystemJar = new File(location, JBossServerType.EAP_STD.getSystemJarPath());
+ if (asSystemJar.exists() && asSystemJar.isFile()) {
+ return isEAP(asSystemJar);
+ }
+ return false;
+ }
+ }
+
public static class ASServerTypeCondition implements Condition {
public boolean isServerRoot(File location) {
File asSystemJar = new File(location, JBossServerType.AS.getSystemJarPath());
- return asSystemJar.exists() && asSystemJar.isFile();
+ if (asSystemJar.exists() && asSystemJar.isFile()) {
+ return !isEAP(asSystemJar);
+ }
+ return false;
}
}
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-02-16
14:39:55 UTC (rev 29175)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java 2011-02-16
15:10:30 UTC (rev 29176)
@@ -35,6 +35,8 @@
public JBossServerType getServerType(File location) {
if(JBossServerType.AS.isServerRoot(location)) {
return JBossServerType.AS;
+ } else if(JBossServerType.EAP_STD.isServerRoot(location)) {
+ return JBossServerType.EAP_STD;
} else if(JBossServerType.EAP.isServerRoot(location) &&
JBossServerType.SOAP.isServerRoot(location)) {
return JBossServerType.SOAP;
} else if(JBossServerType.SOAP_STD.isServerRoot(location)) {
@@ -55,15 +57,24 @@
public String getFullServerVersion(File systemJarFile) {
String version = null;
+ ZipFile jar = null;
if(systemJarFile.canRead()) {
try {
- ZipFile jar = new ZipFile(systemJarFile);
+ jar = new ZipFile(systemJarFile);
ZipEntry manifest = jar.getEntry("META-INF/MANIFEST.MF");//$NON-NLS-1$
Properties props = new Properties();
props.load(jar.getInputStream(manifest));
version = (String)props.get("Specification-Version");//$NON-NLS-1$
} catch (IOException e) {
// version = ""
+ } finally {
+ if (jar != null) {
+ try {
+ jar.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
}
}
return version;
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java
===================================================================
---
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java 2011-02-16
14:39:55 UTC (rev 29175)
+++
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/IJBossRuntimePluginConstants.java 2011-02-16
15:10:30 UTC (rev 29176)
@@ -14,6 +14,7 @@
public static final String DEFAULT_DS = "DefaultDS";
public static final String RUNTIME = Messages.JBossRuntimeStartup_Runtime;
public static final String EAP = "EAP"; //$NON-NLS-1$
+ public static final String EAP_STD = "EAP_STD"; //$NON-NLS-1$
public static final String SOA_P = "SOA-P"; //$NON-NLS-1$
public static final String SOA_P_STD = "SOA-P-STD"; //$NON-NLS-1$
public static final String EPP = "EPP"; //$NON-NLS-1$
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
---
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-02-16
14:39:55 UTC (rev 29175)
+++
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-02-16
15:10:30 UTC (rev 29176)
@@ -98,7 +98,7 @@
if(EWP.equals(type)) {
return new File(serverDefinition.getLocation(),"jboss-as-web");
//$NON-NLS-1$
}
- if (AS.equals(type)) {
+ if (AS.equals(type) || EAP_STD.equals(type)) {
return serverDefinition.getLocation();
}
return null;
@@ -115,7 +115,8 @@
}
String type = serverDefinition.getType();
if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type)
- || SOA_P_STD.equals(type) || EWP.equals(type)) {
+ || SOA_P_STD.equals(type) || EWP.equals(type)
+ || EAP_STD.equals(type)) {
String name = serverDefinition.getName();
String runtimeName = name + " " + RUNTIME; //$NON-NLS-1$
int index = getJBossASVersion(asLocation);
Show replies by date