geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanhongf...@apache.org
Subject svn commit: r1077824 - in /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core: Activator.java GeronimoServerBehaviour.java
Date Fri, 04 Mar 2011 06:17:13 GMT
Author: hanhongfang
Date: Fri Mar  4 06:17:13 2011
New Revision: 1077824

URL: http://svn.apache.org/viewvc?rev=1077824&view=rev
Log:
GERONIMODEVTOOLS-721 Server state in server view is not updated to synchronize with the actual
server state

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java?rev=1077824&r1=1077823&r2=1077824&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/Activator.java
Fri Mar  4 06:17:13 2011
@@ -18,6 +18,9 @@ package org.apache.geronimo.st.v30.core;
 
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerLifecycleListener;
+import org.eclipse.wst.server.core.ServerCore;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -47,6 +50,41 @@ public class Activator extends Plugin {
      */
     public void start(BundleContext context) throws Exception {
         super.start(context);
+        ServerCore.addServerLifecycleListener(new IServerLifecycleListener() {
+            public void serverAdded(IServer server) {
+                triggerStartUpdateServerTask(server);
+            }
+
+            public void serverChanged(IServer server) {
+
+            }
+
+            public void serverRemoved(IServer server) {
+            }
+        });
+        IServer[] servers = ServerCore.getServers();
+        for(int i = 0; i < servers.length; i++) {
+            triggerStartUpdateServerTask(servers[i]);
+        }
+    }
+
+    /** 
+     * <b>triggerStartUpdateServerTask</b> is invoked from:
+     * <ul> 
+     * <li>The WTP ResourceManager after a new server has been defined (via the WTP
NewServerWizard)
+     * <li>When a server lifecycle listener has been added (see above)
+     * </ul>
+     * 
+     * @param server 
+     */
+    private void triggerStartUpdateServerTask(IServer server) {
+        GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class);
+        if (delegate == null) {
+            delegate = (GeronimoServerBehaviourDelegate) server.loadAdapter(GeronimoServerBehaviourDelegate.class,
null);
+        }
+        if (delegate != null) {
+            delegate.startUpdateServerStateTask();
+        }
     }
 
     /*

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java?rev=1077824&r1=1077823&r2=1077824&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/GeronimoServerBehaviour.java
Fri Mar  4 06:17:13 2011
@@ -157,7 +157,7 @@ public class GeronimoServerBehaviour ext
             AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName());
             Set<AbstractName> configLists = kernel.listGBeans(query);
             if (!configLists.isEmpty()) {
-                AbstractName on = configLists.toArray(new AbstractName[configLists.size()])[0];
+                AbstractName on = (AbstractName) configLists.toArray()[0];
                 try {
                     Boolean b = (Boolean) kernel.getAttribute(on, "kernelFullyStarted");
                     return b.booleanValue();



Mime
View raw message