awips2/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/purgeAllGrids.py
David Gillingham 2038a703ac Issue #1759: Refactor PurgeGfeGridsRequestHandler and IscMakeRequestHandler to not use
GfeScriptExecutor and GfeScript.

Change-Id: If3c789549a071e54f9020433f6221e688c51c44a

Conflicts:

	edexOsgi/com.raytheon.edex.plugin.gfe/META-INF/MANIFEST.MF


Former-commit-id: 05f52e6e54 [formerly 055c36ea41] [formerly 0969f85246 [formerly 45846ffc137ef816dc149f3f9e46b99dbe608897]]
Former-commit-id: 0969f85246
Former-commit-id: 8859674c70
2013-04-04 12:46:21 -05:00

64 lines
2.1 KiB
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 sys
import LogStream
from com.raytheon.edex.plugin.gfe.smartinit import IFPDB
#--------------------------------------------------------------------------
# Main program purges all grids from a database.
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# process function
#--------------------------------------------------------------------------
def process(dbname):
LogStream.logEvent("Purging all grids from: ", dbname)
# get list of parms
db = IFPDB(dbname)
parms = db.getKeys()
# cycle through each parm, get inventory, and store None grid to
# remove the grids
for p in range(0, parms.size()):
we = db.getItem(str(parms.get(p)))
inv = we.getKeys()
for i in range(0, inv.size()):
we.removeItem(inv.get(i))
#--------------------------------------------------------------------------
# Main program
#--------------------------------------------------------------------------
def executeFromJava(databaseID):
LogStream.logEvent("PurgeAllGrids starting")
try:
process(databaseID)
LogStream.logEvent("PurgeAllGrids finished")
sys.exit(0)
except SystemExit:
pass
except:
LogStream.logProblem("Caught exception\n", LogStream.exc())