Author: rob.stryker(a)jboss.com
Date: 2011-03-03 19:04:40 -0500 (Thu, 03 Mar 2011)
New Revision: 29492
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JBossServerConnection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java
Log:
JBIDE-8432 to trunk
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JBossServerConnection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JBossServerConnection.java 2011-03-03
23:44:52 UTC (rev 29491)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JBossServerConnection.java 2011-03-04
00:04:40 UTC (rev 29492)
@@ -23,6 +23,8 @@
import org.eclipse.wst.server.core.IServerListener;
import org.eclipse.wst.server.core.ServerEvent;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.tools.jmx.core.ExtensionManager;
import org.jboss.tools.jmx.core.IConnectionProvider;
import org.jboss.tools.jmx.core.IConnectionProviderListener;
@@ -122,7 +124,8 @@
}
protected void checkState() {
- if( server.getServerState() == IServer.STATE_STARTED ) {
+ IDeployableServer jbs = ServerConverter.getDeployableServer(server);
+ if( server.getServerState() == IServer.STATE_STARTED && jbs != null &&
jbs.hasJMXProvider()) {
try {
JMXSafeRunner.run(server, new IJMXRunnable() {
public void run(MBeanServerConnection connection)
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java 2011-03-03
23:44:52 UTC (rev 29491)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java 2011-03-04
00:04:40 UTC (rev 29492)
@@ -42,4 +42,6 @@
public String getConfigDirectory();
public ServerAttributeHelper getAttributeHelper();
public IServer getServer();
+
+ public boolean hasJMXProvider();
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2011-03-03
23:44:52 UTC (rev 29491)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2011-03-04
00:04:40 UTC (rev 29492)
@@ -165,4 +165,8 @@
return ajbsrt;
}
+ public boolean hasJMXProvider() {
+ return false;
+ }
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2011-03-03
23:44:52 UTC (rev 29491)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2011-03-04
00:04:40 UTC (rev 29492)
@@ -16,6 +16,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jst.server.core.IWebModule;
import org.eclipse.wst.server.core.IModule;
@@ -24,8 +25,10 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathModel;
import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathQuery;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
@@ -191,5 +194,17 @@
public void setPassword(String pass) {
setAttribute(SERVER_PASSWORD, pass);
}
+
+ public boolean hasJMXProvider() {
+ DeployableServerBehavior beh = (DeployableServerBehavior)getServer().loadAdapter(
+ DeployableServerBehavior.class, new NullProgressMonitor());
+ if( beh == null )
+ return false;
+ IJBossServerPublishMethodType type = beh.createPublishMethod().getPublishMethodType();
+ if( type.getId().equals(LocalPublishMethod.LOCAL_PUBLISH_METHOD)) {
+ return true;
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java 2011-03-03
23:44:52 UTC (rev 29491)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java 2011-03-04
00:04:40 UTC (rev 29492)
@@ -12,7 +12,6 @@
import java.io.File;
import java.net.URI;
-import java.net.URLEncoder;
import java.util.ArrayList;
import javax.management.MBeanServerConnection;
@@ -59,35 +58,34 @@
public void serverChanged(ServerEvent event) {
IServer server = event.getServer();
JBossServer jbs = (JBossServer)server.loadAdapter(JBossServer.class, new
NullProgressMonitor());
- if( jbs != null ) {
- String[] folders = getDeployLocationFolders(server);
- if( folders.length > 0 )
- doDeploymentAddition(event, folders);
+ if( jbs != null && jbs.hasJMXProvider()) {
+ int eventKind = event.getKind();
+ if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
+ // server change event
+ if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
+ if( event.getServer().getServerState() == IServer.STATE_STARTED ) {
+ String[] folders = getDeployLocationFolders(server);
+ if( folders.length > 0 )
+ doDeploymentAddition(event, folders);
+ }
+ }
+ }
}
}
protected void doDeploymentAddition(final ServerEvent event, final String[] folders) {
- int eventKind = event.getKind();
- if ((eventKind & ServerEvent.SERVER_CHANGE) != 0) {
- // server change event
- if ((eventKind & ServerEvent.STATE_CHANGE) != 0) {
- if( event.getServer().getServerState() == IServer.STATE_STARTED ) {
-
- IJMXRunnable r = new IJMXRunnable() {
- public void run(MBeanServerConnection connection) throws Exception {
- ensureDeployLocationAdded(event.getServer(), connection, folders);
- }
- };
- try {
- JBossServerConnectionProvider.run(event.getServer(), r);
- } catch( JMXException jmxe ) {
- IStatus s = jmxe.getStatus();
- IStatus newStatus = new Status(s.getSeverity(), s.getPlugin(),
IEventCodes.ADD_DEPLOYMENT_FOLDER_FAIL,
- Messages.AddingJMXDeploymentFailed, s.getException());
- ServerLogger.getDefault().log(event.getServer(), newStatus);
- }
- }
+ IJMXRunnable r = new IJMXRunnable() {
+ public void run(MBeanServerConnection connection) throws Exception {
+ ensureDeployLocationAdded(event.getServer(), connection, folders);
}
+ };
+ try {
+ JBossServerConnectionProvider.run(event.getServer(), r);
+ } catch( JMXException jmxe ) {
+ IStatus s = jmxe.getStatus();
+ IStatus newStatus = new Status(s.getSeverity(), s.getPlugin(),
IEventCodes.ADD_DEPLOYMENT_FOLDER_FAIL,
+ Messages.AddingJMXDeploymentFailed, s.getException());
+ ServerLogger.getDefault().log(event.getServer(), newStatus);
}
}