Issue #20: Merge all changes from previous SVN repo to GIT.

Former-commit-id: 926a2a6a5af5b3514c29097deb0fc24b093643a2
This commit is contained in:
David Gillingham 2012-01-26 17:38:43 -06:00
parent bbea60b8ba
commit b056e18757
85 changed files with 2878 additions and 2315 deletions

2
.gitignore vendored
View file

@ -6,3 +6,5 @@ testbin/
testBin/
bin-test/
/Installer.rpm
/Installer.rpm

View file

@ -245,8 +245,8 @@ public class RemoteDataStore implements IDataStore {
}
@Override
public void repack(String dirName, Compression compression)
throws StorageException {
public void repack(Compression compression, String outputDir,
String timestampCheck) throws StorageException {
throw new StorageException("Operation not supported", null);
}

View file

@ -383,9 +383,9 @@ public class CachingDataStore implements IDataStore {
* com.raytheon.uf.common.datastorage.StorageProperties.Compression)
*/
@Override
public void repack(String dirName, Compression compression)
throws StorageException {
delegate.repack(dirName, compression);
public void repack(Compression compression, String outputDir,
String timestampCheck) throws StorageException {
delegate.repack(compression, outputDir, timestampCheck);
}
}

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="jboss-common-core.jar"/>
<classpathentry exported="true" kind="lib" path="jboss-logging-spi.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="jbosscache-core.jar"/>
<classpathentry kind="lib" path="jgroups_2.8.1GA.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.jboss.cache</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,55 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Cache Plug-in
Bundle-SymbolicName: org.jboss.cache
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: jbosscache-core.jar,
jboss-common-core.jar,
jboss-logging-spi.jar,
jgroups_2.8.1GA.jar
Bundle-Vendor: JBoss
Export-Package: org.jboss.cache,
org.jboss.cache.annotations,
org.jboss.cache.batch,
org.jboss.cache.buddyreplication,
org.jboss.cache.cluster,
org.jboss.cache.commands,
org.jboss.cache.commands.legacy,
org.jboss.cache.commands.legacy.read,
org.jboss.cache.commands.legacy.write,
org.jboss.cache.commands.read,
org.jboss.cache.commands.remote,
org.jboss.cache.commands.tx,
org.jboss.cache.commands.write,
org.jboss.cache.config,
org.jboss.cache.config.parsing,
org.jboss.cache.config.parsing.element,
org.jboss.cache.eviction,
org.jboss.cache.factories,
org.jboss.cache.factories.annotations,
org.jboss.cache.factories.context,
org.jboss.cache.interceptors,
org.jboss.cache.interceptors.base,
org.jboss.cache.invocation,
org.jboss.cache.io,
org.jboss.cache.jmx,
org.jboss.cache.jmx.annotations,
org.jboss.cache.loader,
org.jboss.cache.loader.bdbje,
org.jboss.cache.loader.jdbm,
org.jboss.cache.loader.s3,
org.jboss.cache.loader.tcp,
org.jboss.cache.lock,
org.jboss.cache.marshall,
org.jboss.cache.mvcc,
org.jboss.cache.notifications,
org.jboss.cache.notifications.annotation,
org.jboss.cache.notifications.event,
org.jboss.cache.optimistic,
org.jboss.cache.remoting.jgroups,
org.jboss.cache.statetransfer,
org.jboss.cache.transaction,
org.jboss.cache.util,
org.jboss.cache.util.concurrent,
org.jboss.cache.util.concurrent.locks,
org.jboss.cache.util.reflect

View file

@ -1,5 +0,0 @@
bin.includes = META-INF/,\
jbosscache-core.jar,\
jboss-common-core.jar,\
jboss-logging-spi.jar,\
jgroups_2.8.1GA.jar

View file

@ -5,7 +5,13 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?>
<pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
</pydev_project>

View file

@ -0,0 +1,82 @@
import os, subprocess, re, stat, sys, time
import h5py
matchRe = re.compile('.*?(-{1,2}\\d{6,}).h5')
def findEachGroup(group, datasetList):
if type(group) is h5py.highlevel.Group:
for g in group.keys():
findEachGroup(group[g], datasetList)
elif type(group) is h5py.highlevel.Dataset:
datasetList.append(group.name)
def processFile(filename, match):
startIndex = filename.find(match.groups()[0])
endIndex = filename.find('.h5')
reducedFilename = filename[0:startIndex] + filename[endIndex:]
if not os.path.exists(reducedFilename):
# this is the first one, just rename it
try:
os.rename(filename, reducedFilename)
except OSError, e:
print e
else:
# open the file, find the datasets
datasetList = []
hfile = None
try:
hfile = h5py.File(filename, 'r')
findEachGroup(hfile['/'], datasetList)
finally:
if hfile:
hfile.close()
fileSuccess = True
# for each dataset in the file, run h5copy it into the output file
for dataset in datasetList:
if not copy(filename, dataset, reducedFilename):
fileSuccess = False
# remove original file
if True: #if fileSuccess:
os.remove(filename)
def fileWalk(pth):
if os.path.isdir(pth):
innerFiles = os.listdir(pth)
for f in innerFiles:
fileWalk(pth + '/' + f)
else:
match = matchRe.match(pth)
if match:
processFile(pth, match)
def copy(filename, dataset, reducedFilename):
# note that this copies links as if they were real datasets, increasing the size of the output file
cmd = ['h5copy', '-p', '-i', filename, '-o', reducedFilename, '-s', dataset, '-d', dataset]
ret = subprocess.call(cmd)
success = (ret == 0)
if success:
os.chmod(reducedFilename, stat.S_IWUSR | stat.S_IWGRP | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
#print "Successfully copied filename:", filename, "dataset:", dataset
return True
else:
print "Failed to copy filename:", filename, "dataset:", dataset
return False
def main():
if len(sys.argv) < 2:
print "Please provide full path to input directory"
else:
inputDir = sys.argv[1]
t0 = time.time()
fileWalk(inputDir)
t1 = time.time()
print "Total copy time for directory", inputDir, (t1-t0), "seconds"
if __name__ == '__main__':
main()

View file

@ -0,0 +1,10 @@
#!/bin/sh
# This script should be run on dx1 as part of next delivery to remove the hdfFileId columns
tablesToUpdate=`psql -U awips -d metadata -t -c "select table_name from information_schema.columns where table_catalog='metadata' and table_schema='awips' and column_name = 'hdffileid';"`
for table in $tablesToUpdate
do
psql -U awips -d metadata -t -c "ALTER TABLE $table DROP COLUMN hdffileid"
done

1
edexOsgi/build.edex/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/tmp

View file

@ -63,6 +63,17 @@
</layout>
</appender>
<!-- Archive log -->
<appender name="ArchiveLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${edex.home}/logs/edex-${edex.run.mode}-archive-%d{yyyyMMdd}.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<!-- RouteFailedLog log -->
<appender name="RouteFailedLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
@ -219,6 +230,11 @@
<appender-ref ref="PurgeLog"/>
</logger>
<logger name="com.raytheon.uf.edex.maintenance.archive" additivity="false">
<level value="INFO"/>
<appender-ref ref="ArchiveLog"/>
</logger>
<logger name="RouteFailedLog" additivity="false">
<level value="WARN"/>
<appender-ref ref="RouteFailedLog"/>

View file

@ -48,7 +48,7 @@
<svcBackupDir>${env:edex.home}/../GFESuite/</svcBackupDir>
<mhsData>/data/fxa/mhs</mhsData>
<requestTimeLogFilter>1000</requestTimeLogFilter>
<requestSizeLogFilter>8</requestSizeLogFilter>
<responseSizeLogFilter>8</responseSizeLogFilter>
</properties>

View file

@ -25,3 +25,5 @@ qc.cron=0+2,7,12,17,22,27,32,37,42,47,52,57+*+*+*+?
acarssounding.cron=00+10,30,50+*+*+*+?
gfe.cron=0+15+*+*+*+?
repack.cron=0+20+*+*+*+?
# runs database and hdf5 archive for archive server to pull data from
archive.cron=0+0+*+*+*+?

View file

@ -1282,12 +1282,6 @@
install-size="0"
version="0.0.0"/>
<plugin
id="org.jboss.cache"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.edex.purgesrv"
download-size="0"

View file

@ -13,12 +13,12 @@
<constructor-arg value="jms-dist:queue:Ingest.binlightning?destinationResolver=#qpidDurableResolver" />
</bean>
<bean id="binlightningCamelRegistered" factory-bean="contextManager"
<bean id="binlightningCamelRegistered" factory-bean="clusteredCamelContextMgr"
factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="binlightning-camel"/>
<constructor-arg ref="clusteredBinLightningRoutes" />
</bean>
<camelContext id="binlightning-camel"
<camelContext id="clusteredBinLightningRoutes"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">

View file

@ -19,10 +19,7 @@
**/
package com.raytheon.edex.plugin.bufrmos.common;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.CascadeType;
import javax.persistence.Embedded;
@ -230,26 +227,6 @@ public abstract class BufrMosData extends PersistablePluginDataObject implements
return null;
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
*
*/
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
public BufrMosDataLocation getLocation() {
return location;
}

View file

@ -21,7 +21,6 @@ package com.raytheon.edex.plugin.ldadprofiler.common;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -254,6 +253,7 @@ public class ProfilerLdadObs extends PersistablePluginDataObject implements
/**
* @return the pdv
*/
@Override
public PointDataView getPointDataView() {
return pdv;
}
@ -265,6 +265,7 @@ public class ProfilerLdadObs extends PersistablePluginDataObject implements
* @param pdv
* the pdv to set
*/
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@ -315,21 +316,6 @@ public class ProfilerLdadObs extends PersistablePluginDataObject implements
this.location = location;
}
/**
*
*/
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
*
*
*/
public void setPersistenceTime(Date persistTime) {
}
/**
* @return the location
*/

View file

@ -21,7 +21,6 @@ package com.raytheon.edex.plugin.modelsounding.common;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
@ -894,15 +893,4 @@ public class SoundingSite extends PersistablePluginDataObject implements
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.edex.plugin.redbook.common;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -37,7 +36,7 @@ import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.DataTime;
@ -67,8 +66,8 @@ import com.raytheon.uf.common.time.DataTime;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class RedbookRecord extends PersistablePluginDataObject implements
IPersistable, Cloneable {
public class RedbookRecord extends ServerSpecificPersistablePluginDataObject
implements IPersistable, Cloneable {
private static final long serialVersionUID = 1L;
@ -322,30 +321,6 @@ public class RedbookRecord extends PersistablePluginDataObject implements
return null;
}
/**
*
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* @return a mostly shallow copy of the RedbookRecord with the reference
* time set back one minute. Clears the id and dataURI fields of the
@ -362,10 +337,11 @@ public class RedbookRecord extends PersistablePluginDataObject implements
other.dataURI = null;
Date newRefTime = new Date(dataTime.getRefTime().getTime() - 60 * 1000);
if (dataTime.getUtilityFlags().contains(DataTime.FLAG.FCST_USED))
if (dataTime.getUtilityFlags().contains(DataTime.FLAG.FCST_USED)) {
other.dataTime = new DataTime(newRefTime, dataTime.getFcstTime());
else
} else {
other.dataTime = new DataTime(newRefTime);
}
return other;
}

View file

@ -19,10 +19,19 @@
**/
package com.raytheon.edex.plugin.text.dao;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.raytheon.edex.db.dao.DefaultPluginDao;
import com.raytheon.edex.textdb.dao.StdTextProductDao;
import com.raytheon.edex.textdb.dbapi.impl.TextDB;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.dataquery.db.QueryParam.QueryOperand;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.purge.PurgeLogger;
import com.raytheon.uf.edex.database.query.DatabaseQuery;
/**
* DAO for text products
@ -55,9 +64,46 @@ public class TextDao extends DefaultPluginDao {
// no op
}
@Override
public void purgeExpiredData() throws PluginException {
int deletedRecords = TextDB.purgeStdTextProducts();
PurgeLogger.logInfo("Purged " + deletedRecords + " items total.",
"text");
}
@SuppressWarnings("unchecked")
@Override
public List<PersistableDataObject> getRecordsToArchive(
Calendar insertStartTime, Calendar insertEndTime)
throws DataAccessLayerException {
StdTextProductDao dao = new StdTextProductDao(true);
DatabaseQuery dbQuery = new DatabaseQuery(dao.getDaoClass());
dbQuery.addQueryParam("createtime", insertStartTime.getTimeInMillis(),
QueryOperand.GREATERTHANEQUALS);
dbQuery.addQueryParam("createtime", insertEndTime.getTimeInMillis(),
QueryOperand.LESSTHAN);
dbQuery.addOrder("createtime", true);
return (List<PersistableDataObject>) this.queryByCriteria(dbQuery);
}
@Override
public Date getMinInsertTime(String productKey)
throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(this.daoClass);
List<String[]> keys = this.getProductKeyParameters(productKey);
for (String[] key : keys) {
query.addQueryParam(key[0], key[1]);
}
query.addReturnedField("createime");
query.addOrder("createtime", true);
query.setMaxResults(1);
@SuppressWarnings("unchecked")
List<Long> result = (List<Long>) this.queryByCriteria(query);
if (result.isEmpty()) {
return null;
} else {
return new Date(result.get(0));
}
}
}

View file

@ -87,11 +87,13 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
private static UnitConverter ftToHft = NonSI.FOOT.getConverterTo(SI.HECTO(NonSI.FOOT));
private static UnitConverter ftToHft = NonSI.FOOT.getConverterTo(SI
.HECTO(NonSI.FOOT));
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
//private static final HashMap<Integer, String> WX_MAP = new HashMap<Integer, String>();
// private static final HashMap<Integer, String> WX_MAP = new
// HashMap<Integer, String>();
static {
PARM_MAP.put("T", SFC_TEMP);
@ -101,16 +103,16 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
PARM_MAP.put("NLON", STA_LON);
PARM_MAP.put("FLT_LVL", UA_FLTLVL);
// WX_MAP.put(0, "CLR");
// WX_MAP.put(1, "SCT");
// WX_MAP.put(2, "BKN");
// WX_MAP.put(3, "CONT");
// WX_MAP.put(4, "LIGHTNING");
// WX_MAP.put(5, "DZRA");
// WX_MAP.put(6, "CONT RA");
// WX_MAP.put(7, "CONT SN");
// WX_MAP.put(8, "SH");
// WX_MAP.put(9, "TSRA");
// WX_MAP.put(0, "CLR");
// WX_MAP.put(1, "SCT");
// WX_MAP.put(2, "BKN");
// WX_MAP.put(3, "CONT");
// WX_MAP.put(4, "LIGHTNING");
// WX_MAP.put(5, "DZRA");
// WX_MAP.put(6, "CONT RA");
// WX_MAP.put(7, "CONT SN");
// WX_MAP.put(8, "SH");
// WX_MAP.put(9, "TSRA");
}
@Column
@ -544,7 +546,7 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
@Override
public String[] getStrings(String paramName) {
if ("FLT_HZD".matches(paramName) && flightHazard != null) {
String[] flightHazards = {flightHazard.toString()};
String[] flightHazards = { flightHazard.toString() };
return flightHazards;
}
return null;
@ -568,7 +570,7 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
return getReportData();
}
private String buildMessageData(){
private String buildMessageData() {
String s = "";
String lat = String.valueOf(location.getLatitude());
@ -577,15 +579,17 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
String lonDir = location.getLongitude() > 0 ? "E" : "W";
String hour = "";
String minute = "";
if(timeObs != null){
if (timeObs != null) {
hour = String.valueOf(timeObs.get(Calendar.HOUR_OF_DAY));
minute = String.valueOf(timeObs.get(Calendar.MINUTE));
}
String flightLevel = String.valueOf((int)ftToHft.convert(location.getFlightLevel()));
String wind = windDirection != null?
String.valueOf(windDirection.intValue()) + "/"
+ String.valueOf(windSpeed.intValue()) + "KT": "";
//String wx = flightWeather != null? WX_MAP.get(flightWeather) : "";
String flightLevel = String.valueOf((int) ftToHft.convert(location
.getFlightLevel()));
String wind = windDirection != null && windSpeed != null ? String
.valueOf(windDirection.intValue())
+ "/"
+ String.valueOf(windSpeed.intValue()) + "KT" : "";
// String wx = flightWeather != null? WX_MAP.get(flightWeather) : "";
lat = formatLatLon(lat);
lon = formatLatLon(lon);
String temperature = "";
@ -593,7 +597,8 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
if (temp > 0) {
temperature = "P" + temp.intValue();
} else {
temperature = "M" + String.valueOf(temp.intValue()).substring(1);
temperature = "M"
+ String.valueOf(temp.intValue()).substring(1);
}
}
if (hour.length() < 2) {
@ -602,37 +607,36 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
if (minute.length() < 2) {
minute = "0" + minute;
}
s = "ARP " + location.getStationId() + " "
+ lat + latDir + " " + lon + lonDir + " "
+ hour + minute + " F" + flightLevel
+ " " + temperature + " " + wind
+ "TB";
s = "ARP " + location.getStationId() + " " + lat + latDir + " " + lon
+ lonDir + " " + hour + minute + " F" + flightLevel + " "
+ temperature + " " + wind + "TB";
return s;
}
private String formatLatLon(String str){
str = str.startsWith("-")? str.substring(1) : str;
private String formatLatLon(String str) {
str = str.startsWith("-") ? str.substring(1) : str;
int decimalIndex = str.indexOf(".");
if(decimalIndex != -1){
if (decimalIndex != -1) {
String temp = str.substring(decimalIndex + 1);
if(temp.length() > 3){
if (temp.length() > 3) {
temp = temp.substring(0, 3);
} else if (temp.length() != 3) {
while(temp.length() != 3){
while (temp.length() != 3) {
temp += "0";
}
}
str = str.substring(0,decimalIndex) + temp;
str = str.substring(0, decimalIndex) + temp;
}
return str;
}
/**
* Returns the hashCode for this object. This implementation
* returns the hashCode of the generated dataURI.
* Returns the hashCode for this object. This implementation returns the
* hashCode of the generated dataURI.
*
* @see java.lang.Object#hashCode()
*/
@Override
@ -645,26 +649,31 @@ public class AirepRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* Checks if this record is equal to another by checking the
* generated dataURI.
* Checks if this record is equal to another by checking the generated
* dataURI.
*
* @param obj
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
AirepRecord other = (AirepRecord) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI()))
} else if (!getDataURI().equals(other.getDataURI())) {
return false;
}
return true;
}

View file

@ -20,8 +20,6 @@
package com.raytheon.uf.common.dataplugin.binlightning;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -37,7 +35,7 @@ import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.StorageException;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
@ -80,8 +78,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
@XmlRootElement
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class BinLightningRecord extends PersistablePluginDataObject implements
IPersistable {
public class BinLightningRecord extends
ServerSpecificPersistablePluginDataObject implements IPersistable {
/** Serializable id * */
private static final long serialVersionUID = 1L;
@ -187,33 +185,6 @@ public class BinLightningRecord extends PersistablePluginDataObject implements
// super(message);
// }
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data. Returns null if either start
* or stop time are not valid.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Track the current persistence time for the data set.
*/
@ -239,8 +210,8 @@ public class BinLightningRecord extends PersistablePluginDataObject implements
if (insertIndex < obsTimes.length) {
long t1 = startTimeMillis;
Calendar c = TimeTools.getBaseCalendar(strike.getYear(), strike
.getMonth(), strike.getDay());
Calendar c = TimeTools.getBaseCalendar(strike.getYear(),
strike.getMonth(), strike.getDay());
c.set(Calendar.HOUR_OF_DAY, strike.getHour());
c.set(Calendar.MINUTE, strike.getMinute());

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.bufrascat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -372,14 +371,4 @@ public class AScatObs extends PersistablePluginDataObject implements
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.bufrhdw;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -631,18 +630,10 @@ public class BufrHDWObs extends PersistablePluginDataObject implements
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
/**
* Returns the hashCode for this object. This implementation
* returns the hashCode of the generated dataURI.
* Returns the hashCode for this object. This implementation returns the
* hashCode of the generated dataURI.
*
* @see java.lang.Object#hashCode()
*/
@Override
@ -655,26 +646,31 @@ public class BufrHDWObs extends PersistablePluginDataObject implements
}
/**
* Checks if this record is equal to another by checking the
* generated dataURI.
* Checks if this record is equal to another by checking the generated
* dataURI.
*
* @param obj
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
BufrHDWObs other = (BufrHDWObs) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI()))
} else if (!getDataURI().equals(other.getDataURI())) {
return false;
}
return true;
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.bufrmthdw;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -631,15 +630,6 @@ public class BufrMTHDWObs extends PersistablePluginDataObject implements
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
/**
* Returns the hashCode for this object. This implementation returns the
* hashCode of the generated dataURI.
@ -664,19 +654,23 @@ public class BufrMTHDWObs extends PersistablePluginDataObject implements
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
BufrMTHDWObs other = (BufrMTHDWObs) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI()))
} else if (!getDataURI().equals(other.getDataURI())) {
return false;
}
return true;
}
}

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.dataplugin.ncwf;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Embedded;
import javax.persistence.Entity;
@ -273,14 +272,4 @@ public class BUFRncwf extends PersistablePluginDataObject implements
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.bufrquikscat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -372,14 +371,4 @@ public class QUIKScatObs extends PersistablePluginDataObject implements
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
}

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.dataplugin.bufrsigwx;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -293,15 +292,6 @@ public class SigWxData extends PersistablePluginDataObject implements
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
/**
*
* @return

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.bufrssmi;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -326,15 +325,6 @@ public class SSMIScanData extends PersistablePluginDataObject implements
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
/**
*
* @return
@ -353,8 +343,9 @@ public class SSMIScanData extends PersistablePluginDataObject implements
}
/**
* Returns the hashCode for this object. This implementation
* returns the hashCode of the generated dataURI.
* Returns the hashCode for this object. This implementation returns the
* hashCode of the generated dataURI.
*
* @see java.lang.Object#hashCode()
*/
@Override
@ -367,26 +358,31 @@ public class SSMIScanData extends PersistablePluginDataObject implements
}
/**
* Checks if this record is equal to another by checking the
* generated dataURI.
* Checks if this record is equal to another by checking the generated
* dataURI.
*
* @param obj
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
SSMIScanData other = (SSMIScanData) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI()))
} else if (!getDataURI().equals(other.getDataURI())) {
return false;
}
return true;
}

View file

@ -24,7 +24,6 @@ import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
@ -103,12 +102,12 @@ public class UAObs extends PersistablePluginDataObject implements
String wmoA = a.getWmoHeader();
String wmoB = b.getWmoHeader();
if(wmoA != null) {
if(wmoB != null) {
if (wmoA != null) {
if (wmoB != null) {
compValue = wmoA.compareTo(wmoB);
}
}
if(compValue != 0) {
if (compValue != 0) {
compValue *= -1;
}
return compValue;
@ -589,15 +588,6 @@ public class UAObs extends PersistablePluginDataObject implements
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
/**
* Get the value of a parameter that is represented as a String.
*
@ -835,31 +825,36 @@ public class UAObs extends PersistablePluginDataObject implements
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
UAObs other = (UAObs) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI()))
} else if (!getDataURI().equals(other.getDataURI())) {
return false;
}
return true;
}
/**
* Returns a
*
* @param obsList
* @return
*/
public static final List<UAObs> sortByCorrection(List<UAObs> obsList) {
// No need to sort for null, empty, or one item.
if((obsList != null) && (obsList.size() > 1)) {
if ((obsList != null) && (obsList.size() > 1)) {
Collections.sort(obsList, getCorComparator());
}
return obsList;
@ -869,12 +864,12 @@ public class UAObs extends PersistablePluginDataObject implements
return corComparator;
}
@Override
public String toString() {
return wmoHeader;
}
public static final void main(String [] args) {
public static final void main(String[] args) {
List<UAObs> obsList = new ArrayList<UAObs>();
UAObs obsA = new UAObs();
@ -897,17 +892,10 @@ public class UAObs extends PersistablePluginDataObject implements
int c = UAObs.getCorComparator().compare(obsA, obsB);
System.out.println(c);
UAObs test = new UAObs("/bufrua/2011-10-07_00:00:00.0/2022/null/IUSZ52_KWBC_070040/72634/44.90833/-84.71944");
UAObs test = new UAObs(
"/bufrua/2011-10-07_00:00:00.0/2022/null/IUSZ52_KWBC_070040/72634/44.90833/-84.71944");
System.out.println(test.dataURI);
}
}

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.dataplugin.cwa;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Embedded;
import javax.persistence.Entity;
@ -170,22 +169,6 @@ public class CWARecord extends PersistablePluginDataObject implements
this.pdv = pdv;
}
/**
*
* @return The time to use for persistence.
*/
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
* @persistTime
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View file

@ -20,10 +20,7 @@
package com.raytheon.uf.common.dataplugin.cwat;
import java.io.ByteArrayInputStream;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -45,7 +42,7 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.radar.RadarStation;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
@ -83,8 +80,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class CWATRecord extends PersistablePluginDataObject implements
IPersistable, ISpatialEnabled {
public class CWATRecord extends ServerSpecificPersistablePluginDataObject
implements IPersistable, ISpatialEnabled {
private static final long serialVersionUID = 76774564365671L;
@ -347,32 +344,6 @@ public class CWATRecord extends PersistablePluginDataObject implements
return maxScti;
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Get the IDecoderGettable reference for this record.
*
@ -484,8 +455,8 @@ public class CWATRecord extends PersistablePluginDataObject implements
if (getThreats().size() < 1) {
ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
getDataURI(), THREATS, Request.ALL);
ByteArrayInputStream bais = new ByteArrayInputStream(byteData
.getByteData());
ByteArrayInputStream bais = new ByteArrayInputStream(
byteData.getByteData());
Object o = DynamicSerializationManager.getManager(
SerializationType.Thrift).deserialize(bais);
setThreats((HashMap<ThreatLocation, ThreatReport>) o);

View file

@ -22,12 +22,10 @@ package com.raytheon.uf.common.dataplugin.ffmp;
import java.awt.Point;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -42,7 +40,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.StorageException;
@ -79,8 +77,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class FFMPRecord extends PersistablePluginDataObject implements
IPersistable {
public class FFMPRecord extends ServerSpecificPersistablePluginDataObject
implements IPersistable {
private static final long serialVersionUID = 76774564365671L;
@ -299,32 +297,6 @@ public class FFMPRecord extends PersistablePluginDataObject implements
return sourceName;
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Get the IDecoderGettable reference for this record.
*

View file

@ -20,8 +20,6 @@
package com.raytheon.uf.common.dataplugin.fog;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -42,7 +40,7 @@ import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.fog.analysis.FogRange;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IntegerDataRecord;
@ -71,8 +69,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class FogRecord extends PersistablePluginDataObject implements
IPersistable {
public class FogRecord extends ServerSpecificPersistablePluginDataObject
implements IPersistable {
private static final long serialVersionUID = 76774564365671L;
@ -380,32 +378,6 @@ public class FogRecord extends PersistablePluginDataObject implements
this.lon = lon;
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Get the IDecoderGettable reference for this record.
*
@ -690,7 +662,8 @@ public class FogRecord extends PersistablePluginDataObject implements
}
/**
* @param refHour the refHour to set
* @param refHour
* the refHour to set
*/
public void setRefHour(Calendar refHour) {
this.refHour = refHour;

View file

@ -2,9 +2,7 @@ package com.raytheon.uf.common.dataplugin.fssobs;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.TimeZone;
import javax.measure.quantity.Angle;
import javax.measure.quantity.DataAmount;
@ -74,7 +72,6 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
public static final Unit<DataAmount> CLOUD_COVER = NonSI.OCTET;
/** Metar specific parameter keys */
public static final class ParameterKey {
public static final String SFC_ALTIMETER = "SFC.PRESS.ALTIMETER";
@ -160,7 +157,7 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
@Column
private Calendar refHour;
//Raw message
// Raw message
@Transient
@DynamicSerializeElement
@XmlElement
@ -176,7 +173,7 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
@Transient
@DynamicSerializeElement
@XmlElement
private float windGust = -9999; ;
private float windGust = -9999;;
// Observed maximum wind speed in knots
@Transient
@ -214,7 +211,6 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
@XmlElement
private float visibility = -9999;
// Observed visibility in meters for Maritime obs.
@Transient
@DynamicSerializeElement
@ -239,13 +235,13 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
@DynamicSerializeElement
private Integer wavePeriod = -9999;
//in Azimuth degrees
// in Azimuth degrees
@Transient
@XmlElement
@DynamicSerializeElement
private Double primarySwellWaveDir = -9999.0;
//in seconds
// in seconds
@Transient
@XmlElement
@DynamicSerializeElement
@ -275,11 +271,11 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
@DynamicSerializeElement
private Double secondarySwellWaveHeight = -9999.0;
// // Pressure in inches of mercury
// @Transient
// @DynamicSerializeElement
// @XmlElement
// private float pressure = -9999;
// // Pressure in inches of mercury
// @Transient
// @DynamicSerializeElement
// @XmlElement
// private float pressure = -9999;
// Three-hour pressure change in thousandths of an inch of mercury ????
@Transient
@ -377,7 +373,6 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
@Transient
private String[] skyCover;
@XmlElement
@DynamicSerializeElement
@Transient
@ -386,7 +381,7 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
@Embedded
private PointDataView pdv;
//----------------------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------------------
public FSSObsRecord() {
}
@ -394,28 +389,11 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
super(uri);
}
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
@Override
public Amount getValue(String paramName) {
Amount a = null;
@ -434,8 +412,9 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
a = new Amount(windGust, WIND_SPEED_UNIT);
} else if (PRES_SLP.equals(pName) && (seaLevelPress != -9999f)) {
a = new Amount(seaLevelPress, PRESSURE_UNIT);
// } else if (PRES_ALTSG.equals(pName) && (pressureAltimeter != -9999f)) {
// a = new Amount(pressureAltimeter, PRESSURE_UNIT);
// } else if (PRES_ALTSG.equals(pName) && (pressureAltimeter !=
// -9999f)) {
// a = new Amount(pressureAltimeter, PRESSURE_UNIT);
} else if (STA_LAT.equals(pName)) {
a = new Amount(this.getLatitude(), LOCATION_UNIT);
} else if (STA_LON.equals(pName)) {
@ -448,8 +427,9 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
a = new Amount(primarySwellWavePeriod, WAVE_UNIT);
} else if ("SWH".equals(pName)) {
a = new Amount(primarySwellWaveHeight, WAVE_UNIT);
// } else if ("PCHNG".equals(pName) && pressChange3Hour != MISSING) {
// a = new Amount(pressChange3Hour, PRESSURE_UNIT);
// } else if ("PCHNG".equals(pName) && pressChange3Hour != MISSING)
// {
// a = new Amount(pressChange3Hour, PRESSURE_UNIT);
} else if ("PKWND".equals(paramName) && maxWindSpeed != MISSING) {
a = new Amount(maxWindSpeed, WIND_SPEED_UNIT);
} else if ("SWS".equals(paramName) || "SWGS".equals(paramName)) {
@ -476,7 +456,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param monitorUse the monitorUse to set
* @param monitorUse
* the monitorUse to set
*/
public void setMonitorUse(String monitorUse) {
this.monitorUse = monitorUse;
@ -511,7 +492,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param platformId the platformId to set
* @param platformId
* the platformId to set
*/
public void setPlatformId(String platformId) {
this.platformId = platformId;
@ -616,12 +598,12 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
return windChill;
}
// /**
// * @return the highResWaveHeight
// */
// public float getHighResWaveHeight() {
// return highResWaveHeight;
// }
// /**
// * @return the highResWaveHeight
// */
// public float getHighResWaveHeight() {
// return highResWaveHeight;
// }
/**
* @return the waveSteepness
@ -700,20 +682,20 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
return secondarySwellWaveHeight;
}
// /**
// * @return the pressure
// */
// public float getPressure() {
// return pressure;
// }
//
//
// /**
// * @return the pressChangeChar
// */
// public String getPressChangeChar() {
// return pressChangeChar;
// }
// /**
// * @return the pressure
// */
// public float getPressure() {
// return pressure;
// }
//
//
// /**
// * @return the pressChangeChar
// */
// public String getPressChangeChar() {
// return pressChangeChar;
// }
/**
* @return the dewpoint
@ -737,7 +719,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param pressureAltimeter the pressureAltimeter to set
* @param pressureAltimeter
* the pressureAltimeter to set
*/
public void setPressureAltimeter(float pressureAltimeter) {
this.pressureAltimeter = pressureAltimeter;
@ -751,7 +734,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param pressChange3Hour the pressChange3Hour to set
* @param pressChange3Hour
* the pressChange3Hour to set
*/
public void setPressChange3Hour(float pressChange3Hour) {
this.pressChange3Hour = pressChange3Hour;
@ -800,7 +784,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param ceiling the ceiling to set
* @param ceiling
* the ceiling to set
*/
public void setCeiling(float ceiling) {
this.ceiling = ceiling;
@ -828,42 +813,48 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param isNew the isNew to set
* @param isNew
* the isNew to set
*/
public void setIsNew(boolean isNew) {
this.isNew = isNew;
}
/**
* @param cwa the cwa to set
* @param cwa
* the cwa to set
*/
public void setCwa(String cwa) {
this.cwa = cwa;
}
/**
* @param stnName the stnName to set
* @param stnName
* the stnName to set
*/
public void setStnName(String stnName) {
this.stnName = stnName;
}
/**
* @param reportType the reportType to set
* @param reportType
* the reportType to set
*/
public void setReportType(String reportType) {
this.reportType = reportType;
}
/**
* @param location the location to set
* @param location
* the location to set
*/
public void setLocation(SurfaceObsLocation location) {
this.location = location;
}
/**
* @param isStationary the isStationary to set
* @param isStationary
* the isStationary to set
*/
public void setIsStationary(boolean isStationary) {
this.isStationary = isStationary;
@ -874,7 +865,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param timeObs the timeObs to set
* @param timeObs
* the timeObs to set
*/
public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs;
@ -888,49 +880,56 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param refHour the refHour to set
* @param refHour
* the refHour to set
*/
public void setRefHour(Calendar refHour) {
this.refHour = refHour;
}
/**
* @param rawMessage the rawMessage to set
* @param rawMessage
* the rawMessage to set
*/
public void setRawMessage(String rawMessage) {
this.rawMessage = rawMessage;
}
/**
* @param windSpeed the windSpeed to set
* @param windSpeed
* the windSpeed to set
*/
public void setWindSpeed(float windSpeed) {
this.windSpeed = windSpeed;
}
/**
* @param windGust the windGust to set
* @param windGust
* the windGust to set
*/
public void setWindGust(float windGust) {
this.windGust = windGust;
}
/**
* @param maxWindSpeed the maxWindSpeed to set
* @param maxWindSpeed
* the maxWindSpeed to set
*/
public void setMaxWindSpeed(float maxWindSpeed) {
this.maxWindSpeed = maxWindSpeed;
}
/**
* @param windDir the windDir to set
* @param windDir
* the windDir to set
*/
public void setWindDir(float windDir) {
this.windDir = windDir;
}
/**
* @param windChill the windChill to set
* @param windChill
* the windChill to set
*/
public void setWindChill(float windChill) {
this.windChill = windChill;
@ -953,14 +952,16 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param visibility the visibility to set
* @param visibility
* the visibility to set
*/
public void setVisibility(float visibility) {
this.visibility = visibility;
}
/**
* @param horzVisibility the horzVisibility to set
* @param horzVisibility
* the horzVisibility to set
*/
public void setHorzVisibility(float horzVisibility) {
this.horzVisibility = horzVisibility;
@ -974,70 +975,80 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param temperature the temperature to set
* @param temperature
* the temperature to set
*/
public void setTemperature(float temperature) {
this.temperature = temperature;
}
/**
* @param waveHeight the waveHeight to set
* @param waveHeight
* the waveHeight to set
*/
public void setWaveHeight(Double waveHeight) {
this.waveHeight = waveHeight;
}
/**
* @param wavePeriod the wavePeriod to set
* @param wavePeriod
* the wavePeriod to set
*/
public void setWavePeriod(Integer wavePeriod) {
this.wavePeriod = wavePeriod;
}
/**
* @param primarySwellWaveDir the primarySwellWaveDir to set
* @param primarySwellWaveDir
* the primarySwellWaveDir to set
*/
public void setPrimarySwellWaveDir(Double primarySwellWaveDir) {
this.primarySwellWaveDir = primarySwellWaveDir;
}
/**
* @param primarySwellWavePeriod the primarySwellWavePeriod to set
* @param primarySwellWavePeriod
* the primarySwellWavePeriod to set
*/
public void setPrimarySwellWavePeriod(Integer primarySwellWavePeriod) {
this.primarySwellWavePeriod = primarySwellWavePeriod;
}
/**
* @param primarySwellWaveHeight the primarySwellWaveHeight to set
* @param primarySwellWaveHeight
* the primarySwellWaveHeight to set
*/
public void setPrimarySwellWaveHeight(Double primarySwellWaveHeight) {
this.primarySwellWaveHeight = primarySwellWaveHeight;
}
/**
* @param secondarySwellWaveDir the secondarySwellWaveDir to set
* @param secondarySwellWaveDir
* the secondarySwellWaveDir to set
*/
public void setSecondarySwellWaveDir(Double secondarySwellWaveDir) {
this.secondarySwellWaveDir = secondarySwellWaveDir;
}
/**
* @param secondarySwellWavePeriod the secondarySwellWavePeriod to set
* @param secondarySwellWavePeriod
* the secondarySwellWavePeriod to set
*/
public void setSecondarySwellWavePeriod(Integer secondarySwellWavePeriod) {
this.secondarySwellWavePeriod = secondarySwellWavePeriod;
}
/**
* @param secondarySwellWaveHeight the secondarySwellWaveHeight to set
* @param secondarySwellWaveHeight
* the secondarySwellWaveHeight to set
*/
public void setSecondarySwellWaveHeight(Double secondarySwellWaveHeight) {
this.secondarySwellWaveHeight = secondarySwellWaveHeight;
}
/**
* @param pressChangeChar the pressChangeChar to set
* @param pressChangeChar
* the pressChangeChar to set
*/
public void setPressChangeChar(String pressChangeChar) {
this.pressChangeChar = pressChangeChar;
@ -1051,28 +1062,32 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param dewpoint the dewpoint to set
* @param dewpoint
* the dewpoint to set
*/
public void setDewpoint(float dewpoint) {
this.dewpoint = dewpoint;
}
/**
* @param seaSurfaceTemp the seaSurfaceTemp to set
* @param seaSurfaceTemp
* the seaSurfaceTemp to set
*/
public void setSeaSurfaceTemp(float seaSurfaceTemp) {
this.seaSurfaceTemp = seaSurfaceTemp;
}
/**
* @param seaLevelPress the seaLevelPress to set
* @param seaLevelPress
* the seaLevelPress to set
*/
public void setSeaLevelPress(float seaLevelPress) {
this.seaLevelPress = seaLevelPress;
}
/**
* @param hourlyPrecip the hourlyPrecip to set
* @param hourlyPrecip
* the hourlyPrecip to set
*/
public void setHourlyPrecip(float hourlyPrecip) {
this.hourlyPrecip = hourlyPrecip;
@ -1086,42 +1101,48 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param snowDepth the snowDepth to set
* @param snowDepth
* the snowDepth to set
*/
public void setSnowDepth(float snowDepth) {
this.snowDepth = snowDepth;
}
/**
* @param snincrHourly the snincrHourly to set
* @param snincrHourly
* the snincrHourly to set
*/
public void setSnincrHourly(float snincrHourly) {
this.snincrHourly = snincrHourly;
}
/**
* @param snincrTotal the snincrTotal to set
* @param snincrTotal
* the snincrTotal to set
*/
public void setSnincrTotal(float snincrTotal) {
this.snincrTotal = snincrTotal;
}
/**
* @param frostbiteTime the frostbiteTime to set
* @param frostbiteTime
* the frostbiteTime to set
*/
public void setFrostbiteTime(float frostbiteTime) {
this.frostbiteTime = frostbiteTime;
}
/**
* @param relativeHumidity the relativeHumidity to set
* @param relativeHumidity
* the relativeHumidity to set
*/
public void setRelativeHumidity(float relativeHumidity) {
this.relativeHumidity = relativeHumidity;
}
/**
* @param presWeather the presWeather to set
* @param presWeather
* the presWeather to set
*/
public void setPresWeather(String[] presWeather) {
this.presWeather = presWeather;
@ -1135,7 +1156,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param dewpointDepr the dewpointDepr to set
* @param dewpointDepr
* the dewpointDepr to set
*/
public void setDewpointDepr(float dewpointDepr) {
this.dewpointDepr = dewpointDepr;
@ -1149,14 +1171,16 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param skyCover the skyCover to set
* @param skyCover
* the skyCover to set
*/
public void setSkyCover(String[] skyCover) {
this.skyCover = skyCover;
}
/**
* @param totCloudAmount the totCloudAmount to set
* @param totCloudAmount
* the totCloudAmount to set
*/
public void setTotCloudAmount(int totCloudAmount) {
this.totCloudAmount = totCloudAmount;
@ -1170,7 +1194,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param pdv the pdv to set
* @param pdv
* the pdv to set
*/
public void setPdv(PointDataView pdv) {
this.pdv = pdv;
@ -1197,7 +1222,8 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
}
/**
* @param pdv the pdv to set
* @param pdv
* the pdv to set
*/
@Override
public void setPointDataView(PointDataView pdv) {
@ -1212,7 +1238,6 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
return pdv;
}
/**
* Used for debugging.
*/
@ -1222,14 +1247,14 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
sb.append("fssObsRec:\n\t");
if (this != null) {
sb.append(this.getDataURI() + "\n\t");
sb.append(this.getLocation().getStationId() + " ===> " + this.getStnName() + "\n\t");
sb.append(this.getLocation().getStationId() + " ===> "
+ this.getStnName() + "\n\t");
sb.append("Latitude = " + this.getLocation().getLatitude() + "\n\t");
sb.append("Longitude = " + this.getLocation().getLongitude() + "\n\t");
sb.append("Longitude = " + this.getLocation().getLongitude()
+ "\n\t");
sb.append(this.getReportType() + "\n\t");
sb.append("Visibility = " + this.getVisibility()
+ "\n\t");
sb.append("Temperature = " + this.getTemperature()
+ "\n\t");
sb.append("Visibility = " + this.getVisibility() + "\n\t");
sb.append("Temperature = " + this.getTemperature() + "\n\t");
sb.append(this.getDataTime().getRefTime() + "\n");
}
return sb.toString();

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.common.dataplugin.goessounding;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -507,15 +506,4 @@ public class GOESSounding extends PersistablePluginDataObject implements
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
}

View file

@ -22,8 +22,6 @@ package com.raytheon.uf.common.dataplugin.grib;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@ -242,22 +240,6 @@ public class GribRecord extends PersistablePluginDataObject implements
return null;
}
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
@Override
public ISpatialObject getSpatialObject() {
return modelInfo.getLocation();
@ -493,6 +475,7 @@ public class GribRecord extends PersistablePluginDataObject implements
this.resCompFlags = resCompFlags;
}
@Override
public void setId(int id) {
this.id = id;
}
@ -523,12 +506,15 @@ public class GribRecord extends PersistablePluginDataObject implements
@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
GribRecord other = (GribRecord) obj;
if (!this.dataTime.getRefTimeAsCalendar().equals(
other.getDataTime().getRefTimeAsCalendar())) {
@ -541,42 +527,59 @@ public class GribRecord extends PersistablePluginDataObject implements
return false;
}
if (gridVersion != other.gridVersion)
if (gridVersion != other.gridVersion) {
return false;
if (!Arrays.equals(hybridCoordList, other.hybridCoordList))
}
if (!Arrays.equals(hybridCoordList, other.hybridCoordList)) {
return false;
if (hybridGrid != other.hybridGrid)
}
if (hybridGrid != other.hybridGrid) {
return false;
if (isVector != other.isVector)
}
if (isVector != other.isVector) {
return false;
if (!Arrays.equals(localSection, other.localSection))
}
if (!Arrays.equals(localSection, other.localSection)) {
return false;
if (localSectionUsed != other.localSectionUsed)
}
if (localSectionUsed != other.localSectionUsed) {
return false;
if (localTableVersion != other.localTableVersion)
}
if (localTableVersion != other.localTableVersion) {
return false;
if (masterTableVersion != other.masterTableVersion)
}
if (masterTableVersion != other.masterTableVersion) {
return false;
}
if (modelInfo == null) {
if (other.modelInfo != null)
if (other.modelInfo != null) {
return false;
} else if (!modelInfo.equals(other.modelInfo))
}
} else if (!modelInfo.equals(other.modelInfo)) {
return false;
if (processedDataType != other.processedDataType)
}
if (processedDataType != other.processedDataType) {
return false;
if (productionStatus != other.productionStatus)
}
if (productionStatus != other.productionStatus) {
return false;
if (refTimeSignificance != other.refTimeSignificance)
}
if (refTimeSignificance != other.refTimeSignificance) {
return false;
}
if (resCompFlags == null) {
if (other.resCompFlags != null)
if (other.resCompFlags != null) {
return false;
} else if (!resCompFlags.equals(other.resCompFlags))
}
} else if (!resCompFlags.equals(other.resCompFlags)) {
return false;
if (thinnedGrid != other.thinnedGrid)
}
if (thinnedGrid != other.thinnedGrid) {
return false;
if (!Arrays.equals(thinnedPts, other.thinnedPts))
}
if (!Arrays.equals(thinnedPts, other.thinnedPts)) {
return false;
}
return true;
}

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.common.dataplugin.ldadhydro;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import javax.measure.quantity.Angle;
@ -45,9 +44,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
@ -77,7 +76,7 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class HydroLdadRecord extends PluginDataObject implements
public class HydroLdadRecord extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L;
@ -1118,6 +1117,7 @@ public class HydroLdadRecord extends PluginDataObject implements
return reportTime;
}
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
@ -1126,30 +1126,8 @@ public class HydroLdadRecord extends PluginDataObject implements
/**
* @return the pdv
*/
@Override
public PointDataView getPointDataView() {
return this.pdv;
}
@Override
public Integer getHdfFileId() {
// TODO Auto-generated method stub
return null;
}
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setHdfFileId(Integer hdfFileId) {
// TODO Auto-generated method stub
}
@Override
public void setPersistenceTime(Date persistTime) {
// TODO Auto-generated method stub
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.ldadmesonet;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.TimeZone;
@ -46,9 +45,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
@ -78,7 +77,7 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class MesonetLdadRecord extends PluginDataObject implements
public class MesonetLdadRecord extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L;
@ -1707,6 +1706,7 @@ public class MesonetLdadRecord extends PluginDataObject implements
}
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
@ -1715,37 +1715,14 @@ public class MesonetLdadRecord extends PluginDataObject implements
/**
* @return the pdv
*/
@Override
public PointDataView getPointDataView() {
return this.pdv;
}
@Override
public Integer getHdfFileId() {
// TODO Auto-generated method stub
return null;
}
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setHdfFileId(Integer hdfFileId) {
// TODO Auto-generated method stub
}
@Override
public void setPersistenceTime(Date persistTime) {
// TODO Auto-generated method stub
}
public String toMessage() {
StringBuilder sb = null;
if((getStationId() != null)&&(observationTime != null)) {
if ((getStationId() != null) && (observationTime != null)) {
sb = new StringBuilder();
sb.append(getStationId());
@ -1759,7 +1736,7 @@ public class MesonetLdadRecord extends PluginDataObject implements
sb.append((relHumidity != null) ? relHumidity : "");
sb.append(",");
sb.append((wetBulbTemperature != null) ? wetBulbTemperature : "");
//---------------------------------------------------------------
// ---------------------------------------------------------------
sb.append(",");
sb.append((windDir != null) ? windDir : "");
@ -1768,7 +1745,7 @@ public class MesonetLdadRecord extends PluginDataObject implements
sb.append(",");
sb.append((windGust != null) ? windGust : "");
//---------------------------------------------------------------
// ---------------------------------------------------------------
sb.append(",");
sb.append((pressure != null) ? pressure : "");
@ -1786,7 +1763,7 @@ public class MesonetLdadRecord extends PluginDataObject implements
sb.append(",");
sb.append((pressChange3Hour != null) ? pressChange3Hour : "");
//---------------------------------------------------------------
// ---------------------------------------------------------------
sb.append(",");
sb.append((precipAccum != null) ? precipAccum : "");
@ -1795,7 +1772,7 @@ public class MesonetLdadRecord extends PluginDataObject implements
sb.append(",");
sb.append((precipType != null) ? precipType : "");
//---------------------------------------------------------------
// ---------------------------------------------------------------
sb.append(",");
sb.append((totalCloudCover != null) ? totalCloudCover : "");
@ -1805,7 +1782,6 @@ public class MesonetLdadRecord extends PluginDataObject implements
sb.append(",");
sb.append((skyLayerBase != null) ? skyLayerBase : "");
sb.append(",");
sb.append((cloudBaseHeight != null) ? cloudBaseHeight : "");
@ -1821,7 +1797,7 @@ public class MesonetLdadRecord extends PluginDataObject implements
return (sb == null) ? null : sb.toString();
}
public static final void main(String [] args) {
public static final void main(String[] args) {
Calendar c = Calendar.getInstance();
c.setTimeZone(TimeZone.getTimeZone("Z"));
@ -1838,17 +1814,8 @@ public class MesonetLdadRecord extends PluginDataObject implements
rec.setAltimeter(29.85f);
rec.setSeaLevelPressure(100215f);
System.out.println(rec.toMessage());
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.lsr;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import javax.measure.quantity.Angle;
import javax.measure.quantity.DataAmount;
@ -513,22 +512,6 @@ public class LocalStormReport extends PersistablePluginDataObject implements
this.pdv = pdv;
}
/**
*
* @return The time to use for persistence.
*/
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
* @persistTime
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View file

@ -23,7 +23,6 @@ package com.raytheon.uf.common.dataplugin.obs.metar;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -52,11 +51,10 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.obs.metar.util.SkyCover;
import com.raytheon.uf.common.dataplugin.obs.metar.util.WeatherCondition;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
@ -95,8 +93,8 @@ import com.raytheon.uf.common.time.util.TimeUtil;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
IDecoderGettable, IPointData, IPersistable {
public class MetarRecord extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData {
public static final String PLUGIN_NAME = "obs";
@ -166,17 +164,17 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
public static final String PRECIPITATION_24HR = "TP24hr";
// public static final String SNOW_DEPTH = "snow";
//
// public static final String SNOW_WATER = "weqs";
//
// public static final String SNOWFALL6_HOUR = "TP24hr";
//
// public static final String SUNSHINE = "msun";
//
// public static final String TEMP_MAX_6HOUR = "t6xc";
//
// public static final String TEMP_MIN_6HOUR = "t6nc";
// public static final String SNOW_DEPTH = "snow";
//
// public static final String SNOW_WATER = "weqs";
//
// public static final String SNOWFALL6_HOUR = "TP24hr";
//
// public static final String SUNSHINE = "msun";
//
// public static final String TEMP_MAX_6HOUR = "t6xc";
//
// public static final String TEMP_MIN_6HOUR = "t6nc";
private String value;
@ -481,7 +479,6 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
@Transient
private int sunshine = -9999;
@XmlElement
@DynamicSerializeElement
@Column
@ -937,8 +934,9 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
* @return the timeObs
*/
public Calendar getTimeObs() {
if (this.dataTime == null)
if (this.dataTime == null) {
return null;
}
return this.dataTime.getRefTimeAsCalendar();
}
@ -1044,7 +1042,8 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param snowDepth the snowDepth to set
* @param snowDepth
* the snowDepth to set
*/
public void setSnowDepth(int snowDepth) {
this.snowDepth = snowDepth;
@ -1058,7 +1057,8 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param snowFall_6Hours the snowFall_6Hours to set
* @param snowFall_6Hours
* the snowFall_6Hours to set
*/
public void setSnowFall_6Hours(float snowFall_6Hours) {
this.snowFall_6Hours = snowFall_6Hours;
@ -1072,7 +1072,8 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param sunshine the sunshine to set
* @param sunshine
* the sunshine to set
*/
public void setSunshine(int sunshine) {
this.sunshine = sunshine;
@ -1086,7 +1087,8 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param snowWater the snowWater to set
* @param snowWater
* the snowWater to set
*/
public void setSnowWater(float snowWater) {
this.snowWater = snowWater;
@ -1679,28 +1681,7 @@ public class MetarRecord extends PluginDataObject implements ISpatialEnabled,
this.pdv = pdv;
}
@Override
public Integer getHdfFileId() {
return null;
}
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setHdfFileId(Integer hdfFileId) {
}
@Override
public void setPersistenceTime(Date persistTime) {
}
public static Set<String> getAvailableParameters() {
return PARM_MAP.keySet();
}
}

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.dataplugin.poessounding;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
@ -329,28 +328,4 @@ public class POESSounding extends PersistablePluginDataObject implements
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.dataplugin.persist.IPersistable#getPersistenceTime
* ()
*/
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.dataplugin.persist.IPersistable#setPersistenceTime
* (java.util.Calendar)
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
}

View file

@ -21,10 +21,7 @@ package com.raytheon.uf.common.dataplugin.preciprate;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -45,7 +42,7 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.radar.RadarStation;
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants.DHRValues;
import com.raytheon.uf.common.datastorage.IDataStore;
@ -85,8 +82,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class PrecipRateRecord extends PersistablePluginDataObject implements
IMonitorProcessing {
public class PrecipRateRecord extends ServerSpecificPersistablePluginDataObject
implements IMonitorProcessing {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PrecipRateRecord.class);
@ -581,36 +578,6 @@ public class PrecipRateRecord extends PersistablePluginDataObject implements
this.crs = crs;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.dataplugin.persist.IPersistable#getPersistenceTime
* ()
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.dataplugin.persist.IPersistable#setPersistenceTime
* (java.util.Date)
*/
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/*
* (non-Javadoc)
*

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.common.dataplugin.profiler;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
@ -527,23 +526,6 @@ public class ProfilerObs extends PersistablePluginDataObject implements
pdv = view;
}
/**
*
*/
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
*
*
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
private Double getWindSpeed() {
if (windSpeed == null) {
double u = profLevel.getUcWind().doubleValue();

View file

@ -19,10 +19,6 @@
**/
package com.raytheon.uf.common.dataplugin.qpf;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@ -42,8 +38,7 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.radar.RadarStation;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
@ -76,8 +71,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class QPFRecord extends PersistablePluginDataObject implements
IPersistable, ISpatialEnabled, IMonitorProcessing {
public class QPFRecord extends ServerSpecificPersistablePluginDataObject
implements ISpatialEnabled, IMonitorProcessing {
private static final long serialVersionUID = 767763365671L;
@ -275,6 +270,7 @@ public class QPFRecord extends PersistablePluginDataObject implements
*
* @return
*/
@Override
public Integer getNx() {
return nx;
}
@ -293,6 +289,7 @@ public class QPFRecord extends PersistablePluginDataObject implements
*
* @return
*/
@Override
public Integer getNy() {
return ny;
}
@ -405,32 +402,6 @@ public class QPFRecord extends PersistablePluginDataObject implements
return avgdir;
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Get the IDecoderGettable reference for this record.
*
@ -469,6 +440,7 @@ public class QPFRecord extends PersistablePluginDataObject implements
*
* @param data_array
*/
@Override
public float[] getDataArray() {
return data_array;
}
@ -489,6 +461,7 @@ public class QPFRecord extends PersistablePluginDataObject implements
*
* @return
*/
@Override
public GridGeometry2D getGridGeometry() {
ProjectedCRS crs = this.getCRS();
@ -514,6 +487,7 @@ public class QPFRecord extends PersistablePluginDataObject implements
*
* @param dataStore
*/
@Override
public void retrieveFromDataStore(IDataStore dataStore) {
try {

View file

@ -23,14 +23,12 @@ package com.raytheon.uf.common.dataplugin.radar;
import java.awt.geom.Point2D;
import java.text.ParsePosition;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.Vector;
import javax.measure.unit.Unit;
@ -53,7 +51,6 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IHDFFilePathProvider;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.radar.RadarDataPoint.RadarProductType;
import com.raytheon.uf.common.dataplugin.radar.level3.AlertAdaptationParameters;
@ -128,7 +125,7 @@ import com.vividsolutions.jts.geom.Coordinate;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class RadarRecord extends PersistablePluginDataObject implements
IPersistable, ISpatialEnabled, IRadarRecord {
ISpatialEnabled, IRadarRecord {
private static final long serialVersionUID = 1L;
@ -405,33 +402,6 @@ public class RadarRecord extends PersistablePluginDataObject implements
return location;
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* @return the icao
*/

View file

@ -20,10 +20,6 @@
package com.raytheon.uf.common.dataplugin.satellite;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@ -38,8 +34,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -69,8 +64,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class SatelliteRecord extends PersistablePluginDataObject implements
IPersistable, ISpatialEnabled {
public class SatelliteRecord extends ServerSpecificPersistablePluginDataObject
implements ISpatialEnabled {
private static final long serialVersionUID = 1L;
@ -218,32 +213,6 @@ public class SatelliteRecord extends PersistablePluginDataObject implements
super(uri);
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
public Integer getNumRecords() {
return numRecords;
}

View file

@ -20,10 +20,8 @@
package com.raytheon.uf.common.dataplugin.scan;
import java.io.ByteArrayInputStream;
import java.util.Calendar;
import java.util.Date;
import java.util.Set;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -39,8 +37,7 @@ import org.geotools.coverage.grid.GridGeometry2D;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.scan.data.ModelData;
import com.raytheon.uf.common.dataplugin.scan.data.ScanTableData;
import com.raytheon.uf.common.dataplugin.scan.data.SoundingData;
@ -75,8 +72,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class ScanRecord extends PersistablePluginDataObject implements
IPersistable {
public class ScanRecord extends ServerSpecificPersistablePluginDataObject {
/**
*
@ -132,22 +128,6 @@ public class ScanRecord extends PersistablePluginDataObject implements
return null;
}
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Gets the type of Table
*

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.common.dataplugin.sfcobs;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -51,7 +50,6 @@ import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.IPointData;
@ -82,7 +80,7 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class ObsCommon extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
ISpatialEnabled, IDecoderGettable, IPointData {
private static final long serialVersionUID = 1L;
@ -1650,21 +1648,4 @@ public class ObsCommon extends PersistablePluginDataObject implements
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
/**
*
* @return The time to use for persistence.
*/
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
* @persistTime
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
}

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.dataplugin.svrwx;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -35,7 +34,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.IPointData;
@ -66,7 +64,7 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class SvrWxRecord extends PersistablePluginDataObject implements
ISpatialEnabled, IPointData, IPersistable {
ISpatialEnabled, IPointData {
private static final long serialVersionUID = 1L;
@ -269,22 +267,6 @@ public class SvrWxRecord extends PersistablePluginDataObject implements
this.pdv = pdv;
}
/**
*
* @return The time to use for persistence.
*/
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
* @persistTime
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.dataplugin.tcg;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -35,7 +34,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.IPointData;
@ -66,7 +64,7 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class TropicalCycloneGuidance extends PersistablePluginDataObject
implements ISpatialEnabled, IPointData, IPersistable {
implements ISpatialEnabled, IPointData {
private static final long serialVersionUID = 1L;
@ -262,22 +260,6 @@ public class TropicalCycloneGuidance extends PersistablePluginDataObject
this.pdv = pdv;
}
/**
*
* @return The time to use for persistence.
*/
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
* @persistTime
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
public String getProductType() {
return productType;
}

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.common.dataplugin.tcs;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Embedded;
@ -36,7 +35,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.IPointData;
@ -67,7 +65,7 @@ import com.vividsolutions.jts.geom.Geometry;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class TropicalCycloneSummary extends PersistablePluginDataObject
implements ISpatialEnabled, IPointData, IPersistable {
implements ISpatialEnabled, IPointData {
private static final long serialVersionUID = 1L;
@ -209,22 +207,6 @@ public class TropicalCycloneSummary extends PersistablePluginDataObject
this.pdv = pdv;
}
/**
*
* @return The time to use for persistence.
*/
@Override
public Date getPersistenceTime() {
return dataTime.getRefTime();
}
/**
* @persistTime
*/
@Override
public void setPersistenceTime(Date persistTime) {
}
public String getProductType() {
return productType;
}

View file

@ -19,10 +19,6 @@
**/
package com.raytheon.uf.common.dataplugin.vil;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@ -42,8 +38,7 @@ import org.opengis.referencing.crs.ProjectedCRS;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.persist.ServerSpecificPersistablePluginDataObject;
import com.raytheon.uf.common.dataplugin.radar.RadarStation;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
@ -75,8 +70,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class VILRecord extends PersistablePluginDataObject implements
IPersistable, ISpatialEnabled {
public class VILRecord extends ServerSpecificPersistablePluginDataObject
implements ISpatialEnabled {
private static final long serialVersionUID = 767763365671L;
@ -315,22 +310,6 @@ public class VILRecord extends PersistablePluginDataObject implements
return dy;
}
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Get the IDecoderGettable reference for this record.
*

View file

@ -19,17 +19,18 @@
**/
package com.raytheon.uf.common.dataplugin.persist;
import javax.persistence.Column;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Provides an abstract implementation of plugindataobject with clustered file
@ -56,11 +57,6 @@ public abstract class PersistablePluginDataObject extends PluginDataObject
private static final long serialVersionUID = 1L;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer hdfFileId;
/**
* Constructor
*/
@ -80,15 +76,44 @@ public abstract class PersistablePluginDataObject extends PluginDataObject
*
* @see com.raytheon.edex.plugin.IPersistable#getHdfFileId()
*/
@Override
public Integer getHdfFileId() {
return hdfFileId;
return null;
}
/**
* @param hdfFileId
* the hdfFileId to set
*/
@Override
public void setHdfFileId(Integer hdfFileId) {
this.hdfFileId = hdfFileId;
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null) {
return null;
}
return c.getTime();
}
}

View file

@ -0,0 +1,69 @@
/**
* 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.dataplugin.persist;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* Provides an abstract implementation of plugindataobject with clustered file
* support.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2008 chammack Initial creation
*
* </pre>
*
* @author chammack
* @version 1.0
*/
@Entity(name = "SS")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public abstract class ServerSpecificPersistablePluginDataObject extends
PersistablePluginDataObject implements IPersistable {
private static final long serialVersionUID = 1L;
/**
* Constructor
*/
public ServerSpecificPersistablePluginDataObject(String uri) {
super(uri);
}
/**
* Constructor
*/
public ServerSpecificPersistablePluginDataObject() {
super();
}
}

View file

@ -732,6 +732,7 @@ public class HDF5DataStore implements IDataStore {
}
}
@Override
public String[] getDatasets(String group) throws StorageException,
FileNotFoundException {
String[] retVal = null;
@ -1713,6 +1714,7 @@ public class HDF5DataStore implements IDataStore {
throw new StorageException("Unknown state after multiple retries", null);
}
@Override
public void createDataset(IDataRecord rec) throws StorageException,
FileNotFoundException {
@ -1958,8 +1960,8 @@ public class HDF5DataStore implements IDataStore {
}
@Override
public void repack(String dirName, Compression compression)
throws StorageException {
public void repack(Compression compression, String outputDir,
String timestampCheck) throws StorageException {
throw new StorageException("Operation not supported", null);
}
}

View file

@ -252,14 +252,25 @@ public interface IDataStore extends ISerializableObject {
FileNotFoundException;
/**
* Repacks all hdf5 files of a certain plugin that haven't been repacked
* Recursively repacks all files of a certain directory. Presumes that the
* IDataStore instance is tied to a directory, not a specific file.
*
* @param dirName
* the name of the directory to scan for files to repack
* @param compression
* the type of compression to repack with
* @param outputDir
* the output directory to put the repacked files, or null if the
* same dir. If the same dir is used, it will delete the original
* file.
* @param timestampCheck
* if not null, the attribute to check on the file for a
* timestamp of the last time this particular action was run.
* e.g. "lastRepacked" or "lastArchived". if set, this attribute
* will be set on the file when the request is made, and then
* future requests for the same file will check this attribute
* and if the file has not been modified since last run, the file
* will be skipped.
*/
public void repack(String dirName, Compression compression)
throws StorageException;
public void repack(Compression compression, String outputDir,
String timestampCheck) throws StorageException;
}

View file

@ -374,11 +374,13 @@ public class PyPiesDataStore implements IDataStore {
}
@Override
public void repack(String dirName, Compression compression)
throws StorageException {
public void repack(Compression compression, String outputDir,
String timestampCheck) throws StorageException {
RepackRequest req = new RepackRequest();
req.setFilename(dirName);
req.setFilename(this.filename);
req.setCompression(compression);
req.setOutputDir(outputDir);
req.setTimestampCheck(timestampCheck);
RepackResponse resp = (RepackResponse) sendRequest(req);
// TODO do we really want to make this an exception?
// reasoning is if the repack fails for some reason, the original file

View file

@ -46,6 +46,12 @@ public class RepackRequest extends AbstractRequest {
@DynamicSerializeElement
private Compression compression;
@DynamicSerializeElement
private String outputDir;
@DynamicSerializeElement
private String timestampCheck;
public Compression getCompression() {
return compression;
}
@ -54,4 +60,20 @@ public class RepackRequest extends AbstractRequest {
this.compression = compression;
}
public String getOutputDir() {
return outputDir;
}
public void setOutputDir(String outputDir) {
this.outputDir = outputDir;
}
public String getTimestampCheck() {
return timestampCheck;
}
public void setTimestampCheck(String timestampCheck) {
this.timestampCheck = timestampCheck;
}
}

View file

@ -21,6 +21,7 @@
package com.raytheon.uf.edex.database.plugin;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@ -38,6 +39,7 @@ import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider;
import com.raytheon.uf.common.dataplugin.persist.IHDFFilePathProvider;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
@ -53,6 +55,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException;
import com.raytheon.uf.edex.core.props.PropertiesFactory;
@ -1068,11 +1071,13 @@ public abstract class PluginDao extends CoreDao {
public Date getMaxInsertTime(String productKey)
throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(this.daoClass);
query.addDistinctParameter("insertTime");
// doing distinct is wasted with a ordered max
// query.addDistinctParameter("insertTime");
List<String[]> keys = this.getProductKeyParameters(productKey);
for (String[] key : keys) {
query.addQueryParam(key[0], key[1]);
}
query.addReturnedField("insertTime");
query.addOrder("insertTime", false);
query.setMaxResults(1);
List<Calendar> result = (List<Calendar>) this.queryByCriteria(query);
@ -1083,6 +1088,37 @@ public abstract class PluginDao extends CoreDao {
}
}
/**
* Gets the minimum insert time contained in the database for the given key.
* The key corresponds to the productKey field in the data object.
*
* @param productKey
* The key for which to get the minimum reference time
* @return Null if this key was not found, else the minimum reference time
* @throws DataAccessLayerException
* If errors occur while querying the database
*/
@SuppressWarnings("unchecked")
public Date getMinInsertTime(String productKey)
throws DataAccessLayerException {
DatabaseQuery query = new DatabaseQuery(this.daoClass);
// doing distinct is wasted with a ordered max
// query.addDistinctParameter("insertTime");
List<String[]> keys = this.getProductKeyParameters(productKey);
for (String[] key : keys) {
query.addQueryParam(key[0], key[1]);
}
query.addReturnedField("insertTime");
query.addOrder("insertTime", true);
query.setMaxResults(1);
List<Calendar> result = (List<Calendar>) this.queryByCriteria(query);
if (result == null || result.isEmpty()) {
return null;
} else {
return result.get(0).getTime();
}
}
/**
* Gets the minimum reference time contained in the database for the given
* key. The key corresponds to the productKey field in the data object.
@ -1119,7 +1155,7 @@ public abstract class PluginDao extends CoreDao {
* The product key to break apart into pairs
* @return The product key/value pairs
*/
private List<String[]> getProductKeyParameters(String productKey) {
protected List<String[]> getProductKeyParameters(String productKey) {
List<String[]> params = new ArrayList<String[]>();
if (productKey.isEmpty()) {
return params;
@ -1194,8 +1230,8 @@ public abstract class PluginDao extends CoreDao {
}
public static List<PurgeRule> getPurgeRulesForPlugin(String pluginName) {
File rulesFile = PathManagerFactory.getPathManager().getStaticFile("purge/"+
pluginName + "PurgeRules.xml");
File rulesFile = PathManagerFactory.getPathManager().getStaticFile(
"purge/" + pluginName + "PurgeRules.xml");
if (rulesFile != null) {
try {
PurgeRuleSet purgeRules = (PurgeRuleSet) SerializationUtil
@ -1231,4 +1267,111 @@ public abstract class PluginDao extends CoreDao {
return null;
}
public void archiveData(String archivePath, Calendar insertStartTime,
Calendar insertEndTime) throws DataAccessLayerException,
SerializationException, IOException {
List<PersistableDataObject> pdos = getRecordsToArchive(insertStartTime,
insertEndTime);
if (pdos != null && pdos.size() > 0) {
// map of file to list of pdo
Map<String, List<PersistableDataObject>> pdoMap = new HashMap<String, List<PersistableDataObject>>();
if (pdos.get(0) instanceof IPersistable) {
IHDFFilePathProvider pathProvider = this.pathProvider;
for (PersistableDataObject pdo : pdos) {
IPersistable persistable = (IPersistable) pdo;
String path = pathProvider.getHDFPath(pluginName,
persistable)
+ File.separator
+ pathProvider.getHDFFileName(pluginName,
persistable);
List<PersistableDataObject> list = pdoMap.get(path);
if (list == null) {
list = new ArrayList<PersistableDataObject>(pdos.size());
pdoMap.put(path, list);
}
list.add(pdo);
}
} else {
// order files by refTime hours
for (PersistableDataObject pdo : pdos) {
String timeString = null;
if (pdo instanceof PluginDataObject) {
PluginDataObject pluginDataObj = (PluginDataObject) pdo;
Date time = pluginDataObj.getDataTime()
.getRefTimeAsCalendar().getTime();
synchronized (DefaultPathProvider.fileNameFormat) {
timeString = DefaultPathProvider.fileNameFormat
.format(time);
}
} else {
// no refTime to use bounded insert query bounds
Date time = insertStartTime.getTime();
synchronized (DefaultPathProvider.fileNameFormat) {
timeString = DefaultPathProvider.fileNameFormat
.format(time);
}
}
String path = pluginName + timeString;
List<PersistableDataObject> list = pdoMap.get(path);
if (list == null) {
list = new ArrayList<PersistableDataObject>(pdos.size());
pdoMap.put(path, list);
}
list.add(pdo);
}
}
for (Map.Entry<String, List<PersistableDataObject>> entry : pdoMap
.entrySet()) {
String path = archivePath + File.separator + pluginName
+ File.separator + entry.getKey();
// remove .h5
int index = path.lastIndexOf('.');
if (index > 0 && path.length() - index < 5) {
// ensure its end of string in case extension is
// dropped/changed
path = path.substring(0, index);
}
path += ".bin.gz";
File file = new File(path);
if (file.exists()) {
// pull the
}
// Thrift serialize pdo list
byte[] data = SerializationUtil.transformToThrift(entry
.getValue());
// debug transform back for object inspection
Object obj = SerializationUtil.transformFromThrift(data);
// save list to disk (in gz format?)
FileUtil.bytes2File(data, file, true);
}
}
}
@SuppressWarnings("unchecked")
public List<PersistableDataObject> getRecordsToArchive(
Calendar insertStartTime, Calendar insertEndTime)
throws DataAccessLayerException {
DatabaseQuery dbQuery = new DatabaseQuery(this.getDaoClass());
dbQuery.addQueryParam("insertTime", insertStartTime,
QueryOperand.GREATERTHANEQUALS);
dbQuery.addQueryParam("insertTime", insertEndTime,
QueryOperand.LESSTHAN);
dbQuery.addOrder("dataTime.refTime", true);
return (List<PersistableDataObject>) this.queryByCriteria(dbQuery);
}
}

View file

@ -6,11 +6,20 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.dataquery.db,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.localization,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.status,
com.raytheon.uf.common.time,
com.raytheon.uf.common.util,
com.raytheon.uf.common.util.registry,
com.raytheon.uf.edex.core.dataplugin,
com.raytheon.uf.edex.core.props,
com.raytheon.uf.edex.pointdata
com.raytheon.uf.edex.database,
com.raytheon.uf.edex.database.cluster,
com.raytheon.uf.edex.database.cluster.handler,
com.raytheon.uf.edex.database.plugin,
com.raytheon.uf.edex.pointdata,
org.springframework.orm.hibernate3.support

View file

@ -0,0 +1 @@
com.raytheon.uf.edex.maintenance.archive.config.DataArchiveConfig

View file

@ -8,10 +8,30 @@
<constructor-arg value="LZF" />
</bean>
<bean id="dataArchiver" class="com.raytheon.uf.edex.maintenance.archive.DataArchiver">
<constructor-arg value="/awips2/edex/data/archive"/>
</bean>
<bean id="databaseArchiver" class="com.raytheon.uf.edex.maintenance.archive.DatabaseArchiver"/>
<bean id="dataStoreArchiver" class="com.raytheon.uf.edex.maintenance.archive.DataStoreArchiver">
<!-- the compression to archive at, valid values are NONE or LZF -->
<constructor-arg value="LZF" />
</bean>
<bean id="databaseArchiverRegistered" factory-bean="dataArchiver" factory-method="registerPluginArchiver" depends-on="dataArchiver">
<constructor-arg ref="databaseArchiver"/>
</bean>
<bean id="datastoreArchiverRegistered" factory-bean="dataArchiver" factory-method="registerPluginArchiver">
<constructor-arg ref="dataStoreArchiver"/>
</bean>
<camelContext id="clusteredMaintenanceContext" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler" autoStartup="false">
<endpoint id="repackCron" uri="quartz://repack/repackScheduled/?cron=${repack.cron}"/>
<endpoint id="archiveCron" uri="quartz://archive/archiveScheduled/?cron=${archive.cron}"/>
<!-- Repack on Scheduled timer -->
<route id="repackScheduled">
@ -26,12 +46,22 @@
</doTry>
</route>
<!-- Archive on Scheduled timer -->
<route id="archiveScheduled">
<from uri="archiveCron" />
<doTry>
<bean ref="dataArchiver" method="archivePlugins" />
<doCatch>
<exception>java.lang.Throwable</exception>
<to
uri="log:archive?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true" />
</doCatch>
</doTry>
</route>
</camelContext>
<bean factory-bean="clusteredCamelContextMgr"
factory-method="register">
<constructor-arg ref="clusteredMaintenanceContext" />
</bean>
</beans>

View file

@ -84,7 +84,7 @@ public class DataStoreRepacker {
String dir = hdf5Dir + File.separator + plugin;
IDataStore ds = DataStoreFactory.getDataStore(new File(dir));
try {
ds.repack(dir, compression);
ds.repack(compression, null, "lastRepacked");
} catch (StorageException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage());
}

View file

@ -0,0 +1,257 @@
/**
* 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.edex.maintenance.archive;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.maintenance.archive.config.DataArchiveConfig;
/**
* Handles archiving of data. Has two interfaces for registering data archive.
* Data archived based on archiving for each plugin and general data archive
* programs.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2011 rjpeter Initial creation
*
* </pre>
*
* @author rjpeter
* @version 1.0
*/
public class DataArchiver {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DataArchiver.class);
private List<IPluginArchiver> pluginArchivers = new ArrayList<IPluginArchiver>();
private List<IDataArchiver> dataArchivers = new ArrayList<IDataArchiver>();
private String archivePath = null;
private String defaultPlugin = "default";
private String configDir = "archiver";
public DataArchiver(String archivePath) {
this.archivePath = archivePath;
}
public void archivePlugins() {
statusHandler.info("Archival of plugin data starting");
// get list of plugins, ordered by plugin
Set<String> availablePlugins = new TreeSet<String>(PluginRegistry
.getInstance().getRegisteredObjects());
Map<String, DataArchiveConfig> configs = getDataArchiveConfigs();
DataArchiveConfig defaultConf = configs.get(defaultPlugin);
File baseArchive = new File(archivePath);
for (String pluginName : availablePlugins) {
DataArchiveConfig conf = configs.get(pluginName);
if (conf == null) {
conf = defaultConf;
}
if (conf.getHoursToKeep() > 0) {
File pluginArchive = new File(baseArchive, pluginName);
if (pluginArchive.isDirectory()) {
long purgeThreshold = System.currentTimeMillis()
- (conf.getHoursToKeep() * 60 * 60 * 1000);
purgeDirectory(pluginArchive, purgeThreshold);
}
}
if (Boolean.TRUE.equals(conf.getArchivingEnabled())) {
for (IPluginArchiver pluginArchiver : pluginArchivers) {
pluginArchiver.archivePlugin(pluginName, archivePath, conf);
}
}
}
statusHandler.info("Archival of plugin data complete");
}
public Object registerPluginArchiver(IPluginArchiver archiver) {
if (!pluginArchivers.contains(archiver)) {
pluginArchivers.add(archiver);
} else {
statusHandler.warn("Plugin archiver already registered: "
+ archiver);
}
return this;
}
public Object registerDataArchiver(IDataArchiver archiver) {
if (!dataArchivers.contains(archiver)) {
dataArchivers.add(archiver);
} else {
statusHandler.warn("Data archiver already registered: " + archiver);
}
return this;
}
private boolean purgeDirectory(File directory, long purgeThreshold) {
File[] listing = directory.listFiles();
int numDeleted = 0;
for (File file : listing) {
if (file.isDirectory()) {
if (purgeDirectory(file, purgeThreshold)) {
numDeleted++;
}
} else if (file.lastModified() < purgeThreshold) {
if (file.delete()) {
numDeleted++;
}
}
}
// we deleted all files/directories, or there were no files in this
// directory
if (numDeleted == listing.length
&& !directory.getAbsolutePath().equals(archivePath)) {
if (directory.delete()) {
return true;
}
}
return false;
}
private Map<String, DataArchiveConfig> getDataArchiveConfigs() {
Map<String, DataArchiveConfig> configs = new HashMap<String, DataArchiveConfig>();
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext[] contexts = pathMgr
.getLocalSearchHierarchy(LocalizationType.COMMON_STATIC);
String[] extensions = new String[] { "xml" };
for (LocalizationContext ctx : contexts) {
statusHandler.info("Loading context: " + ctx);
LocalizationFile[] lfs = pathMgr.listFiles(ctx, configDir,
extensions, false, true);
if (lfs != null && lfs.length > 0) {
for (LocalizationFile lf : lfs) {
String fileName = lf.getName();
try {
File f = lf.getFile(true);
fileName = f.getAbsolutePath();
Object obj = SerializationUtil
.jaxbUnmarshalFromXmlFile(f);
if (obj instanceof DataArchiveConfig) {
DataArchiveConfig conf = (DataArchiveConfig) obj;
String plugin = conf.getPluginName();
if (plugin != null) {
plugin = plugin.trim();
if (!plugin.isEmpty()
&& !configs.containsKey(plugin)) {
configs.put(plugin, conf);
} else {
throw new Exception(
"Configuration file does not specify pluginName");
}
} else {
throw new Exception(
"Configuration file does not specify pluginName");
}
} else {
throw new Exception(
"File in wrong format, expected "
+ DataArchiveConfig.class
+ ", found " + obj.getClass());
}
} catch (Throwable e) {
statusHandler.error(
"Failed to load archive configuration file: "
+ fileName, e);
}
}
}
}
DataArchiveConfig defaultConf = configs.get(defaultPlugin);
if (defaultConf == null) {
// default plugin didn't load from disk, force a default config
statusHandler
.warn("Failed to find default configuration, using internal defaults");
defaultConf = new DataArchiveConfig();
defaultConf.setPluginName(defaultPlugin);
configs.put(defaultPlugin, defaultConf);
}
if (!defaultConf.isArchivingEnabledSet()) {
defaultConf.setArchivingEnabled(Boolean.TRUE);
}
if (!defaultConf.isHoursToKeepSet()) {
defaultConf.setHoursToKeep(6);
} else if (defaultConf.getHoursToKeep() < 0) {
}
// override unset fields with default
for (DataArchiveConfig pluginConf : configs.values()) {
if (pluginConf.getPluginName().equals(defaultPlugin)) {
// skip default conf
continue;
}
if (!pluginConf.isArchivingEnabledSet()) {
pluginConf.setArchivingEnabled(defaultConf
.getArchivingEnabled());
}
if (!pluginConf.isHoursToKeepSet()) {
pluginConf.setHoursToKeep(defaultConf.getHoursToKeep());
}
}
try {
statusHandler.info("DefaultConfiguration:\n"
+ SerializationUtil.marshalToXml(defaultConf));
} catch (Exception e) {
statusHandler.handle(Priority.WARN, "Failed to deserialize config",
e);
}
return configs;
}
}

View file

@ -0,0 +1,85 @@
/**
* 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.edex.maintenance.archive;
import java.io.File;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.StorageException;
import com.raytheon.uf.common.datastorage.StorageProperties.Compression;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.core.props.EnvProperties;
import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.maintenance.archive.config.DataArchiveConfig;
/**
* Uses the repack feature of IDataStore to archive data by repacking it to a
* specified compression at the hdf5 dataset level and moving the resulting file
* to the archive dir.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 8, 2011 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class DataStoreArchiver implements IPluginArchiver {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DataStoreArchiver.class);
private String hdf5Dir;
private Compression compression = Compression.NONE;
public DataStoreArchiver(String compression) {
EnvProperties properties = PropertiesFactory.getInstance()
.getEnvProperties();
hdf5Dir = properties.getEnvValue("HDF5DIR");
this.compression = Compression.valueOf(compression);
}
@Override
public void archivePlugin(String pluginName, String archiveDir,
DataArchiveConfig conf) {
String dirToArchive = hdf5Dir + File.separator + pluginName;
IDataStore ds = DataStoreFactory.getDataStore(new File(dirToArchive));
String outputDir = archiveDir + File.separator + pluginName;
statusHandler.info("Archiving " + dirToArchive);
try {
ds.repack(compression, outputDir, "lastArchived");
} catch (StorageException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage());
}
}
}

View file

@ -0,0 +1,405 @@
/**
* 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.edex.maintenance.archive;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.PluginProperties;
import com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider;
import com.raytheon.uf.common.dataplugin.persist.IHDFFilePathProvider;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
import com.raytheon.uf.edex.database.cluster.ClusterTask;
import com.raytheon.uf.edex.database.cluster.handler.CurrentTimeClusterLockHandler;
import com.raytheon.uf.edex.database.plugin.PluginDao;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
import com.raytheon.uf.edex.maintenance.archive.config.DataArchiveConfig;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 17, 2011 rjpeter Initial creation
*
* </pre>
*
* @author rjpeter
* @version 1.0
*/
public class DatabaseArchiver implements IPluginArchiver {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DatabaseArchiver.class);
private final SimpleDateFormat DATE_FORMAT;
// Minimum time increment to archive, note based off of insertTime
private static final int MIN_DURATION_MILLIS = 1000 * 60 * 30;
// Maximum time increment to archive, note based off of insertTime
private static final int MAX_DURATION_MILLIS = 1000 * 60 * 60;
private static final String TASK_NAME = "DB Archiver";
private static final int CLUSTER_LOCK_TIMEOUT = 60000;
public DatabaseArchiver() {
DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
}
@Override
public void archivePlugin(String pluginName, String archivePath,
DataArchiveConfig conf) {
PluginProperties props = PluginRegistry.getInstance()
.getRegisteredObject(pluginName);
if (props != null && props.getRecord() != null
&& props.getDao() != null) {
Class<?> recordClass = props.getRecord();
if (recordClass != null) {
try {
recordClass.asSubclass(PluginDataObject.class);
archivePluginData(pluginName, archivePath, conf);
} catch (ClassCastException e) {
// not an error, using asSubClass to filter non
// PluginDataObjects
}
}
}
}
public boolean archivePluginData(String pluginName, String archivePath,
DataArchiveConfig conf) {
// set archive time
Calendar runTime = Calendar.getInstance();
runTime.setTimeZone(TimeZone.getTimeZone("GMT"));
runTime.add(Calendar.MINUTE, -30);
// cluster lock, grabbing time of last successful archive
CurrentTimeClusterLockHandler lockHandler = new CurrentTimeClusterLockHandler(
CLUSTER_LOCK_TIMEOUT, DATE_FORMAT.format(runTime.getTime()),
false);
ClusterTask ct = ClusterLockUtils.lock(TASK_NAME, pluginName,
lockHandler, false);
if (!LockState.SUCCESSFUL.equals(ct.getLockState())) {
return true;
}
Calendar startTime = null;
try {
// lookup dao
PluginDao dao = null;
try {
dao = PluginFactory.getInstance().getPluginDao(pluginName);
} catch (PluginException e) {
statusHandler
.error(pluginName
+ ": Error getting data access object! Unable to archive data!",
e);
return false;
}
startTime = determineStartTime(pluginName, ct.getExtraInfo(),
runTime, dao, conf);
Calendar endTime = determineEndTime(startTime, runTime);
Map<String, List<PersistableDataObject>> pdoMap = new HashMap<String, List<PersistableDataObject>>();
while (startTime != null && endTime != null) {
Map<String, List<PersistableDataObject>> pdosToSave = getPdosByFile(
pluginName, dao, pdoMap, startTime, endTime);
if (pdosToSave != null && pdosToSave.size() > 0) {
savePdoMap(pluginName, archivePath, pdosToSave);
}
startTime = endTime;
endTime = determineEndTime(startTime, runTime);
}
if (pdoMap != null && pdoMap.size() > 0) {
savePdoMap(pluginName, archivePath, pdoMap);
}
// set last archive time to startTime
if (startTime != null) {
lockHandler
.setExtraInfo(DATE_FORMAT.format(startTime.getTime()));
}
} catch (Throwable e) {
// previous run time needs to be reset
if (startTime != null) {
lockHandler
.setExtraInfo(DATE_FORMAT.format(startTime.getTime()));
}
statusHandler.error(pluginName + ": Error occurred archiving data",
e);
} finally {
if (ct != null) {
// release lock setting archive time in cluster lock
ClusterLockUtils.unlock(ct, false);
}
}
return true;
}
/**
*
* @param pdoMap
* The current pdos by file. This map will be merged with pdos,
* if a key was not referenced by pdos it will be removed and
* returned in the returned map for storage.
* @param pdos
* The pdos to sort by file
* @return The pdos to save to disk. If sortPdosByFiles did not store any
* entries from pdos into a file listed in currentPdoMap then that
* entry will be returned in a new map and removed from
* currentPdoMap.
*/
protected Map<String, List<PersistableDataObject>> getPdosByFile(
String pluginName, PluginDao dao,
Map<String, List<PersistableDataObject>> pdoMap,
Calendar startTime, Calendar endTime)
throws DataAccessLayerException {
List<PersistableDataObject> pdos = dao.getRecordsToArchive(startTime,
endTime);
Set<String> newFileEntries = new HashSet<String>();
if (pdos != null && pdos.size() > 0) {
if (pdos.get(0) instanceof IPersistable) {
IHDFFilePathProvider pathProvider = dao.pathProvider;
for (PersistableDataObject pdo : pdos) {
IPersistable persistable = (IPersistable) pdo;
String path = pathProvider.getHDFPath(pluginName,
persistable)
+ File.separator
+ pathProvider.getHDFFileName(pluginName,
persistable);
newFileEntries.add(path);
List<PersistableDataObject> list = pdoMap.get(path);
if (list == null) {
list = new ArrayList<PersistableDataObject>(pdos.size());
pdoMap.put(path, list);
}
list.add(pdo);
}
} else {
// order files by refTime hours
for (PersistableDataObject pdo : pdos) {
String timeString = null;
if (pdo instanceof PluginDataObject) {
PluginDataObject pluginDataObj = (PluginDataObject) pdo;
Date time = pluginDataObj.getDataTime()
.getRefTimeAsCalendar().getTime();
synchronized (DefaultPathProvider.fileNameFormat) {
timeString = DefaultPathProvider.fileNameFormat
.format(time);
}
} else {
// no refTime to use bounded insert query bounds
Date time = startTime.getTime();
synchronized (DefaultPathProvider.fileNameFormat) {
timeString = DefaultPathProvider.fileNameFormat
.format(time);
}
}
String path = pluginName + timeString;
newFileEntries.add(path);
List<PersistableDataObject> list = pdoMap.get(path);
if (list == null) {
list = new ArrayList<PersistableDataObject>(pdos.size());
pdoMap.put(path, list);
}
list.add(pdo);
}
}
}
Iterator<String> iter = pdoMap.keySet().iterator();
Map<String, List<PersistableDataObject>> pdosToSave = new HashMap<String, List<PersistableDataObject>>(
pdoMap.size() - newFileEntries.size());
while (iter.hasNext()) {
String key = iter.next();
if (!newFileEntries.contains(key)) {
pdosToSave.put(key, pdoMap.get(key));
iter.remove();
}
}
return pdosToSave;
}
protected void savePdoMap(String pluginName, String archivePath,
Map<String, List<PersistableDataObject>> pdoMap)
throws SerializationException, IOException {
for (Map.Entry<String, List<PersistableDataObject>> entry : pdoMap
.entrySet()) {
String path = archivePath + File.separator + pluginName
+ File.separator + entry.getKey();
// remove .h5
int index = path.lastIndexOf('.');
if (index > 0 && path.length() - index < 5) {
// ensure its end of string in case extension is
// dropped/changed
path = path.substring(0, index);
}
path += ".bin.gz";
File file = new File(path);
List<PersistableDataObject> pdosToSerialize = entry.getValue();
if (file.exists()) {
// save list to disk (in gz format?)
byte[] data = FileUtil.file2bytes(file, true);
// debug transform back for object inspection
@SuppressWarnings("unchecked")
List<PersistableDataObject> prev = (List<PersistableDataObject>) SerializationUtil
.transformFromThrift(data);
prev.addAll(pdosToSerialize);
pdosToSerialize = prev;
}
// Thrift serialize pdo list
byte[] data = SerializationUtil.transformToThrift(pdosToSerialize);
// save list to disk (in gz format?)
FileUtil.bytes2File(data, file, true);
}
}
protected Calendar determineStartTime(String pluginName, String extraInfo,
Calendar runTime, PluginDao dao, DataArchiveConfig conf)
throws DataAccessLayerException {
Calendar startTime = null;
// get previous run time
if (extraInfo != null && extraInfo.length() > 0) {
try {
Date prevDate = DATE_FORMAT.parse(extraInfo);
// cloning runTime as it already has the correct time zone
startTime = (Calendar) runTime.clone();
startTime.setTimeInMillis(prevDate.getTime());
} catch (ParseException e) {
statusHandler.error(pluginName
+ ": Unable to parse last run time [" + extraInfo
+ "], will archive all data up to current time", e);
startTime = null;
}
}
// protect against time failure where startTime is more than
// MIN_DURATION in the future
if (startTime != null) {
if ((startTime.getTimeInMillis() - runTime.getTimeInMillis()) > MIN_DURATION_MILLIS) {
statusHandler
.warn(pluginName
+ ": Previous run time is a future time, reseting to current time. Check server times");
startTime = (Calendar) runTime.clone();
}
} else {
// startTime has never been set lookup earliest start time
Date minInsert = dao.getMinInsertTime("");
if (minInsert != null) {
startTime = Calendar.getInstance();
startTime.setTimeZone(TimeZone.getTimeZone("GMT"));
startTime.setTimeInMillis(minInsert.getTime());
} else {
// if no data for plugin in db, set startTime to runTime
startTime = (Calendar) runTime.clone();
}
}
// earliest time based on default retention
long earliestTime = System.currentTimeMillis()
- (conf.getHoursToKeep() * 60 * 60 * 1000);
if (startTime.getTimeInMillis() < earliestTime) {
startTime.setTimeInMillis(earliestTime);
}
return startTime;
}
/**
* Determines the endTime to bound the next query by. Uses
* MAX_DURATION_MILLIS and MIN_DURATION_MILLIS to determine endTime based on
* startTime and runTime. If starTime + MIN_DURATION_MILLIS < runTime, will
* return null.
*
* @param startTime
* Starting time bound for query.
* @param runTime
* Time of current archive run.
* @return
*/
protected Calendar determineEndTime(Calendar startTime, Calendar runTime) {
Calendar endTime = null;
long timeDiff = runTime.getTimeInMillis() - startTime.getTimeInMillis();
if (timeDiff > MAX_DURATION_MILLIS) {
endTime = (Calendar) startTime.clone();
endTime.setTimeInMillis(endTime.getTimeInMillis()
+ MAX_DURATION_MILLIS);
} else if (timeDiff > MIN_DURATION_MILLIS) {
endTime = (Calendar) runTime.clone();
}
return endTime;
}
}

View file

@ -0,0 +1,40 @@
/**
* 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.edex.maintenance.archive;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2011 rjpeter Initial creation
*
* </pre>
*
* @author rjpeter
* @version 1.0
*/
public interface IDataArchiver {
}

View file

@ -0,0 +1,44 @@
/**
* 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.edex.maintenance.archive;
import com.raytheon.uf.edex.maintenance.archive.config.DataArchiveConfig;
/**
* Interface for archiving data based on plugins.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2011 rjpeter Initial creation
*
* </pre>
*
* @author rjpeter
* @version 1.0
*/
public interface IPluginArchiver {
public void archivePlugin(String pluginName, String archivePath,
DataArchiveConfig config);
}

View file

@ -0,0 +1,109 @@
/**
* 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.edex.maintenance.archive.config;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Data archive configuration. Configuration should be pulled from common_static
* localization. Configuration with a pluginName of default will all to all
* plugins.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 14, 2012 rjpeter Initial creation
*
* </pre>
*
* @author rjpeter
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class DataArchiveConfig {
@XmlElement
private String pluginName;
@XmlElement
private Integer hoursToKeep;
@XmlElement
private Boolean archivingEnabled;
/**
* @return the pluginName
*/
public String getPluginName() {
return pluginName;
}
/**
* @param pluginName
* the pluginName to set
*/
public void setPluginName(String pluginName) {
this.pluginName = pluginName;
}
/**
* @return the hoursToKeep
*/
public Integer getHoursToKeep() {
return hoursToKeep;
}
/**
* @param hoursToKeep
* the hoursToKeep to set
*/
public void setHoursToKeep(Integer hoursToKeep) {
this.hoursToKeep = hoursToKeep;
}
/**
* @return the archivingEnabled
*/
public Boolean getArchivingEnabled() {
return archivingEnabled;
}
/**
* @param archivingEnabled
* the archivingEnabled to set
*/
public void setArchivingEnabled(Boolean archivingEnabled) {
this.archivingEnabled = archivingEnabled;
}
public boolean isArchivingEnabledSet() {
return archivingEnabled != null;
}
public boolean isHoursToKeepSet() {
return hoursToKeep != null;
}
}

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dataArchiveConfig>
<pluginName>default</pluginName>
<hoursToKeep>6</hoursToKeep>
<archivingEnabled>true</archivingEnabled>
</dataArchiveConfig>

View file

@ -25,12 +25,10 @@
package gov.noaa.nws.ncep.common.dataplugin.h5scd;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import javax.measure.quantity.Length;
import javax.measure.quantity.Temperature;
@ -48,22 +46,24 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
@Entity
@Table(name = "h5scd", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
public class H5ScdRecord extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData {
private static final long serialVersionUID = 1L;
@ -78,15 +78,15 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
private String reportType;
/** Station ID */
@Column(length=32)
@DataURI(position=1)
@Column(length = 32)
@DataURI(position = 1)
@XmlElement
@DynamicSerializeElement
private String stationID;
/** Bulletin correction */
@Column(length=8)
@DataURI(position=2)
@Column(length = 8)
@DataURI(position = 2)
@XmlElement
@DynamicSerializeElement
private String corIndicator;
@ -99,7 +99,7 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
/** Bulletin issuance time */
@Column
@DataURI(position=3)
@DataURI(position = 3)
@XmlElement
@DynamicSerializeElement
private Calendar issueTime;
@ -188,7 +188,9 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
@DynamicSerializeElement
private int CFRT;
/** Fraction of celestial dome covered by low or mid cloud from WMO Code 2700 */
/**
* Fraction of celestial dome covered by low or mid cloud from WMO Code 2700
*/
@Transient
@XmlElement
@DynamicSerializeElement
@ -219,7 +221,7 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
* Default constructor
*
*/
public H5ScdRecord(){
public H5ScdRecord() {
this.stationID = null;
this.issueTime = null;
this.corIndicator = "REG";
@ -247,7 +249,8 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
/**
* Constructs a SCD record from a dataURI
*
* @param uri The dataURI
* @param uri
* The dataURI
*/
public H5ScdRecord(String uri) {
super(uri);
@ -266,145 +269,164 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
this.reportType = reportType;
}
public String getStationID(){
public String getStationID() {
return stationID;
}
public void setStationID(String stationID){
this.stationID=stationID;
public void setStationID(String stationID) {
this.stationID = stationID;
}
public Calendar getIssueTime(){
public Calendar getIssueTime() {
return issueTime;
}
public void setIssueTime(Calendar issueTime){
this.issueTime=issueTime;
public void setIssueTime(Calendar issueTime) {
this.issueTime = issueTime;
}
public String getCorIndicator(){
public String getCorIndicator() {
return corIndicator;
}
public void setCorIndicator(String corIndicator){
this.corIndicator=corIndicator;
public void setCorIndicator(String corIndicator) {
this.corIndicator = corIndicator;
}
public Calendar getObsTime(){
public Calendar getObsTime() {
return obsTime;
}
public void setObsTime(Calendar obsTime){
this.obsTime=obsTime;
public void setObsTime(Calendar obsTime) {
this.obsTime = obsTime;
}
public float getTDXC(){
public float getTDXC() {
return TDXC;
}
public void setTDXC(float TDXC){
this.TDXC=TDXC;
public void setTDXC(float TDXC) {
this.TDXC = TDXC;
}
public float getTDNC(){
public float getTDNC() {
return TDNC;
}
public void setTDNC(float TDNC){
this.TDNC=TDNC;
public void setTDNC(float TDNC) {
this.TDNC = TDNC;
}
public float getP06I(){
public float getP06I() {
return P06I;
}
public void setP06I(float P06I){
this.P06I=P06I;
public void setP06I(float P06I) {
this.P06I = P06I;
}
public float getP24I(){
public float getP24I() {
return P24I;
}
public void setP24I(float P24I){
this.P24I=P24I;
public void setP24I(float P24I) {
this.P24I = P24I;
}
public String getWTHR(){
public String getWTHR() {
return WTHR;
}
public void setWTHR(String WTHR){
this.WTHR=WTHR;
public void setWTHR(String WTHR) {
this.WTHR = WTHR;
}
public float getSNOW(){
public float getSNOW() {
return SNOW;
}
public void setSNOW(float SNOW){
this.SNOW=SNOW;
public void setSNOW(float SNOW) {
this.SNOW = SNOW;
}
public float getSNEW(){
public float getSNEW() {
return SNEW;
}
public void setSNEW(float SNEW){
this.SNEW=SNEW;
public void setSNEW(float SNEW) {
this.SNEW = SNEW;
}
public float getS24I(){
public float getS24I() {
return S24I;
}
public void setS24I(float S24I){
this.S24I=S24I;
public void setS24I(float S24I) {
this.S24I = S24I;
}
public float getWEQS(){
public float getWEQS() {
return WEQS;
}
public void setWEQS(float WEQS){
this.WEQS=WEQS;
public void setWEQS(float WEQS) {
this.WEQS = WEQS;
}
public int getMSUN(){
public int getMSUN() {
return MSUN;
}
public void setMSUN(int MSUN){
this.MSUN=MSUN;
public void setMSUN(int MSUN) {
this.MSUN = MSUN;
}
public int getCTYL(){
public int getCTYL() {
return CTYL;
}
public void setCTYL(int CTYL){
this.CTYL=CTYL;
public void setCTYL(int CTYL) {
this.CTYL = CTYL;
}
public int getCTYM(){
public int getCTYM() {
return CTYM;
}
public void setCTYM(int CTYM){
this.CTYM=CTYM;
public void setCTYM(int CTYM) {
this.CTYM = CTYM;
}
public int getCTYH(){
public int getCTYH() {
return CTYH;
}
public void setCTYH(int CTYH){
this.CTYH=CTYH;
public void setCTYH(int CTYH) {
this.CTYH = CTYH;
}
public int getCFRT(){
public int getCFRT() {
return CFRT;
}
public void setCFRT(int CFRT){
this.CFRT=CFRT;
public void setCFRT(int CFRT) {
this.CFRT = CFRT;
}
public int getCFRL(){
public int getCFRL() {
return CFRL;
}
public void setCFRL(int CFRL){
this.CFRL=CFRL;
public void setCFRL(int CFRL) {
this.CFRL = CFRL;
}
public int getCBAS(){
public int getCBAS() {
return CBAS;
}
public void setCBAS(int CBAS){
this.CBAS=CBAS;
public void setCBAS(int CBAS) {
this.CBAS = CBAS;
}
public String getReport() {
@ -423,33 +445,6 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
this.suspectTimeFlag = suspectTimeFlag;
}
/**
* Get the value and units of a named parameter within this observation.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return An Amount with value and units. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
@Override
public Integer getHdfFileId() {
return null;
}
@Override
public void setHdfFileId(Integer hdfFileId) {
}
/*
* (non-Javadoc)
*

View file

@ -18,12 +18,12 @@
package gov.noaa.nws.ncep.common.dataplugin.h5uair;
import java.util.Date;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
@ -35,14 +35,14 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@ -51,10 +51,11 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class H5UairRecord extends PluginDataObject implements ISpatialEnabled,
IDecoderGettable, IPointData, IPersistable {
public class H5UairRecord extends PersistablePluginDataObject implements
ISpatialEnabled, IDecoderGettable, IPointData {
private static final long serialVersionUID = 1L;
public static final String PLUGIN_NAME = "h5uair";
// Time of the UTC
@ -187,18 +188,17 @@ public class H5UairRecord extends PluginDataObject implements ISpatialEnabled,
@Embedded
private PointDataView pdv;
private Integer hdfFileId;
/**
* Empty constructor.
*/
public H5UairRecord() {
this.nil=false;
this.stnum="";
this.wmoHeader="";
this.stid="";
this.corr="";
this.dataType="";
this.nil = false;
this.stnum = "";
this.wmoHeader = "";
this.stid = "";
this.corr = "";
this.dataType = "";
}
/**
@ -377,16 +377,18 @@ public class H5UairRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param uair observation levels to set
* @param uair
* observation levels to set
*/
public void setObsLevels(Set<H5ObsLevels> uairLevel) {
this.obsLevels = uairLevel;
}
/**
* @param add uair observation levels to set
* @param add
* uair observation levels to set
*/
public void addObsLevels(H5ObsLevels plevel){
public void addObsLevels(H5ObsLevels plevel) {
obsLevels.add(plevel);
plevel.setParentID(this);
}
@ -399,16 +401,18 @@ public class H5UairRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param uair observation levels to set
* @param uair
* observation levels to set
*/
public void setTropopause(Set<H5Tropopause> trop) {
this.tropopause = trop;
}
/**
* @param add uair observation levels to set
* @param add
* uair observation levels to set
*/
public void addTropopause(H5Tropopause trop){
public void addTropopause(H5Tropopause trop) {
tropopause.add(trop);
trop.setParentID(this);
}
@ -421,16 +425,18 @@ public class H5UairRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param uair maximum wind to set
* @param uair
* maximum wind to set
*/
public void setMaxWind(Set<H5MaxWind> mwind) {
this.maxwind = mwind;
}
/**
* @param add uair maximum wind to set
* @param add
* uair maximum wind to set
*/
public void addMaxWind(H5MaxWind mwind){
public void addMaxWind(H5MaxWind mwind) {
maxwind.add(mwind);
mwind.setParentID(this);
}
@ -443,57 +449,58 @@ public class H5UairRecord extends PluginDataObject implements ISpatialEnabled,
}
/**
* @param uair lifted index to set
* @param uair
* lifted index to set
*/
public void setLiftedIndex(Set<H5LiftedIndex> li) {
this.liftedindex = li;
}
/**
* @param add uair lifted index to set
* @param add
* uair lifted index to set
*/
public void addLiftedIndex(H5LiftedIndex li){
public void addLiftedIndex(H5LiftedIndex li) {
liftedindex.add(li);
li.setParentID(this);
}
/**
* Override existing set method to modify any
* classes that use the dataURI as a foreign key
* Override existing set method to modify any classes that use the dataURI
* as a foreign key
*/
@Override
public void setIdentifier(Object dataURI)
{
public void setIdentifier(Object dataURI) {
this.identifier = dataURI;
if(this.getObsLevels() != null && this.getObsLevels().size() > 0)
{
for (Iterator<H5ObsLevels> iter = this.getObsLevels().iterator(); iter.hasNext();) {
if (this.getObsLevels() != null && this.getObsLevels().size() > 0) {
for (Iterator<H5ObsLevels> iter = this.getObsLevels().iterator(); iter
.hasNext();) {
H5ObsLevels level = iter.next();
level.setParentID(this);
}
}
if(this.getTropopause() != null && this.getTropopause().size() > 0)
{
for (Iterator<H5Tropopause> iter = this.getTropopause().iterator(); iter.hasNext();) {
if (this.getTropopause() != null && this.getTropopause().size() > 0) {
for (Iterator<H5Tropopause> iter = this.getTropopause().iterator(); iter
.hasNext();) {
H5Tropopause trop = iter.next();
trop.setParentID(this);
}
}
if(this.getMaxWind() != null && this.getMaxWind().size() > 0)
{
for (Iterator<H5MaxWind> iter = this.getMaxWind().iterator(); iter.hasNext();) {
if (this.getMaxWind() != null && this.getMaxWind().size() > 0) {
for (Iterator<H5MaxWind> iter = this.getMaxWind().iterator(); iter
.hasNext();) {
H5MaxWind mwind = iter.next();
mwind.setParentID(this);
}
}
if(this.getLiftedIndex() != null && this.getLiftedIndex().size() > 0)
{
for (Iterator<H5LiftedIndex> iter = this.getLiftedIndex().iterator(); iter.hasNext();) {
if (this.getLiftedIndex() != null && this.getLiftedIndex().size() > 0) {
for (Iterator<H5LiftedIndex> iter = this.getLiftedIndex()
.iterator(); iter.hasNext();) {
H5LiftedIndex li = iter.next();
li.setParentID(this);
}
@ -523,29 +530,6 @@ public class H5UairRecord extends PluginDataObject implements ISpatialEnabled,
this.pdv = pdv;
}
@Override
public Integer getHdfFileId() {
return null;
}
@Override
public Date getPersistenceTime() {
// return this.dataTime.getRefTime();
return null;
}
@Override
public void setHdfFileId(Integer hdfFileId) {
this.hdfFileId = hdfFileId;
}
@Override
public void setPersistenceTime(Date persistTime) {
// TODO Auto-generated method stub
}
@Override
public Amount getValue(String paramName) {
// TODO Auto-generated method stub

View file

@ -22,7 +22,6 @@
package gov.noaa.nws.ncep.common.dataplugin.mcidas;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -42,12 +41,10 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasMapCoverage;
@Entity
@Table(name = "mcidas", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@ -56,7 +53,7 @@ import gov.noaa.nws.ncep.common.dataplugin.mcidas.McidasMapCoverage;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class McidasRecord extends PersistablePluginDataObject implements
IPersistable, ISpatialEnabled {
ISpatialEnabled {
private static final long serialVersionUID = 1L;
@ -72,8 +69,8 @@ public class McidasRecord extends PersistablePluginDataObject implements
@DataURI(position = 2)
@XmlAttribute
@DynamicSerializeElement
private String areaName;
/** The resolution */
@Column
@DataURI(position = 3)
@ -113,19 +110,19 @@ public class McidasRecord extends PersistablePluginDataObject implements
private Integer sizeRecords;
/** Satellite projection */
@Column(length=16)
@Column(length = 16)
@XmlAttribute
@DynamicSerializeElement
private String projection;
/** The report type */
@Column(length=16)
@Column(length = 16)
@XmlAttribute
@DynamicSerializeElement
private String reportType;
/** The calibration type */
@Column(length=16)
@Column(length = 16)
@XmlAttribute
@DynamicSerializeElement
private String calType;
@ -148,8 +145,8 @@ public class McidasRecord extends PersistablePluginDataObject implements
private Integer prefix;
/*
* Validation code. if these bytes are non-zero, they must match the first four
* bytes of each DATA block line prefix or the line's data is ignored.
* Validation code. if these bytes are non-zero, they must match the first
* four bytes of each DATA block line prefix or the line's data is ignored.
*/
private Integer validCode;
@ -203,22 +200,6 @@ public class McidasRecord extends PersistablePluginDataObject implements
super(uri);
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
@ -367,10 +348,4 @@ public class McidasRecord extends PersistablePluginDataObject implements
public void setImageTypeNumber(Integer imageTypeNumber) {
this.imageTypeNumber = imageTypeNumber;
}
@Override
public void setPersistenceTime(Date persistTime) {
// TODO Auto-generated method stub
}
}

View file

@ -22,8 +22,6 @@ package gov.noaa.nws.ncep.common.dataplugin.ncgrib;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@ -46,7 +44,6 @@ import org.hibernate.annotations.FetchMode;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IHDFFilePathProvider;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.ISpatialObject;
@ -76,7 +73,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcgribRecord extends PersistablePluginDataObject implements
IPersistable, ISpatialEnabled {
ISpatialEnabled {
private static final long serialVersionUID = 1L;
@ -416,22 +413,6 @@ public class NcgribRecord extends PersistablePluginDataObject implements
return null;
}
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
@Override
public ISpatialObject getSpatialObject() {
return modelInfo.getLocation();

View file

@ -14,21 +14,13 @@
package gov.noaa.nws.ncep.common.dataplugin.ncscat;
import java.util.Calendar;
import java.util.Date;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@ -37,57 +29,49 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@Entity
@Table(name = "ncscat", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcscatRecord extends PersistablePluginDataObject implements
IPersistable{
public class NcscatRecord extends PersistablePluginDataObject {
private static final long serialVersionUID = 1L;
// The time from the report
@Column
@DataURI(position=1)
@DataURI(position = 1)
@XmlElement
@DynamicSerializeElement
private Calendar startTime;
@Column
@DataURI(position=2)
@DataURI(position = 2)
@XmlElement
@DynamicSerializeElement
private Calendar endTime;
@Column
@DataURI(position=3)
@DataURI(position = 3)
@XmlElement
@DynamicSerializeElement
private String reportType;
@Transient
private byte[] convertedMessage;
@Column
@XmlElement
@DynamicSerializeElement
private int recordLength;
/**
* Default Constructor
*/
@ -97,13 +81,13 @@ IPersistable{
/**
* Constructs a ascat record from a dataURI
*
* @param uri The dataURI
* @param uri
* The dataURI
*/
public NcscatRecord(String uri) {
super(uri);
}
public Calendar getStartTime() {
return startTime;
}
@ -146,13 +130,9 @@ IPersistable{
return serialVersionUID;
}
@Override
public void setIdentifier(Object dataURI)
{
public void setIdentifier(Object dataURI) {
this.identifier = dataURI;
}
public int getRecordLength() {
@ -162,47 +142,4 @@ IPersistable{
public void setRecordLength(int recordLength) {
this.recordLength = recordLength;
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
if(getInsertTime()== null) return null;
else
return getInsertTime().getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
@Override
public void setPersistenceTime(Date persistTime){
Calendar insertTime=Calendar.getInstance();
insertTime.setTime(persistTime);
setInsertTime(insertTime);
}
}

View file

@ -1,35 +1,22 @@
package gov.noaa.nws.ncep.edex.plugin.mosaic.common;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.MosaicConstants;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.MosaicConstants.MapValues;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.level3.DataLevelThreshold;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.level3.SymbologyBlock;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.level3.SymbologyPacket;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.level3.SymbologyPoint;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.MosaicConstants;
import gov.noaa.nws.ncep.edex.plugin.mosaic.util.MosaicConstants.MapValues;
import java.awt.geom.Point2D;
import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.text.ParsePosition;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.Vector;
import javax.measure.unit.Unit;
import javax.measure.unit.UnitFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
@ -38,15 +25,11 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.geotools.referencing.GeodeticCalculator;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.opengis.referencing.crs.ProjectedCRS;
import org.opengis.referencing.operation.MathTransform;
//import com.raytheon.edex.map.MapUtil;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
@ -55,7 +38,6 @@ import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.StorageException;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
import com.raytheon.uf.common.datastorage.records.ShortDataRecord;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.ISpatialObject;
@ -64,13 +46,12 @@ import com.raytheon.uf.common.serialization.DynamicSerializationManager;
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.DataTime;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
/**
* Decoder implementation for mosaic plugin
*
* <pre>
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/2009 143 L. Lin Initial creation
@ -81,11 +62,11 @@ import com.vividsolutions.jts.geom.Envelope;
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*
* @author L. Lin
* @version 1.0
*/
@Entity
@Table(name = "mosaic", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
@ -104,7 +85,7 @@ public class MosaicRecord extends PersistablePluginDataObject implements
private Integer productCode;
@Column
@DataURI(position=3)
@DataURI(position = 3)
@DynamicSerializeElement
@XmlElement(nillable = false)
private Integer resolution;
@ -251,7 +232,7 @@ public class MosaicRecord extends PersistablePluginDataObject implements
throws StorageException, FileNotFoundException {
if ("Radial".equals(format) || "Raster".equals(format)) {
//ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
// ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
// getDataURI(), "Data");
ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
getDataURI(), "Data", Request.ALL);
@ -262,12 +243,13 @@ public class MosaicRecord extends PersistablePluginDataObject implements
|| "Graph".equals(format)) {
try {
//ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
// ByteDataRecord byteData = (ByteDataRecord)
// dataStore.retrieve(
// getDataURI(), "Symbology");
ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
getDataURI(), "Symbology", Request.ALL);
ByteArrayInputStream bais = new ByteArrayInputStream(byteData
.getByteData());
ByteArrayInputStream bais = new ByteArrayInputStream(
byteData.getByteData());
Object o = DynamicSerializationManager.getManager(
SerializationType.Thrift).deserialize(bais);
setSymbologyBlock((SymbologyBlock) o);
@ -278,8 +260,8 @@ public class MosaicRecord extends PersistablePluginDataObject implements
try {
ByteDataRecord byteData = (ByteDataRecord) dataStore.retrieve(
getDataURI(), "ProductVals", Request.ALL);
ByteArrayInputStream bais = new ByteArrayInputStream(byteData
.getByteData());
ByteArrayInputStream bais = new ByteArrayInputStream(
byteData.getByteData());
Object o = DynamicSerializationManager.getManager(
SerializationType.Thrift).deserialize(bais);
setProductVals((HashMap<MosaicConstants.MapValues, Map<String, Map<MosaicConstants.MapValues, String>>>) o);
@ -305,30 +287,6 @@ public class MosaicRecord extends PersistablePluginDataObject implements
}
}
/**
* Get the time to use for persisting this data.
*
* @return The persistence time for this data.
*/
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
/**
* Set the time to be used for the persistence time for this object.
*
* @param persistTime
* The persistence time to be used.
*/
public void setPersistenceTime(Calendar persistTime) {
setInsertTime(persistTime);
}
public String getProdName() {
return prodName;
}
@ -605,7 +563,8 @@ public class MosaicRecord extends PersistablePluginDataObject implements
* @param symbologyData
* the symbologyData to set
*/
public void setSymbologyData(Map<MosaicDataKey, MosaicDataPoint> symbologyData) {
public void setSymbologyData(
Map<MosaicDataKey, MosaicDataPoint> symbologyData) {
this.symbologyData = symbologyData;
}
@ -627,11 +586,9 @@ public class MosaicRecord extends PersistablePluginDataObject implements
// **********************************
if ("Raster".equals(this.getFormat())) {
int col = (int) (output[0] / this.getResolution() + (this
.getNy() / 2));
int col = (int) (output[0] / this.getResolution() + (this.getNy() / 2));
int row = (int) (output[1] / this.getResolution() + (this
.getNy() / 2));
int row = (int) (output[1] / this.getResolution() + (this.getNy() / 2));
row = this.getNy() - row - 1;
@ -784,12 +741,6 @@ public class MosaicRecord extends PersistablePluginDataObject implements
return list;
}
@Override
public void setPersistenceTime(Date persistTime) {
// TODO Auto-generated method stub
}
@Override
public ISpatialObject getSpatialObject() {
// TODO Auto-generated method stub

View file

@ -24,6 +24,8 @@ class RepackRequest(object):
def __init__(self):
self.compression = None
self.outputDir = None
self.timestampCheck = None
self.filename = None
def getCompression(self):
@ -32,6 +34,18 @@ class RepackRequest(object):
def setCompression(self, compression):
self.compression = compression
def getOutputDir(self):
return self.outputDir
def setOutputDir(self, outputDir):
self.outputDir = outputDir
def getTimestampCheck(self):
return self.timestampCheck
def setTimestampCheck(self, timestampCheck):
self.timestampCheck = timestampCheck
def getFilename(self):
return self.filename

View file

@ -622,25 +622,27 @@ class H5pyDataStore(IDataStore.IDataStore):
compression = request.getCompression()
resp = RepackResponse()
if os.path.exists(pth):
self.__recurseRepack(pth, compression, resp)
self.__recurseRepack(pth, request, resp)
return resp
def __recurseRepack(self, pth, compression, resp):
def __recurseRepack(self, pth, req, resp):
files = os.listdir(pth)
for f in files:
fullpath = pth + '/' + f
if os.path.isdir(fullpath):
self.__recurseRepack(fullpath, compression, resp)
self.__recurseRepack(fullpath, req, resp)
elif len(f) > 3 and f[-3:] == '.h5':
self.__doRepack(fullpath, resp, compression)
self.__doRepack(fullpath, req, resp)
def __doRepack(self, fullpath, response, compression='NONE'):
def __doRepack(self, fullpath, req, response):
lock = None
try:
f, lock = self.__openFile(fullpath, 'a')
proceedWithRepack = True
if 'lastRepacked' in f.attrs.keys():
lastRepacked = f.attrs['lastRepacked']
timestampCheck = req.getTimestampCheck()
if timestampCheck:
if timestampCheck in f.attrs.keys():
lastRepacked = f.attrs[timestampCheck]
lastModified = os.stat(fullpath).st_mtime
if lastRepacked > lastModified:
proceedWithRepack = False
@ -648,16 +650,23 @@ class H5pyDataStore(IDataStore.IDataStore):
# update repack time even if repack will fail, cause if it fails at
# this time there's no point in retrying. put time in the near future
# cause the modified time will be after the repack and rename
f.attrs['lastRepacked'] = time.time() + 30
if timestampCheck:
f.attrs[timestampCheck] = time.time() + 30
f.close()
# call h5repack to repack the file
outDir = req.getOutputDir()
if outDir is None:
repackedFullPath = fullpath + '.repacked'
cmd = ['h5repack', '-f', compression, fullpath, repackedFullPath]
else:
repackedFullPath = fullpath.replace(req.getFilename(), outDir)
cmd = ['h5repack', '-f', req.getCompression(), fullpath, repackedFullPath]
ret = subprocess.call(cmd)
success = (ret == 0)
if success:
# repack was successful, replace the old file
# repack was successful, replace the old file if we did it in the
# same directory, otherwise leave it alone
if outDir is None:
os.remove(fullpath)
os.rename(repackedFullPath, fullpath)
os.chmod(fullpath, stat.S_IWUSR | stat.S_IWGRP | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
@ -665,6 +674,10 @@ class H5pyDataStore(IDataStore.IDataStore):
# remove failed new file if there was one
if os.path.exists(repackedFullPath):
os.remove(repackedFullPath)
if outDir is not None:
# repack failed, but they wanted the data in a different
# directory, so just copy the original data without the repack
shutil.copy(fullpath, repackedFullPath)
# update response
if success: