Issue #2952 - Change MPE fieldgen to use thriftSrv
Change-Id: Ibd0ed87582a6374db1e49bc66093705436f6d5d3 Former-commit-id:e779ceee40
[formerly5d44d7d470
] [formerlyd1a705822c
] [formerlyd1a705822c
[formerly2cb92e6039
]] [formerly235080c256
[formerlyd1a705822c
[formerly2cb92e6039
] [formerly235080c256
[formerly 182b9f69c72332e73cdda26ebbebedb4abc059b0]]]] Former-commit-id:235080c256
Former-commit-id: 0a723d6b72adb8dae17b543092deaaef127523ba [formerly c7fdcb88f6d17b73071e2cd4f40334515c7187d6] [formerly7bb2c5535a
[formerlyb4f0f5c5b0
]] Former-commit-id:7bb2c5535a
Former-commit-id:f753a3bb03
This commit is contained in:
parent
24ddcccfc5
commit
318444a4aa
18 changed files with 337 additions and 232 deletions
|
@ -20,23 +20,18 @@
|
|||
|
||||
package com.raytheon.viz.mpe.core;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.comm.HttpClient;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.mpe.fieldgen.MpeFieldGenRequest;
|
||||
import com.raytheon.uf.common.mpe.fieldgen.MpeFieldGenResponse;
|
||||
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.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.mpe.Activator;
|
||||
|
||||
/**
|
||||
|
@ -48,21 +43,18 @@ import com.raytheon.viz.mpe.Activator;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 1/08/09 1674 bphillip Initial creation
|
||||
* 08/09/12 15307 snaples Updated job to use postStreamingByteArray.
|
||||
* 03/28/14 2952 mpduff Changed to use ThriftSrv.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
public class MpeFieldGenJob extends Job {
|
||||
|
||||
private static final IUFStatusHandler handler = UFStatus.getHandler(
|
||||
MpeFieldGenJob.class, "DEFAULT");
|
||||
|
||||
/** The HTTP endpoint of the field gen service */
|
||||
private static final String ENDPOINT_NAME = "/mpeFieldGenHttpService";
|
||||
private final IUFStatusHandler log = UFStatus
|
||||
.getHandler(MpeFieldGenJob.class);
|
||||
|
||||
/** The argument to run the MPE Field Gen with */
|
||||
private String fieldGenArg;
|
||||
private final String fieldGenArg;
|
||||
|
||||
/**
|
||||
* Constructs a new MpeFieldGenJob
|
||||
|
@ -79,50 +71,23 @@ public class MpeFieldGenJob extends Job {
|
|||
protected IStatus run(IProgressMonitor monitor) {
|
||||
final Integer[] mpeExitValue = new Integer[1];
|
||||
|
||||
String httpAddress = VizApp.getHttpServer() + ENDPOINT_NAME;
|
||||
String args = fieldGenArg;
|
||||
byte[] ba = args.getBytes();
|
||||
|
||||
MpeFieldGenRequest req = new MpeFieldGenRequest();
|
||||
req.setArgs(fieldGenArg);
|
||||
|
||||
MpeFieldGenResponse response;
|
||||
try {
|
||||
HttpClient.getInstance().postStreamingByteArray(httpAddress, ba,
|
||||
new HttpClient.IStreamHandler() {
|
||||
response = (MpeFieldGenResponse) ThriftClient.sendRequest(req);
|
||||
int exitValue = response.getExitValue();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.comm.Connector.IStreamHandler
|
||||
* #handleStream(java.io.InputStream)
|
||||
*/
|
||||
@Override
|
||||
public void handleStream(InputStream is)
|
||||
throws CommunicationException {
|
||||
try {
|
||||
|
||||
DynamicSerializationManager dsm = DynamicSerializationManager
|
||||
.getManager(SerializationType.Thrift);
|
||||
mpeExitValue[0] = (Integer) dsm.deserialize(is);
|
||||
System.out.println("MPE FieldGen returned: "
|
||||
+ mpeExitValue[0]);
|
||||
} catch (SerializationException e) {
|
||||
throw new CommunicationException(
|
||||
"Error deserializing", e);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
} catch (CommunicationException e) {
|
||||
return new Status(Status.ERROR, Activator.PLUGIN_ID,
|
||||
"MPE Field Gen execution failed with exit code: "
|
||||
+ mpeExitValue[0]);
|
||||
}
|
||||
|
||||
if (mpeExitValue[0] != null && mpeExitValue[0] == 0) {
|
||||
return Status.OK_STATUS;
|
||||
if (exitValue != 0) {
|
||||
return new Status(Status.ERROR, Activator.PLUGIN_ID,
|
||||
"MPE Field Gen execution failed with exit code: "
|
||||
+ mpeExitValue[0]);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
log.handle(Priority.ERROR, "Error executing MPE FieldGen", e);
|
||||
}
|
||||
|
||||
return new Status(Status.ERROR, Activator.PLUGIN_ID,
|
||||
"MPE Field Gen execution failed with exit code: "
|
||||
+ mpeExitValue[0]);
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,14 +2,16 @@ Manifest-Version: 1.0
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Mpe Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.uf.common.mpe
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Version: 1.14.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: com.raytheon.edex.common,
|
||||
org.geotools,
|
||||
org.apache.commons.lang,
|
||||
javax.persistence;bundle-version="1.0.0",
|
||||
javax.measure;bundle-version="1.0.0"
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.serialization.comm
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.common.mpe.constants,
|
||||
com.raytheon.uf.common.mpe.fieldgen,
|
||||
com.raytheon.uf.common.mpe.util
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* 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.mpe.fieldgen;
|
||||
|
||||
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 kick off MPE FieldGen with the provided arguments.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 28, 2014 2952 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class MpeFieldGenRequest implements IServerRequest {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String args;
|
||||
|
||||
/**
|
||||
* @return the args
|
||||
*/
|
||||
public String getArgs() {
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* the args to set
|
||||
*/
|
||||
public void setArgs(String args) {
|
||||
this.args = args;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* 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.mpe.fieldgen;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Response object providing the exit status code of MPE FieldGen.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 28, 2014 2952 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@DynamicSerialize
|
||||
public class MpeFieldGenResponse {
|
||||
/** Field gen exit value */
|
||||
@DynamicSerializeElement
|
||||
private int exitValue;
|
||||
|
||||
/**
|
||||
* @return the exitValue
|
||||
*/
|
||||
public int getExitValue() {
|
||||
return exitValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param exitValue
|
||||
* the exitValue to set
|
||||
*/
|
||||
public void setExitValue(int exitValue) {
|
||||
this.exitValue = exitValue;
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@ Import-Package: com.raytheon.edex.util,
|
|||
com.raytheon.uf.edex.database,
|
||||
com.raytheon.uf.edex.database.dao,
|
||||
com.raytheon.uf.edex.database.plugin,
|
||||
org.apache.commons.logging,
|
||||
org.quartz
|
||||
Export-Package: com.raytheon.uf.edex.ohd,
|
||||
com.raytheon.uf.edex.ohd.reportalarm,
|
||||
|
|
|
@ -16,25 +16,9 @@
|
|||
<constructor-arg ref="mpeProcessGribHandler"/>
|
||||
</bean>
|
||||
|
||||
<camelContext id="mpeFieldGenReq-context"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
|
||||
<endpoint id="mpeHttp_from"
|
||||
uri="jetty:http://0.0.0.0:${HTTP_PORT}/services/mpeFieldGenHttpService?disableStreamCache=true" />
|
||||
|
||||
<route id="mpeHttp">
|
||||
<from uri="ref:mpeHttp_from" />
|
||||
<doTry>
|
||||
<bean ref="mpeFieldGenService" method="process" />
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:mpeFieldGen?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
<bean ref="serializationUtil" method="transformToThrift" />
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
<bean factory-bean="handlerRegistry" factory-method="register">
|
||||
<constructor-arg value="com.raytheon.uf.common.mpe.fieldgen.MpeFieldGenRequest"/>
|
||||
<constructor-arg ref="mpeFieldGenService"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
||||
|
|
|
@ -27,10 +27,9 @@ import java.io.InputStreamReader;
|
|||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.core.props.PropertiesFactory;
|
||||
|
||||
/**
|
||||
|
@ -51,6 +50,7 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 28, 2008 jelkins Initial creation
|
||||
* Oct 19, 2012 #1274 bgonzale Set AppContext on the process builder in ctor.
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
* </pre>
|
||||
*
|
||||
* @author jelkins
|
||||
|
@ -59,9 +59,10 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
|
|||
|
||||
public class MainMethod extends Process {
|
||||
|
||||
protected Log log;
|
||||
private static final IUFStatusHandler log = UFStatus
|
||||
.getHandler(MainMethod.class);
|
||||
|
||||
private ProcessBuilder processBuilder;
|
||||
private final ProcessBuilder processBuilder;
|
||||
|
||||
private Process process;
|
||||
|
||||
|
@ -112,7 +113,6 @@ public class MainMethod extends Process {
|
|||
public MainMethod(ProcessBuilder builder) {
|
||||
|
||||
this.processBuilder = builder;
|
||||
this.log = LogFactory.getLog(processBuilder.getClass());
|
||||
|
||||
try {
|
||||
processBuilder.environment().put(
|
||||
|
@ -156,7 +156,7 @@ public class MainMethod extends Process {
|
|||
error.append(processBuilder.command().get(i)).append(" ");
|
||||
}
|
||||
error.append("failed with exit code " + exitValue);
|
||||
log.error(error);
|
||||
log.error(error.toString());
|
||||
}
|
||||
|
||||
return exitValue;
|
||||
|
|
|
@ -22,10 +22,10 @@ package com.raytheon.uf.edex.ohd;
|
|||
import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.quartz.CronExpression;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
|
||||
/**
|
||||
|
@ -40,6 +40,7 @@ import com.raytheon.uf.edex.core.EdexException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19, 2008 jelkins Initial creation
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,6 +49,8 @@ import com.raytheon.uf.edex.core.EdexException;
|
|||
*/
|
||||
|
||||
public class ScriptService implements ServiceInterface {
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(ScriptService.class);
|
||||
|
||||
/** A Cron expression representation of the cron line in the legacy system */
|
||||
private CronExpression cronExpression;
|
||||
|
@ -58,10 +61,8 @@ public class ScriptService implements ServiceInterface {
|
|||
/** Additional environment variables to set before running the script */
|
||||
private Map<String, String> environmentVariables;
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
/** The last portion of the scriptLocation */
|
||||
private String scriptName;
|
||||
private final String scriptName;
|
||||
|
||||
/**
|
||||
* Execute the script service.
|
||||
|
@ -73,10 +74,11 @@ public class ScriptService implements ServiceInterface {
|
|||
* wrong.
|
||||
* @throws EdexException
|
||||
*/
|
||||
@Override
|
||||
public void execute() throws EdexException {
|
||||
|
||||
MainMethod m = new MainMethod(new ProcessBuilder(script
|
||||
.getAbsolutePath()));
|
||||
MainMethod m = new MainMethod(new ProcessBuilder(
|
||||
script.getAbsolutePath()));
|
||||
|
||||
if (environmentVariables != null) {
|
||||
m.getProcessBuilder().environment().putAll(environmentVariables);
|
||||
|
|
|
@ -24,30 +24,38 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
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.EdexException;
|
||||
|
||||
/**
|
||||
* Performs setup operations for OHD services
|
||||
*
|
||||
* @author jelkins
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jelkins
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SetupSrv implements ServiceInterface {
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(SetupSrv.class);
|
||||
|
||||
/** set to true when setup service has succeeded */
|
||||
private static boolean isSetup = false;
|
||||
|
||||
Log logger = LogFactory.getLog(SetupSrv.class);
|
||||
|
||||
AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
public SetupSrv() {
|
||||
|
|
|
@ -32,8 +32,6 @@ import java.util.Map;
|
|||
import java.util.StringTokenizer;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.opengis.metadata.spatial.PixelOrientation;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
|
@ -50,6 +48,9 @@ import com.raytheon.uf.common.hydro.spatial.HRAPSubGrid;
|
|||
import com.raytheon.uf.common.mpe.util.XmrgFile;
|
||||
import com.raytheon.uf.common.mpe.util.XmrgFile.XmrgHeader;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
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.common.util.FileUtil;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
|
@ -71,6 +72,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 26, 2011 snaples Initial creation
|
||||
* Jan 10, 2013 1448 bgonzale Added app context check in processArealQpe().
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -79,6 +81,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
*/
|
||||
|
||||
public class ArealQpeGenSrv {
|
||||
private static final IUFStatusHandler log = UFStatus
|
||||
.getHandler(ArealQpeGenSrv.class);
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
@ -146,8 +150,6 @@ public class ArealQpeGenSrv {
|
|||
|
||||
private HRAPSubGrid subGrid;
|
||||
|
||||
private Log log = LogFactory.getLog("GenArealQPE");
|
||||
|
||||
private Rectangle wfoExtent;
|
||||
|
||||
/**
|
||||
|
@ -183,13 +185,13 @@ public class ArealQpeGenSrv {
|
|||
|
||||
private static final String GRIBIT = "gribit.LX";
|
||||
|
||||
private Map<String, Rectangle> extentsMap = new HashMap<String, Rectangle>();
|
||||
private final Map<String, Rectangle> extentsMap = new HashMap<String, Rectangle>();
|
||||
|
||||
private Map<String, float[]> gridMap = new HashMap<String, float[]>();
|
||||
private final Map<String, float[]> gridMap = new HashMap<String, float[]>();
|
||||
|
||||
private int dur;
|
||||
|
||||
private AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
private final AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
private String gaq_xmrg_1hr_dir;
|
||||
|
||||
|
@ -205,9 +207,10 @@ public class ArealQpeGenSrv {
|
|||
|
||||
private boolean qpe_out;
|
||||
|
||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private SimpleDateFormat fdf = new SimpleDateFormat("yyyyMMddHH");
|
||||
private final SimpleDateFormat fdf = new SimpleDateFormat("yyyyMMddHH");
|
||||
|
||||
public Object processArealQpe() {
|
||||
if (!AppsDefaults.getInstance().setAppContext(this)) {
|
||||
|
@ -232,7 +235,7 @@ public class ArealQpeGenSrv {
|
|||
|
||||
/* loop on QPE durations */
|
||||
for (int dd : durs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug("Processing for " + dd + " hr duration");
|
||||
}
|
||||
processSingleQpe(dd, hrap, subGrid);
|
||||
|
@ -377,13 +380,12 @@ public class ArealQpeGenSrv {
|
|||
} catch (IOException e) {
|
||||
log.error("Copy grib file " + mvFile.getName()
|
||||
+ " to " + d2d_input_dir + File.separator
|
||||
+ "arealQpeGenSrv" + " failed. ");
|
||||
e.printStackTrace();
|
||||
+ "arealQpeGenSrv" + " failed. ", e);
|
||||
}
|
||||
}
|
||||
// Remove the xmrg file from the temp directory.
|
||||
fr.delete();
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug("Removed file " + fr
|
||||
+ " from rfcqpe_temp directory.");
|
||||
}
|
||||
|
@ -465,7 +467,6 @@ public class ArealQpeGenSrv {
|
|||
xmhead = null;
|
||||
} catch (IOException e) {
|
||||
log.error("Error writing RFC QPE file", e);
|
||||
e.printStackTrace();
|
||||
xmhead = null;
|
||||
return;
|
||||
}
|
||||
|
@ -492,7 +493,6 @@ public class ArealQpeGenSrv {
|
|||
xmhead = null;
|
||||
} catch (IOException e) {
|
||||
log.error("Error writing Temp QPE file", e);
|
||||
e.printStackTrace();
|
||||
xmhead = null;
|
||||
return;
|
||||
}
|
||||
|
@ -517,7 +517,6 @@ public class ArealQpeGenSrv {
|
|||
wfoExtent = HRAPCoordinates.getHRAPCoordinates();
|
||||
} catch (Exception e2) {
|
||||
log.error("Error setting up the wfo extent", e2);
|
||||
e2.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -544,7 +543,7 @@ public class ArealQpeGenSrv {
|
|||
processGrids();
|
||||
writeXmrg(dd, mosaicQpeShort);
|
||||
} else {
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug("Getting data for duration " + durString
|
||||
+ " returned no data.");
|
||||
}
|
||||
|
@ -584,7 +583,6 @@ public class ArealQpeGenSrv {
|
|||
subGrid = hrap.getHRAPSubGrid(extent);
|
||||
} catch (Exception e) {
|
||||
log.error("Error setting up HRAP subgrid", e);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -698,11 +696,9 @@ public class ArealQpeGenSrv {
|
|||
|
||||
} catch (PluginException e1) {
|
||||
log.error("Error querying grids", e1);
|
||||
e1.printStackTrace();
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating rfc qpe grid", e);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -748,10 +744,7 @@ public class ArealQpeGenSrv {
|
|||
y--;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Error in populating getData::mosaicQpeShort.");
|
||||
}
|
||||
e.printStackTrace();
|
||||
log.error("Error in populating getData::mosaicQpeShort.", e);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -30,11 +30,10 @@ import java.util.Scanner;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
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.EdexException;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
|
@ -51,6 +50,7 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
* Nov 14, 2008 bphillip Initial creation
|
||||
* Mar 20, 2013 1804 bsteffen Switch all radar decompressing to be in
|
||||
* memory.
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,9 +65,10 @@ public class DecodeDpaSrv {
|
|||
|
||||
private static final Pattern dpaPat = Pattern.compile("DPA...");
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(DecodeDpaSrv.class);
|
||||
|
||||
private AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
private final AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
private File outFile;
|
||||
|
||||
|
|
|
@ -20,10 +20,9 @@
|
|||
|
||||
package com.raytheon.uf.edex.ohd.pproc;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.ohd.MainMethod;
|
||||
|
||||
|
@ -35,6 +34,7 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 25 2008 snaples Initial creation
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -42,15 +42,16 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
*/
|
||||
public class DqcPreProcSrv {
|
||||
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(DqcPreProcSrv.class);
|
||||
|
||||
/** The argument pattern if only hours are specified */
|
||||
private static final String DAYS_ARG = "\\d{1,2}";
|
||||
|
||||
/** The default number of days to process if no argument if provided */
|
||||
private static final String defaultNumDays = "10";
|
||||
|
||||
private AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
public Object process(String dqcArg) throws EdexException {
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.opengis.metadata.spatial.PixelOrientation;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
|
@ -45,6 +43,9 @@ import com.raytheon.uf.common.hydro.spatial.HRAPSubGrid;
|
|||
import com.raytheon.uf.common.mpe.util.XmrgFile;
|
||||
import com.raytheon.uf.common.mpe.util.XmrgFile.XmrgHeader;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
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.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginDao;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||
|
@ -61,6 +62,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2011 mpduff Initial creation
|
||||
* Sep 5, 2013 16437 wkwock Fix the "HiRes" issue
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -69,6 +71,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
*/
|
||||
|
||||
public class GAFF {
|
||||
private static final IUFStatusHandler log = UFStatus.getHandler(GAFF.class);
|
||||
|
||||
private static final int MISSING_VALUE = -99;
|
||||
|
||||
private static final String PROC_FLAG = "MPA01 ";
|
||||
|
@ -162,14 +166,12 @@ public class GAFF {
|
|||
private Rectangle wfoExtent = null;
|
||||
|
||||
/** Process start time */
|
||||
private long start;
|
||||
private final long start;
|
||||
|
||||
/** Process end time */
|
||||
private long end;
|
||||
|
||||
private Log log = LogFactory.getLog("GenArealFFG");
|
||||
|
||||
private GAFFDB db = new GAFFDB();
|
||||
private final GAFFDB db = new GAFFDB();
|
||||
|
||||
/** RFC Site name to RFC lookup map */
|
||||
public static Map<String, String> RFCMAP = new HashMap<String, String>();
|
||||
|
@ -209,12 +211,10 @@ public class GAFF {
|
|||
|
||||
public GAFF() {
|
||||
start = Calendar.getInstance().getTimeInMillis();
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("GAFF process is starting");
|
||||
}
|
||||
log.debug("GAFF process is starting");
|
||||
|
||||
init();
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug(toString());
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class GAFF {
|
|||
|
||||
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
if (cal.getTimeInMillis() - this.lastRunTime < minutesBetweenRuns * 60 * 1000) {
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
float time = (cal.getTimeInMillis() - this.lastRunTime) / 1000 / 60;
|
||||
log.debug("Only run every 12 minutes. " + time
|
||||
+ " minutes since last run.");
|
||||
|
@ -255,13 +255,12 @@ public class GAFF {
|
|||
subGrid = hrap.getHRAPSubGrid(extent);
|
||||
} catch (Exception e) {
|
||||
log.error("Error setting up HRAP subgrid", e);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
/* loop on FFG durations */
|
||||
for (int dur : this.durations) {
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug("Processing for " + dur + " duration");
|
||||
}
|
||||
createFFGMosaic(dur, hrap, subGrid);
|
||||
|
@ -306,7 +305,6 @@ public class GAFF {
|
|||
wfoExtent = HRAPCoordinates.getHRAPCoordinates();
|
||||
} catch (Exception e2) {
|
||||
log.error("Error setting up the wfo extent", e2);
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
||||
// Initialize arrays for each calculation
|
||||
|
@ -331,7 +329,7 @@ public class GAFF {
|
|||
Map<String, float[]> gridMap = new HashMap<String, float[]>();
|
||||
|
||||
for (String rfc : this.rfcNames) {
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug("Getting data for " + rfc + " for " + durString
|
||||
+ " duration");
|
||||
}
|
||||
|
@ -345,7 +343,7 @@ public class GAFF {
|
|||
try {
|
||||
uri = db.getDataURI(rfc, durString, today);
|
||||
if (uri == null) {
|
||||
uri = db.getDataURI(rfc+"-HiRes", durString, today);
|
||||
uri = db.getDataURI(rfc + "-HiRes", durString, today);
|
||||
}
|
||||
if (uri == null) {
|
||||
continue;
|
||||
|
@ -386,10 +384,8 @@ public class GAFF {
|
|||
|
||||
} catch (PluginException e1) {
|
||||
log.error("Error querying grids", e1);
|
||||
e1.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating wfo ffg grid", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +428,7 @@ public class GAFF {
|
|||
y--;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("Caught exception.", e);
|
||||
}
|
||||
|
||||
writeXmrgFile();
|
||||
|
@ -479,13 +475,10 @@ public class GAFF {
|
|||
xmrg.setData(this.mosaicFfgShort);
|
||||
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Writing xmrg file: " + name);
|
||||
}
|
||||
log.debug("Writing xmrg file: " + name);
|
||||
xmrg.save(name);
|
||||
} catch (IOException e) {
|
||||
log.error("Error writing xmrg file", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.ohd.pproc;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
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.database.DataAccessLayerException;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,8 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 8, 2011 mpduff Initial creation
|
||||
* Jan 08, 2011 mpduff Initial creation
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -44,7 +45,8 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|||
public class GAFFAreaProcessor {
|
||||
private static final float MISSING_VALUE_FLOAT = -99.0f;
|
||||
|
||||
private Log log = LogFactory.getLog("GenArealFFG");
|
||||
private static final IUFStatusHandler log = UFStatus
|
||||
.getHandler(GAFFAreaProcessor.class);
|
||||
|
||||
private int xor;
|
||||
|
||||
|
@ -68,7 +70,7 @@ public class GAFFAreaProcessor {
|
|||
|
||||
private double avgVal = 0;
|
||||
|
||||
private GAFFDB db = new GAFFDB();
|
||||
private final GAFFDB db = new GAFFDB();
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
|
@ -105,8 +107,8 @@ public class GAFFAreaProcessor {
|
|||
* read the HRAP bin coords for the area and extract the
|
||||
* information from the blob fields.
|
||||
*/
|
||||
Object[] lineSegsRs = db.getLineSegs(areaId);
|
||||
log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
||||
Object[] lineSegsRs = db.getLineSegs(areaId);
|
||||
log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
||||
int numRows = lineSegsRs.length;
|
||||
rows = new int[numRows];
|
||||
begCol = new int[numRows];
|
||||
|
@ -132,10 +134,12 @@ log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
|||
} else {
|
||||
/* compute average FFG value for basin and areal coverage */
|
||||
try {
|
||||
computeAvgFfg(areaId, lineSegsRs.length, rows, begCol,
|
||||
endCol);
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
computeAvgFfg(areaId, lineSegsRs.length, rows, begCol,
|
||||
endCol);
|
||||
} catch (Exception e) {
|
||||
log.error(
|
||||
"Error computing average FFG value for basin and areal coverage",
|
||||
e);
|
||||
}
|
||||
/*
|
||||
* if average FFG value for basin successfully computed AND
|
||||
|
@ -154,9 +158,8 @@ log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
|||
log.error(
|
||||
"Error inserting data into ContingencyValue table",
|
||||
e);
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("Error writing contingency data", e);
|
||||
}
|
||||
} else {
|
||||
log.info("AreaId = " + areaId
|
||||
|
@ -171,8 +174,6 @@ log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
|||
} else {
|
||||
log.info("No basins found in GeoArea table");
|
||||
}
|
||||
|
||||
System.out.println("leaving processAreas()");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -201,7 +202,7 @@ log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
|||
* originally loaded
|
||||
*/
|
||||
int row = rows[i] - yor;
|
||||
|
||||
|
||||
// Grid starts outside the window
|
||||
if (row < 0) {
|
||||
continue;
|
||||
|
@ -241,7 +242,7 @@ log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
|||
* compute the avg ffg value as the average of all the bins within the
|
||||
* area that have valid area_id data.
|
||||
*/
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug(areaId + " bincnts: total: " + totalCnt + "(= valid "
|
||||
+ valCnt + " + msg " + missCnt + ")");
|
||||
}
|
||||
|
@ -260,7 +261,7 @@ log.debug(lineSegsRs.length + " rows in the lineSegsRs");
|
|||
min = 0;
|
||||
}
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
if (log.isPriorityEnabled(Priority.DEBUG)) {
|
||||
log.debug(areaId + ": Sum/Cnt=unadjstd avg => " + sum + "/"
|
||||
+ valCnt + " = " + avgVal + "; max,min=" + max + "," + min);
|
||||
}
|
||||
|
|
|
@ -26,11 +26,10 @@ import java.util.Calendar;
|
|||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||
|
@ -45,7 +44,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 11, 2011 mpduff Initial creation
|
||||
* Jan 11, 2011 mpduff Initial creation
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,7 +64,8 @@ public class GAFFDB {
|
|||
private static final String LINESEGS_QUERY = "select hrap_row, hrap_beg_col, "
|
||||
+ "hrap_end_col, area from linesegs";
|
||||
|
||||
private Log log = LogFactory.getLog("GenArealFFG");
|
||||
private static final IUFStatusHandler log = UFStatus
|
||||
.getHandler(GAFFDB.class);
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
|
@ -131,9 +132,8 @@ public class GAFFDB {
|
|||
} else {
|
||||
throw new Exception("Error getting Last Run Time");
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Last run time: " + ts.toString());
|
||||
}
|
||||
|
||||
log.debug("Last run time: " + ts.toString());
|
||||
return ts.getTime();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -146,9 +146,7 @@ public class GAFFDB {
|
|||
c.set(Calendar.SECOND, 0);
|
||||
c.set(Calendar.MILLISECOND, 0);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Last run time set to 00Z");
|
||||
}
|
||||
log.debug("Last run time set to 00Z");
|
||||
|
||||
return c.getTimeInMillis();
|
||||
}
|
||||
|
@ -261,9 +259,7 @@ public class GAFFDB {
|
|||
+ DEFAULT_QC_VALUE + ", " + "0, 'GRIDFFG', '" + validDate
|
||||
+ "', '" + postDate + "')";
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(sql);
|
||||
}
|
||||
log.debug(sql);
|
||||
|
||||
dao.executeNativeSql(sql, false);
|
||||
} else {
|
||||
|
@ -306,9 +302,7 @@ public class GAFFDB {
|
|||
if ((rs != null) && (rs.length > 0)) {
|
||||
if ((rs[0] != null) && (rs[0] instanceof String)) {
|
||||
hsa = (String) rs[0];
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("HSA: " + hsa);
|
||||
}
|
||||
log.debug("HSA: " + hsa);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,12 @@ package com.raytheon.uf.edex.ohd.pproc;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.mpe.fieldgen.MpeFieldGenRequest;
|
||||
import com.raytheon.uf.common.mpe.fieldgen.MpeFieldGenResponse;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.ohd.MainMethod;
|
||||
|
||||
|
@ -38,12 +40,16 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 14, 2008 bphillip Initial creation
|
||||
* Mar 28, 2014 2952 mpduff Changed to use ThriftSrv and UFStatus, cleanup
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
public class MpeFieldGenSrv {
|
||||
public class MpeFieldGenSrv implements IRequestHandler<MpeFieldGenRequest> {
|
||||
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(MpeFieldGenSrv.class);
|
||||
|
||||
/** The argument pattern if only hours are specified */
|
||||
private static final String HOURS_ARG = "\\d{1,2}";
|
||||
|
@ -54,36 +60,60 @@ public class MpeFieldGenSrv {
|
|||
private static final Pattern HOURS_DATE_PATTERN = Pattern
|
||||
.compile(HOURS_DATE_ARG);
|
||||
|
||||
private static final Pattern HOURS_ARG_PATTERN = Pattern.compile(HOURS_ARG);
|
||||
|
||||
/** The default number of hours to process if no argument if provided */
|
||||
private static final String defaultMpeArg = "3";
|
||||
private static final String DEFAULT_ARG = "3";
|
||||
|
||||
private AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
private static final AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private static final String EXECUTE_PATH = appsDefaults
|
||||
.getToken("pproc_bin") + "/run_mpe_fieldgen";
|
||||
|
||||
public Object process(String mpeArg) throws EdexException {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Object handleRequest(MpeFieldGenRequest request) throws Exception {
|
||||
MpeFieldGenResponse response = new MpeFieldGenResponse();
|
||||
int exitValue = process(request.getArgs());
|
||||
response.setExitValue(exitValue);
|
||||
|
||||
if (!mpeArg.matches(HOURS_ARG) && !mpeArg.matches(HOURS_DATE_ARG)) {
|
||||
throw new EdexException("Invalid argument sent to mpe_fieldgen");
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute mpe fieldgen.
|
||||
*
|
||||
* @param mpeArg
|
||||
* Program arguments
|
||||
* @return exit status
|
||||
* @throws EdexException
|
||||
*/
|
||||
private int process(String mpeArg) throws EdexException {
|
||||
|
||||
if (!HOURS_ARG_PATTERN.matcher(mpeArg).matches()
|
||||
&& !HOURS_DATE_PATTERN.matcher(mpeArg).matches()) {
|
||||
throw new EdexException("Invalid argument sent to mpe_fieldgen: "
|
||||
+ mpeArg);
|
||||
}
|
||||
|
||||
int exitValue = 0;
|
||||
logger.info("Executing MPE FieldGen with argument: " + mpeArg);
|
||||
|
||||
if (appsDefaults.setAppContext(this)) {
|
||||
if (mpeArg.matches(HOURS_ARG)) {
|
||||
logger.info("Executing MPE FieldGen with argument: " + mpeArg);
|
||||
exitValue = MainMethod.runProgram("ksh",
|
||||
appsDefaults.getToken("pproc_bin")
|
||||
+ "/run_mpe_fieldgen", mpeArg);
|
||||
if (HOURS_ARG_PATTERN.matcher(mpeArg).matches()) {
|
||||
exitValue = MainMethod.runProgram("ksh", EXECUTE_PATH, mpeArg);
|
||||
} else if (mpeArg.matches(HOURS_DATE_ARG)) {
|
||||
logger.info("Executing MPE FieldGen with arguments: " + mpeArg);
|
||||
Matcher matcher = HOURS_DATE_PATTERN.matcher(mpeArg);
|
||||
if (matcher.find()) {
|
||||
exitValue = MainMethod.runProgram("ksh",
|
||||
appsDefaults.getToken("pproc_bin")
|
||||
+ "/run_mpe_fieldgen", matcher.group(1),
|
||||
matcher.group(2), matcher.group(3));
|
||||
exitValue = MainMethod.runProgram("ksh", EXECUTE_PATH,
|
||||
matcher.group(1), matcher.group(2),
|
||||
matcher.group(3));
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new EdexException(
|
||||
"Invalid argument sent to mpe_fieldgen: " + mpeArg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,11 +124,18 @@ public class MpeFieldGenSrv {
|
|||
"MpeFieldGen process terminated abnormally with exit code: "
|
||||
+ exitValue);
|
||||
}
|
||||
|
||||
return exitValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run fieldgen with the defalut argument.
|
||||
*
|
||||
* @return exit status
|
||||
* @throws EdexException
|
||||
*/
|
||||
public Object runHourlyMpe() throws EdexException {
|
||||
return process(defaultMpeArg);
|
||||
return process(DEFAULT_ARG);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@ package com.raytheon.uf.edex.ohd.pproc;
|
|||
import java.io.File;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.opengis.metadata.spatial.PixelOrientation;
|
||||
|
||||
|
@ -38,6 +36,8 @@ import com.raytheon.uf.common.datastorage.IDataStore;
|
|||
import com.raytheon.uf.common.datastorage.StorageException;
|
||||
import com.raytheon.uf.common.hydro.spatial.HRAP;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||
|
@ -53,8 +53,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 06, 2011 5951 jnjanga Initial creation
|
||||
* Jan 10, 2013 1448 bgonzale Added app context check in runOnSchedule().
|
||||
* Jan 10, 2013 1448 bgonzale Added app context check in runOnSchedule().
|
||||
* Jan 18, 2013 1469 bkowal Removed the hdf5 data directory.
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,7 +81,8 @@ public class MpeLightningSrv {
|
|||
}
|
||||
}
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(MpeLightningSrv.class);
|
||||
|
||||
/**
|
||||
* Check the metadata Database for new lightning entries.
|
||||
|
|
|
@ -20,12 +20,11 @@
|
|||
|
||||
package com.raytheon.uf.edex.ohd.pproc;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.hydro.service.MpeGribProcessRequest;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.ohd.MainMethod;
|
||||
|
||||
|
@ -37,7 +36,8 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 1, 2010 snaples Initial creation
|
||||
* Feb 01, 2010 snaples Initial creation
|
||||
* Mar 28, 2014 2952 mpduff Changed to use UFStatus for logging.
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -46,9 +46,10 @@ import com.raytheon.uf.edex.ohd.MainMethod;
|
|||
public class MpeProcessGribSrv implements
|
||||
IRequestHandler<MpeGribProcessRequest> {
|
||||
|
||||
private AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
private static final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(MpeProcessGribSrv.class);
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
private final AppsDefaults appsDefaults = AppsDefaults.getInstance();
|
||||
|
||||
/**
|
||||
* The serialized incoming request contains the file names of the xmrg file
|
||||
|
@ -64,12 +65,11 @@ public class MpeProcessGribSrv implements
|
|||
throw new EdexException("Invalid argument sent to MpeProcessGrib");
|
||||
}
|
||||
int exitValue = 0;
|
||||
logger
|
||||
.info("Executing process_grib_files with arguments: xmrgfilename: "
|
||||
+ xmrg + " gribfilename: " + grib);
|
||||
exitValue = MainMethod.runProgram("ksh", appsDefaults
|
||||
.getToken("pproc_bin")
|
||||
+ "/process_grib_files", xmrg, grib);
|
||||
logger.info("Executing process_grib_files with arguments: xmrgfilename: "
|
||||
+ xmrg + " gribfilename: " + grib);
|
||||
exitValue = MainMethod.runProgram("ksh",
|
||||
appsDefaults.getToken("pproc_bin") + "/process_grib_files",
|
||||
xmrg, grib);
|
||||
if (exitValue == 0) {
|
||||
logger.info("MpeProcessGrib execution successful");
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue