();
+
+ private StatsCollector() {
+
+ }
+
+ /**
+ * Get the instance.
+ *
+ * @return The instance
+ */
+ public static final StatsCollector getInstance() {
+ return instance;
+ }
+
+ /**
+ * Mark a start point for this event.
+ *
+ * @param key
+ * The Statistics key
+ *
+ * @param event
+ * The event to track
+ */
+ public static void start(String key, StatisticsEvent event) {
+ getInstance().setStart(key, event);
+ }
+
+ /**
+ * Mark a stop point for this event.
+ *
+ * @param key
+ * StatisticsEvent
+ */
+ public static void stop(String key) {
+ getInstance().setStop(key);
+ }
+
+ /**
+ * Mark a start point for this event.
+ *
+ * @param key
+ * The Statistics key
+ * @param event
+ * The event to track
+ */
+ public void setStart(String key, StatisticsEvent event) {
+ statsDataMap.put(key, event);
+ }
+
+ /**
+ * Mark a stop point for this id.
+ *
+ * @param key
+ * The Statistics key
+ */
+ public void setStop(String key) {
+ StatisticsEvent event = statsDataMap.remove(key);
+ event.finalizeEvent();
+
+ EventBus.publish(event);
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.stats/src/com/raytheon/uf/viz/stats/utils/StatsConstants.java b/cave/com.raytheon.uf.viz.stats/src/com/raytheon/uf/viz/stats/utils/StatsConstants.java
index 3bee5ddb39..f9c09baefd 100644
--- a/cave/com.raytheon.uf.viz.stats/src/com/raytheon/uf/viz/stats/utils/StatsConstants.java
+++ b/cave/com.raytheon.uf.viz.stats/src/com/raytheon/uf/viz/stats/utils/StatsConstants.java
@@ -26,7 +26,7 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
/**
- * TODO Add Description
+ * Constants for CAVE statistics.
*
*
*
@@ -54,12 +54,10 @@ public class StatsConstants {
private static final String release = defineRelease();
/**
- * @return Hostname of the workstation running CAVE
+ * Return the host name.
+ *
+ * @return the host name
*/
- public static String getHostname() {
- return hostname;
- }
-
private static String defineHostName() {
String hn = null;
InetAddress addr;
@@ -73,6 +71,11 @@ public class StatsConstants {
return hn;
}
+ /**
+ * Define the release that is currently running.
+ *
+ * @return The release
+ */
private static String defineRelease() {
String release = null;
BufferedReader in = null;
@@ -107,4 +110,11 @@ public class StatsConstants {
public static String getRelease() {
return release;
}
+
+ /**
+ * @return Hostname of the workstation running CAVE
+ */
+ public static String getHostname() {
+ return hostname;
+ }
}
diff --git a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java
index 676230c094..8a91774037 100644
--- a/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java
+++ b/edexOsgi/com.raytheon.edex.plugin.shef/src/com/raytheon/edex/transform/shef/MetarToShefFilter.java
@@ -41,21 +41,20 @@ import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
-import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
+import com.raytheon.uf.common.localization.PathManagerFactory;
+import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
-import com.raytheon.uf.common.ohd.AppsDefaults;
-//import com.raytheon.edex.transform.shef.MetarToShefTransformer;
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter;
import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
/**
- * Use information in metarToShefFilter.xml, MetarToShefFilter filters out
- * the metar messages before send the message to MetarToShefTransformer to
- * encode to a SHEF message.
+ * Use information in metarToShefFilter.xml, MetarToShefFilter filters out the
+ * metar messages before send the message to MetarToShefTransformer to encode to
+ * a SHEF message.
*
*
*
@@ -63,6 +62,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
* Date Ticket# Engineer Description
* ---------- ------- -------- --------------------------
* 1/10/2013 15497 wkwock Initial creation
+ * 2/13/2013 1584 mpduff Fix creation of "dummy" config.
*
*
*
@@ -72,7 +72,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
-public class MetarToShefFilter {
+public class MetarToShefFilter {
@XmlElement
@DynamicSerializeElement
protected List metarToShefRun = new ArrayList();
@@ -82,12 +82,13 @@ public class MetarToShefFilter {
private static final String ERROR_2_FMT = "File %s does not exist";
private static final String METAR_CFG = "metar.cfg";
-
- public static final String FILTERS_DIR = "plugin-filters";
-
- private String metarToShefOptions = AppsDefaults.getInstance().getToken("metar2shef_options");
- private Log logger = LogFactory.getLog(getClass());
+ public static final String FILTERS_DIR = "plugin-filters";
+
+ private final String metarToShefOptions = AppsDefaults.getInstance()
+ .getToken("metar2shef_options");
+
+ private final Log logger = LogFactory.getLog(getClass());
private String filterConfigFile = null;
@@ -99,9 +100,10 @@ public class MetarToShefFilter {
try {
File filterDir = null;
IPathManager manager = PathManagerFactory.getPathManager();
- if(manager != null) {
- LocalizationContext context = manager.getContext(EDEX_STATIC, LocalizationLevel.valueOf(localContext));
- if(context != null) {
+ if (manager != null) {
+ LocalizationContext context = manager.getContext(EDEX_STATIC,
+ LocalizationLevel.valueOf(localContext));
+ if (context != null) {
filterDir = manager.getFile(context, FILTERS_DIR);
if (filterDir.exists()) {
File srcFile = new File(filterDir, filterConfigFile);
@@ -113,73 +115,84 @@ public class MetarToShefFilter {
stream.read(data);
stream.close();
Object obj = SerializationUtil
- .unmarshalFromXml(new String(data));
- if (obj instanceof PluginDataObjectFilter){
- logger.info("Found "+filterConfigFile+" is PluginDataObjectFilter");
- PluginDataObjectFilter pdof=(PluginDataObjectFilter) obj;
- MetarToShefRun mtsr= new MetarToShefRun();
+ .unmarshalFromXml(new String(data));
+ if (obj instanceof PluginDataObjectFilter) {
+ logger.info("Found " + filterConfigFile
+ + " is PluginDataObjectFilter");
+ PluginDataObjectFilter pdof = (PluginDataObjectFilter) obj;
+ MetarToShefRun mtsr = new MetarToShefRun();
mtsr.setConfigFileName(METAR_CFG);
mtsr.setMetarToShefOptions(metarToShefOptions);
mtsr.setFilterElements(pdof.getFilterElements());
mtsr.setFilterName(pdof.getFilterName());
this.metarToShefRun.add(mtsr);
- }else if (obj instanceof MetarToShefFilter) {
- MetarToShefFilter filter = (MetarToShefFilter) obj;
- this.metarToShefRun=filter.metarToShefRun;
- logger.info("Found "+filterConfigFile+" is MetarToShefFilter");
- }else {
- logger.error("Found "+filterConfigFile+" is "+obj.getClass().getCanonicalName());
- createDummyFilter();
- }
+ } else if (obj instanceof MetarToShefFilter) {
+ MetarToShefFilter filter = (MetarToShefFilter) obj;
+ this.metarToShefRun = filter.metarToShefRun;
+ logger.info("Found " + filterConfigFile
+ + " is MetarToShefFilter");
+ } else {
+ logger.error("Found " + filterConfigFile
+ + " is "
+ + obj.getClass().getCanonicalName());
+ createDummyFilter();
+ }
} catch (IOException e) {
logger.error("Unable to read filter config", e);
} catch (JAXBException e) {
- logger.error("Unable to unmarshall filter config", e);
+ logger.error("Unable to unmarshall filter config",
+ e);
}
} else {
- logger.error(String.format(ERROR_2_FMT,filterDir.getPath()));
+ logger.error(String.format(ERROR_2_FMT,
+ filterDir.getPath()));
createDummyFilter();
}
} else {
- logger.error(String.format(ERROR_1_FMT, localContext,configFile));
+ logger.error(String.format(ERROR_1_FMT, localContext,
+ configFile));
createDummyFilter();
}
} else {
// Could not create PathManager
}
} catch (Exception e) {
- logger.error(
- "Error creating filter.", e);
+ logger.error("Error creating filter.", e);
createDummyFilter();
}
- for (MetarToShefRun mtsr: metarToShefRun){
- logger.info("Filter name = " + mtsr.getFilterName()+" with config file: "+mtsr.getConfigFileName());
+ for (MetarToShefRun mtsr : metarToShefRun) {
+ logger.info("Filter name = " + mtsr.getFilterName()
+ + " with config file: " + mtsr.getConfigFileName());
}
}
- private PluginDataObject[] filterARun(PluginDataObject[] reports, List filterElements) {
+ private PluginDataObject[] filterARun(PluginDataObject[] reports,
+ List filterElements) {
int reportCount = 0;
if (reports != null) {
-
for (int i = 0; i < reports.length; i++) {
PluginDataObject r = null;
boolean keep = true;
for (AbstractFilterElement element : filterElements) {
r = element.filter(reports[i]);
-
- // Only allow keep to be set to true. Once true it stays that way.
- if(AbstractObsFilter.INCLUDE_TYPE.equals(element.getFilterType())) {
+
+ // Only allow keep to be set to true. Once true it stays
+ // that way.
+ if (AbstractObsFilter.INCLUDE_TYPE.equals(element
+ .getFilterType())) {
// Did the filter pass?
- if(r == null) {
- // If we fail an element, exit now.
+ if (r == null) {
+ // If we fail an element, exit now.
keep = false;
break;
}
- } else if(AbstractObsFilter.EXCLUDE_TYPE.equals(element.getFilterType())) {
- if(r != null) {
- // There was a match, so we want to remove this item.
+ } else if (AbstractObsFilter.EXCLUDE_TYPE.equals(element
+ .getFilterType())) {
+ if (r != null) {
+ // There was a match, so we want to remove this
+ // item.
keep = false;
// And there's no reason for further checks.
break;
@@ -208,29 +221,30 @@ public class MetarToShefFilter {
}
return reports;
}
-
+
/**
* Apply the list of filters against given input data.
*
*/
- // @Override
+ // @Override
public PluginDataObject[] filter(PluginDataObject[] reports) {
- PluginDataObject[] resultRpt=null;
- for (MetarToShefRun mtsr : metarToShefRun) {
- PluginDataObject[] tmpRprts = reports.clone();
- resultRpt=filterARun(tmpRprts,mtsr.getFilterElements());
- if (resultRpt!=null && resultRpt.length>=1) {
- logger.info("Report matchs in filter "+mtsr.getFilterName());
- MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),mtsr.getMetarToShefOptions());
- break ;
- }
- }
+ PluginDataObject[] resultRpt = null;
+ for (MetarToShefRun mtsr : metarToShefRun) {
+ PluginDataObject[] tmpRprts = reports.clone();
+ resultRpt = filterARun(tmpRprts, mtsr.getFilterElements());
+ if (resultRpt != null && resultRpt.length >= 1) {
+ logger.info("Report matchs in filter " + mtsr.getFilterName());
+ MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),
+ mtsr.getMetarToShefOptions());
+ break;
+ }
+ }
return resultRpt;
}
private void createDummyFilter() {
- MetarToShefRun mtsr= new MetarToShefRun();
+ MetarToShefRun mtsr = new MetarToShefRun();
mtsr.setConfigFileName(METAR_CFG);
mtsr.setMetarToShefOptions(metarToShefOptions);
@@ -242,7 +256,7 @@ public class MetarToShefFilter {
}
};
dummy.setFilterType(AbstractObsFilter.INCLUDE_TYPE);
- mtsr.getFilterElements().set(0, dummy);
+ mtsr.getFilterElements().add(dummy);
mtsr.setFilterName("Created Pass-All filter");
this.metarToShefRun.add(mtsr);
}
@@ -262,9 +276,9 @@ public class MetarToShefFilter {
}
return fis;
}
-
+
public void addMetarToShefRun(MetarToShefRun element) {
- metarToShefRun.add(element);
+ metarToShefRun.add(element);
}
/**
@@ -274,13 +288,13 @@ public class MetarToShefFilter {
public List getMetarToShefRun() {
return metarToShefRun;
}
-
+
/**
*
* @param elements
*/
public void setMetarToShefRun(List elements) {
- metarToShefRun = elements;
+ metarToShefRun = elements;
}
- }
+}
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/DataRetrievalEvent.java b/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/DataRetrievalEvent.java
index 9c54af8593..92e148cd0b 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/DataRetrievalEvent.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/DataRetrievalEvent.java
@@ -142,4 +142,10 @@ public class DataRetrievalEvent extends RetrievalEvent {
return "DataRetrievalEvent " + super.toString() + " provider: "
+ provider + " numRecord: " + numRecords + " bytes: " + bytes;
}
+
+ @Override
+ public void finalizeEvent() {
+ // Not implemented
+
+ }
}
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/SubscriptionRetrievalEvent.java b/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/SubscriptionRetrievalEvent.java
index a2d47fa7ac..a25d3621f6 100644
--- a/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/SubscriptionRetrievalEvent.java
+++ b/edexOsgi/com.raytheon.uf.common.datadelivery.event/src/com/raytheon/uf/common/datadelivery/event/retrieval/SubscriptionRetrievalEvent.java
@@ -177,4 +177,9 @@ public class SubscriptionRetrievalEvent extends RetrievalEvent implements
}
return rval.toString();
}
+
+ @Override
+ public void finalizeEvent() {
+ // Not implemented
+ }
}
diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/utility/common_static/base/stats/ffmpStats.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/utility/common_static/base/stats/ffmpStats.xml
new file mode 100644
index 0000000000..52d8172725
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/utility/common_static/base/stats/ffmpStats.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
diff --git a/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RegistryStatisticsEvent.java b/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RegistryStatisticsEvent.java
index 6761909edb..99cb1aac52 100644
--- a/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RegistryStatisticsEvent.java
+++ b/edexOsgi/com.raytheon.uf.common.registry.event/src/com/raytheon/uf/common/registry/event/RegistryStatisticsEvent.java
@@ -136,4 +136,8 @@ public class RegistryStatisticsEvent extends StatisticsEvent {
return registryObject;
}
+ @Override
+ public void finalizeEvent() {
+ // not implemented
+ }
}
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.stats/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.stats/META-INF/MANIFEST.MF
index 3ecb4c506e..b2726a09ef 100644
--- a/edexOsgi/com.raytheon.uf.common.stats/META-INF/MANIFEST.MF
+++ b/edexOsgi/com.raytheon.uf.common.stats/META-INF/MANIFEST.MF
@@ -19,4 +19,5 @@ Require-Bundle: com.raytheon.uf.common.time;bundle-version="1.12.1174",
com.raytheon.uf.common.util;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0",
- com.raytheon.uf.common.units;bundle-version="1.0.0"
+ com.raytheon.uf.common.units;bundle-version="1.0.0",
+ org.apache.commons.lang;bundle-version="2.3.0"
diff --git a/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/LoadEvent.java b/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/LoadEvent.java
index 3400f0fb8d..bf3f1f225a 100644
--- a/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/LoadEvent.java
+++ b/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/LoadEvent.java
@@ -23,8 +23,12 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
+import com.raytheon.uf.common.time.util.TimeUtil;
/**
* Load event to track dialog/table/data load times.
@@ -53,30 +57,12 @@ public class LoadEvent extends StatisticsEvent {
FIELD_UNIT_MAP = Collections.unmodifiableMap(m);
}
- /**
- * The plugin name
- */
- @DynamicSerializeElement
- private String pluginName;
-
- /**
- * The workstation id
- */
- @DynamicSerializeElement
- private String workstation;
-
/**
* The type of object that is having its load time tracked
*/
@DynamicSerializeElement
private String type;
- /**
- * The version of CAVE
- */
- @DynamicSerializeElement
- private String caveVersion;
-
/**
* The load time in ms
*/
@@ -89,41 +75,23 @@ public class LoadEvent extends StatisticsEvent {
@DynamicSerializeElement
private String message;
+ /**
+ * Start time in ms.
+ */
+ private long start;
+
+ /**
+ * Constructor. Sets the start time to current time.
+ */
+ public LoadEvent() {
+ start = TimeUtil.currentTimeMillis();
+ }
+
@Override
protected Map getFieldUnitMap() {
return FIELD_UNIT_MAP;
}
- /**
- * @return the pluginName
- */
- public String getPluginName() {
- return pluginName;
- }
-
- /**
- * @param pluginName
- * the pluginName to set
- */
- public void setPluginName(String pluginName) {
- this.pluginName = pluginName;
- }
-
- /**
- * @return the workstation
- */
- public String getWorkstation() {
- return workstation;
- }
-
- /**
- * @param workstation
- * the workstation to set
- */
- public void setWorkstation(String workstation) {
- this.workstation = workstation;
- }
-
/**
* @return the type
*/
@@ -170,18 +138,18 @@ public class LoadEvent extends StatisticsEvent {
}
/**
- * @return the caveVersion
+ * @return the start
*/
- public String getCaveVersion() {
- return caveVersion;
+ public long getStart() {
+ return start;
}
/**
- * @param caveVersion
- * the caveVersion to set
+ * @param start
+ * the start to set
*/
- public void setCaveVersion(String caveVersion) {
- this.caveVersion = caveVersion;
+ public void setStart(long start) {
+ this.start = start;
}
/**
@@ -191,4 +159,45 @@ public class LoadEvent extends StatisticsEvent {
public String toString() {
return super.toString() + " : " + getMessage();
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder(17, 37).appendSuper(super.hashCode())
+ .append(date).append(message).append(type).toHashCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (obj == this) {
+ return true;
+ }
+ if (obj.getClass() != getClass()) {
+ return false;
+ }
+ LoadEvent other = (LoadEvent) obj;
+ return new EqualsBuilder().appendSuper(super.equals(obj))
+ .append(this.date, other.date).append(this.id, other.id)
+ .append(this.message, other.message)
+ .append(this.type, other.type).isEquals();
+ }
+
+ @Override
+ public void finalizeEvent() {
+ long now = TimeUtil.currentTimeMillis();
+ this.loadTime = now - start;
+ }
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/ProcessEvent.java b/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/ProcessEvent.java
index b257fa8673..ffd9f93d2c 100644
--- a/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/ProcessEvent.java
+++ b/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/ProcessEvent.java
@@ -165,4 +165,9 @@ public class ProcessEvent extends StatisticsEvent {
return super.toString() + " : " + getMessage();
}
+ @Override
+ public void finalizeEvent() {
+ // not implemented
+ }
+
}
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/StatisticsEvent.java b/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/StatisticsEvent.java
index 9e37e948b0..9ed5e73c2a 100644
--- a/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/StatisticsEvent.java
+++ b/edexOsgi/com.raytheon.uf.common.stats/src/com/raytheon/uf/common/stats/StatisticsEvent.java
@@ -23,6 +23,9 @@ package com.raytheon.uf.common.stats;
import java.util.Map;
import java.util.Set;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
import com.raytheon.uf.common.event.Event;
/**
@@ -35,6 +38,7 @@ import com.raytheon.uf.common.event.Event;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 25, 2012 #1340 dhladky Initial creation
+ * Feb 10, 2013 #1584 mpduff Add equals and hashCode.
*
*
*
@@ -52,7 +56,43 @@ public abstract class StatisticsEvent extends Event {
protected abstract Map getFieldUnitMap();
+ public abstract void finalizeEvent();
+
public String getStorageUnit(String field) {
return getFieldUnitMap().get(field);
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ HashCodeBuilder hcBuilder = new HashCodeBuilder();
+ hcBuilder.append(this.date);
+ hcBuilder.append(this.id);
+
+ return hcBuilder.toHashCode();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof StatisticsEvent) {
+ StatisticsEvent other = (StatisticsEvent) obj;
+ EqualsBuilder builder = new EqualsBuilder();
+ builder.append(this.date, other.date);
+ builder.append(this.id, this.id);
+
+ return builder.isEquals();
+ }
+
+ return super.equals(obj);
+ }
+
}
diff --git a/edexOsgi/com.raytheon.uf.common.status/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.status/META-INF/MANIFEST.MF
index fed2341905..cc1e82eb6b 100644
--- a/edexOsgi/com.raytheon.uf.common.status/META-INF/MANIFEST.MF
+++ b/edexOsgi/com.raytheon.uf.common.status/META-INF/MANIFEST.MF
@@ -7,3 +7,4 @@ Bundle-Vendor: RAYTHEON
Eclipse-BuddyPolicy: ext, registered, global
Export-Package: com.raytheon.uf.common.status
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.apache.log4j;bundle-version="1.0.0"
diff --git a/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/IPerformanceStatusHandler.java b/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/IPerformanceStatusHandler.java
new file mode 100644
index 0000000000..22eba5f645
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/IPerformanceStatusHandler.java
@@ -0,0 +1,56 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.common.status;
+
+/**
+ * Performance status handler interface.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Feb 14, 2013 1584 mpduff Initial creation
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public interface IPerformanceStatusHandler {
+
+ /**
+ * Performance message. Use {@link #logDuration(String, long)} if the
+ * duration is known.
+ *
+ * @param message
+ */
+ void log(String message);
+
+ /**
+ * Performance message with time duration.
+ *
+ * @param message
+ * @param timeMs
+ */
+ void logDuration(String message, long timeMs);
+}
diff --git a/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/Log4JPerformanceStatusHandler.java b/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/Log4JPerformanceStatusHandler.java
new file mode 100644
index 0000000000..b543997390
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/Log4JPerformanceStatusHandler.java
@@ -0,0 +1,54 @@
+package com.raytheon.uf.common.status;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Log4j Performance status handler.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Feb 14, 2013 1584 mpduff Initial creation
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class Log4JPerformanceStatusHandler implements IPerformanceStatusHandler {
+ /** Logger */
+ private final Logger perfLog = Logger.getLogger("PerformanceLogger");
+
+ /** Prefix to append to all log messages */
+ private final String prefix;
+
+ /**
+ * Constructor.
+ *
+ * @param prefix
+ * Message prefix
+ */
+ public Log4JPerformanceStatusHandler(String prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void log(String message) {
+ perfLog.info(prefix + " " + message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void logDuration(String message, long timeMs) {
+ perfLog.info(prefix + " " + message + " took " + timeMs + " ms");
+ }
+}
diff --git a/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/PerformanceStatus.java b/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/PerformanceStatus.java
new file mode 100644
index 0000000000..e7dd793eb6
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.common.status/src/com/raytheon/uf/common/status/PerformanceStatus.java
@@ -0,0 +1,51 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ *
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ *
+ * Contractor Name: Raytheon Company
+ * Contractor Address: 6825 Pine Street, Suite 340
+ * Mail Stop B8
+ * Omaha, NE 68106
+ * 402.291.0100
+ *
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ **/
+package com.raytheon.uf.common.status;
+
+/**
+ * Performance Status class to handle logging of performance stats.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Feb 13, 2013 1584 mpduff Initial creation
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class PerformanceStatus {
+ /**
+ * Get a handler for performance logging.
+ *
+ * @param prefix
+ * A prefix to each log statement
+ * @return The handler
+ */
+ public static IPerformanceStatusHandler getHandler(String prefix) {
+ return new Log4JPerformanceStatusHandler(prefix);
+ }
+
+}
diff --git a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/utility/edex_static/base/stats/retrievalProcessStats.xml b/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/utility/edex_static/base/stats/retrievalProcessStats.xml
deleted file mode 100644
index 2759dde1d3..0000000000
--- a/edexOsgi/com.raytheon.uf.edex.datadelivery.retrieval/utility/edex_static/base/stats/retrievalProcessStats.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/utility/edex_static/base/stats/registryProcessStats.xml b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/utility/edex_static/base/stats/registryProcessStats.xml
deleted file mode 100644
index 7c3ed01ee8..0000000000
--- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/utility/edex_static/base/stats/registryProcessStats.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/edexOsgi/com.raytheon.uf.edex.stats/utility/edex_static/base/stats/edexProcessStats.xml b/edexOsgi/com.raytheon.uf.edex.stats/utility/edex_static/base/stats/edexProcessStats.xml
deleted file mode 100644
index 13264c5463..0000000000
--- a/edexOsgi/com.raytheon.uf.edex.stats/utility/edex_static/base/stats/edexProcessStats.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/tests/unit/com/raytheon/uf/edex/stats/MockEvent.java b/tests/unit/com/raytheon/uf/edex/stats/MockEvent.java
index 419ed5be0f..d6a7c629d8 100644
--- a/tests/unit/com/raytheon/uf/edex/stats/MockEvent.java
+++ b/tests/unit/com/raytheon/uf/edex/stats/MockEvent.java
@@ -166,4 +166,9 @@ public class MockEvent extends StatisticsEvent {
return super.toString() + " : " + getMessage();
}
+ @Override
+ public void finalizeEvent() {
+ // not implemented
+ }
+
}
\ No newline at end of file