Issue #2147 Changes to properly place gfe files in /awips2/edex/data/archive.

Change-Id: I00ab0a44e37d4e9898aa256f4963c34ed8ae1f48

Former-commit-id: 93ce65763e [formerly e8be9f980a] [formerly 546c051e35 [formerly 482b253e94e069ae82507e22a94213342b1b92e6]]
Former-commit-id: 546c051e35
Former-commit-id: f01f8e9eb4
This commit is contained in:
Roger Ferrel 2013-09-30 16:45:32 -05:00
parent 434321aa89
commit 3466232f8d
3 changed files with 116 additions and 1 deletions

View file

@ -95,6 +95,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* 05/20/13 #2127 rjpeter Set session's to read only and switched to stateless where possible.
* 08/08/13 DR16485 ryu Remove call to getDatabaseId() from getMaxInsertTimeByDbId()
* so new GFE databases aren't accidentally created.
* 09/30/2013 #2147 rferrel Changes to archive hdf5 files.
* </pre>
*
* @author bphillip
@ -106,6 +107,7 @@ public class GFEDao extends DefaultPluginDao {
public GFEDao() throws PluginException {
super("gfe");
this.pathProvider = new GFEPathProvider();
}
/**
@ -115,6 +117,7 @@ public class GFEDao extends DefaultPluginDao {
*/
public GFEDao(String pluginName) throws PluginException {
super(pluginName);
this.pathProvider = new GFEPathProvider();
}
/**

View file

@ -0,0 +1,97 @@
/**
* 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.edex.plugin.gfe.db.dao;
import java.io.File;
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord;
import com.raytheon.uf.common.dataplugin.gfe.util.GfeUtil;
import com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
/**
* Provider for GFE that uses the GfeUtil to get the HDF5 path and file names.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 23, 2013 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class GFEPathProvider extends DefaultPathProvider {
/**
* Constructor.
*/
public GFEPathProvider() {
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider#getHDFFileName
* (java.lang.String,
* com.raytheon.uf.common.dataplugin.persist.IPersistable)
*/
@Override
public String getHDFFileName(String pluginName, IPersistable persistable) {
String name = null;
if (persistable instanceof GFERecord) {
GFERecord gfeRecord = (GFERecord) persistable;
File hdf5File = GfeUtil.getHdf5File(GridDatabase.gfeBaseDataDir,
gfeRecord.getParmId(), gfeRecord.getTimeRange());
name = hdf5File.toString();
name = name.substring(name.lastIndexOf(File.separator) + 1);
}
return name;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.dataplugin.persist.DefaultPathProvider#getHDFPath
* (java.lang.String,
* com.raytheon.uf.common.dataplugin.persist.IPersistable)
*/
@Override
public String getHDFPath(String pluginName, IPersistable persistable) {
String path = null;
path = super.getHDFPath(pluginName, persistable);
if (persistable instanceof GFERecord) {
GFERecord gfeRecord = (GFERecord) persistable;
File pathDir = GfeUtil.getHdf5Dir(GridDatabase.gfeBaseDataDir,
gfeRecord.getDbId());
path = pathDir.toString();
path = path.substring(pluginName.length() + 1);
}
return path;
}
}

View file

@ -25,6 +25,7 @@ package com.raytheon.uf.common.dataplugin.gfe.db.objects;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
@ -47,6 +48,7 @@ import org.hibernate.annotations.OnDeleteAction;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.DataTime;
@ -78,6 +80,7 @@ import com.raytheon.uf.common.time.TimeRange;
* May 13, 2013 1869 bsteffen Remove DataURI column from GFE.
* Jun 20, 2013 2127 rjpeter Added OnDelete annotation.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Sep 20, 2013 2147 rferrel Changes to archive hdf5 files.
*
* </pre>
*
@ -96,7 +99,7 @@ import com.raytheon.uf.common.time.TimeRange;
"refTime", "forecastTime" }) })
@DynamicSerialize
@BatchSize(size = 500)
public class GFERecord extends PluginDataObject {
public class GFERecord extends PluginDataObject implements IPersistable {
private static final long serialVersionUID = 1L;
@ -281,4 +284,16 @@ public class GFERecord extends PluginDataObject {
public String getPluginName() {
return "gfe";
}
@Override
public Date getPersistenceTime() {
return getInsertTime().getTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
Calendar pTime = Calendar.getInstance();
pTime.setTime(persistTime);
setInsertTime(pTime);
}
}