Author: rob.stryker(a)jboss.com
Date: 2012-04-11 06:33:17 -0400 (Wed, 11 Apr 2012)
New Revision: 40124
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss6ModuleStateVerifier.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS6ExtendedProperties.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ExtendedServerPropertiesAdapterFactory.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossLT6ModuleStateVerifier.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ModuleStateVerifier.java
Log:
JBIDE-11514 - changing as6 to fast-return on module state
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ExtendedServerPropertiesAdapterFactory.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ExtendedServerPropertiesAdapterFactory.java 2012-04-11
07:56:30 UTC (rev 40123)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ExtendedServerPropertiesAdapterFactory.java 2012-04-11
10:33:17 UTC (rev 40124)
@@ -16,6 +16,7 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerAttributes;
+import
org.jboss.ide.eclipse.as.core.server.internal.extendedproperties.JBossAS6ExtendedProperties;
import
org.jboss.ide.eclipse.as.core.server.internal.extendedproperties.JBossAS710ExtendedProperties;
import
org.jboss.ide.eclipse.as.core.server.internal.extendedproperties.JBossAS7ExtendedProperties;
import
org.jboss.ide.eclipse.as.core.server.internal.extendedproperties.JBossEAP60ExtendedProperties;
@@ -66,7 +67,7 @@
if( SERVER_AS_51.equals(typeId) || AS_51.equals(typeId))
return new JBossExtendedProperties(adaptable);
if( SERVER_AS_60.equals(typeId) || AS_60.equals(typeId))
- return new JBossExtendedProperties(adaptable);
+ return new JBossAS6ExtendedProperties(adaptable);
if( SERVER_EAP_43.equals(typeId) || EAP_43.equals(typeId))
return new JBossExtendedProperties(adaptable);
if( SERVER_EAP_50.equals(typeId) || EAP_50.equals(typeId))
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss6ModuleStateVerifier.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss6ModuleStateVerifier.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBoss6ModuleStateVerifier.java 2012-04-11
10:33:17 UTC (rev 40124)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IServerModuleStateVerifier;
+
+public class JBoss6ModuleStateVerifier /* extends JBossLT6ModuleStateVerifier */
implements IServerModuleStateVerifier {
+
+ @Override
+ public boolean isModuleStarted(IServer server, IModule module,
+ IProgressMonitor monitor) {
+ // NO IDEA
+ return true;
+ }
+
+ @Override
+ public void waitModuleStarted(IServer server, IModule module,
+ IProgressMonitor monitor) {
+ return;
+ }
+
+ @Override
+ public void waitModuleStarted(IServer server, IModule module, int maxDelay) {
+ return;
+ }
+
+ // If proper mbeans are found, uncomment this and customize it
+
+// protected boolean checkNestedWebModuleStarted(IServer server, IModule module,
MBeanServerConnection connection) throws Exception {
+// String mbeanName = "jboss.deployment:id=\"jboss.web.deployment:war=/"
+ module.getName() + "\",type=Component"; //$NON-NLS-1$//$NON-NLS-2$
+// String stateAttribute = "State"; //$NON-NLS-1$
+// Object result = getAttributeResult(connection, mbeanName, stateAttribute);
+// if( result == null || !result.toString().equals("DEPLOYED"))
//$NON-NLS-1$
+// return false;
+// return true;
+// }
+//
+// protected boolean checkStandaloneWebModuleStarted(IServer server, IModule module,
MBeanServerConnection connection) throws Exception {
+// String mbeanName =
"jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/"
+ module.getName(); //$NON-NLS-1$
+// String stateAttribute = "state"; //$NON-NLS-1$
+// Object result = getAttributeResult(connection, mbeanName, stateAttribute);
+// if(result == null || !(result instanceof Integer) || ((Integer)result).intValue() !=
1 ) {
+// return false;
+// }
+// return true;
+// }
+
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossLT6ModuleStateVerifier.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossLT6ModuleStateVerifier.java 2012-04-11
07:56:30 UTC (rev 40123)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossLT6ModuleStateVerifier.java 2012-04-11
10:33:17 UTC (rev 40124)
@@ -33,6 +33,9 @@
import org.jboss.ide.eclipse.as.core.server.IServerModuleStateVerifier;
public class JBossLT6ModuleStateVerifier implements IServerModuleStateVerifier {
+ public JBossLT6ModuleStateVerifier() {
+ // Nothing
+ }
public boolean isModuleStarted(final IServer server, final IModule module,
final IProgressMonitor monitor) {
final boolean[] result = new boolean[1];
@@ -75,7 +78,7 @@
// call is over, can notify the thread to go finish itself
synchronized(monitor) {
if( !monitor.isCanceled() )
- t.notify();
+ t.interrupt();
}
}
public void waitModuleStarted(IServer server, IModule module,
@@ -119,33 +122,42 @@
protected boolean checkDeploymentStarted(final IServer server, final IModule module,
final MBeanServerConnection connection, IProgressMonitor monitor) throws Exception {
- String typeId;
- typeId = module.getModuleType().getId();
-
+ String typeId = module.getModuleType().getId();
if( typeId.equals("wst.web") || typeId.equals("jst.web")) {
//$NON-NLS-1$ //$NON-NLS-2$
- String mbeanName = null;
- IModule earParent = findEarParent(server, module);
- String stateAttribute;
- Object result;
- if( earParent == null ) {
- mbeanName =
"jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/"
+ module.getName(); //$NON-NLS-1$
- stateAttribute = "state"; //$NON-NLS-1$
- result = getAttributeResult(connection, mbeanName, stateAttribute);
- if(result == null || !(result instanceof Integer) || ((Integer)result).intValue() !=
1 ) {
- return false;
- }
- } else {
- mbeanName = "jboss.deployment:id=\"jboss.web.deployment:war=/" +
module.getName() + "\",type=Component"; //$NON-NLS-1$//$NON-NLS-2$
- stateAttribute = "State"; //$NON-NLS-1$
- result = getAttributeResult(connection, mbeanName, stateAttribute);
- if( result == null || !result.toString().equals("DEPLOYED"))
//$NON-NLS-1$
- return false;
- }
+ return checkWebModuleStarted(server, module, connection);
}
return true;
}
- private Object getAttributeResult(final MBeanServerConnection connection, String
mbeanName, String stateAttribute) throws Exception {
+ protected boolean checkWebModuleStarted(IServer server, IModule module,
MBeanServerConnection connection) throws Exception {
+ IModule earParent = findEarParent(server, module);
+ if( earParent == null ) {
+ return checkStandaloneWebModuleStarted(server, module, connection);
+ } else {
+ return checkNestedWebModuleStarted(server, module, connection);
+ }
+ }
+
+ protected boolean checkNestedWebModuleStarted(IServer server, IModule module,
MBeanServerConnection connection) throws Exception {
+ String mbeanName = "jboss.deployment:id=\"jboss.web.deployment:war=/" +
module.getName() + "\",type=Component"; //$NON-NLS-1$//$NON-NLS-2$
+ String stateAttribute = "State"; //$NON-NLS-1$
+ Object result = getAttributeResult(connection, mbeanName, stateAttribute);
+ if( result == null || !result.toString().equals("DEPLOYED")) //$NON-NLS-1$
+ return false;
+ return true;
+ }
+
+ protected boolean checkStandaloneWebModuleStarted(IServer server, IModule module,
MBeanServerConnection connection) throws Exception {
+ String mbeanName =
"jboss.web:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/"
+ module.getName(); //$NON-NLS-1$
+ String stateAttribute = "state"; //$NON-NLS-1$
+ Object result = getAttributeResult(connection, mbeanName, stateAttribute);
+ if(result == null || !(result instanceof Integer) || ((Integer)result).intValue() != 1
) {
+ return false;
+ }
+ return true;
+ }
+
+ protected Object getAttributeResult(final MBeanServerConnection connection, String
mbeanName, String stateAttribute) throws Exception {
ObjectName on = new ObjectName(mbeanName);
try {
return connection.getAttribute(on, stateAttribute);
@@ -155,7 +167,7 @@
}
/* TODO Unify findEarParent with findRootModule */
- private IModule findEarParent(IServer server, IModule module) {
+ protected IModule findEarParent(IServer server, IModule module) {
try {
IModule[] deployed = server.getModules();
ArrayList<IModule> deployedAsList = new ArrayList<IModule>();
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS6ExtendedProperties.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS6ExtendedProperties.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS6ExtendedProperties.java 2012-04-11
10:33:17 UTC (rev 40124)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.extendedproperties;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.jboss.ide.eclipse.as.core.server.IServerModuleStateVerifier;
+import org.jboss.ide.eclipse.as.core.server.internal.JBoss6ModuleStateVerifier;
+
+public class JBossAS6ExtendedProperties extends JBossExtendedProperties {
+
+ public JBossAS6ExtendedProperties(IAdaptable adaptable) {
+ super(adaptable);
+ }
+
+ public IServerModuleStateVerifier getModuleStateVerifier() {
+ return new JBoss6ModuleStateVerifier();
+ }
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ModuleStateVerifier.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ModuleStateVerifier.java 2012-04-11
07:56:30 UTC (rev 40123)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ModuleStateVerifier.java 2012-04-11
10:33:17 UTC (rev 40124)
@@ -43,6 +43,9 @@
} catch(InterruptedException ie) {
return;
}
+ synchronized(monitor) {
+ monitor.setCanceled(true);
+ }
}
};
t.start();