Issue #1236: Merge tropical automated testing changes from old git repo to common baseline.
Change-Id: I820b4e09482b52ecd42252bec7eb95c1db741c95 Former-commit-id:f17309d5f7
[formerlye27be9180b
[formerly b64085fb436bb8347c3bff529f1c421c665c6438]] Former-commit-id:e27be9180b
Former-commit-id:65057b8ced
This commit is contained in:
parent
cc54818088
commit
6f1720aae0
15 changed files with 575 additions and 73 deletions
|
@ -20,7 +20,11 @@
|
|||
package com.raytheon.viz.ui.personalities.awips;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
|
@ -49,6 +53,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.viz.alertviz.SystemStatusHandler;
|
||||
import com.raytheon.uf.viz.alertviz.ui.dialogs.AlertVisualization;
|
||||
import com.raytheon.uf.viz.application.ProgramArguments;
|
||||
import com.raytheon.uf.viz.application.component.IStandaloneComponent;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver;
|
||||
|
@ -77,6 +82,11 @@ import com.raytheon.viz.core.units.UnitRegistrar;
|
|||
* and CAVE immediately exits
|
||||
* if connection cannot be made to
|
||||
* localization server.
|
||||
* May 31, 2012 #674 dgilling Allow SimulatedTime to be set from
|
||||
* the command line.
|
||||
* Oct 02, 2012 #1236 dgilling Allow SimulatedTime to be set from
|
||||
* the command line even if practice
|
||||
* mode is off.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -105,10 +115,6 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
|||
@SuppressWarnings("restriction")
|
||||
@Override
|
||||
public final Object startComponent(String componentName) throws Exception {
|
||||
UnitRegistrar.registerUnits();
|
||||
CAVEMode.performStartupDuties();
|
||||
|
||||
long t0 = System.currentTimeMillis();
|
||||
// This is a workaround to receive status messages because without the
|
||||
// PlatformUI initialized Eclipse throws out the status
|
||||
// messages. Once PlatformUI has started, the status handler
|
||||
|
@ -127,6 +133,11 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
|||
|
||||
});
|
||||
|
||||
UnitRegistrar.registerUnits();
|
||||
CAVEMode.performStartupDuties();
|
||||
|
||||
long t0 = System.currentTimeMillis();
|
||||
|
||||
Display display = null;
|
||||
int modes = getRuntimeModes();
|
||||
boolean alertviz = (modes & ALERT_VIZ) != 0;
|
||||
|
@ -192,9 +203,7 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
|||
System.out.println("Localization time: " + (t1 - t0) + "ms");
|
||||
|
||||
try {
|
||||
if (CAVEMode.getMode() == CAVEMode.PRACTICE) {
|
||||
restoreUserTime();
|
||||
}
|
||||
initializeSimulatedTime();
|
||||
|
||||
if (cave) {
|
||||
workbenchAdvisor = getWorkbenchAdvisor();
|
||||
|
@ -274,14 +283,34 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
|
|||
/**
|
||||
* Restore the prior state of SimulatedTime
|
||||
*/
|
||||
private void restoreUserTime() {
|
||||
// Get the last saved time from the localization settings
|
||||
|
||||
// If CorePlugin.getDefault() == null, assume running from a unit test
|
||||
private void initializeSimulatedTime() {
|
||||
long timeValue = 0;
|
||||
boolean isFrozen = false;
|
||||
if (CAVEMode.getMode() == CAVEMode.PRACTICE
|
||||
&& CorePlugin.getDefault() != null) {
|
||||
|
||||
// If CorePlugin.getDefault() == null, assume running from a unit test
|
||||
if (CorePlugin.getDefault() != null) {
|
||||
String dateString = ProgramArguments.getInstance().getString(
|
||||
"-time");
|
||||
if (dateString != null && !dateString.isEmpty()) {
|
||||
try {
|
||||
DateFormat dateParser = new SimpleDateFormat(
|
||||
"yyyyMMdd_HHmm");
|
||||
dateParser.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
Date newSimTime = dateParser.parse(dateString);
|
||||
timeValue = newSimTime.getTime();
|
||||
} catch (ParseException e) {
|
||||
statusHandler
|
||||
.handle(Priority.WARN,
|
||||
"Invalid argument specified for command-line parameter '-time'.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we're in practice mode and the user did not specify a DRT value on
|
||||
// the CLI, restore their previous time setting
|
||||
if ((CAVEMode.getMode() == CAVEMode.PRACTICE) && (timeValue == 0)) {
|
||||
// Get the last saved time from the localization settings
|
||||
timeValue = CorePlugin.getDefault().getPreferenceStore()
|
||||
.getLong(PreferenceConstants.P_LAST_USER_TIME);
|
||||
|
||||
|
|
|
@ -23,5 +23,9 @@
|
|||
<constructor-arg ref="getCoveragesHandler"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="deleteAllModelDataHandler" class="com.raytheon.edex.plugin.grib.handler.DeleteAllModelDataHandler" />
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg value="com.raytheon.uf.common.dataplugin.grib.request.DeleteAllModelDataRequest"/>
|
||||
<constructor-arg ref="deleteAllModelDataHandler"/>
|
||||
</bean>
|
||||
</beans>
|
|
@ -57,11 +57,15 @@ import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
|
|||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IntegerDataRecord;
|
||||
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.EDEXUtil;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginDao;
|
||||
import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
||||
|
||||
/**
|
||||
* Data access object for accessing Grib records from the database
|
||||
|
@ -73,6 +77,8 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/7/09 1994 bphillip Initial Creation
|
||||
* 5/31/12 #674 dgilling Re-factor so all purge methods
|
||||
* call updateCaches().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -81,6 +87,9 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
|
|||
*/
|
||||
public class GribDao extends PluginDao {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(GribDao.class);
|
||||
|
||||
private static final String LOCAL_SECTION = "localSection";
|
||||
|
||||
private static final String HYBRID_LEVELS = "hybridLevels";
|
||||
|
@ -91,8 +100,6 @@ public class GribDao extends PluginDao {
|
|||
|
||||
private static final String PURGE_MODEL_CACHE_TOPIC = "jms-generic:topic:purgeGribModelCache";
|
||||
|
||||
private static final String ORPHAN_MODEL_QUERY = "select id from awips.grib_models where id not in(select distinct(modelinfo_id) from awips.grib)";
|
||||
|
||||
/**
|
||||
* Creates a new GribPyDao object
|
||||
*
|
||||
|
@ -109,62 +116,64 @@ public class GribDao extends PluginDao {
|
|||
this("grib");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purgeExpiredData() throws PluginException {
|
||||
super.purgeExpiredData();
|
||||
try {
|
||||
List<Integer> orphanedIds = purgeGribModelOrphans();
|
||||
EDEXUtil.getMessageProducer().sendAsyncUri(PURGE_MODEL_CACHE_TOPIC,
|
||||
orphanedIds);
|
||||
} catch (DataAccessLayerException e1) {
|
||||
statusHandler
|
||||
.error("Error purging orphaned grib model entries", e1);
|
||||
} catch (EdexException e) {
|
||||
statusHandler.error(
|
||||
"Error sending message to purge grib model topic", e);
|
||||
}
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendAsyncUri(REBUILD_CACHE_TOPIC,
|
||||
null);
|
||||
} catch (EdexException e) {
|
||||
statusHandler.error(
|
||||
"Error sending message to rebuild D2D Cache topic", e);
|
||||
}
|
||||
updateCaches();
|
||||
}
|
||||
|
||||
private List<Integer> purgeGribModelOrphans()
|
||||
throws DataAccessLayerException {
|
||||
QueryResult result = (QueryResult) this
|
||||
.executeNativeSql(ORPHAN_MODEL_QUERY);
|
||||
QueryResult result = (QueryResult) executeNativeSql("select id from awips.grib_models where id not in(select distinct(modelinfo_id) from awips.grib)");
|
||||
List<Integer> orphanedIds = new ArrayList<Integer>();
|
||||
for (int i = 0; i < result.getResultCount(); i++) {
|
||||
orphanedIds.add((Integer) result.getRowColumnValue(0, 0));
|
||||
orphanedIds.add((Integer) result.getRowColumnValue(i, 0));
|
||||
}
|
||||
|
||||
if (!orphanedIds.isEmpty()) {
|
||||
this.executeNativeSql(ORPHAN_MODEL_QUERY.replace("select id",
|
||||
"delete"));
|
||||
DatabaseQuery deleteQuery = new DatabaseQuery(GribModel.class);
|
||||
deleteQuery.addQueryParam("id", orphanedIds, "in");
|
||||
deleteByCriteria(deleteQuery);
|
||||
}
|
||||
return orphanedIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void purgeAllData() throws PluginException {
|
||||
super.purgeAllData();
|
||||
updateCaches();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws PluginException
|
||||
*/
|
||||
private void updateCaches() throws PluginException {
|
||||
Exception rethrow = null;
|
||||
|
||||
try {
|
||||
List<Integer> orphanedIds = purgeGribModelOrphans();
|
||||
EDEXUtil.getMessageProducer().sendAsyncUri(PURGE_MODEL_CACHE_TOPIC,
|
||||
orphanedIds);
|
||||
} catch (DataAccessLayerException e1) {
|
||||
statusHandler
|
||||
.error("Error purging orphaned grib model entries", e1);
|
||||
} catch (EdexException e) {
|
||||
} catch (DataAccessLayerException e) {
|
||||
statusHandler.error("Error purging orphaned grib model entries", e);
|
||||
rethrow = e;
|
||||
} catch (EdexException e1) {
|
||||
statusHandler.error(
|
||||
"Error sending message to purge grib model topic", e);
|
||||
"Error sending message to purge grib model topic", e1);
|
||||
rethrow = e1;
|
||||
}
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendAsyncUri(REBUILD_CACHE_TOPIC,
|
||||
null);
|
||||
} catch (EdexException e) {
|
||||
throw new PluginException(
|
||||
statusHandler.error(
|
||||
"Error sending message to rebuild D2D Cache topic", e);
|
||||
rethrow = e;
|
||||
}
|
||||
|
||||
if (rethrow != null) {
|
||||
throw new PluginException(
|
||||
"Error updating GribModelCache or D2DParmIDCache", rethrow);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,12 +201,13 @@ public class GribDao extends PluginDao {
|
|||
storageRecord = new FloatDataRecord("Data",
|
||||
gribRec.getDataURI(),
|
||||
(float[]) gribRec.getMessageData(), 2, sizes);
|
||||
} else
|
||||
} else {
|
||||
throw new Exception(
|
||||
"Cannot create data record, spatialData = "
|
||||
+ gribRec.getSpatialObject()
|
||||
+ " and messageData = "
|
||||
+ gribRec.getMessageData());
|
||||
}
|
||||
} else if (gribRec.getMessageData() instanceof byte[]) {
|
||||
storageRecord = new ByteDataRecord("Data",
|
||||
gribRec.getDataURI(), (byte[]) gribRec.getMessageData());
|
||||
|
@ -411,16 +421,13 @@ public class GribDao extends PluginDao {
|
|||
public List<StorageException> replaceRecord(GribRecord pdo)
|
||||
throws PluginException {
|
||||
List<StorageException> exceptions = new ArrayList<StorageException>();
|
||||
IPersistable persistable = (IPersistable) pdo;
|
||||
IPersistable persistable = pdo;
|
||||
persistable.setHdfFileId(EDEXUtil.getServerId());
|
||||
|
||||
// get the directory
|
||||
String directory = HDF5_DIR
|
||||
String directory = HDF5_DIR + File.separator + pdo.getPluginName()
|
||||
+ File.separator
|
||||
+ pdo.getPluginName()
|
||||
+ File.separator
|
||||
+ pathProvider.getHDFPath(pdo.getPluginName(),
|
||||
(IPersistable) pdo);
|
||||
+ pathProvider.getHDFPath(pdo.getPluginName(), pdo);
|
||||
File dataStoreFile = new File(directory + File.separator
|
||||
+ pathProvider.getHDFFileName(pdo.getPluginName(), persistable));
|
||||
|
||||
|
@ -445,26 +452,38 @@ public class GribDao extends PluginDao {
|
|||
}
|
||||
|
||||
public int purgeModelData(final String modelName) {
|
||||
return (Integer) txTemplate.execute(new TransactionCallback() {
|
||||
@Override
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
int rval = 0;
|
||||
HibernateTemplate ht = getHibernateTemplate();
|
||||
Session sess = ht.getSessionFactory().getCurrentSession();
|
||||
Query modelIdQuery = sess
|
||||
.createQuery("SELECT distinct id from GribModel where modelName = :modelName");
|
||||
modelIdQuery.setString("modelName", modelName);
|
||||
List<Integer> mIds = (List<Integer>) modelIdQuery.list();
|
||||
for (Integer mId : mIds) {
|
||||
Query query = sess
|
||||
.createQuery("DELETE from GribRecord where modelInfo.id = :mId");
|
||||
query.setInteger("mId", mId);
|
||||
rval += query.executeUpdate();
|
||||
}
|
||||
Integer recordsDeleted = (Integer) txTemplate
|
||||
.execute(new TransactionCallback() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object doInTransaction(TransactionStatus status) {
|
||||
int rval = 0;
|
||||
HibernateTemplate ht = getHibernateTemplate();
|
||||
Session sess = ht.getSessionFactory()
|
||||
.getCurrentSession();
|
||||
Query modelIdQuery = sess
|
||||
.createQuery("SELECT distinct id from GribModel where modelName = :modelName");
|
||||
modelIdQuery.setString("modelName", modelName);
|
||||
List<Integer> mIds = modelIdQuery.list();
|
||||
for (Integer mId : mIds) {
|
||||
Query query = sess
|
||||
.createQuery("DELETE from GribRecord where modelInfo.id = :mId");
|
||||
query.setInteger("mId", mId);
|
||||
rval += query.executeUpdate();
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
});
|
||||
return rval;
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
updateCaches();
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not update grib cache.", e);
|
||||
}
|
||||
|
||||
return recordsDeleted;
|
||||
}
|
||||
|
||||
public void purgeHdf5ModelData(final String modelName)
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* 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.grib.handler;
|
||||
|
||||
import com.raytheon.edex.plugin.grib.dao.GribModelDao;
|
||||
import com.raytheon.uf.common.dataplugin.grib.request.DeleteAllModelDataRequest;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
|
||||
/**
|
||||
* Request handler for <code>DeleteAllModelDataRequest</code>.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 25, 2012 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DeleteAllModelDataHandler implements
|
||||
IRequestHandler<DeleteAllModelDataRequest> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest
|
||||
* (com.raytheon.uf.common.serialization.comm.IServerRequest)
|
||||
*/
|
||||
@Override
|
||||
public Integer handleRequest(DeleteAllModelDataRequest request)
|
||||
throws Exception {
|
||||
return new GribModelDao().deleteModelAndAssociatedData(request
|
||||
.getModelName());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* 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.grib.request;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
|
||||
/**
|
||||
* Request object used to delete all stored data for the specified model name.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 25, 2012 dgilling Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@DynamicSerialize
|
||||
public class DeleteAllModelDataRequest implements IServerRequest {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String modelName;
|
||||
|
||||
public DeleteAllModelDataRequest() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public DeleteAllModelDataRequest(String modelName) {
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return modelName;
|
||||
}
|
||||
|
||||
public void setModelName(String modelName) {
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("DeleteAllModelDataRequest [modelName=");
|
||||
builder.append(modelName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
51
edexOsgi/com.raytheon.uf.tools.cli/impl/purgeAllModelData
Normal file
51
edexOsgi/com.raytheon.uf.tools.cli/impl/purgeAllModelData
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/bin/bash
|
||||
##
|
||||
# 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.
|
||||
##
|
||||
##############################################################################
|
||||
# This script allows you to purge all ingested data for a specified
|
||||
# model.
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 06/08/12 #674 dgilling Initial Creation.
|
||||
##############################################################################
|
||||
|
||||
# this allows you to run this script from outside of ./bin
|
||||
path_to_script=`readlink -f $0`
|
||||
RUN_FROM_DIR=`dirname $path_to_script`
|
||||
|
||||
BASE_AWIPS_DIR=`dirname $RUN_FROM_DIR`
|
||||
|
||||
# get the base environment
|
||||
source ${RUN_FROM_DIR}/setup.env
|
||||
|
||||
# setup the environment needed to run the the Python
|
||||
export LD_LIBRARY_PATH=${BASE_AWIPS_DIR}/src/lib:${PYTHON_INSTALL}/lib
|
||||
export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH
|
||||
|
||||
# execute the ifpInit Python module
|
||||
_PYTHON="${PYTHON_INSTALL}/bin/python"
|
||||
_MODULE="${RUN_FROM_DIR}/src/purgeallmodeldata/purgeAllModelData.py"
|
||||
|
||||
# quoting of '$@' is used to prevent command line interpretation
|
||||
$_PYTHON $_MODULE -h ${DEFAULT_HOST} -p ${DEFAULT_PORT} "$@"
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
import logging
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.grib.request import DeleteAllModelDataRequest
|
||||
from ufpy import ThriftClient
|
||||
from ufpy import UsageArgumentParser
|
||||
|
||||
logger = None
|
||||
def __initLogger():
|
||||
global logger
|
||||
logger = logging.getLogger("purgeAllModelData")
|
||||
logger.setLevel(logging.DEBUG)
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(logging.INFO)
|
||||
# Uncomment line below to enable debug-level logging
|
||||
# ch.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter("%(asctime)s %(name)s %(levelname)s: %(message)s", "%H:%M:%S")
|
||||
ch.setFormatter(formatter)
|
||||
logger.addHandler(ch)
|
||||
|
||||
def __parseCommandLine():
|
||||
parser = UsageArgumentParser.UsageArgumentParser(conflict_handler="resolve", prog='purgeAllModelData')
|
||||
parser.add_argument("-h", action="store", dest="host",
|
||||
help="Host upon which the EDEX server is running",
|
||||
required=True, metavar="hostname")
|
||||
parser.add_argument("-p", action="store", type=int, dest="port",
|
||||
help="Port on which the EDEX server is listening",
|
||||
required=True, metavar="portNumber")
|
||||
parser.add_argument("-m", action="append", dest="models",
|
||||
help="Name of the model to purge. Use multiple -m arguments to delete more than 1 model, but duplicate model names will be ignored.",
|
||||
required=True, metavar="modelName")
|
||||
options = parser.parse_args()
|
||||
# Ensure no duplicates end up in the list of models
|
||||
options.models = list(set(options.models))
|
||||
logger.debug("Command-line arguments: " + str(options))
|
||||
return options
|
||||
|
||||
def main():
|
||||
__initLogger()
|
||||
logger.info("Starting purgeAllModelData.")
|
||||
options = __parseCommandLine()
|
||||
|
||||
client = ThriftClient.ThriftClient(options.host, options.port)
|
||||
for model in options.models:
|
||||
try:
|
||||
logger.info("Deleting all data for model [" + model + "]...")
|
||||
req = DeleteAllModelDataRequest(model)
|
||||
client.sendRequest(req)
|
||||
logger.info("Model data for model [" + model + "] successfully deleted...")
|
||||
except Exception:
|
||||
logger.exception("Could not purge data for model [" + model + "]:")
|
||||
logger.info("purgeAllModelData is complete.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -21,7 +21,8 @@
|
|||
# File auto-generated by PythonFileGenerator
|
||||
|
||||
__all__ = [
|
||||
'gfe'
|
||||
'gfe',
|
||||
'grib'
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
##
|
||||
|
||||
# File auto-generated against equivalent DynamicSerialize Java class
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class AbstractGfeRequest(object):
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def __init__(self):
|
||||
self.siteID = None
|
||||
self.workstationID = None
|
||||
|
||||
def getSiteID(self):
|
||||
return self.siteID
|
||||
|
||||
def setSiteID(self, siteID):
|
||||
self.siteID = siteID
|
||||
|
||||
def getWorkstationID(self):
|
||||
return self.workstationID
|
||||
|
||||
def setWorkstationID(self, workstationID):
|
||||
self.workstationID = workstationID
|
|
@ -0,0 +1,45 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated against equivalent DynamicSerialize Java class
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import AbstractGfeRequest
|
||||
|
||||
|
||||
class ClearPracticeVTECTableRequest(AbstractGfeRequest):
|
||||
|
||||
def __init__(self):
|
||||
super(ClearPracticeVTECTableRequest, self).__init__()
|
||||
self.requestedSiteId = None
|
||||
self.mode = None
|
||||
|
||||
def getRequestedSiteId(self):
|
||||
return self.requestedSiteId
|
||||
|
||||
def setRequestedSiteId(self, requestedSiteId):
|
||||
self.requestedSiteId = requestedSiteId
|
||||
|
||||
def getMode(self):
|
||||
return self.mode
|
||||
|
||||
def setMode(self, mode):
|
||||
if mode not in ['OPERATIONAL', 'PRACTICE']:
|
||||
raise ValueError("Invalid value " + mode + " specified for ActiveTableMode.")
|
||||
self.mode = mode
|
|
@ -21,6 +21,8 @@
|
|||
# File auto-generated by PythonFileGenerator
|
||||
|
||||
__all__ = [
|
||||
'AbstractGfeRequest',
|
||||
'ClearPracticeVTECTableRequest',
|
||||
'CommitGridsRequest',
|
||||
'ConfigureTextProductsRequest',
|
||||
'CreateNetCDFGridRequest',
|
||||
|
@ -48,6 +50,8 @@ __all__ = [
|
|||
]
|
||||
|
||||
from CommitGridsRequest import CommitGridsRequest
|
||||
from AbstractGfeRequest import AbstractGfeRequest
|
||||
from ClearPracticeVTECTableRequest import ClearPracticeVTECTableRequest
|
||||
from ConfigureTextProductsRequest import ConfigureTextProductsRequest
|
||||
from CreateNetCDFGridRequest import CreateNetCDFGridRequest
|
||||
from ExecuteIscMosaicRequest import ExecuteIscMosaicRequest
|
||||
|
|
|
@ -56,4 +56,7 @@ class ServerResponse(object):
|
|||
for serverMsg in self.messages:
|
||||
compMessage += serverMsg.getMessage() + "\n"
|
||||
|
||||
return compMessage
|
||||
return compMessage
|
||||
|
||||
def __str__(self):
|
||||
return self.message()
|
|
@ -0,0 +1,27 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated by PythonFileGenerator
|
||||
|
||||
__all__ = [
|
||||
'request'
|
||||
]
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated against equivalent DynamicSerialize Java class
|
||||
|
||||
class DeleteAllModelDataRequest(object):
|
||||
|
||||
def __init__(self, modelName=None):
|
||||
self.modelName = modelName
|
||||
|
||||
def getModelName(self):
|
||||
return self.modelName
|
||||
|
||||
def setModelName(self, modelName):
|
||||
self.modelName = modelName
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
|
||||
# File auto-generated by PythonFileGenerator
|
||||
|
||||
__all__ = [
|
||||
'DeleteAllModelDataRequest'
|
||||
]
|
||||
|
||||
from DeleteAllModelDataRequest import DeleteAllModelDataRequest
|
||||
|
Loading…
Add table
Reference in a new issue