Issue #2005 stop cave from starting if spring fails, prompt user if they want to restart
Change-Id: I6b77e06c5737dab04c6c1a89cc2f5242a784bc53 Conflicts: cave/com.raytheon.viz.ui.personalities.awips/META-INF/MANIFEST.MF Former-commit-id:5d1ecb3a5d
[formerly537b731f6e
[formerly329d9d1c6a
] [formerly5d1ecb3a5d
[formerly 6742f7dbcac39261d8bee4e055bb9e4eda66520d]]] Former-commit-id:537b731f6e
[formerly329d9d1c6a
] Former-commit-id:537b731f6e
Former-commit-id:f4d0188254
This commit is contained in:
parent
8cb6e79767
commit
ec9fee62ba
5 changed files with 172 additions and 136 deletions
|
@ -11,3 +11,4 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
com.raytheon.uf.common.comm;bundle-version="1.12.1174"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.spring.dm
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
@ -34,6 +35,7 @@ import org.osgi.framework.Constants;
|
|||
* Jan 24, 2013 1522 bkowal Halt initialization if a p2 installation
|
||||
* has been started
|
||||
* Mar 05, 2013 1754 djohnson Catch exceptions and allow as much of the Spring container to boot as possible.
|
||||
* May 23, 2013 2005 njensen Added springSuccess flag
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,9 +52,15 @@ public class Activator implements BundleActivator {
|
|||
|
||||
private static final String SPRING_FILE_EXT = "*.xml";
|
||||
|
||||
private static final Pattern COMMA_SPLIT = Pattern.compile("[,]");
|
||||
|
||||
private static final Pattern SEMICOLON_SPLIT = Pattern.compile("[;]");
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
private boolean springSuccess = true;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
|
@ -93,6 +101,7 @@ public class Activator implements BundleActivator {
|
|||
if (contextMap.containsKey(bundleName) == false
|
||||
&& bundleName.contains(".edex.") == false) {
|
||||
if (processing.contains(bundleName)) {
|
||||
springSuccess = false;
|
||||
throw new RuntimeException(
|
||||
"Found recursive spring dependency while processing plugins: "
|
||||
+ bundleName);
|
||||
|
@ -119,14 +128,15 @@ public class Activator implements BundleActivator {
|
|||
String requiredBundlesHeader = (String) bundle.getHeaders()
|
||||
.get(Constants.REQUIRE_BUNDLE);
|
||||
// Split comma separated string from MANIFEST
|
||||
String[] requiredBundles = requiredBundlesHeader
|
||||
.split("[,]");
|
||||
String[] requiredBundles = COMMA_SPLIT
|
||||
.split(requiredBundlesHeader);
|
||||
List<OSGIXmlApplicationContext> parentContexts = new ArrayList<OSGIXmlApplicationContext>();
|
||||
for (String requiredBndl : requiredBundles) {
|
||||
// Extract bundle name which is first item in
|
||||
// semicolon
|
||||
// split list
|
||||
String[] bndlParts = requiredBndl.split("[;]");
|
||||
String[] bndlParts = SEMICOLON_SPLIT
|
||||
.split(requiredBndl);
|
||||
Bundle reqBndl = bundles.get(bndlParts[0]);
|
||||
if (reqBndl != null) {
|
||||
// Found bundle, process context for bundle
|
||||
|
@ -159,6 +169,7 @@ public class Activator implements BundleActivator {
|
|||
System.err
|
||||
.println("Errors booting the Spring container. CAVE will not be fully functional.");
|
||||
t.printStackTrace();
|
||||
springSuccess = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,4 +224,8 @@ public class Activator implements BundleActivator {
|
|||
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public boolean isSpringInitSuccessful() {
|
||||
return springSuccess;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.application;bundle-version="1.0.0",
|
||||
com.raytheon.viz.alerts;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.comm;bundle-version="1.12.1174"
|
||||
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.spring.dm
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.eclipse.equinox.app.IApplication;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.application.WorkbenchAdvisor;
|
||||
import org.eclipse.ui.internal.WorkbenchPlugin;
|
||||
|
@ -95,6 +96,7 @@ import com.raytheon.viz.core.units.UnitRegistrar;
|
|||
* Apr 17, 2013 1786 mpduff startComponent now sets StatusHandlerFactory
|
||||
* Apr 23, 2013 #1939 randerso Allow serialization to complete initialization
|
||||
* before connecting to JMS to avoid deadlock
|
||||
* May 23, 2013 #2005 njensen Shutdown on spring initialization errors
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -158,6 +160,24 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
|||
display = new Display();
|
||||
}
|
||||
|
||||
// verify Spring successfully initialized, otherwise stop CAVE
|
||||
if (!com.raytheon.uf.viz.spring.dm.Activator.getDefault()
|
||||
.isSpringInitSuccessful()) {
|
||||
String msg = "CAVE's Spring container did not initialize correctly and CAVE must shut down.";
|
||||
boolean restart = false;
|
||||
if (!nonui) {
|
||||
msg += " Attempt to restart CAVE?";
|
||||
restart = MessageDialog.openQuestion(new Shell(display),
|
||||
"Startup Error", msg);
|
||||
} else {
|
||||
System.err.println(msg);
|
||||
}
|
||||
if (restart) {
|
||||
return IApplication.EXIT_RESTART;
|
||||
}
|
||||
return IApplication.EXIT_OK;
|
||||
}
|
||||
|
||||
try {
|
||||
initializeLocalization(nonui);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -461,7 +461,6 @@ public abstract class AbstractWWAResource extends
|
|||
}
|
||||
|
||||
protected void cleanupData(DataTime paintTime, DataTime[] descFrameTimes) {
|
||||
System.out.println("entryMap size " + entryMap.size());
|
||||
List<TimeRange> framePeriods = new ArrayList<TimeRange>(
|
||||
descFrameTimes.length);
|
||||
for (int i = 0; i < descFrameTimes.length; i++) {
|
||||
|
|
Loading…
Add table
Reference in a new issue