Author: rob.stryker(a)jboss.com
Date: 2007-09-11 01:42:18 -0400 (Tue, 11 Sep 2007)
New Revision: 3545
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ProcessTerminatedPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/TimeoutPoller.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/IJBossServerPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerPollingAttributes.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerStatePollerType.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/IServerStatePoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/PollThread.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ProcessTerminatedPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ServerStatePollerType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/TimeoutPoller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.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/DeployableServerBehavior.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/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
Moved many interfaces into as.core.server for public access
Moved PollThread and ServerStatePollerType into as.core.server.internal
Moved the remainder of polling to as.core.extensions.polling
Moving to a cleaner API which can be opened up logically and more easily extended.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-09-11
05:31:36 UTC (rev 3544)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2007-09-11
05:42:18 UTC (rev 3545)
@@ -25,11 +25,10 @@
org.jboss.ide.eclipse.as.core.extensions.archives,
org.jboss.ide.eclipse.as.core.extensions.descriptors,
org.jboss.ide.eclipse.as.core.extensions.events,
+ org.jboss.ide.eclipse.as.core.extensions.polling,
org.jboss.ide.eclipse.as.core.modules,
org.jboss.ide.eclipse.as.core.publishers,
- org.jboss.ide.eclipse.as.core.runtime,
- org.jboss.ide.eclipse.as.core.runtime.server.polling,
- org.jboss.ide.eclipse.as.core.server.attributes,
+ org.jboss.ide.eclipse.as.core.server,
org.jboss.ide.eclipse.as.core.server.internal,
org.jboss.ide.eclipse.as.core.server.internal.launch,
org.jboss.ide.eclipse.as.core.server.xpl,
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -28,7 +28,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
-import org.jboss.ide.eclipse.as.core.runtime.server.polling.ServerStatePollerType;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
/**
*
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling)
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/IServerStatePoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/IServerStatePoller.java 2007-09-11
05:09:17 UTC (rev 3530)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/IServerStatePoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -1,44 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.runtime.server.polling;
-
-import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.server.attributes.IServerPollingAttributes;
-
-public interface IServerStatePoller extends IServerPollingAttributes {
-
- public static final boolean SERVER_UP = true;
- public static final boolean SERVER_DOWN = false;
-
- public static final int CANCEL = 0;
- public static final int TIMEOUT_REACHED = 1;
-
- public void beginPolling(IServer server, boolean expectedState, PollThread pt); //
expected to launch own thread
- public boolean isComplete() throws PollingException;
- public boolean getState() throws PollingException;
- public void cancel(int type); // cancel the polling
- public void cleanup(); // clean up any resources / processes. Will ALWAYS be called
-
- public class PollingException extends Exception {
- public PollingException(String message) {super(message);}
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java 2007-09-11
05:09:17 UTC (rev 3530)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -1,283 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.runtime.server.polling;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.Principal;
-import java.util.Date;
-import java.util.Properties;
-
-import javax.management.AttributeNotFoundException;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.MBeanServerConnection;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.naming.CommunicationException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.wst.server.core.IRuntime;
-import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogTreeItem;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
-
-public class JMXPoller implements IServerStatePoller {
-
- public static final String STATUS =
"org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.status";
-
- public static final String TYPE_TERMINATED =
"org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_TERMINATED";
- public static final String TYPE_RESULT =
"org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_RESULT";
-
- public static final int STATE_STARTED = 1;
- public static final int STATE_STOPPED = 0;
- public static final int STATE_TRANSITION = -1;
-
- private int started;
- private boolean canceled;
- private boolean done;
- private IServer server;
- private PollingException pollingException = null;
-
- private EventLogTreeItem event;
-
- public void beginPolling(IServer server, boolean expectedState,
- PollThread pt) {
- this.canceled = false;
- this.done = false;
- this.server = server;
- event = pt.getActiveEvent();
- launchJMXPoller();
- }
-
- private class PollerRunnable implements Runnable {
- public void run() {
- ClassLoader currentLoader = Thread.currentThread()
- .getContextClassLoader();
- ClassLoader twiddleLoader = getClassLoader();
- if( pollingException != null ) {done = true; return;}
- if (twiddleLoader != null) {
- int port = ServerConverter.getJBossServer(server).getJNDIPort();
-
- Thread.currentThread().setContextClassLoader(twiddleLoader);
- Properties props = new Properties();
- props.put("java.naming.factory.initial",
- "org.jnp.interfaces.NamingContextFactory");
- props.put("java.naming.factory.url.pkgs",
- "org.jboss.naming:org.jnp.interfaces");
- props.put("java.naming.provider.url", "jnp://"
- + server.getHost() + ":" + port);
-
- setCredentials();
- if( pollingException != null ) {done = true; return;}
-
- Exception failingException = null;
- while (!done && !canceled) {
- InitialContext ic;
- try {
- ic = new InitialContext(props);
- Object obj = ic.lookup("jmx/invoker/RMIAdaptor");
- ic.close();
- if (obj instanceof MBeanServerConnection) {
- MBeanServerConnection connection = (MBeanServerConnection) obj;
- Object attInfo = connection.getAttribute(
- new ObjectName("jboss.system:type=Server"),
- "Started");
- boolean b = ((Boolean) attInfo).booleanValue();
- started = b ? STATE_STARTED : STATE_TRANSITION;
- done = b;
- }
- } catch (SecurityException se) {
- pollingException = new PollingSecurityException(
- "Security Exception: " + se.getMessage());
- done = true;
- } catch (CommunicationException ce) {
- started = STATE_STOPPED;
- } catch (NamingException nnfe) {
- started = STATE_STOPPED;
- } catch (AttributeNotFoundException e) {
- failingException = e;
- } catch (InstanceNotFoundException e) {
- failingException = e;
- } catch (MalformedObjectNameException e) {
- failingException = e;
- } catch (MBeanException e) {
- failingException = e;
- } catch (ReflectionException e) {
- failingException = e;
- } catch (NullPointerException e) {
- failingException = e;
- } catch (IOException e) {
- failingException = e;
- }
- if( failingException != null ) {
- pollingException = new PollingException(failingException.getMessage());
- done = true;
- }
-
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- }
- } // end while
- }
-
- Thread.currentThread().setContextClassLoader(currentLoader);
- }
-
- protected void setCredentials() {
- Exception temp = null;
- try {
- ILaunchConfiguration lc = server.getLaunchConfiguration(true,
- new NullProgressMonitor());
- // get user from the IServer, but override with launch configuration
- String user = ServerConverter.getJBossServer(server).getUsername();
-
- // get password from the IServer, but override with launch configuration
- String pass = ServerConverter.getJBossServer(server).getPassword();
-
- // get our methods
- Class simplePrincipal = Thread.currentThread()
- .getContextClassLoader().loadClass(
- "org.jboss.security.SimplePrincipal");
- Class securityAssoc = Thread.currentThread()
- .getContextClassLoader().loadClass(
- "org.jboss.security.SecurityAssociation");
- securityAssoc.getMethods(); // force-init the methods since the
- // class hasn't been initialized yet.
-
- Constructor newSimplePrincipal = simplePrincipal
- .getConstructor(new Class[] { String.class });
- Object newPrincipalInstance = newSimplePrincipal
- .newInstance(new Object[] { user });
-
- // set the principal
- Method setPrincipalMethod = securityAssoc.getMethod(
- "setPrincipal", new Class[] { Principal.class });
- setPrincipalMethod.invoke(null,
- new Object[] { newPrincipalInstance });
-
- // set the credential
- Method setCredentialMethod = securityAssoc.getMethod(
- "setCredential", new Class[] { Object.class });
- setCredentialMethod.invoke(null, new Object[] { pass });
- } catch (CoreException e) {
- temp = e;
- } catch (ClassNotFoundException e) {
- temp = e;
- } catch (SecurityException e) {
- temp = e;
- } catch (NoSuchMethodException e) {
- temp = e;
- } catch (IllegalArgumentException e) {
- temp = e;
- } catch (InstantiationException e) {
- temp = e;
- } catch (IllegalAccessException e) {
- temp = e;
- } catch (InvocationTargetException e) {
- temp = e;
- }
- if( temp != null ) {
- pollingException = new PollingException(temp.getMessage());
- }
- }
-
- protected ClassLoader getClassLoader() {
- try {
- IRuntime rt = server.getRuntime();
- IPath loc = rt.getLocation();
- URL url = loc.append("client").append("jbossall-client.jar")
- .toFile().toURI().toURL();
- URL url2 = loc.append("bin").append("twiddle.jar").toFile()
- .toURI().toURL();
- URLClassLoader loader = new URLClassLoader(new URL[] { url,
- url2 }, Thread.currentThread().getContextClassLoader());
- return loader;
- } catch (MalformedURLException murle) {
- pollingException = new PollingException(murle.getMessage());
- }
- return null;
- }
- }
-
- private void launchJMXPoller() {
- PollerRunnable run = new PollerRunnable();
- Thread t = new Thread(run, "JMX Poller");
- t.start();
- }
-
- public void cancel(int type) {
- canceled = true;
- }
-
- public void cleanup() {
- }
-
- public class PollingSecurityException extends PollingException {
- public PollingSecurityException(String msg) {
- super(msg);
- }
- }
-
- public boolean getState() throws PollingException {
- if (pollingException != null)
- throw pollingException;
- if (started == 0)
- return SERVER_DOWN;
- if (started == 1)
- return SERVER_UP;
-
- if (!done && !canceled)
- return SERVER_DOWN; // Not there yet.
-
- return SERVER_UP; // done or canceled, doesnt matter
- }
-
- public boolean isComplete() throws PollingException {
- if (pollingException != null)
- throw pollingException;
- return done;
- }
-
- public class JMXPollerEvent extends EventLogTreeItem {
- public JMXPollerEvent(SimpleTreeItem parent, String type, int status,
- boolean expectedState) {
- super(parent, PollThread.SERVER_STATE_MAJOR_TYPE, type);
- setProperty(PollThread.EXPECTED_STATE, new Boolean(expectedState));
- setProperty(STATUS, new Integer(status));
- setProperty(DATE, new Long(new Date().getTime()));
- }
- }
-}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
(from rev 3544,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/JMXPoller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/JMXPoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,285 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.extensions.polling;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.Principal;
+import java.util.Date;
+import java.util.Properties;
+
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.naming.CommunicationException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
+
+public class JMXPoller implements IServerStatePoller {
+
+ public static final String STATUS =
"org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.status";
+
+ public static final String TYPE_TERMINATED =
"org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_TERMINATED";
+ public static final String TYPE_RESULT =
"org.jboss.ide.eclipse.as.core.runtime.server.internal.TwiddlePoller.TYPE_RESULT";
+
+ public static final int STATE_STARTED = 1;
+ public static final int STATE_STOPPED = 0;
+ public static final int STATE_TRANSITION = -1;
+
+ private int started;
+ private boolean canceled;
+ private boolean done;
+ private IServer server;
+ private PollingException pollingException = null;
+
+ private EventLogTreeItem event;
+
+ public void beginPolling(IServer server, boolean expectedState,
+ PollThread pt) {
+ this.canceled = false;
+ this.done = false;
+ this.server = server;
+ event = pt.getActiveEvent();
+ launchJMXPoller();
+ }
+
+ private class PollerRunnable implements Runnable {
+ public void run() {
+ ClassLoader currentLoader = Thread.currentThread()
+ .getContextClassLoader();
+ ClassLoader twiddleLoader = getClassLoader();
+ if( pollingException != null ) {done = true; return;}
+ if (twiddleLoader != null) {
+ int port = ServerConverter.getJBossServer(server).getJNDIPort();
+
+ Thread.currentThread().setContextClassLoader(twiddleLoader);
+ Properties props = new Properties();
+ props.put("java.naming.factory.initial",
+ "org.jnp.interfaces.NamingContextFactory");
+ props.put("java.naming.factory.url.pkgs",
+ "org.jboss.naming:org.jnp.interfaces");
+ props.put("java.naming.provider.url", "jnp://"
+ + server.getHost() + ":" + port);
+
+ setCredentials();
+ if( pollingException != null ) {done = true; return;}
+
+ Exception failingException = null;
+ while (!done && !canceled) {
+ InitialContext ic;
+ try {
+ ic = new InitialContext(props);
+ Object obj = ic.lookup("jmx/invoker/RMIAdaptor");
+ ic.close();
+ if (obj instanceof MBeanServerConnection) {
+ MBeanServerConnection connection = (MBeanServerConnection) obj;
+ Object attInfo = connection.getAttribute(
+ new ObjectName("jboss.system:type=Server"),
+ "Started");
+ boolean b = ((Boolean) attInfo).booleanValue();
+ started = b ? STATE_STARTED : STATE_TRANSITION;
+ done = b;
+ }
+ } catch (SecurityException se) {
+ pollingException = new PollingSecurityException(
+ "Security Exception: " + se.getMessage());
+ done = true;
+ } catch (CommunicationException ce) {
+ started = STATE_STOPPED;
+ } catch (NamingException nnfe) {
+ started = STATE_STOPPED;
+ } catch (AttributeNotFoundException e) {
+ failingException = e;
+ } catch (InstanceNotFoundException e) {
+ failingException = e;
+ } catch (MalformedObjectNameException e) {
+ failingException = e;
+ } catch (MBeanException e) {
+ failingException = e;
+ } catch (ReflectionException e) {
+ failingException = e;
+ } catch (NullPointerException e) {
+ failingException = e;
+ } catch (IOException e) {
+ failingException = e;
+ }
+ if( failingException != null ) {
+ pollingException = new PollingException(failingException.getMessage());
+ done = true;
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ } // end while
+ }
+
+ Thread.currentThread().setContextClassLoader(currentLoader);
+ }
+
+ protected void setCredentials() {
+ Exception temp = null;
+ try {
+ ILaunchConfiguration lc = server.getLaunchConfiguration(true,
+ new NullProgressMonitor());
+ // get user from the IServer, but override with launch configuration
+ String user = ServerConverter.getJBossServer(server).getUsername();
+
+ // get password from the IServer, but override with launch configuration
+ String pass = ServerConverter.getJBossServer(server).getPassword();
+
+ // get our methods
+ Class simplePrincipal = Thread.currentThread()
+ .getContextClassLoader().loadClass(
+ "org.jboss.security.SimplePrincipal");
+ Class securityAssoc = Thread.currentThread()
+ .getContextClassLoader().loadClass(
+ "org.jboss.security.SecurityAssociation");
+ securityAssoc.getMethods(); // force-init the methods since the
+ // class hasn't been initialized yet.
+
+ Constructor newSimplePrincipal = simplePrincipal
+ .getConstructor(new Class[] { String.class });
+ Object newPrincipalInstance = newSimplePrincipal
+ .newInstance(new Object[] { user });
+
+ // set the principal
+ Method setPrincipalMethod = securityAssoc.getMethod(
+ "setPrincipal", new Class[] { Principal.class });
+ setPrincipalMethod.invoke(null,
+ new Object[] { newPrincipalInstance });
+
+ // set the credential
+ Method setCredentialMethod = securityAssoc.getMethod(
+ "setCredential", new Class[] { Object.class });
+ setCredentialMethod.invoke(null, new Object[] { pass });
+ } catch (CoreException e) {
+ temp = e;
+ } catch (ClassNotFoundException e) {
+ temp = e;
+ } catch (SecurityException e) {
+ temp = e;
+ } catch (NoSuchMethodException e) {
+ temp = e;
+ } catch (IllegalArgumentException e) {
+ temp = e;
+ } catch (InstantiationException e) {
+ temp = e;
+ } catch (IllegalAccessException e) {
+ temp = e;
+ } catch (InvocationTargetException e) {
+ temp = e;
+ }
+ if( temp != null ) {
+ pollingException = new PollingException(temp.getMessage());
+ }
+ }
+
+ protected ClassLoader getClassLoader() {
+ try {
+ IRuntime rt = server.getRuntime();
+ IPath loc = rt.getLocation();
+ URL url = loc.append("client").append("jbossall-client.jar")
+ .toFile().toURI().toURL();
+ URL url2 = loc.append("bin").append("twiddle.jar").toFile()
+ .toURI().toURL();
+ URLClassLoader loader = new URLClassLoader(new URL[] { url,
+ url2 }, Thread.currentThread().getContextClassLoader());
+ return loader;
+ } catch (MalformedURLException murle) {
+ pollingException = new PollingException(murle.getMessage());
+ }
+ return null;
+ }
+ }
+
+ private void launchJMXPoller() {
+ PollerRunnable run = new PollerRunnable();
+ Thread t = new Thread(run, "JMX Poller");
+ t.start();
+ }
+
+ public void cancel(int type) {
+ canceled = true;
+ }
+
+ public void cleanup() {
+ }
+
+ public class PollingSecurityException extends PollingException {
+ public PollingSecurityException(String msg) {
+ super(msg);
+ }
+ }
+
+ public boolean getState() throws PollingException {
+ if (pollingException != null)
+ throw pollingException;
+ if (started == 0)
+ return SERVER_DOWN;
+ if (started == 1)
+ return SERVER_UP;
+
+ if (!done && !canceled)
+ return SERVER_DOWN; // Not there yet.
+
+ return SERVER_UP; // done or canceled, doesnt matter
+ }
+
+ public boolean isComplete() throws PollingException {
+ if (pollingException != null)
+ throw pollingException;
+ return done;
+ }
+
+ public class JMXPollerEvent extends EventLogTreeItem {
+ public JMXPollerEvent(SimpleTreeItem parent, String type, int status,
+ boolean expectedState) {
+ super(parent, PollThread.SERVER_STATE_MAJOR_TYPE, type);
+ setProperty(PollThread.EXPECTED_STATE, new Boolean(expectedState));
+ setProperty(STATUS, new Integer(status));
+ setProperty(DATE, new Long(new Date().getTime()));
+ }
+ }
+}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/PollThread.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/PollThread.java 2007-09-11
05:09:17 UTC (rev 3530)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/PollThread.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -1,265 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.runtime.server.polling;
-
-import java.util.Date;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.ServerType;
-import org.jboss.ide.eclipse.as.core.ExtensionManager;
-import org.jboss.ide.eclipse.as.core.model.EventLogModel;
-import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogRoot;
-import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogTreeItem;
-import
org.jboss.ide.eclipse.as.core.runtime.server.polling.IServerStatePoller.PollingException;
-import org.jboss.ide.eclipse.as.core.server.JBossServer;
-import org.jboss.ide.eclipse.as.core.server.JBossServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.server.attributes.IServerPollingAttributes;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
-
-/**
- *
- * @author rob.stryker(a)jboss.com
- */
-public class PollThread extends Thread {
- public static final String SERVER_STATE_MAJOR_TYPE =
"org.jboss.ide.eclipse.as.core.runtime.server.polling.MajorType";
-
-
- public static final String SERVER_STARTING =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.server.starting";
- public static final String SERVER_STOPPING =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.server.stopping";
- public static final String FAILURE =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.failure";
- public static final String SUCCESS =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.success";
- public static final String POLLER_NOT_FOUND =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.pollerNotFound";
- public static final String POLL_THREAD_ABORTED =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.aborted";
- public static final String POLL_THREAD_TIMEOUT =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.timeout";
- public static final String EXPECTED_STATE =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThreadEvent.expectedState";
- public static final String POLL_THREAD_EXCEPTION =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.exception";
- public static final String POLL_THREAD_EXCEPTION_MESSAGE =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.exception.message";
-
-
- private boolean expectedState;
- private IServerStatePoller poller;
- private boolean abort;
- private JBossServerBehavior behavior;
- private EventLogRoot eventRoot;
-
- private PollThreadEvent activeEvent;
-
- public PollThread(String name, boolean expectedState, JBossServerBehavior behavior) {
- super(name);
- this.expectedState = expectedState;
- this.abort = false;
- this.behavior = behavior;
- eventRoot = EventLogModel.getModel(behavior.getServer()).getRoot();
-
- poller = discoverPoller(behavior, expectedState);
- }
-
- protected IServerStatePoller discoverPoller(JBossServerBehavior behavior, boolean
expectedState) {
- JBossServer s = ServerConverter.getJBossServer(behavior.getServer());
- ServerAttributeHelper helper = s.getAttributeHelper();
- String key = expectedState == IServerStatePoller.SERVER_UP ?
- IServerPollingAttributes.STARTUP_POLLER_KEY :
- IServerPollingAttributes.SHUTDOWN_POLLER_KEY;
- String defaultPoller = expectedState == IServerStatePoller.SERVER_UP ?
- IServerPollingAttributes.DEFAULT_STARTUP_POLLER :
- IServerPollingAttributes.DEFAULT_SHUTDOWN_POLLER;
- String pollerId = helper.getAttribute(key, defaultPoller);
- ServerStatePollerType type = ExtensionManager.getDefault().getPollerType(pollerId);
- return type == null ? null : type.createPoller();
- }
-
- public void cancel() {
- abort = true;
- }
-
-
- // Getting the timeouts. First from plugin.xml as default, or from user settings.
- public int getTimeout() {
- int timeout;
- JBossServer jbs = ((JBossServer)getServer().loadAdapter(JBossServer.class, null));
- ServerAttributeHelper helper = (ServerAttributeHelper)jbs.getAttributeHelper();
- if( expectedState == IServerStatePoller.SERVER_UP) {
- int def = ((ServerType)getServer().getServerType()).getStartTimeout();
- timeout = helper.getAttribute(IServerPollingAttributes.START_TIMEOUT, def);
- } else {
- int def = ((ServerType)getServer().getServerType()).getStopTimeout();
- timeout = helper.getAttribute(IServerPollingAttributes.STOP_TIMEOUT, def);
- }
- return timeout;
- }
-
-
- public void run() {
- // Poller not found
- if( poller == null ) {
- alertEventLogStarting();
- alertPollerNotFound();
- alertBehavior(getTimeoutBehavior(), false);
- return;
- }
-
- int maxWait = getTimeout();
- alertEventLogStarting();
-
- long startTime = new Date().getTime();
- boolean done = false;
- poller.beginPolling(getServer(), expectedState, this);
-
- // begin the loop; ask the poller every so often
- while( !abort && !done && new Date().getTime() < startTime + maxWait
) {
- try {
- Thread.sleep(100);
- } catch( InterruptedException ie ) { }
-
- try {
- done = poller.isComplete();
- } catch( PollingException e ) {
- // abort and put the message in event log
- poller.cancel(IServerStatePoller.CANCEL);
- poller.cleanup();
- alertEventLogPollerException(e);
- alertBehavior(IServerStatePoller.SERVER_DOWN, false);
- return;
- }
- }
-
- boolean currentState = !expectedState;
- // we stopped. Did we abort?
- if( abort ) {
- poller.cancel(IServerStatePoller.CANCEL);
- poller.cleanup();
- alertEventLogAbort();
- } else {
- boolean finalAlert = true;
- if( done ) {
- // the poller has an answer
- try {
- currentState = poller.getState();
- poller.cleanup();
- } catch( PollingException pe) {
- // abort and put the message in event log
- poller.cancel(IServerStatePoller.CANCEL);
- poller.cleanup();
- alertEventLogPollerException(pe);
- alertBehavior(IServerStatePoller.SERVER_DOWN, false);
- return;
- }
- } else {
- // we timed out. get response from preferences
- poller.cancel(IServerStatePoller.TIMEOUT_REACHED);
- currentState = getTimeoutBehavior();
- poller.cleanup();
- alertEventLogTimeout();
- finalAlert = false;
- }
- alertBehavior(currentState, finalAlert);
- }
- }
-
- protected void alertBehavior(boolean currentState, boolean finalAlert) {
- if( currentState != expectedState ) {
- // it didnt work... cancel all processes! force stop
- behavior.forceStop(false);
- if( finalAlert ) alertEventLogFailure();
- } else {
- if( currentState == IServerStatePoller.SERVER_UP )
- behavior.setServerStarted();
- else {
- behavior.forceStop(false);
- }
- if( finalAlert ) alertEventLogSuccess(currentState);
- }
- }
-
- protected boolean getTimeoutBehavior() {
- // timeout has been reached, so let the user's preferences override
- JBossServer jbs = ((JBossServer)getServer().loadAdapter(JBossServer.class, null));
- ServerAttributeHelper helper = (ServerAttributeHelper)jbs.getAttributeHelper();
-
- boolean behavior = helper.getAttribute(IServerPollingAttributes.TIMEOUT_BEHAVIOR,
IServerPollingAttributes.TIMEOUT_IGNORE);
- if( behavior == IServerPollingAttributes.TIMEOUT_ABORT )
- return !expectedState;
-
- return expectedState;
- }
-
- protected IServer getServer() {
- return behavior.getServer();
- }
-
-
- /*
- * Event Log Stuff here!
- */
- protected void alertEventLogStarting() {
- if( expectedState == IServerStatePoller.SERVER_UP) {
- activeEvent = new PollThreadEvent(eventRoot, SERVER_STARTING, expectedState);
- } else {
- activeEvent = new PollThreadEvent(eventRoot, SERVER_STOPPING, expectedState);
- }
- EventLogModel.markChanged(eventRoot);
- }
-
- public PollThreadEvent getActiveEvent() {
- return activeEvent;
- }
-
- protected void alertEventLogPollerException(PollingException e) {
- PollThreadEvent event = new PollThreadEvent(activeEvent, POLL_THREAD_EXCEPTION,
expectedState);
- event.setProperty(POLL_THREAD_EXCEPTION_MESSAGE, e.getMessage());
- EventLogModel.markChanged(activeEvent);
- }
-
- protected void alertEventLogAbort() {
- PollThreadEvent event = new PollThreadEvent(activeEvent, POLL_THREAD_ABORTED,
expectedState);
- EventLogModel.markChanged(activeEvent);
- }
- protected void alertEventLogTimeout() {
- PollThreadEvent event = new PollThreadEvent(activeEvent, POLL_THREAD_TIMEOUT,
expectedState);
- EventLogModel.markChanged(activeEvent);
- }
- protected void alertEventLogFailure() {
- PollThreadEvent event = new PollThreadEvent(eventRoot, FAILURE, expectedState);
- EventLogModel.markChanged(eventRoot);
- }
- protected void alertEventLogSuccess(boolean currentState) {
- PollThreadEvent event = new PollThreadEvent(activeEvent, SUCCESS, expectedState);
- EventLogModel.markChanged(eventRoot);
- }
- protected void alertPollerNotFound() {
- PollThreadEvent event = new PollThreadEvent(activeEvent, POLLER_NOT_FOUND,
expectedState);
- EventLogModel.markChanged(activeEvent);
- }
-
- public class PollThreadEvent extends EventLogTreeItem {
- public PollThreadEvent(SimpleTreeItem parent, String type, boolean expectedState) {
- super(parent, SERVER_STATE_MAJOR_TYPE, type);
- setProperty(EXPECTED_STATE, new Boolean(expectedState));
- }
-
- public boolean getExpectedState() {
- return ((Boolean) getProperty(EXPECTED_STATE)).booleanValue();
- }
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ProcessTerminatedPoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/ProcessTerminatedPoller.java 2007-09-11
05:09:17 UTC (rev 3530)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ProcessTerminatedPoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -1,38 +0,0 @@
-package org.jboss.ide.eclipse.as.core.runtime.server.polling;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.server.JBossServerBehavior;
-
-/**
- * Essentially does nothing because the process already has a listener
- * on it that sets the server state to stopped once the process dies.
- *
- * It's here to make the shutdown include no polling though, thus
- * more efficient.
- * @author rob
- *
- */
-public class ProcessTerminatedPoller implements IServerStatePoller {
-
- private JBossServerBehavior server;
- public void beginPolling(IServer server, boolean expectedState,
- PollThread pt) {
- this.server = (JBossServerBehavior)server.loadAdapter(JBossServerBehavior.class, new
NullProgressMonitor());
- }
-
- public void cancel(int type) {
- }
-
- public void cleanup() {
- }
-
- public boolean getState() throws PollingException {
- return !isComplete();
- }
-
- public boolean isComplete() throws PollingException {
- return server.getProcess() == null || server.getProcess().isTerminated();
- }
-
-}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ProcessTerminatedPoller.java
(from rev 3544,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/ProcessTerminatedPoller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ProcessTerminatedPoller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ProcessTerminatedPoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,40 @@
+package org.jboss.ide.eclipse.as.core.extensions.polling;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+
+/**
+ * Essentially does nothing because the process already has a listener
+ * on it that sets the server state to stopped once the process dies.
+ *
+ * It's here to make the shutdown include no polling though, thus
+ * more efficient.
+ * @author rob
+ *
+ */
+public class ProcessTerminatedPoller implements IServerStatePoller {
+
+ private JBossServerBehavior server;
+ public void beginPolling(IServer server, boolean expectedState,
+ PollThread pt) {
+ this.server = (JBossServerBehavior)server.loadAdapter(JBossServerBehavior.class, new
NullProgressMonitor());
+ }
+
+ public void cancel(int type) {
+ }
+
+ public void cleanup() {
+ }
+
+ public boolean getState() throws PollingException {
+ return !isComplete();
+ }
+
+ public boolean isComplete() throws PollingException {
+ return server.getProcess() == null || server.getProcess().isTerminated();
+ }
+
+}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ServerStatePollerType.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/ServerStatePollerType.java 2007-09-11
05:09:17 UTC (rev 3530)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/ServerStatePollerType.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -1,29 +0,0 @@
-package org.jboss.ide.eclipse.as.core.runtime.server.polling;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-public class ServerStatePollerType {
- private IConfigurationElement el;
- public ServerStatePollerType(IConfigurationElement el) {
- this.el = el;
- }
- public boolean supportsStartup() {
- return Boolean.parseBoolean(el.getAttribute("supportsStartup"));
- }
- public boolean supportsShutdown() {
- return Boolean.parseBoolean(el.getAttribute("supportsShutdown"));
- }
- public String getName() {
- return el.getAttribute("name");
- }
- public String getId() {
- return el.getAttribute("id");
- }
- public IServerStatePoller createPoller() {
- try {
- return (IServerStatePoller)el.createExecutableExtension("class");
- } catch( Exception e ) {
- }
- return null;
- }
-}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/TimeoutPoller.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TimeoutPoller.java 2007-09-11
05:09:17 UTC (rev 3530)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/TimeoutPoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -1,86 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.runtime.server.polling;
-
-import java.util.Date;
-
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.ServerType;
-import org.jboss.ide.eclipse.as.core.server.JBossServer;
-import org.jboss.ide.eclipse.as.core.server.ServerAttributeHelper;
-import org.jboss.ide.eclipse.as.core.server.attributes.IServerPollingAttributes;
-
-// Wait 15 seconds, then say it's at it's expected state
-public class TimeoutPoller implements IServerStatePoller {
-
- private boolean expectedState;
- private long endTime;
- private IServer server;
- int timeout = -1;
-
-
- public void beginPolling(IServer server, boolean expectedState, PollThread pt) {
- this.expectedState = expectedState;
- this.server = server;
- this.endTime = new Date().getTime() + getTimeout() - 2000;
- }
-
- public void cancel(int type) {
- }
-
- public boolean getState() {
- if( new Date().getTime() > endTime ) return expectedState;
- return !expectedState;
- }
-
- public boolean isComplete() {
- if( new Date().getTime() > endTime ) return true;
- return false;
- }
-
- public void cleanup() {
- }
-
- public int getTimeout() {
- int timeout;
- JBossServer jbs = ((JBossServer)server.loadAdapter(JBossServer.class, null));
- ServerAttributeHelper helper = (ServerAttributeHelper)jbs.getAttributeHelper();
- if( expectedState == IServerStatePoller.SERVER_UP) {
- int def = ((ServerType)server.getServerType()).getStartTimeout();
- timeout = helper.getAttribute(IServerPollingAttributes.START_TIMEOUT, def);
- } else {
- int def = ((ServerType)server.getServerType()).getStopTimeout();
- timeout = helper.getAttribute(IServerPollingAttributes.STOP_TIMEOUT, def);
- }
- return timeout;
- }
-
- public boolean supportsShutdown() {
- return true;
- }
-
- public boolean supportsStartup() {
- return true;
- }
-
-
-}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/TimeoutPoller.java
(from rev 3544,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/TimeoutPoller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/TimeoutPoller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/TimeoutPoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,88 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.extensions.polling;
+
+import java.util.Date;
+
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.ServerType;
+import org.jboss.ide.eclipse.as.core.server.IServerPollingAttributes;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+
+// Wait 15 seconds, then say it's at it's expected state
+public class TimeoutPoller implements IServerStatePoller {
+
+ private boolean expectedState;
+ private long endTime;
+ private IServer server;
+ int timeout = -1;
+
+
+ public void beginPolling(IServer server, boolean expectedState, PollThread pt) {
+ this.expectedState = expectedState;
+ this.server = server;
+ this.endTime = new Date().getTime() + getTimeout() - 2000;
+ }
+
+ public void cancel(int type) {
+ }
+
+ public boolean getState() {
+ if( new Date().getTime() > endTime ) return expectedState;
+ return !expectedState;
+ }
+
+ public boolean isComplete() {
+ if( new Date().getTime() > endTime ) return true;
+ return false;
+ }
+
+ public void cleanup() {
+ }
+
+ public int getTimeout() {
+ int timeout;
+ JBossServer jbs = ((JBossServer)server.loadAdapter(JBossServer.class, null));
+ ServerAttributeHelper helper = (ServerAttributeHelper)jbs.getAttributeHelper();
+ if( expectedState == IServerStatePoller.SERVER_UP) {
+ int def = ((ServerType)server.getServerType()).getStartTimeout();
+ timeout = helper.getAttribute(IServerPollingAttributes.START_TIMEOUT, def);
+ } else {
+ int def = ((ServerType)server.getServerType()).getStopTimeout();
+ timeout = helper.getAttribute(IServerPollingAttributes.STOP_TIMEOUT, def);
+ }
+ return timeout;
+ }
+
+ public boolean supportsShutdown() {
+ return true;
+ }
+
+ public boolean supportsStartup() {
+ return true;
+ }
+
+
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/ArchivesBuildListener.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -41,7 +41,7 @@
import org.jboss.ide.eclipse.archives.core.model.other.IArchiveModelListener;
import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
import
org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.PackagedModuleDelegate;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.as.core.publishers;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-
-public interface IJBossServerPublisher {
- public IStatus publishModule(int kind, int deltaKind, int modulePublishState,
- IModule module, IProgressMonitor monitor)
- throws CoreException;
- public int getPublishState();
- public void setDelta(IModuleResourceDelta[] delta);
-
-}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -47,7 +47,7 @@
import org.eclipse.wst.server.core.util.PublishUtil;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.internal.NestedPublishInfo;
import org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/NullPublisher.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -27,6 +27,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
/**
*
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PackagesPublisher.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -41,7 +41,8 @@
import
org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory.PackagedModuleDelegate;
import org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.PublishEvent;
import
org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.PublisherFileUtilListener;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -12,7 +12,8 @@
import org.eclipse.wst.server.core.model.ServerBehaviourDelegate;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
import
org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.SingleDeployableModuleDelegate;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java
(from rev 3541,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/IDeployableServer.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,36 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public interface IDeployableServer {
+ public String getDeployDirectory();
+ public String getConfigDirectory();
+ public ServerAttributeHelper getAttributeHelper();
+ public IServer getServer();
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java
(from rev 3535,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/IJBossServerPublisher.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerPublisher.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+
+public interface IJBossServerPublisher {
+ public IStatus publishModule(int kind, int deltaKind, int modulePublishState,
+ IModule module, IProgressMonitor monitor)
+ throws CoreException;
+ public int getPublishState();
+ public void setDelta(IModuleResourceDelta[] delta);
+
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/IJBossServerRuntime.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBossServerRuntime.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,35 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server;
+
+import org.eclipse.jdt.launching.IVMInstall;
+
+public interface IJBossServerRuntime {
+ public static String PROPERTY_VM_ID = "PROPERTY_VM_ID";
+ public static String PROPERTY_VM_TYPE_ID = "PROPERTY_VM_TYPE_ID";
+
+ public static String PROPERTY_CONFIGURATION_NAME =
"org.jboss.ide.eclipse.as.core.runtime.configurationName";
+
+ public IVMInstall getVM();
+ public String getJBossConfiguration();
+ public String getId();
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerPollingAttributes.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/IServerPollingAttributes.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerPollingAttributes.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerPollingAttributes.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,36 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server;
+
+public interface IServerPollingAttributes {
+ public static final String START_TIMEOUT =
"org.jboss.ide.eclipse.as.core.server.attributes.startTimeout";
+ public static final String STOP_TIMEOUT =
"org.jboss.ide.eclipse.as.core.server.attributes.stopTimeout";
+
+ public static final String TIMEOUT_BEHAVIOR =
"org.jboss.ide.eclipse.as.core.server.attributes.timeoutBehavior";
+ public static final String STARTUP_POLLER_KEY =
"org.jboss.ide.eclipse.as.core.server.attributes.startupPollerKey";
+ public static final String SHUTDOWN_POLLER_KEY =
"org.jboss.ide.eclipse.as.core.server.attributes.shutdownPollerKey";
+ public static final String DEFAULT_STARTUP_POLLER =
"org.jboss.ide.eclipse.as.core.runtime.server.JMXPoller";
+ public static final String DEFAULT_SHUTDOWN_POLLER =
"org.jboss.ide.eclipse.as.core.runtime.server.processTerminatedPoller";
+ public static final boolean TIMEOUT_ABORT = true;
+ public static final boolean TIMEOUT_IGNORE = false;
+
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/attributes/IServerStartupParameters.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStartupParameters.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,33 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server;
+
+public interface IServerStartupParameters {
+ public static final String JBOSS_SERVER_HOME_DIR = "jboss.server.home.dir";
+ public static final String JBOSS_SERVER_BASE_DIR = "jboss.server.base.dir";
+ public static final String JBOSS_SERVER_NAME = "jboss.server.name";
+ public static final String JBOSS_HOME_DIR = "jboss.home.dir";
+
+ public static final String DEFAULT_SERVER_NAME = "default";
+ public static final String DEPLOY = "deploy";
+ public static final String SERVER = "server";
+}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java
(from rev 3530,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/server/polling/IServerStatePoller.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IServerStatePoller.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,44 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+
+public interface IServerStatePoller extends IServerPollingAttributes {
+
+ public static final boolean SERVER_UP = true;
+ public static final boolean SERVER_DOWN = false;
+
+ public static final int CANCEL = 0;
+ public static final int TIMEOUT_REACHED = 1;
+
+ public void beginPolling(IServer server, boolean expectedState, PollThread pt); //
expected to launch own thread
+ public boolean isComplete() throws PollingException;
+ public boolean getState() throws PollingException;
+ public void cancel(int type); // cancel the polling
+ public void cleanup(); // clean up any resources / processes. Will ALWAYS be called
+
+ public class PollingException extends Exception {
+ public PollingException(String message) {super(message);}
+ }
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/AbstractJBossServerRuntime.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -36,7 +36,7 @@
import org.eclipse.wst.server.core.internal.ServerPlugin;
import org.eclipse.wst.server.core.model.RuntimeDelegate;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
public abstract class AbstractJBossServerRuntime extends RuntimeDelegate implements
IJBossServerRuntime {
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 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -8,7 +8,7 @@
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.model.ServerDelegate;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
public class DeployableServer extends ServerDelegate implements IDeployableServer {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -20,12 +20,12 @@
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
import org.jboss.ide.eclipse.as.core.modules.PackageModuleFactory;
-import org.jboss.ide.eclipse.as.core.publishers.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.publishers.JstPublisher;
import org.jboss.ide.eclipse.as.core.publishers.NullPublisher;
import org.jboss.ide.eclipse.as.core.publishers.PackagesPublisher;
import org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger;
import org.jboss.ide.eclipse.as.core.publishers.SingleFilePublisher;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.DeployableLaunchConfiguration;
public class DeployableServerBehavior extends ServerBehaviourDelegate {
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 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -46,9 +46,9 @@
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.runtime.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.attributes.IServerStartupParameters;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IServerStartupParameters;
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
public class JBossServer extends ServerDelegate
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -31,8 +31,7 @@
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
-import org.jboss.ide.eclipse.as.core.runtime.server.polling.IServerStatePoller;
-import org.jboss.ide.eclipse.as.core.runtime.server.polling.PollThread;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.server.internal.launch.StopLaunchConfiguration;
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,263 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.core.server.internal;
+
+import java.util.Date;
+
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.ServerType;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogRoot;
+import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
+import org.jboss.ide.eclipse.as.core.server.IServerPollingAttributes;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller.PollingException;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.SimpleTreeItem;
+
+/**
+ *
+ * @author rob.stryker(a)jboss.com
+ */
+public class PollThread extends Thread {
+ public static final String SERVER_STATE_MAJOR_TYPE =
"org.jboss.ide.eclipse.as.core.runtime.server.polling.MajorType";
+
+
+ public static final String SERVER_STARTING =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.server.starting";
+ public static final String SERVER_STOPPING =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.server.stopping";
+ public static final String FAILURE =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.failure";
+ public static final String SUCCESS =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.success";
+ public static final String POLLER_NOT_FOUND =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.pollerNotFound";
+ public static final String POLL_THREAD_ABORTED =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.aborted";
+ public static final String POLL_THREAD_TIMEOUT =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.timeout";
+ public static final String EXPECTED_STATE =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThreadEvent.expectedState";
+ public static final String POLL_THREAD_EXCEPTION =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.exception";
+ public static final String POLL_THREAD_EXCEPTION_MESSAGE =
"org.jboss.ide.eclipse.as.core.runtime.server.PollThread.exception.message";
+
+
+ private boolean expectedState;
+ private IServerStatePoller poller;
+ private boolean abort;
+ private JBossServerBehavior behavior;
+ private EventLogRoot eventRoot;
+
+ private PollThreadEvent activeEvent;
+
+ public PollThread(String name, boolean expectedState, JBossServerBehavior behavior) {
+ super(name);
+ this.expectedState = expectedState;
+ this.abort = false;
+ this.behavior = behavior;
+ eventRoot = EventLogModel.getModel(behavior.getServer()).getRoot();
+
+ poller = discoverPoller(behavior, expectedState);
+ }
+
+ protected IServerStatePoller discoverPoller(JBossServerBehavior behavior, boolean
expectedState) {
+ JBossServer s = ServerConverter.getJBossServer(behavior.getServer());
+ ServerAttributeHelper helper = s.getAttributeHelper();
+ String key = expectedState == IServerStatePoller.SERVER_UP ?
+ IServerPollingAttributes.STARTUP_POLLER_KEY :
+ IServerPollingAttributes.SHUTDOWN_POLLER_KEY;
+ String defaultPoller = expectedState == IServerStatePoller.SERVER_UP ?
+ IServerPollingAttributes.DEFAULT_STARTUP_POLLER :
+ IServerPollingAttributes.DEFAULT_SHUTDOWN_POLLER;
+ String pollerId = helper.getAttribute(key, defaultPoller);
+ ServerStatePollerType type = ExtensionManager.getDefault().getPollerType(pollerId);
+ return type == null ? null : type.createPoller();
+ }
+
+ public void cancel() {
+ abort = true;
+ }
+
+
+ // Getting the timeouts. First from plugin.xml as default, or from user settings.
+ public int getTimeout() {
+ int timeout;
+ JBossServer jbs = ((JBossServer)getServer().loadAdapter(JBossServer.class, null));
+ ServerAttributeHelper helper = (ServerAttributeHelper)jbs.getAttributeHelper();
+ if( expectedState == IServerStatePoller.SERVER_UP) {
+ int def = ((ServerType)getServer().getServerType()).getStartTimeout();
+ timeout = helper.getAttribute(IServerPollingAttributes.START_TIMEOUT, def);
+ } else {
+ int def = ((ServerType)getServer().getServerType()).getStopTimeout();
+ timeout = helper.getAttribute(IServerPollingAttributes.STOP_TIMEOUT, def);
+ }
+ return timeout;
+ }
+
+
+ public void run() {
+ // Poller not found
+ if( poller == null ) {
+ alertEventLogStarting();
+ alertPollerNotFound();
+ alertBehavior(getTimeoutBehavior(), false);
+ return;
+ }
+
+ int maxWait = getTimeout();
+ alertEventLogStarting();
+
+ long startTime = new Date().getTime();
+ boolean done = false;
+ poller.beginPolling(getServer(), expectedState, this);
+
+ // begin the loop; ask the poller every so often
+ while( !abort && !done && new Date().getTime() < startTime + maxWait
) {
+ try {
+ Thread.sleep(100);
+ } catch( InterruptedException ie ) { }
+
+ try {
+ done = poller.isComplete();
+ } catch( PollingException e ) {
+ // abort and put the message in event log
+ poller.cancel(IServerStatePoller.CANCEL);
+ poller.cleanup();
+ alertEventLogPollerException(e);
+ alertBehavior(IServerStatePoller.SERVER_DOWN, false);
+ return;
+ }
+ }
+
+ boolean currentState = !expectedState;
+ // we stopped. Did we abort?
+ if( abort ) {
+ poller.cancel(IServerStatePoller.CANCEL);
+ poller.cleanup();
+ alertEventLogAbort();
+ } else {
+ boolean finalAlert = true;
+ if( done ) {
+ // the poller has an answer
+ try {
+ currentState = poller.getState();
+ poller.cleanup();
+ } catch( PollingException pe) {
+ // abort and put the message in event log
+ poller.cancel(IServerStatePoller.CANCEL);
+ poller.cleanup();
+ alertEventLogPollerException(pe);
+ alertBehavior(IServerStatePoller.SERVER_DOWN, false);
+ return;
+ }
+ } else {
+ // we timed out. get response from preferences
+ poller.cancel(IServerStatePoller.TIMEOUT_REACHED);
+ currentState = getTimeoutBehavior();
+ poller.cleanup();
+ alertEventLogTimeout();
+ finalAlert = false;
+ }
+ alertBehavior(currentState, finalAlert);
+ }
+ }
+
+ protected void alertBehavior(boolean currentState, boolean finalAlert) {
+ if( currentState != expectedState ) {
+ // it didnt work... cancel all processes! force stop
+ behavior.forceStop(false);
+ if( finalAlert ) alertEventLogFailure();
+ } else {
+ if( currentState == IServerStatePoller.SERVER_UP )
+ behavior.setServerStarted();
+ else {
+ behavior.forceStop(false);
+ }
+ if( finalAlert ) alertEventLogSuccess(currentState);
+ }
+ }
+
+ protected boolean getTimeoutBehavior() {
+ // timeout has been reached, so let the user's preferences override
+ JBossServer jbs = ((JBossServer)getServer().loadAdapter(JBossServer.class, null));
+ ServerAttributeHelper helper = (ServerAttributeHelper)jbs.getAttributeHelper();
+
+ boolean behavior = helper.getAttribute(IServerPollingAttributes.TIMEOUT_BEHAVIOR,
IServerPollingAttributes.TIMEOUT_IGNORE);
+ if( behavior == IServerPollingAttributes.TIMEOUT_ABORT )
+ return !expectedState;
+
+ return expectedState;
+ }
+
+ protected IServer getServer() {
+ return behavior.getServer();
+ }
+
+
+ /*
+ * Event Log Stuff here!
+ */
+ protected void alertEventLogStarting() {
+ if( expectedState == IServerStatePoller.SERVER_UP) {
+ activeEvent = new PollThreadEvent(eventRoot, SERVER_STARTING, expectedState);
+ } else {
+ activeEvent = new PollThreadEvent(eventRoot, SERVER_STOPPING, expectedState);
+ }
+ EventLogModel.markChanged(eventRoot);
+ }
+
+ public PollThreadEvent getActiveEvent() {
+ return activeEvent;
+ }
+
+ protected void alertEventLogPollerException(PollingException e) {
+ PollThreadEvent event = new PollThreadEvent(activeEvent, POLL_THREAD_EXCEPTION,
expectedState);
+ event.setProperty(POLL_THREAD_EXCEPTION_MESSAGE, e.getMessage());
+ EventLogModel.markChanged(activeEvent);
+ }
+
+ protected void alertEventLogAbort() {
+ PollThreadEvent event = new PollThreadEvent(activeEvent, POLL_THREAD_ABORTED,
expectedState);
+ EventLogModel.markChanged(activeEvent);
+ }
+ protected void alertEventLogTimeout() {
+ PollThreadEvent event = new PollThreadEvent(activeEvent, POLL_THREAD_TIMEOUT,
expectedState);
+ EventLogModel.markChanged(activeEvent);
+ }
+ protected void alertEventLogFailure() {
+ PollThreadEvent event = new PollThreadEvent(eventRoot, FAILURE, expectedState);
+ EventLogModel.markChanged(eventRoot);
+ }
+ protected void alertEventLogSuccess(boolean currentState) {
+ PollThreadEvent event = new PollThreadEvent(activeEvent, SUCCESS, expectedState);
+ EventLogModel.markChanged(eventRoot);
+ }
+ protected void alertPollerNotFound() {
+ PollThreadEvent event = new PollThreadEvent(activeEvent, POLLER_NOT_FOUND,
expectedState);
+ EventLogModel.markChanged(activeEvent);
+ }
+
+ public class PollThreadEvent extends EventLogTreeItem {
+ public PollThreadEvent(SimpleTreeItem parent, String type, boolean expectedState) {
+ super(parent, SERVER_STATE_MAJOR_TYPE, type);
+ setProperty(EXPECTED_STATE, new Boolean(expectedState));
+ }
+
+ public boolean getExpectedState() {
+ return ((Boolean) getProperty(EXPECTED_STATE)).booleanValue();
+ }
+ }
+}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerStatePollerType.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerStatePollerType.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerStatePollerType.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -0,0 +1,30 @@
+package org.jboss.ide.eclipse.as.core.server.internal;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+
+public class ServerStatePollerType {
+ private IConfigurationElement el;
+ public ServerStatePollerType(IConfigurationElement el) {
+ this.el = el;
+ }
+ public boolean supportsStartup() {
+ return Boolean.parseBoolean(el.getAttribute("supportsStartup"));
+ }
+ public boolean supportsShutdown() {
+ return Boolean.parseBoolean(el.getAttribute("supportsShutdown"));
+ }
+ public String getName() {
+ return el.getAttribute("name");
+ }
+ public String getId() {
+ return el.getAttribute("id");
+ }
+ public IServerStatePoller createPoller() {
+ try {
+ return (IServerStatePoller)el.createExecutableExtension("class");
+ } catch( Exception e ) {
+ }
+ return null;
+ }
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -26,7 +26,7 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -40,7 +40,7 @@
import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.ServerType;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -15,7 +15,7 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -11,7 +11,7 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
public class TwiddleLaunchConfiguration extends AbstractJBossLaunchConfigType {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ASLaunchConfigurationConverter.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -66,7 +66,7 @@
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.internal.ServerType;
-import org.jboss.ide.eclipse.as.core.runtime.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.AbstractJBossServerRuntime;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration;
import org.w3c.dom.Element;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2007-09-11
05:31:36 UTC (rev 3544)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2007-09-11
05:42:18 UTC (rev 3545)
@@ -26,7 +26,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
-import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-11 05:31:36 UTC (rev
3544)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2007-09-11 05:42:18 UTC (rev
3545)
@@ -289,19 +289,19 @@
<extension
point="org.jboss.ide.eclipse.as.core.pollers">
<serverPoller
-
class="org.jboss.ide.eclipse.as.core.runtime.server.polling.TimeoutPoller"
+
class="org.jboss.ide.eclipse.as.core.extensions.polling.TimeoutPoller"
id="org.jboss.ide.eclipse.as.core.runtime.server.timeoutpoller"
name="Timeout Poller"
supportsStartup="true"
supportsShutdown="true"/>
<serverPoller
-
class="org.jboss.ide.eclipse.as.core.runtime.server.polling.JMXPoller"
+ class="org.jboss.ide.eclipse.as.core.extensions.polling.JMXPoller"
id="org.jboss.ide.eclipse.as.core.runtime.server.JMXPoller"
name="JMX Poller"
supportsStartup="true"
supportsShutdown="false"/>
<serverPoller
-
class="org.jboss.ide.eclipse.as.core.runtime.server.polling.ProcessTerminatedPoller"
+
class="org.jboss.ide.eclipse.as.core.extensions.polling.ProcessTerminatedPoller"
id="org.jboss.ide.eclipse.as.core.runtime.server.processTerminatedPoller"
name="Process Terminated Poller"
supportsShutdown="true"