You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by de...@apache.org on 2009/08/03 05:18:28 UTC
svn commit: r800188 -
/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerBehaviour.java
Author: delos
Date: Mon Aug 3 03:18:27 2009
New Revision: 800188
URL: http://svn.apache.org/viewvc?rev=800188&view=rev
Log:
GERONIMODEVTOOLS-575 add job for GeronimoServerBehaviour to shown error message when invalid username/password is provided
Modified:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerBehaviour.java
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerBehaviour.java?rev=800188&r1=800187&r2=800188&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerBehaviour.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/GeronimoServerBehaviour.java Mon Aug 3 03:18:27 2009
@@ -37,7 +37,12 @@
import org.apache.geronimo.st.v21.core.internal.Trace;
import org.apache.geronimo.system.jmx.KernelDelegate;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.internal.IModulePublishHelper;
@@ -92,10 +97,12 @@
try {
return getKernel() != null && kernel.isRunning();
} catch (SecurityException e) {
- Activator.log(Status.ERROR, "Invalid username and/or password.", e);
+ Trace.trace(Trace.SEVERE, "Invalid username and/or password.", e);
+
pingThread.interrupt();
if (getServer().getServerState() != IServer.STATE_STOPPED) {
- stop(true);
+ forceStopJob(true,e);
+
}
} catch (Exception e) {
Activator.log(Status.WARNING, "Geronimo Server may have been terminated manually outside of workspace.", e);
@@ -103,6 +110,40 @@
}
return false;
}
+
+ private void forceStopJob(boolean b, final SecurityException e) {
+ /*
+ *
+ * Currently, there is another Status is returned by StartJob in Server.
+ * The message doesn't contain reason for the exception.
+ * So this job is created to show a message(Invalid username and/or password) to user.
+ *
+ * TODO: Need a method to remove the error message thrown by StartJob in Server.
+ *
+ */
+
+ String jobName = NLS.bind(org.eclipse.wst.server.core.internal.Messages.errorStartFailed, getServer().getName());
+
+ //This message has different variable names in WTP 3.0 and 3.1, so we define it here instead of using that in WTP
+ final String jobStartingName = NLS.bind("Starting {0}", getServer().getName());
+
+ new Job(jobName){
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, 0, jobStartingName, null);
+ multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Invalid username and/or password.",e));
+ try{
+ GeronimoServerBehaviour.this.stop(true);
+ }catch (Exception e){
+ multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Failed to stop server",e));
+ }
+
+ return multiStatus;
+ }
+ }.schedule();
+
+ }
/*
* (non-Javadoc)