Issue #1786 - Modify status handler to log to default handler if PlatformUI is not up.
Peer review comments Change-Id: Idf195398fdfcf7f52abf0ce203b048c3ac1186cb Former-commit-id:0935bc3e30
[formerly1f80f38e8a
] [formerly0935bc3e30
[formerly1f80f38e8a
] [formerly866e27825f
[formerly dbdfc33769f7b179f9f4a3a2a2f9d509facb78d8]]] Former-commit-id:866e27825f
Former-commit-id:e1e3449c71
[formerly17d3ed8fde
] Former-commit-id:61c9dde6d0
This commit is contained in:
parent
e4c7161748
commit
9ff19270a5
7 changed files with 64 additions and 54 deletions
|
@ -1 +1 @@
|
|||
com.raytheon.uf.viz.core.status.VizStatusHandlerFactory
|
||||
com.raytheon.uf.common.status.DefaultStatusHandlerFactory
|
|
@ -78,16 +78,17 @@ public class VizStatusHandler implements IUFStatusHandler {
|
|||
*/
|
||||
@Override
|
||||
public void handle(UFStatus status) {
|
||||
handle(status, this.category);
|
||||
}
|
||||
handle(status, this.category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(UFStatus status, String category) {
|
||||
@Override
|
||||
public void handle(UFStatus status, String category) {
|
||||
if (this.source == null) {
|
||||
if (factory != null) {
|
||||
this.source = factory.getSource(source, pluginId);
|
||||
}
|
||||
}
|
||||
|
||||
VizStatusInternal vizStatus = new VizStatusInternal(status, category,
|
||||
source, pluginId);
|
||||
StatusManager.getManager().handle(vizStatus);
|
||||
|
@ -98,10 +99,10 @@ public class VizStatusHandler implements IUFStatusHandler {
|
|||
handle(new UFStatus(p, msg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Priority priority, String category, String message) {
|
||||
handle(priority, category, message, (Throwable) null);
|
||||
}
|
||||
@Override
|
||||
public void handle(Priority priority, String category, String message) {
|
||||
handle(priority, category, message, (Throwable) null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Priority p, String msg, Throwable t) {
|
||||
|
@ -109,19 +110,19 @@ public class VizStatusHandler implements IUFStatusHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handle(Priority p, String category, String msg, Throwable t) {
|
||||
handle(new UFStatus(p, msg, t), category);
|
||||
}
|
||||
public void handle(Priority p, String category, String msg, Throwable t) {
|
||||
handle(new UFStatus(p, msg, t), category);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void debug(String message) {
|
||||
handle(Priority.DEBUG, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debug(String category, String message) {
|
||||
handle(Priority.DEBUG, category, message);
|
||||
}
|
||||
@Override
|
||||
public void debug(String category, String message) {
|
||||
handle(Priority.DEBUG, category, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void info(String message) {
|
||||
|
@ -129,48 +130,48 @@ public class VizStatusHandler implements IUFStatusHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void info(String category, String message) {
|
||||
handle(Priority.INFO, category, message);
|
||||
}
|
||||
public void info(String category, String message) {
|
||||
handle(Priority.INFO, category, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void warn(String message) {
|
||||
handle(Priority.WARN, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warn(String category, String message) {
|
||||
handle(Priority.WARN, category, message);
|
||||
}
|
||||
public void warn(String category, String message) {
|
||||
handle(Priority.WARN, category, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void error(String message) {
|
||||
handle(Priority.ERROR, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String category, String message) {
|
||||
handle(Priority.ERROR, category, message);
|
||||
}
|
||||
public void error(String category, String message) {
|
||||
handle(Priority.ERROR, category, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void error(String message, Throwable throwable) {
|
||||
handle(Priority.ERROR, message, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(String message, String category, Throwable throwable) {
|
||||
handle(Priority.ERROR, category, message, throwable);
|
||||
}
|
||||
public void error(String message, String category, Throwable throwable) {
|
||||
handle(Priority.ERROR, category, message, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void fatal(String message, Throwable throwable) {
|
||||
handle(Priority.FATAL, message, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fatal(String message, String category, Throwable throwable) {
|
||||
handle(Priority.FATAL, category, message, throwable);
|
||||
}
|
||||
@Override
|
||||
public void fatal(String message, String category, Throwable throwable) {
|
||||
handle(Priority.FATAL, category, message, throwable);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Viz Status Handler Factory
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -60,6 +60,7 @@ import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserve
|
|||
import com.raytheon.uf.viz.core.localization.LocalizationConstants;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationInitializer;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.core.status.VizStatusHandlerFactory;
|
||||
import com.raytheon.viz.alerts.jobs.AutoUpdater;
|
||||
import com.raytheon.viz.alerts.jobs.MenuUpdater;
|
||||
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
|
||||
|
@ -88,6 +89,7 @@ import com.raytheon.viz.core.units.UnitRegistrar;
|
|||
* the command line even if practice
|
||||
* mode is off.
|
||||
* Jan 09, 2013 #1442 rferrel Changes to notify SimultedTime listeners.
|
||||
* Apr 17, 2013 1786 mpduff startComponent now sets StatusHandlerFactory
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -162,6 +164,8 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
|||
// dialog which would break gfeClient-based cron jobs.
|
||||
return IApplication.EXIT_OK;
|
||||
}
|
||||
UFStatus.setHandlerFactory(new VizStatusHandlerFactory());
|
||||
|
||||
initializeSerialization();
|
||||
initializeDataStoreFactory();
|
||||
initializeObservers();
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.serialization.comm;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.util.registry.GenericRegistry;
|
||||
import com.raytheon.uf.common.util.registry.RegistryException;
|
||||
|
||||
|
@ -35,8 +37,7 @@ import com.raytheon.uf.common.util.registry.RegistryException;
|
|||
* Nov 15, 2012 1322 djohnson Add ability to route by server key.
|
||||
* Mar 05, 2013 1754 djohnson Prevent infinite loop when request.server router not registered,
|
||||
* info log when router registered.
|
||||
* Apr 04, 2013 1786 mpduff Remove StatusHandler and logging. Prevents thrift logging
|
||||
* requests from happening before the VIZ platform is ready.
|
||||
* Apr 04, 2013 1786 mpduff Simplify logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -45,6 +46,9 @@ import com.raytheon.uf.common.util.registry.RegistryException;
|
|||
*/
|
||||
|
||||
public final class RequestRouter {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RequestRouter.class);
|
||||
|
||||
static final String REQUEST_SERVICE = "request.server";
|
||||
|
||||
/**
|
||||
|
@ -65,7 +69,8 @@ public final class RequestRouter {
|
|||
+ s.getClass().getName()
|
||||
+ "] already registered for key [" + t + "]"));
|
||||
}
|
||||
|
||||
statusHandler.info("Registered request router for key [" + t
|
||||
+ "] of type [" + s.getClass().getName() + "]");
|
||||
return super.register(t, s);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class AbstractHandlerFactory implements
|
|||
|
||||
private final String defaultCategory;
|
||||
|
||||
private Map<String, IUFStatusHandler> namedHandlers = new HashMap<String, IUFStatusHandler>();
|
||||
private final Map<String, IUFStatusHandler> namedHandlers = new HashMap<String, IUFStatusHandler>();
|
||||
|
||||
private FilterPatternContainer sourceFilters;
|
||||
|
||||
|
@ -57,17 +57,6 @@ public abstract class AbstractHandlerFactory implements
|
|||
this.defaultCategory = category;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.status.IUFStatusHandlerFactory#getInstance()
|
||||
*/
|
||||
@Override
|
||||
public IUFStatusHandler getInstance() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 6, 2008 1433 chammack Initial creation
|
||||
* Apr 17, 2013 1786 mpduff Allow setting of Handler Factory.
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -100,7 +101,7 @@ public class UFStatus {
|
|||
protected final String message;
|
||||
|
||||
/** handler factory */
|
||||
private static final IUFStatusHandlerFactory handlerFactory = createHandlerFactory();
|
||||
private static IUFStatusHandlerFactory handlerFactory = createHandlerFactory();
|
||||
|
||||
private static final IUFStatusHandlerFactory createHandlerFactory() {
|
||||
ServiceLoader<IUFStatusHandlerFactory> loader = ServiceLoader.load(
|
||||
|
@ -314,4 +315,14 @@ public class UFStatus {
|
|||
String monitorSource) {
|
||||
return handlerFactory.getMonitorInstance(cls, monitorSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the handler factory
|
||||
*
|
||||
* @param factory
|
||||
* the handler factory
|
||||
*/
|
||||
public static void setHandlerFactory(IUFStatusHandlerFactory factory) {
|
||||
handlerFactory = factory;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue