Author: rob.stryker(a)jboss.com
Date: 2011-10-12 07:38:03 -0400 (Wed, 12 Oct 2011)
New Revision: 35566
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/BehaviourModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java
Log:
incomplete cleanup of extension point refactor - relates to JBIDE-9864 and JBIDE-9724
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/BehaviourModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/BehaviourModel.java 2011-10-12
09:58:34 UTC (rev 35565)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/BehaviourModel.java 2011-10-12
11:38:03 UTC (rev 35566)
@@ -50,7 +50,7 @@
for( int i = 0; i < impls.length; i++ ) {
list.add(impls[i].getLaunchDelegate());
}
- return null;
+ return list;
}
/*
@@ -128,6 +128,8 @@
private IConfigurationElement element;
private IJBossLaunchDelegate launchDelegate;
private String supportedServers;
+ private IJBossBehaviourDelegate behaviourDelegate = null;
+
public BehaviourImpl(IConfigurationElement element) {
this.element = element;
name = element.getAttribute("name"); //$NON-NLS-1$
@@ -171,5 +173,17 @@
}
return null;
}
+
+ public IJBossBehaviourDelegate getBehaviourDelegate() {
+ if( behaviourDelegate != null )
+ return behaviourDelegate;
+ try {
+ behaviourDelegate =
(IJBossBehaviourDelegate)element.createExecutableExtension("behaviourDelegate");
//$NON-NLS-1$
+ return behaviourDelegate;
+ } catch(CoreException ce) {
+ JBossServerCorePlugin.getInstance().getLog().log(ce.getStatus());
+ }
+ return null;
+ }
}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java 2011-10-12
09:58:34 UTC (rev 35565)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java 2011-10-12
11:38:03 UTC (rev 35566)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal;
-import java.util.HashMap;
-
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -27,6 +25,7 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
+import org.jboss.ide.eclipse.as.core.server.internal.BehaviourModel.BehaviourImpl;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
import
org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
@@ -40,18 +39,7 @@
*
*/
public class DelegatingServerBehavior extends DeployableServerBehavior {
-
- private static HashMap<String, Class> delegateClassMap;
-
- static {
- delegateClassMap = new HashMap<String, Class>();
- delegateClassMap.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD,
LocalJBossBehaviorDelegate.class);
- }
-
- public static void addDelegateMapping(String s, Class c) {
- delegateClassMap.put(s, c);
- }
-
+
private IJBossBehaviourDelegate delegate;
private String lastModeId;
@@ -65,25 +53,11 @@
if( id.equals(lastModeId) && delegate != null &&
delegate.getBehaviourTypeId().equals(id))
return delegate;
- Class c = getDelegateMap().get(id);
- if( c == null )
- c = getDelegateMap().get(LocalPublishMethod.LOCAL_PUBLISH_METHOD);
-
- try {
- IJBossBehaviourDelegate o = (IJBossBehaviourDelegate)c.newInstance();
- o.setActualBehaviour(this);
- lastModeId = id;
- delegate = o;
- } catch( InstantiationException ie) {
- } catch( IllegalAccessException iae) {
- }
+ BehaviourImpl impl =
BehaviourModel.getModel().getBehaviour(getServer().getServerType().getId()).getImpl(id);
+ delegate = impl.getBehaviourDelegate();
return delegate;
}
- protected HashMap<String, Class> getDelegateMap() {
- return delegateClassMap;
- }
-
public void stop(boolean force) {
if( LaunchCommandPreferences.isIgnoreLaunchCommand(getServer())) {
super.setServerStopped();
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java 2011-10-12
09:58:34 UTC (rev 35565)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java 2011-10-12
11:38:03 UTC (rev 35566)
@@ -27,13 +27,9 @@
public class DelegatingStartLaunchConfiguration extends
AbstractJBossStartLaunchConfiguration {
public ArrayList<IJBossLaunchDelegate> getSetupParticipants(IServer server) {
- //return ExtensionManager.getDefault().getSetupParticipants(server);
return BehaviourModel.getModel().getSetupParticipants(server);
}
-// public HashMap<String, IStartLaunchDelegate> getLaunchDelegates(IServer server)
{
-// return ExtensionManager.getDefault().getLaunchDelegates(server);
-// }
-
+
// Allow all participants to set some defaults for their own details
// Participants should be careful not to change shared launch keys / values
// unless their operation mode (local / rse / etc) is in use
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java 2011-10-12
09:58:34 UTC (rev 35565)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java 2011-10-12
11:38:03 UTC (rev 35566)
@@ -13,7 +13,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -32,7 +31,6 @@
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
-import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
@@ -50,20 +48,6 @@
private IDebugEventSetListener serverProcessListener;
private PollThread pollThread;
- private static HashMap<String, Class> delegateClassMap;
- static {
- delegateClassMap = new HashMap<String, Class>();
- delegateClassMap.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD,
LocalJBoss7BehaviorDelegate.class);
- }
-
- public static void addDelegateMapping(String s, Class c) {
- delegateClassMap.put(s, c);
- }
-
- protected HashMap<String, Class> getDelegateMap() {
- return delegateClassMap;
- }
-
@Override
public boolean shouldSuspendScanner() {
return false;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2011-10-12
09:58:34 UTC (rev 35565)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2011-10-12
11:38:03 UTC (rev 35566)
@@ -58,12 +58,17 @@
return createServer2(currentRuntime,
runtimeServerTypeMap.get(currentRuntime.getRuntimeType().getId()), name);
}
- public static IServer createServer2(IRuntime currentRuntime, String serverID) throws
CoreException {
- return createServer2(currentRuntime, serverID, serverID);
+ public static IServer createServer2(IRuntime currentRuntime, String serverTypeId) throws
CoreException {
+ return createServer2(currentRuntime, serverTypeId, serverTypeId);
}
- public static IServer createServer2(IRuntime currentRuntime, String serverID, String
serverName) throws CoreException {
- IServerType serverType = ServerCore.findServerType(serverID);
+ public static IServer createServer2(IRuntime currentRuntime, String serverTypeId, String
serverName) throws CoreException {
+ IServerType serverType = ServerCore.findServerType(serverTypeId);
+ return createServer2(currentRuntime, serverType, serverName);
+ }
+
+
+ public static IServer createServer2(IRuntime currentRuntime, IServerType serverType,
String serverName) throws CoreException {
IServerWorkingCopy serverWC = serverType.createServer(null, null,
new NullProgressMonitor());
serverWC.setRuntime(currentRuntime);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java 2011-10-12
09:58:34 UTC (rev 35565)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java 2011-10-12
11:38:03 UTC (rev 35566)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.egit.core.internal;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.DelegatingJBoss7ServerBehavior;
-import org.jboss.ide.eclipse.as.egit.core.EgitBehaviourDelegate;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -28,7 +26,8 @@
public void start(BundleContext bundleContext) throws Exception {
EGitCoreActivator.context = bundleContext;
- DelegatingJBoss7ServerBehavior.addDelegateMapping(EgitBehaviourDelegate.ID,
EgitBehaviourDelegate.class);
+ //DelegatingJBoss7ServerBehavior.addDelegateMapping(EgitBehaviourDelegate.ID,
EgitBehaviourDelegate.class);
+ // THIS is not relevant at the moment. Egit support will need to be revisited
}