Merge "Issue #1236: Merge tropical automated testing changes from old git repo to common baseline." into development

Former-commit-id: d24f4505f4 [formerly 3861494b69] [formerly 44058f97a4] [formerly 3d4b67aca9 [formerly 44058f97a4 [formerly 49b7b7d5685561cb9964e03a541a84983829be98]]]
Former-commit-id: 3d4b67aca9
Former-commit-id: 05abfcf87a42809f0075518d4722b1252eadfe5f [formerly 773d86477f]
Former-commit-id: 7ac27effa3
This commit is contained in:
Ron Anderson 2012-10-02 18:20:02 -05:00 committed by Gerrit Code Review
commit 0291c9eb3b
15 changed files with 575 additions and 73 deletions

View file

@ -20,7 +20,11 @@
package com.raytheon.viz.ui.personalities.awips; package com.raytheon.viz.ui.personalities.awips;
import java.io.IOException; import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.TimeZone;
import javax.xml.bind.JAXBException; 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.common.time.SimulatedTime;
import com.raytheon.uf.viz.alertviz.SystemStatusHandler; import com.raytheon.uf.viz.alertviz.SystemStatusHandler;
import com.raytheon.uf.viz.alertviz.ui.dialogs.AlertVisualization; 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.application.component.IStandaloneComponent;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver; import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver;
@ -77,6 +82,11 @@ import com.raytheon.viz.core.units.UnitRegistrar;
* and CAVE immediately exits * and CAVE immediately exits
* if connection cannot be made to * if connection cannot be made to
* localization server. * 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> * </pre>
* *
@ -105,10 +115,6 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
@SuppressWarnings("restriction") @SuppressWarnings("restriction")
@Override @Override
public final Object startComponent(String componentName) throws Exception { 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 // This is a workaround to receive status messages because without the
// PlatformUI initialized Eclipse throws out the status // PlatformUI initialized Eclipse throws out the status
// messages. Once PlatformUI has started, the status handler // 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; Display display = null;
int modes = getRuntimeModes(); int modes = getRuntimeModes();
boolean alertviz = (modes & ALERT_VIZ) != 0; boolean alertviz = (modes & ALERT_VIZ) != 0;
@ -192,9 +203,7 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
System.out.println("Localization time: " + (t1 - t0) + "ms"); System.out.println("Localization time: " + (t1 - t0) + "ms");
try { try {
if (CAVEMode.getMode() == CAVEMode.PRACTICE) { initializeSimulatedTime();
restoreUserTime();
}
if (cave) { if (cave) {
workbenchAdvisor = getWorkbenchAdvisor(); workbenchAdvisor = getWorkbenchAdvisor();
@ -274,14 +283,34 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent {
/** /**
* Restore the prior state of SimulatedTime * Restore the prior state of SimulatedTime
*/ */
private void restoreUserTime() { private void initializeSimulatedTime() {
// Get the last saved time from the localization settings
// If CorePlugin.getDefault() == null, assume running from a unit test
long timeValue = 0; long timeValue = 0;
boolean isFrozen = false; 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() timeValue = CorePlugin.getDefault().getPreferenceStore()
.getLong(PreferenceConstants.P_LAST_USER_TIME); .getLong(PreferenceConstants.P_LAST_USER_TIME);

View file

@ -23,5 +23,9 @@
<constructor-arg ref="getCoveragesHandler"/> <constructor-arg ref="getCoveragesHandler"/>
</bean> </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> </beans>

View file

@ -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.FloatDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; 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.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException; import com.raytheon.uf.edex.core.EdexException;
import com.raytheon.uf.edex.core.dataplugin.PluginRegistry; import com.raytheon.uf.edex.core.dataplugin.PluginRegistry;
import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.plugin.PluginDao; 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 * 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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 4/7/09 1994 bphillip Initial Creation * 4/7/09 1994 bphillip Initial Creation
* 5/31/12 #674 dgilling Re-factor so all purge methods
* call updateCaches().
* *
* </pre> * </pre>
* *
@ -81,6 +87,9 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
*/ */
public class GribDao extends 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 LOCAL_SECTION = "localSection";
private static final String HYBRID_LEVELS = "hybridLevels"; 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 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 * Creates a new GribPyDao object
* *
@ -109,62 +116,64 @@ public class GribDao extends PluginDao {
this("grib"); this("grib");
} }
@Override
public void purgeExpiredData() throws PluginException { public void purgeExpiredData() throws PluginException {
super.purgeExpiredData(); super.purgeExpiredData();
try { updateCaches();
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);
}
} }
private List<Integer> purgeGribModelOrphans() private List<Integer> purgeGribModelOrphans()
throws DataAccessLayerException { throws DataAccessLayerException {
QueryResult result = (QueryResult) this QueryResult result = (QueryResult) executeNativeSql("select id from awips.grib_models where id not in(select distinct(modelinfo_id) from awips.grib)");
.executeNativeSql(ORPHAN_MODEL_QUERY);
List<Integer> orphanedIds = new ArrayList<Integer>(); List<Integer> orphanedIds = new ArrayList<Integer>();
for (int i = 0; i < result.getResultCount(); i++) { 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()) { if (!orphanedIds.isEmpty()) {
this.executeNativeSql(ORPHAN_MODEL_QUERY.replace("select id", DatabaseQuery deleteQuery = new DatabaseQuery(GribModel.class);
"delete")); deleteQuery.addQueryParam("id", orphanedIds, "in");
deleteByCriteria(deleteQuery);
} }
return orphanedIds; return orphanedIds;
} }
@Override
public void purgeAllData() throws PluginException { public void purgeAllData() throws PluginException {
super.purgeAllData(); super.purgeAllData();
updateCaches();
}
/**
* @throws PluginException
*/
private void updateCaches() throws PluginException {
Exception rethrow = null;
try { try {
List<Integer> orphanedIds = purgeGribModelOrphans(); List<Integer> orphanedIds = purgeGribModelOrphans();
EDEXUtil.getMessageProducer().sendAsyncUri(PURGE_MODEL_CACHE_TOPIC, EDEXUtil.getMessageProducer().sendAsyncUri(PURGE_MODEL_CACHE_TOPIC,
orphanedIds); orphanedIds);
} catch (DataAccessLayerException e1) { } catch (DataAccessLayerException e) {
statusHandler statusHandler.error("Error purging orphaned grib model entries", e);
.error("Error purging orphaned grib model entries", e1); rethrow = e;
} catch (EdexException e) { } catch (EdexException e1) {
statusHandler.error( statusHandler.error(
"Error sending message to purge grib model topic", e); "Error sending message to purge grib model topic", e1);
rethrow = e1;
} }
try { try {
EDEXUtil.getMessageProducer().sendAsyncUri(REBUILD_CACHE_TOPIC, EDEXUtil.getMessageProducer().sendAsyncUri(REBUILD_CACHE_TOPIC,
null); null);
} catch (EdexException e) { } catch (EdexException e) {
throw new PluginException( statusHandler.error(
"Error sending message to rebuild D2D Cache topic", e); "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", storageRecord = new FloatDataRecord("Data",
gribRec.getDataURI(), gribRec.getDataURI(),
(float[]) gribRec.getMessageData(), 2, sizes); (float[]) gribRec.getMessageData(), 2, sizes);
} else } else {
throw new Exception( throw new Exception(
"Cannot create data record, spatialData = " "Cannot create data record, spatialData = "
+ gribRec.getSpatialObject() + gribRec.getSpatialObject()
+ " and messageData = " + " and messageData = "
+ gribRec.getMessageData()); + gribRec.getMessageData());
}
} else if (gribRec.getMessageData() instanceof byte[]) { } else if (gribRec.getMessageData() instanceof byte[]) {
storageRecord = new ByteDataRecord("Data", storageRecord = new ByteDataRecord("Data",
gribRec.getDataURI(), (byte[]) gribRec.getMessageData()); gribRec.getDataURI(), (byte[]) gribRec.getMessageData());
@ -411,16 +421,13 @@ public class GribDao extends PluginDao {
public List<StorageException> replaceRecord(GribRecord pdo) public List<StorageException> replaceRecord(GribRecord pdo)
throws PluginException { throws PluginException {
List<StorageException> exceptions = new ArrayList<StorageException>(); List<StorageException> exceptions = new ArrayList<StorageException>();
IPersistable persistable = (IPersistable) pdo; IPersistable persistable = pdo;
persistable.setHdfFileId(EDEXUtil.getServerId()); persistable.setHdfFileId(EDEXUtil.getServerId());
// get the directory // get the directory
String directory = HDF5_DIR String directory = HDF5_DIR + File.separator + pdo.getPluginName()
+ File.separator + File.separator
+ pdo.getPluginName() + pathProvider.getHDFPath(pdo.getPluginName(), pdo);
+ File.separator
+ pathProvider.getHDFPath(pdo.getPluginName(),
(IPersistable) pdo);
File dataStoreFile = new File(directory + File.separator File dataStoreFile = new File(directory + File.separator
+ pathProvider.getHDFFileName(pdo.getPluginName(), persistable)); + pathProvider.getHDFFileName(pdo.getPluginName(), persistable));
@ -445,26 +452,38 @@ public class GribDao extends PluginDao {
} }
public int purgeModelData(final String modelName) { public int purgeModelData(final String modelName) {
return (Integer) txTemplate.execute(new TransactionCallback() { Integer recordsDeleted = (Integer) txTemplate
@Override .execute(new TransactionCallback() {
public Object doInTransaction(TransactionStatus status) { @SuppressWarnings("unchecked")
int rval = 0; @Override
HibernateTemplate ht = getHibernateTemplate(); public Object doInTransaction(TransactionStatus status) {
Session sess = ht.getSessionFactory().getCurrentSession(); int rval = 0;
Query modelIdQuery = sess HibernateTemplate ht = getHibernateTemplate();
.createQuery("SELECT distinct id from GribModel where modelName = :modelName"); Session sess = ht.getSessionFactory()
modelIdQuery.setString("modelName", modelName); .getCurrentSession();
List<Integer> mIds = (List<Integer>) modelIdQuery.list(); Query modelIdQuery = sess
for (Integer mId : mIds) { .createQuery("SELECT distinct id from GribModel where modelName = :modelName");
Query query = sess modelIdQuery.setString("modelName", modelName);
.createQuery("DELETE from GribRecord where modelInfo.id = :mId"); List<Integer> mIds = modelIdQuery.list();
query.setInteger("mId", mId); for (Integer mId : mIds) {
rval += query.executeUpdate(); 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) public void purgeHdf5ModelData(final String modelName)

View file

@ -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());
}
}

View file

@ -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();
}
}

View 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} "$@"

View file

@ -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()

View file

@ -21,7 +21,8 @@
# File auto-generated by PythonFileGenerator # File auto-generated by PythonFileGenerator
__all__ = [ __all__ = [
'gfe' 'gfe',
'grib'
] ]

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.
##
# 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

View file

@ -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

View file

@ -21,6 +21,8 @@
# File auto-generated by PythonFileGenerator # File auto-generated by PythonFileGenerator
__all__ = [ __all__ = [
'AbstractGfeRequest',
'ClearPracticeVTECTableRequest',
'CommitGridsRequest', 'CommitGridsRequest',
'ConfigureTextProductsRequest', 'ConfigureTextProductsRequest',
'CreateNetCDFGridRequest', 'CreateNetCDFGridRequest',
@ -48,6 +50,8 @@ __all__ = [
] ]
from CommitGridsRequest import CommitGridsRequest from CommitGridsRequest import CommitGridsRequest
from AbstractGfeRequest import AbstractGfeRequest
from ClearPracticeVTECTableRequest import ClearPracticeVTECTableRequest
from ConfigureTextProductsRequest import ConfigureTextProductsRequest from ConfigureTextProductsRequest import ConfigureTextProductsRequest
from CreateNetCDFGridRequest import CreateNetCDFGridRequest from CreateNetCDFGridRequest import CreateNetCDFGridRequest
from ExecuteIscMosaicRequest import ExecuteIscMosaicRequest from ExecuteIscMosaicRequest import ExecuteIscMosaicRequest

View file

@ -56,4 +56,7 @@ class ServerResponse(object):
for serverMsg in self.messages: for serverMsg in self.messages:
compMessage += serverMsg.getMessage() + "\n" compMessage += serverMsg.getMessage() + "\n"
return compMessage return compMessage
def __str__(self):
return self.message()

View file

@ -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'
]

View file

@ -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

View file

@ -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