Author: rob.stryker(a)jboss.com
Date: 2012-03-01 01:42:36 -0500 (Thu, 01 Mar 2012)
New Revision: 39215
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS710ExtendedProperties.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/extendedproperties/JBossAS7ExtendedProperties.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossExtendedProperties.java
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnectionProvider.java
Log:
JBIDE-11064 - initial cleanup (damage control) to ensure no exceptions for as71 and to add
jmx provider type to the new "extended properties"
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-03-01
06:00:32 UTC (rev 39214)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ExtendedServerPropertiesAdapterFactory.java 2012-03-01
06:42:36 UTC (rev 39215)
@@ -12,15 +12,20 @@
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.wst.server.core.IServer;
+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.JBossExtendedProperties;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
public class ExtendedServerPropertiesAdapterFactory implements IAdapterFactory {
+ public static JBossExtendedProperties getExtendedProperties(IServer server) {
+ return (JBossExtendedProperties) new
ExtendedServerPropertiesAdapterFactory().getAdapter(server,
JBossExtendedProperties.class);
+ }
+
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
- if( adaptableObject instanceof IServer ) {
+ if( adaptableObject instanceof IServer && adapterType ==
JBossExtendedProperties.class) {
String typeId = ((IServer)adaptableObject).getServerType().getId();
if( IJBossToolingConstants.SERVER_AS_32.equals(typeId))
return new JBossExtendedProperties((IServer)adaptableObject);
@@ -42,9 +47,9 @@
if( IJBossToolingConstants.SERVER_AS_70.equals(typeId))
return new JBossAS7ExtendedProperties((IServer)adaptableObject);
if( IJBossToolingConstants.SERVER_AS_71.equals(typeId))
- return new JBossAS7ExtendedProperties((IServer)adaptableObject);
+ return new JBossAS710ExtendedProperties((IServer)adaptableObject);
if( IJBossToolingConstants.SERVER_EAP_60.equals(typeId))
- return new JBossAS7ExtendedProperties((IServer)adaptableObject);
+ return new JBossAS710ExtendedProperties((IServer)adaptableObject);
// NEW_SERVER_ADAPTER
}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS710ExtendedProperties.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS710ExtendedProperties.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS710ExtendedProperties.java 2012-03-01
06:42:36 UTC (rev 39215)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.wst.server.core.IServer;
+
+/**
+ *
+ */
+public class JBossAS710ExtendedProperties extends JBossAS7ExtendedProperties {
+
+ public JBossAS710ExtendedProperties(IServer server) {
+ super(server);
+ }
+
+ public int getJMXProviderType() {
+ return JMX_AS_710_PROVIDER;
+ }
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS7ExtendedProperties.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS7ExtendedProperties.java 2012-03-01
06:00:32 UTC (rev 39214)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossAS7ExtendedProperties.java 2012-03-01
06:42:36 UTC (rev 39215)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.wst.server.core.IServer;
@@ -13,4 +23,9 @@
public String getNewFilesetDefaultRootFolder() {
return "standalone/configuration"; //$NON-NLS-1$
}
+
+ public int getJMXProviderType() {
+ return JMX_DEFAULT_PROVIDER;
+ }
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossExtendedProperties.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossExtendedProperties.java 2012-03-01
06:00:32 UTC (rev 39214)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/extendedproperties/JBossExtendedProperties.java 2012-03-01
06:42:36 UTC (rev 39215)
@@ -28,4 +28,12 @@
return new ConfigNameResolver().performSubstitutions(
original, server.getName());
}
+
+
+ public static final int JMX_DEFAULT_PROVIDER = 0;
+ public static final int JMX_AS_3_TO_6_PROVIDER = 1;
+ public static final int JMX_AS_710_PROVIDER = 2;
+ public int getJMXProviderType() {
+ return JMX_AS_3_TO_6_PROVIDER;
+ }
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnectionProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnectionProvider.java 2012-03-01
06:00:32 UTC (rev 39214)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/src/org/jboss/ide/eclipse/as/jmx/integration/JBossServerConnectionProvider.java 2012-03-01
06:42:36 UTC (rev 39215)
@@ -27,8 +27,10 @@
import org.eclipse.wst.server.core.ServerEvent;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import
org.jboss.ide.eclipse.as.core.server.internal.ExtendedServerPropertiesAdapterFactory;
+import
org.jboss.ide.eclipse.as.core.server.internal.extendedproperties.JBossExtendedProperties;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.tools.jmx.core.ExtensionManager;
import org.jboss.tools.jmx.core.IConnectionProvider;
import org.jboss.tools.jmx.core.IConnectionProviderListener;
@@ -72,15 +74,23 @@
}
protected boolean requiresDefaultProvider(IServer server) {
- if(server.getServerType().getId().equals(IJBossToolingConstants.SERVER_AS_70))
- return true;
+ if(ServerUtil.isJBoss7(server))
+ return true;
return false;
}
protected IConnectionWrapper createConnection(IServer server) {
- if( !requiresDefaultProvider(server))
+ JBossExtendedProperties props =
ExtendedServerPropertiesAdapterFactory.getExtendedProperties(server);
+ int type = props == null ? -1 : props.getJMXProviderType();
+ switch(type) {
+ case JBossExtendedProperties.JMX_AS_3_TO_6_PROVIDER:
return new JBossServerConnection(server);
- return createDefaultServerConnection(server);
+ case JBossExtendedProperties.JMX_DEFAULT_PROVIDER:
+ return createDefaultServerConnection(server);
+ // TODO add as7.1 logic here when we figure it out
+ default:
+ return null;
+ }
}
protected IConnectionWrapper createDefaultServerConnection(IServer server) {
@@ -147,19 +157,19 @@
if( !idToConnection.containsKey(server.getId())) {
IConnectionWrapper connection = createConnection(server);
idToConnection.put(server.getId(), connection);
+ if( connection != null )
+ fireAdded(idToConnection.get(server.getId()));
}
- fireAdded(idToConnection.get(server.getId()));
}
}
public void serverChanged(IServer server) {
if( belongsHere(server)) {
getConnections();
- if( !idToConnection.containsKey(server.getId())) {
- IConnectionWrapper connection = createConnection(server);
- idToConnection.put(server.getId(), connection);
- }
- fireAdded(idToConnection.get(server.getId()));
+ IConnectionWrapper connection = createConnection(server);
+ idToConnection.put(server.getId(), connection);
+ if( connection != null )
+ fireAdded(idToConnection.get(server.getId()));
}
}
@@ -177,7 +187,11 @@
getConnections();
// but now its missing from the collection, so make one up
- fireRemoved(createConnection(server));
+ IConnectionWrapper dummy = createConnection(server);
+
+ // Make sure we don't fire a removal for a connection that doesn't exist
+ if( dummy != null )
+ fireRemoved(dummy);
}
}
}