Merged 1354 -5 and -6 into 1412 based on 1411-25

Former-commit-id: 407b42b0eff676a95483e219d6be899e45effd6c
This commit is contained in:
Brian.Dyke 2014-04-04 12:57:32 -04:00
parent 074abeb0fa
commit dd98c213c7
41 changed files with 1388 additions and 921 deletions

View file

@ -315,6 +315,10 @@
# Status: TEST
# Title: AvnFPS: OB9.2 installation breaks mtrs.cfg file
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 02APR2014 17211 zhao (code obtained from the listserver via Virgil that implements a new rule regarding CB, TS etc)
#
#
#
import exceptions, re, time, types
@ -423,6 +427,8 @@ ddHH/ddHH)""",
60: """NSW not needed""",
61: """The period covered by a TAF shall not exceed 30
hours""",
81: """CB may only be mentioned when TS or VCTS mentioned
(NWSI 10-813, Appendix B, 1.2.7.3)""",
}
_Warnings = { \
@ -1054,6 +1060,10 @@ class Decoder(tpg.VerboseParser):
'TS' in g['vcnty']['str']:
if 'sky' not in g or 'CB' not in g['sky']['str']:
raise Error(_Errors[11])
if 'sky' in g and 'CB' in g['sky']['str']:
if ('pcp' not in g or 'TS' not in g['pcp']['str']) and \
('vcnty' not in g or 'TS' not in g['vcnty']['str']):
raise Error(_Errors[81])
def check_obv(self):
# NWSI 10-813, 1.2.6

View file

@ -505,16 +505,16 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
def windSpdProb_thresholds(self, tree, node):
return [
((50.0, 80.0), (40.0, 60.0)), # Per 1
(45.0, 32.5), # Per 2
(40.0, 25.0), # Per 3
(35.0, 20.0), # Per 4
(30.0, 15.0), # Per 5
(25.0, 12.5), # Per 6
(22.5, 10.0), # Per 7
(20.0, 8.0), # Per 8
(17.5, 6.0), # Per 9
(15.0, 5.0), # Per 10
((45.0, 80.0), (25.0, 60.0)), # Per 1
(35.0, 20.0), # Per 2
(30.0, 15.0), # Per 3
(25.0, 12.5), # Per 4
(22.5, 10.0), # Per 5
(20.0, 8.0), # Per 6
(17.5, 7.0), # Per 7
(15.0, 6.0), # Per 8
(12.5, 5.0), # Per 9
(10.0, 4.0), # Per 10
]
def firstComponentPeriod(self, tree, node):
@ -1130,7 +1130,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR"
elif maxMag >= 34.0:
desc = "posTS"
elif pws64 >= thresh64low or pws64 +2.0 >= thresh64low:
elif pws64 >= thresh64low or pws64 +5.0 >= thresh64low:
desc = "posHR"
elif pws34 >= thresh34low or pws34+10.0 >= thresh34low:
desc = "posTS"
@ -1203,7 +1203,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR"
elif maxMag >= 34.0:
desc = "posTS"
elif pws64 >= thresh64 or pws64 +2.0 >= thresh64:
elif pws64 >= thresh64 or pws64 +5.0 >= thresh64:
desc = "posHR"
elif pws34 >= thresh34 or pws34+10.0 >= thresh34:
desc = "posTS"
@ -1299,7 +1299,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else:
self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1.0 >= thresh64:
if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
@ -1399,7 +1399,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else:
self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1 >= thresh64:
if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
@ -1435,14 +1435,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0:
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0:
elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS"
elif maxMag >= 34.0:
desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else:
desc = ""
@ -1470,14 +1474,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0:
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0:
elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS"
elif maxMag >= 34.0:
desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else:
desc = ""

View file

@ -25,7 +25,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.archive.request.ArchiveAdminAuthRequest;
import com.raytheon.uf.common.archive.request.ArchiveCaseCreationAuthRequest;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -56,8 +56,12 @@ public class ArchiveCaseCreationDialogAction extends AbstractHandler {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ArchiveCaseCreationDialogAction.class);
/** Dialog to display */
private CaseCreationDlg dialog;
/** Default case directory location. */
private String caseDir;
/** Case Administration permission */
private final String PERMISSION = "archive.casecreation";
@ -74,7 +78,7 @@ public class ArchiveCaseCreationDialogAction extends AbstractHandler {
if (dialog == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
dialog = new CaseCreationDlg(shell);
dialog = new CaseCreationDlg(shell, caseDir);
dialog.open();
} else {
dialog.bringToTop();
@ -93,16 +97,25 @@ public class ArchiveCaseCreationDialogAction extends AbstractHandler {
IUser user = UserController.getUserObject();
String msg = user.uniqueId()
+ " does not have permission to access archive case creation dialog.";
ArchiveAdminAuthRequest request = new ArchiveAdminAuthRequest();
ArchiveCaseCreationAuthRequest request = new ArchiveCaseCreationAuthRequest();
request.setRoleId(PERMISSION);
request.setNotAuthorizedMessage(msg);
request.setUser(user);
try {
Object o = ThriftClient.sendPrivilegedRequest(request);
if (o instanceof ArchiveAdminAuthRequest) {
ArchiveAdminAuthRequest r = (ArchiveAdminAuthRequest) o;
return r.isAuthorized();
if (o instanceof ArchiveCaseCreationAuthRequest) {
ArchiveCaseCreationAuthRequest r = (ArchiveCaseCreationAuthRequest) o;
if (r.isAuthorized()) {
this.caseDir = r.getCaseDirectory();
return true;
}
} else {
statusHandler
.handle(Priority.ERROR,
String.format(
"Cannot validate user expected response type ArchiveCaseCreationAuthRequest, received %s",
o.getClass().getName()));
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);

View file

@ -38,6 +38,7 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
@ -45,6 +46,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.archive.config.ArchiveConstants.Type;
import com.raytheon.uf.common.archive.config.DisplayData;
@ -71,6 +73,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Jul 24, 2013 #2221 rferrel Changes for select configuration.
* Aug 06, 2013 #2222 rferrel Changes to display all selected data.
* Aug 26, 2013 #2225 rferrel Make perspective independent and no longer modal.
* Mar 24, 2014 #2853 rferrel Populate case label directory with default value.
* Mar 26, 2014 32880 rferrerl Implement case compression and split.
*
* </pre>
*
@ -79,6 +83,9 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
*/
public class CaseCreationDlg extends AbstractArchiveDlg {
/** The case creation label's default directory. */
private final String defaultCaseDir;
/** Start time label. */
private Label startTimeLbl;
@ -100,9 +107,8 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
/** Compression check box. */
private Button compressChk;
// TODO restore when Multi-file implemented.
// /** Break files check box. */
// private Button breakFilesChk;
/** Break files check box. */
private Button breakFilesChk;
/** Button to save new select case configuration. */
private Button saveAsBtn;
@ -113,17 +119,14 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
/** Button to delete select case configuration. */
private Button deleteBtn;
// TODO restore when Multi-file implemented.
// /** File size spinner control. */
// private Spinner fileSizeSpnr;
/** File size spinner control. */
private Spinner fileSizeSpnr;
// TODO restore when Multi-file implemented.
// /** File size combo box. */
// private Combo fileSizeCbo;
/** File size combo box. */
private Combo fileSizeCbo;
// TODO restore when Multi-file implemented.
// /** Maximum file size label. */
// private Label maxFileSizeLbl;
/** Maximum file size label. */
private Label maxFileSizeLbl;
/** Directory location label. */
private Label locationLbl;
@ -168,13 +171,14 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
* @param parentShell
* Parent shell.
*/
public CaseCreationDlg(Shell parentShell) {
public CaseCreationDlg(Shell parentShell, String defaultCaseDir) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
| CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT
| CAVE.INDEPENDENT_SHELL);
this.type = Type.Case;
this.setSelect = false;
this.type = Type.Case;
this.defaultCaseDir = defaultCaseDir;
}
/*
@ -372,60 +376,58 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
*/
compressChk = new Button(compressionComp, SWT.CHECK);
compressChk.setText("Compress Files");
// TODO restore when Multi-file implemented.
// compressChk.addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(SelectionEvent e) {
// handleCompressSelection();
// }
// });
compressChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleCompressSelection();
}
});
// TODO restore when Multi-file implemented.
// gd = new GridData();
// gd.horizontalIndent = 20;
// breakFilesChk = new Button(compressionComp, SWT.CHECK);
// breakFilesChk.setText("Break into multiple files");
// breakFilesChk.setLayoutData(gd);
// breakFilesChk.setEnabled(false);
// breakFilesChk.addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(SelectionEvent e) {
// handleBreakFilesSelection(breakFilesChk.getSelection());
// }
// });
gd = new GridData();
gd.horizontalIndent = 20;
breakFilesChk = new Button(compressionComp, SWT.CHECK);
breakFilesChk.setText("Break into multiple files");
breakFilesChk.setLayoutData(gd);
breakFilesChk.setEnabled(false);
breakFilesChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleBreakFilesSelection(breakFilesChk.getSelection());
}
});
// Composite maxFileSizeComp = new Composite(compressionComp, SWT.NONE);
// gl = new GridLayout(3, false);
// gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
// gd.horizontalIndent = 20;
// maxFileSizeComp.setLayout(gl);
// maxFileSizeComp.setLayoutData(gd);
//
// maxFileSizeLbl = new Label(maxFileSizeComp, SWT.NONE);
// maxFileSizeLbl.setText("Max File Size: ");
// maxFileSizeLbl.setEnabled(false);
//
// gd = new GridData(60, SWT.DEFAULT);
// fileSizeSpnr = new Spinner(maxFileSizeComp, SWT.BORDER);
// fileSizeSpnr.setIncrement(1);
// fileSizeSpnr.setPageIncrement(50);
// fileSizeSpnr.setMaximum(2000);
// fileSizeSpnr.setMinimum(500);
// fileSizeSpnr.setLayoutData(gd);
// fileSizeSpnr.setEnabled(false);
//
// fileSizeCbo = new Combo(maxFileSizeComp, SWT.VERTICAL | SWT.DROP_DOWN
// | SWT.BORDER | SWT.READ_ONLY);
// fileSizeCbo.setEnabled(false);
// fileSizeCbo.addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(SelectionEvent e) {
// handleFileSizeChangeSelection();
// }
// });
// fileSizeCbo.add("MB");
// fileSizeCbo.add("GB");
// fileSizeCbo.select(0);
Composite maxFileSizeComp = new Composite(compressionComp, SWT.NONE);
gl = new GridLayout(3, false);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gd.horizontalIndent = 20;
maxFileSizeComp.setLayout(gl);
maxFileSizeComp.setLayoutData(gd);
maxFileSizeLbl = new Label(maxFileSizeComp, SWT.NONE);
maxFileSizeLbl.setText("Max File Size: ");
maxFileSizeLbl.setEnabled(false);
gd = new GridData(60, SWT.DEFAULT);
fileSizeSpnr = new Spinner(maxFileSizeComp, SWT.BORDER);
fileSizeSpnr.setIncrement(1);
fileSizeSpnr.setPageIncrement(50);
fileSizeSpnr.setMaximum(2000);
fileSizeSpnr.setMinimum(500);
fileSizeSpnr.setLayoutData(gd);
fileSizeSpnr.setEnabled(false);
fileSizeCbo = new Combo(maxFileSizeComp, SWT.VERTICAL | SWT.DROP_DOWN
| SWT.BORDER | SWT.READ_ONLY);
fileSizeCbo.setEnabled(false);
fileSizeCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleFileSizeChangeSelection();
}
});
fileSizeCbo.add("MB");
fileSizeCbo.add("GB");
fileSizeCbo.select(0);
}
/**
@ -648,14 +650,9 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
List<DisplayData> displayDatas = getSelectedData();
boolean doCompress = compressChk.getSelection();
// TODO restore once Multi-file implemented.
// boolean doMultiFiles = breakFilesChk.getSelection();
// int compressSize = fileSizeSpnr.getSelection();
// String sizeType =
// fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex());
boolean doMultiFiles = false;
int compressSize = 500;
String sizeType = "MB";
boolean doMultiFiles = breakFilesChk.getSelection();
int compressSize = fileSizeSpnr.getSelection();
String sizeType = fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex());
setCursorBusy(true);
if (generateCaseDlg == null || generateCaseDlg.isDisposed()) {
@ -698,19 +695,18 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
}
// TODO restore when Multi-file implemented.
// /**
// * Enable/Disable controls based on the compression check box.
// */
// private void handleCompressSelection() {
// if (compressChk.getSelection()) {
// handleBreakFilesSelection(breakFilesChk.getSelection());
// } else {
// handleBreakFilesSelection(false);
// }
//
// breakFilesChk.setEnabled(compressChk.getSelection());
// }
/**
* Enable/Disable controls based on the compression check box.
*/
private void handleCompressSelection() {
if (compressChk.getSelection()) {
handleBreakFilesSelection(breakFilesChk.getSelection());
} else {
handleBreakFilesSelection(false);
}
breakFilesChk.setEnabled(compressChk.getSelection());
}
/**
* Bring up modal dialog to get the case's directory name.
@ -749,18 +745,17 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
}
}
// TODO restore when Multi-file implemented.
// /**
// * Enable/Disable file size controls.
// *
// * @param enabled
// * Enabled flag.
// */
// private void handleBreakFilesSelection(boolean enabled) {
// maxFileSizeLbl.setEnabled(enabled);
// fileSizeSpnr.setEnabled(enabled);
// fileSizeCbo.setEnabled(enabled);
// }
/**
* Enable/Disable file size controls.
*
* @param enabled
* Enabled flag.
*/
private void handleBreakFilesSelection(boolean enabled) {
maxFileSizeLbl.setEnabled(enabled);
fileSizeSpnr.setEnabled(enabled);
fileSizeCbo.setEnabled(enabled);
}
/**
* Enables the generate button will user has entered all needed elements.
@ -772,36 +767,35 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
}
}
// TODO restore when Multi-file implemented.
// /**
// * Action performed when the file size has changed.
// */
// private void handleFileSizeChangeSelection() {
// /*
// * If the same item was selected just return.
// */
// if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals(
// (String) fileSizeCbo.getData())) {
// return;
// }
//
// if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals("MB")) {
// fileSizeSpnr.setIncrement(1);
// fileSizeSpnr.setPageIncrement(50);
// fileSizeSpnr.setMaximum(2000);
// fileSizeSpnr.setMinimum(500);
// fileSizeSpnr.setSelection(500);
// } else {
// fileSizeSpnr.setIncrement(1);
// fileSizeSpnr.setPageIncrement(5);
// fileSizeSpnr.setMinimum(1);
// fileSizeSpnr.setMaximum(10);
// fileSizeSpnr.setSelection(1);
// }
//
// fileSizeCbo
// .setData(fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()));
// }
/**
* Action performed when the file size has changed.
*/
private void handleFileSizeChangeSelection() {
/*
* If the same item was selected just return.
*/
if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals(
(String) fileSizeCbo.getData())) {
return;
}
if (fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()).equals("MB")) {
fileSizeSpnr.setIncrement(1);
fileSizeSpnr.setPageIncrement(50);
fileSizeSpnr.setMaximum(2000);
fileSizeSpnr.setMinimum(500);
fileSizeSpnr.setSelection(500);
} else {
fileSizeSpnr.setIncrement(1);
fileSizeSpnr.setPageIncrement(5);
fileSizeSpnr.setMinimum(1);
fileSizeSpnr.setMaximum(10);
fileSizeSpnr.setSelection(1);
}
fileSizeCbo
.setData(fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()));
}
/**
* Display the directory browser dialog.
@ -810,6 +804,15 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
DirectoryDialog dlg = new DirectoryDialog(shell, SWT.OPEN);
dlg.setText("Case Location");
String dirName = dlg.open();
updateLocationLbl(dirName);
}
/**
* Update the case label and fields dependent on the change.
*
* @param dirName
*/
private void updateLocationLbl(String dirName) {
if (dirName != null) {
locationLbl.setText(trimDirectoryName(dirName));
locationLbl.setToolTipText(dirName);
@ -1009,4 +1012,26 @@ public class CaseCreationDlg extends AbstractArchiveDlg {
super.clearModified();
saveBtn.setEnabled(false);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#opened()
*/
@Override
protected void opened() {
super.opened();
File caseDir = new File(defaultCaseDir);
if (caseDir.isDirectory()) {
updateLocationLbl(defaultCaseDir);
} else {
MessageDialog
.openError(
shell,
"Error",
String.format(
"Unable to find Case Location directory:\n%s\nMay need to mount the directory.",
defaultCaseDir));
}
}
}

View file

@ -32,6 +32,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.zip.GZIPOutputStream;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.archivers.ArchiveOutputStream;
import org.apache.commons.compress.archivers.ArchiveStreamFactory;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@ -62,6 +63,8 @@ import com.raytheon.uf.common.archive.config.DisplayData;
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.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
@ -82,6 +85,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* implementation of compression.
* Oct 08, 2013 2442 rferrel Remove category directory.
* Feb 04, 2013 2270 rferrel Move HDF files to parent's directory.
* Mar 26, 2014 2880 rferrel Compress and split cases implemented.
*
* </pre>
*
@ -130,9 +134,8 @@ public class GenerateCaseDlg extends CaveSWTDialog {
/** When true break the compress file into multiple files. */
private final boolean doMultiFiles;
// Needed when compress and split implemented
// /** The compress size for multiple files. */
// private final long splitSize;
/** The compress size for multiple files. */
private final long splitSize;
/** Job to perform the case generation off of the UI thread. */
private GenerateJob generateJob;
@ -174,8 +177,7 @@ public class GenerateCaseDlg extends CaveSWTDialog {
this.doCompress = doCompress;
this.doMultiFiles = doMultiFiles;
// Needed when compress and split implemented.
// this.splitSize = splitSize;
this.splitSize = splitSize;
this.caseName = caseDir.getAbsolutePath().substring(
targetDir.getAbsolutePath().length() + 1);
setText("Generating - " + caseName);
@ -412,6 +414,9 @@ public class GenerateCaseDlg extends CaveSWTDialog {
String currentCategory = null;
boolean updateDestDir = false;
ITimer timer = TimeUtil.getTimer();
timer.start();
try {
for (DisplayData displayData : sourceDataList) {
if (shutdown.get()) {
@ -436,7 +441,7 @@ public class GenerateCaseDlg extends CaveSWTDialog {
if (!doCompress) {
caseCopy = new CopyMove();
} else if (doMultiFiles) {
caseCopy = new CompressAndSplitCopy();
caseCopy = new CompressAndSplitCopy(splitSize);
} else {
caseCopy = new CompressCopy();
}
@ -478,11 +483,18 @@ public class GenerateCaseDlg extends CaveSWTDialog {
if (caseCopy != null) {
try {
caseCopy.finishCase();
} catch (CaseCreateException ex) {
} catch (Exception ex) {
// Ignore
}
caseCopy = null;
}
timer.stop();
if (statusHandler.isPriorityEnabled(Priority.INFO)) {
String message = String.format("Case %s took %s.",
caseDir.getName(),
TimeUtil.prettyDuration(timer.getElapsedTime()));
statusHandler.handle(Priority.INFO, message);
}
}
return Status.OK_STATUS;
@ -504,6 +516,8 @@ public class GenerateCaseDlg extends CaveSWTDialog {
* This class copies selected files/directories to a case-directory/archive.
*/
private static class CopyMove implements ICaseCopy {
private final IUFStatusHandler statusHandler;
/**
* Flag to indicate user canceled the case generation.
*/
@ -519,6 +533,13 @@ public class GenerateCaseDlg extends CaveSWTDialog {
*/
private int startRelativePath;
/**
* Constructor.
*/
public CopyMove() {
statusHandler = UFStatus.getHandler(this.getClass());
}
/**
* Copy source File to desired destination.
*
@ -531,6 +552,16 @@ public class GenerateCaseDlg extends CaveSWTDialog {
return;
}
if (!source.exists()) {
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
String message = String.format(
"Purged and unable to place in case: %s",
source.getAbsoluteFile());
statusHandler.handle(Priority.DEBUG, message);
}
return;
}
if (source.isDirectory()) {
if (!destination.exists()) {
@ -554,6 +585,11 @@ public class GenerateCaseDlg extends CaveSWTDialog {
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.ICaseCopy#copy(java.io.File)
*/
@Override
public void copy(File source) throws CaseCreateException {
String relativePath = source.getAbsolutePath().substring(
@ -563,10 +599,17 @@ public class GenerateCaseDlg extends CaveSWTDialog {
destination.getParentFile().mkdirs();
copyFile(source, destination);
} catch (IOException ex) {
throw new CaseCreateException("CopyMove.copy: ", ex);
throw new CaseCreateException("Copy Move ", ex);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.ICaseCopy#startCase(java.io.File,
* com.raytheon.uf.common.archive.config.DisplayData,
* java.util.concurrent.atomic.AtomicBoolean)
*/
@Override
public void startCase(File caseDir, DisplayData displayData,
AtomicBoolean shutdown) {
@ -578,6 +621,11 @@ public class GenerateCaseDlg extends CaveSWTDialog {
startRelativePath = displayData.getRootDir().length();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.ICaseCopy#finishCase()
*/
@Override
public void finishCase() {
// Nothing to do.
@ -587,55 +635,79 @@ public class GenerateCaseDlg extends CaveSWTDialog {
/**
* This class takes selected directories/files to
* case-directory/archive/compress-category-file. The compress-category-file
* is a tar gzip file containing the categorie's data.
* is a tar gzip file containing the category's data.
*/
private static class CompressCopy implements ICaseCopy {
private final IUFStatusHandler statusHandler;
/**
* Flag to indicate user canceled case generation.
*/
private AtomicBoolean shutdown;
protected AtomicBoolean shutdown;
/**
* Top Level destination directory.
*/
private File destDir;
protected File destDir;
/**
* Stream to the file being created.
*/
private FileOutputStream fileStream;
protected FileOutputStream fileStream;
/**
* Stream to perform the compression.
*/
private GZIPOutputStream zipStream;
protected GZIPOutputStream zipStream;
/**
* Stream to create the tar image.
*/
private ArchiveOutputStream tarStream;
protected ArchiveOutputStream tarStream;
/**
* The category directory name used to generate tar file name(s).
*/
protected String categoryDirName;
/**
* Index to start of relative path in source File.
*/
private int startRelativePath;
protected int startRelativePath;
/**
* Directories already created in the tar image.
*/
private final HashSet<File> tarDirFile = new HashSet<File>();
protected final HashSet<File> tarDirFile = new HashSet<File>();
/**
* Buffer to use for reading in a file.
*/
private final byte[] buffer = new byte[(int) (32 * FileUtils.ONE_KB)];
protected final byte[] buffer = new byte[(int) (32 * FileUtils.ONE_KB)];
/**
* Current tar file being created.
*/
protected File tarFile;
/**
* Constructor.
*/
public CompressCopy() {
this.statusHandler = UFStatus.getHandler(this.getClass());
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.ICaseCopy#copy(java.io.File)
*/
@Override
public void copy(File source) throws CaseCreateException {
try {
addParentDir(source);
addTarFiles(new File[] { source });
} catch (IOException e) {
} catch (Exception e) {
throw new CaseCreateException("Compress Copy failed: ", e);
}
}
@ -645,14 +717,26 @@ public class GenerateCaseDlg extends CaveSWTDialog {
*
* @param files
* @throws IOException
* @throws ArchiveException
* @throws CaseCreateException
*/
private void addTarFiles(File[] files) throws IOException {
private void addTarFiles(File[] files) throws IOException,
ArchiveException {
for (File file : files) {
if (shutdown.get()) {
return;
}
String name = file.getAbsolutePath().substring(
startRelativePath);
if (!file.exists()) {
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
String message = String.format(
"Purged and unable to place in case: %s",
file.getAbsoluteFile());
statusHandler.handle(Priority.DEBUG, message);
}
continue;
}
if (file.isDirectory()) {
if (!tarDirFile.contains(file)) {
TarArchiveEntry entry = new TarArchiveEntry(file, name);
@ -662,6 +746,7 @@ public class GenerateCaseDlg extends CaveSWTDialog {
addTarFiles(file.listFiles());
}
} else {
checkFit(file);
// DR 2270 bump HDF files up a directory.
if (name.endsWith(hdfExt)) {
File destination = new File(file.getParentFile()
@ -695,7 +780,7 @@ public class GenerateCaseDlg extends CaveSWTDialog {
*
* @param stream
*/
private void closeStream(Closeable stream) {
protected void closeStream(Closeable stream) {
try {
stream.close();
} catch (IOException ex) {
@ -703,13 +788,21 @@ public class GenerateCaseDlg extends CaveSWTDialog {
}
}
/**
* Allows sub-class to check to see if file will fit in the current tar
* file and if needed setup new tar file.
*/
protected void checkFit(File file) throws IOException, ArchiveException {
// Do not change the tar file.
}
/**
* If needed add parent directories to the tar image.
*
* @param file
* @throws IOException
*/
private void addParentDir(File file) throws IOException {
protected void addParentDir(File file) throws IOException {
File parent = file.getParentFile();
if (parent != null && !tarDirFile.contains(parent)
&& (parent.getAbsolutePath().length() > startRelativePath)) {
@ -723,6 +816,13 @@ public class GenerateCaseDlg extends CaveSWTDialog {
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.ICaseCopy#startCase(java.io.File,
* com.raytheon.uf.common.archive.config.DisplayData,
* java.util.concurrent.atomic.AtomicBoolean)
*/
@Override
public void startCase(File caseDir, DisplayData displayData,
AtomicBoolean shutdown) throws CaseCreateException {
@ -730,14 +830,26 @@ public class GenerateCaseDlg extends CaveSWTDialog {
this.shutdown = shutdown;
String archiveDirName = ArchiveConstants
.convertToFileName(displayData.getArchiveName());
String categoryDirName = ArchiveConstants
categoryDirName = ArchiveConstants
.convertToFileName(displayData.getCategoryName());
destDir = new File(caseDir, archiveDirName);
destDir.mkdirs();
tarDirFile.clear();
startRelativePath = displayData.getRootDir().length();
File tarFile = new File(destDir, categoryDirName
+ ArchiveConstants.TAR_EXTENSION);
openStreams();
} catch (Exception e) {
throw new CaseCreateException("Compress Copy start case: ", e);
}
}
/**
* Determine a new tar file and set up its streams.
*
* @throws IOException
* @throws ArchiveException
*/
protected void openStreams() throws IOException, ArchiveException {
tarDirFile.clear();
tarFile = getTarFile();
fileStream = new FileOutputStream(tarFile);
zipStream = new GZIPOutputStream(fileStream);
ArchiveStreamFactory factory = new ArchiveStreamFactory();
@ -747,13 +859,38 @@ public class GenerateCaseDlg extends CaveSWTDialog {
((TarArchiveOutputStream) tarStream)
.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
}
} catch (Exception e) {
throw new CaseCreateException("CompressCopy.startCase: ", e);
}
/**
* Determine new tar file.
*
* @return tarFile
*/
protected File getTarFile() {
return new File(destDir, categoryDirName
+ ArchiveConstants.TAR_EXTENSION);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.ICaseCopy#finishCase()
*/
@Override
public void finishCase() throws CaseCreateException {
try {
closeStreams();
} catch (IOException e) {
throw new CaseCreateException("Compress Copy finish: ", e);
}
}
@Override
public void finishCase() throws CaseCreateException {
/**
* Close all the streams for current tar file.
*
* @throws IOException
*/
protected void closeStreams() throws IOException {
try {
if (tarStream != null) {
tarStream.finish();
@ -761,8 +898,6 @@ public class GenerateCaseDlg extends CaveSWTDialog {
if (zipStream != null) {
zipStream.finish();
}
} catch (IOException e) {
throw new CaseCreateException("CaseCopy.finish: ", e);
} finally {
if (tarStream != null) {
closeStream(tarStream);
@ -780,315 +915,89 @@ public class GenerateCaseDlg extends CaveSWTDialog {
/*
* This class intended for making "image" files read for burning to a CD or
* DVD. Need to resolve issues on how this should be done.
* DVD.
*/
private static class CompressAndSplitCopy implements ICaseCopy {
private static class CompressAndSplitCopy extends CompressCopy {
/**
* Number of bytes to back off the split limit to allow finishing the
* tar without exceeding the limit.
*/
private final long BACK_OFF_BYTES = 5 * FileUtils.ONE_KB;
/**
* Maximum bytes for a tar file.
*/
private final long splitSize;
/**
* Count of tar files for a category.
*/
private int fileCnt = 0;
/**
* Constructor.
*
* @param splitSize
*/
public CompressAndSplitCopy(long splitSize) {
super();
this.splitSize = splitSize - BACK_OFF_BYTES;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.GenerateCaseDlg.CompressCopy#startCase
* (java.io.File, com.raytheon.uf.common.archive.config.DisplayData,
* java.util.concurrent.atomic.AtomicBoolean)
*/
@Override
public void startCase(File caseDir, DisplayData displayData,
AtomicBoolean shutdown) throws CaseCreateException {
throw new CaseCreateException(
"Compress and split not yet implemented.");
this.fileCnt = 0;
super.startCase(caseDir, displayData, shutdown);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.GenerateCaseDlg.CompressCopy#getTarFile
* ()
*/
@Override
public void copy(File source) throws CaseCreateException {
// TODO Auto-generated method stub
protected File getTarFile() {
int cnt = ++fileCnt;
String name = String.format("%s_%03d%s", categoryDirName, cnt,
ArchiveConstants.TAR_EXTENSION);
return new File(destDir, name);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.GenerateCaseDlg.CompressCopy#checkFit
* (java.io.File)
*/
@Override
public void finishCase() {
// TODO Auto-generated method stub
protected void checkFit(File file) throws IOException, ArchiveException {
// force update of tarFile length.
tarStream.flush();
zipStream.flush();
fileStream.flush();
/*
* Most likely over estimates the size since it is unknown how well
* file will compress.
*/
long size = tarFile.length() + file.length();
if (size >= splitSize) {
closeStreams();
openStreams();
addParentDir(file);
}
}
// TODO Example code for future implementation of this class.
// Will need to break up into the starCase, copy and finishCase will
// need close and join.
// private void compressAndSplitCase() {
// ArchiveOutputStream tarStream = null;
// GZIPOutputStream zipStream = null;
// try {
// Pipe pipe = Pipe.open();
// OutputStream poStream = Channels.newOutputStream(pipe.sink());
// zipStream = new GZIPOutputStream(poStream);
// ArchiveStreamFactory factory = new ArchiveStreamFactory();
//
// tarStream = factory.createArchiveOutputStream(
// ArchiveStreamFactory.TAR, zipStream);
//
// if (tarStream instanceof TarArchiveOutputStream) {
// ((TarArchiveOutputStream) tarStream)
// .setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
// }
//
// final InputStream piStream = Channels.newInputStream(pipe
// .source());
// splitDone.set(false);
//
// Job splitJob = new Job("Split") {
//
// @Override
// protected IStatus run(IProgressMonitor monitor) {
// OutputStream splitStream = null;
// long totSize = 0;
// try {
// byte[] buffer = new byte[12 * 1024];
//
// int bufCnt = 0;
// long splitCnt = 0L;
// while ((bufCnt = piStream.read(buffer)) != -1) {
// totSize += bufCnt;
// if (splitStream == null) {
// splitStream = openSplitFile(++numSplitFiles);
// }
// long fileSize = splitCnt + bufCnt;
// if (fileSize < splitSize) {
// splitStream.write(buffer, 0, bufCnt);
// splitCnt = fileSize;
// } else if (fileSize == splitSize) {
// splitStream.write(buffer, 0, bufCnt);
// splitStream.close();
// splitStream = null;
// splitCnt = 0L;
// } else {
// int cnt = (int) (splitSize - splitCnt);
// splitStream.write(buffer, 0, cnt);
// splitStream.close();
// splitStream = openSplitFile(++numSplitFiles);
// int remainder = bufCnt - cnt;
// splitStream.write(buffer, cnt, remainder);
// splitCnt = remainder;
// }
// }
// } catch (IOException e) {
// statusHandler.handle(Priority.PROBLEM,
// e.getLocalizedMessage(), e);
// } finally {
// if (splitStream != null) {
// try {
// splitStream.close();
// } catch (IOException e) {
// // Ignore
// }
// }
// splitDone.set(true);
// System.out.println("totalSize: " + totSize
// + ", splitSize: " + splitSize
// + ", numSplitFiles: " + numSplitFiles);
// }
//
// return Status.OK_STATUS;
// }
// };
// splitJob.schedule();
//
// createTarFile(tarStream, caseDir.listFiles());
// tarStream.finish();
// zipStream.finish();
// try {
// tarStream.close();
// } catch (IOException ex) {
// // Ignore
// }
// tarStream = null;
//
// try {
// zipStream.close();
// } catch (IOException ex) {
// // Ignore
// }
// zipStream = null;
//
// while (!splitDone.get()) {
// if (splitJob.getState() == Job.RUNNING) {
// try {
// System.out.println("splitJob.join()");
// splitJob.join();
// } catch (InterruptedException e) {
// statusHandler.handle(Priority.INFO,
// e.getLocalizedMessage(), e);
// }
// } else {
// try {
// private void compressAndSplitCase() {
// ArchiveOutputStream tarStream = null;
// GZIPOutputStream zipStream = null;
// try {
// Pipe pipe = Pipe.open();
// OutputStream poStream = Channels.newOutputStream(pipe.sink());
// zipStream = new GZIPOutputStream(poStream);
// ArchiveStreamFactory factory = new ArchiveStreamFactory();
//
// tarStream = factory.createArchiveOutputStream(
// ArchiveStreamFactory.TAR, zipStream);
//
// if (tarStream instanceof TarArchiveOutputStream) {
// ((TarArchiveOutputStream) tarStream)
// .setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
// }
//
// final InputStream piStream = Channels.newInputStream(pipe
// .source());
// splitDone.set(false);
//
// Job splitJob = new Job("Split") {
//
// @Override
// protected IStatus run(IProgressMonitor monitor) {
// OutputStream splitStream = null;
// long totSize = 0;
// try {
// byte[] buffer = new byte[12 * 1024];
//
// int bufCnt = 0;
// long splitCnt = 0L;
// while ((bufCnt = piStream.read(buffer)) != -1) {
// totSize += bufCnt;
// if (splitStream == null) {
// splitStream = openSplitFile(++numSplitFiles);
// }
// long fileSize = splitCnt + bufCnt;
// if (fileSize < splitSize) {
// splitStream.write(buffer, 0, bufCnt);
// splitCnt = fileSize;
// } else if (fileSize == splitSize) {
// splitStream.write(buffer, 0, bufCnt);
// splitStream.close();
// splitStream = null;
// splitCnt = 0L;
// } else {
// int cnt = (int) (splitSize - splitCnt);
// splitStream.write(buffer, 0, cnt);
// splitStream.close();
// splitStream = openSplitFile(++numSplitFiles);
// int remainder = bufCnt - cnt;
// splitStream.write(buffer, cnt, remainder);
// splitCnt = remainder;
// }
// }
// } catch (IOException e) {
// statusHandler.handle(Priority.PROBLEM,
// e.getLocalizedMessage(), e);
// } finally {
// if (splitStream != null) {
// try {
// splitStream.close();
// } catch (IOException e) {
// // Ignore
// }
// }
// splitDone.set(true);
// System.out.println("totalSize: " + totSize
// + ", splitSize: " + splitSize
// + ", numSplitFiles: " + numSplitFiles);
// }
//
// return Status.OK_STATUS;
// }
// };
// splitJob.schedule();
//
// createTarFile(tarStream, caseDir.listFiles());
// tarStream.finish();
// zipStream.finish();
// try {
// tarStream.close();
// } catch (IOException ex) {
// // Ignore
// }
// tarStream = null;
//
// try {
// zipStream.close();
// } catch (IOException ex) {
// // Ignore
// }
// zipStream = null;
//
// while (!splitDone.get()) {
// if (splitJob.getState() == Job.RUNNING) {
// try {
// System.out.println("splitJob.join()");
// splitJob.join();
// } catch (InterruptedException e) {
// statusHandler.handle(Priority.INFO,
// e.getLocalizedMessage(), e);
// }
// } else {
// try {
// Thread.sleep(200L);
// } catch (InterruptedException e) {
// statusHandler.handle(Priority.INFO,
// e.getLocalizedMessage(), e);
// }
// }
// }
// } catch (IOException e) {
// statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
// e);
// } catch (ArchiveException e1) {
// statusHandler.handle(Priority.PROBLEM,
// e1.getLocalizedMessage(), e1);
// } finally {
// if (tarStream != null) {
// try {
// tarStream.close();
// } catch (IOException e) {
// // Ignore
// }
// }
//
// if (zipStream != null) {
// try {
// zipStream.close();
// } catch (IOException e) {
// // Ignore
// }
// }
// }
// setProgressBar(100, SWT.NORMAL);
// deleteCaseDir();
// String message = caseDir.getName() + "split into " + numSplitFiles
// + " file(s).";
// setStateLbl(message, null);
// }
// Thread.sleep(200L);
// } catch (InterruptedException e) {
// statusHandler.handle(Priority.INFO,
// e.getLocalizedMessage(), e);
// }
// }
// }
// } catch (IOException e) {
// statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
// e);
// } catch (ArchiveException e1) {
// statusHandler.handle(Priority.PROBLEM,
// e1.getLocalizedMessage(), e1);
// } finally {
// if (tarStream != null) {
// try {
// tarStream.close();
// } catch (IOException e) {
// // Ignore
// }
// }
//
// if (zipStream != null) {
// try {
// zipStream.close();
// } catch (IOException e) {
// // Ignore
// }
// }
// }
// setProgressBar(100, SWT.NORMAL);
// deleteCaseDir();
// String message = caseDir.getName() + "split into " + numSplitFiles
// + " file(s).";
// setStateLbl(message, null);
// }
}
}

View file

@ -62,6 +62,7 @@ import com.raytheon.viz.grid.util.RadarAdapter;
* ------------ ---------- ----------- --------------------------
* Dec 13, 2011 bsteffen Initial creation
* Feb 21, 2014 DR 16744 D. Friedman Add radar/grid updates
* Apr 1, 2014 DR 17220 D. Friedman Handle uninitialized grid inventory
*
* </pre>
*
@ -142,6 +143,10 @@ public class ThinClientDataUpdateTree extends DataUpdateTree {
private void getRadarUpdates(String time, Set<AlertMessage> messages) {
Set<AlertMessage> radarMessages = new HashSet<AlertMessage>();
Map<String, RequestConstraint> metadata = RadarAdapter.getInstance().getUpdateConstraints();
if (metadata == null) {
// Can happen if grid inventory has not been initialized
return;
}
metadata = new HashMap<String, RequestConstraint>(metadata);
metadata.put("insertTime", new RequestConstraint(time,
ConstraintType.GREATER_THAN));

View file

@ -84,6 +84,7 @@ import com.vividsolutions.jts.geom.LineString;
* 10-21-09 #1711 bsteffen Initial Creation
* 04-07-10 #4614 randerso Reworked to use localization files
* 07-11-12 #875 rferrel Move points to PointsDataManager.
* 04-02-14 DR 16351 D. Friedman Fix updates to storm track from preferences. (backport from 14.2.2)
*
* </pre>
*
@ -136,6 +137,8 @@ public class ToolsDataManager implements ILocalizationFileObserver,
private Object stormLock = new Object();
private boolean stormTrackDirty = false;
private String site;
private LocalizationFile userToolsDir;
@ -232,7 +235,7 @@ public class ToolsDataManager implements ILocalizationFileObserver,
public StormTrackData getStormTrackData() {
synchronized (stormLock) {
if (stormData == null) {
if (stormData == null || stormTrackDirty) {
loadStormData();
}
return new StormTrackData(stormData);
@ -268,6 +271,7 @@ public class ToolsDataManager implements ILocalizationFileObserver,
if (points != null) {
setCoordinates(stormData, points);
}
stormTrackDirty = false;
}
private void setCoordinates(StormTrackData data, String[] points) {
@ -664,6 +668,11 @@ public class ToolsDataManager implements ILocalizationFileObserver,
} else if (P_STORMTRACK_SPEED.equals(key)
&& value instanceof Double) {
stormData.setMotionSpeed((Double) value);
} else {
/* Incompatible value indicates update from preference
* store. We will want to reload.
*/
stormTrackDirty = true;
}
}

View file

@ -56,6 +56,10 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* Aug 20, 2012 #1081 dgilling Don't pass -server and -site args
* to python script.
* Dec 04, 2013 #2588 dgilling Add thread to force shutdown.
* Mar 25, 2014 #2963 randerso Removed obsolete python_include support
* which was adding an empty string into the
* python path causing python to look in user's
* current default directory for modules.
*
* </pre>
*
@ -104,19 +108,14 @@ public class GfeClient extends AbstractCAVEComponent {
String pyVizDir = pathMgr.getFile(baseContext, "pyViz").getPath();
String pyInclude = System.getProperty("python_include");
if (pyInclude == null) {
pyInclude = "";
}
String utilityDir = pathMgr.getFile(baseContext,
com.raytheon.uf.common.util.FileUtil.join("gfe", "utility"))
.getPath();
boolean includeUser = (!VizApp.getWsId().getUserName().equals("SITE"));
String includePath = PyUtil.buildJepIncludePath(true, pyInclude,
utilityDir, GfePyIncludeUtil.getCommonPythonIncludePath(),
String includePath = PyUtil.buildJepIncludePath(true, utilityDir,
GfePyIncludeUtil.getCommonPythonIncludePath(),
GfePyIncludeUtil.getCommonGfeIncludePath(),
GfePyIncludeUtil.getConfigIncludePath(includeUser), pyVizDir,
GfePyIncludeUtil.getUtilitiesIncludePath(includeUser),

View file

@ -68,6 +68,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
* Jan 30, 2013 #15719 jdynina Allowed more than 128 chars in wx
* strings
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* 04/01/2014 17187 randerso (code checked in by zhao) To allow over 128 wx lements
*
* </pre>
*
@ -907,8 +908,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
for (int i = 0; i < dim.x; i++) {
for (int j = 0; j < dim.y; j++) {
if (points.get(i, j) == 1) {
WeatherKey combined = new WeatherKey(key.get(values
.get(i, j)));
WeatherKey combined = new WeatherKey(
key.get(0xFF & values.get(i, j)));
combined.addAll(doGetWeatherValue(i, j));
grid.set(i, j, lookupKeyValue(combined));
}

View file

@ -156,6 +156,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* update VTEC lines on products that
* aren't being corrected.
* 02/05/2014 17022 ryu Modified loadDraft() to fix merging of WMO heading and AWIPS ID.
* 03/25/2014 #2884 randerso Added xxxid to check for disabling editor
*
* </pre>
*
@ -2728,20 +2729,31 @@ public class ProductEditorComp extends Composite implements
&& !msg.getMode().equals(ActiveTableMode.PRACTICE)) {
return;
}
List<String> pils = VTECTableChangeNotification.DisableTable.get(pil);
String brained = null;
boolean allFound = false;
String sid = getDefString("fullStationID");
String pil = getDefString("pil");
if (pil != null) {
pil = pil.substring(0, 3);
String pilxxx = getDefString("pil");
String pil = null;
if (pilxxx != null) {
pil = pilxxx.substring(0, 3);
List<String> pils = VTECTableChangeNotification.DisableTable
.get(pil);
// append xxxId to pil for matching
if (pils != null) {
String xxxId = pilxxx.substring(3, pilxxx.length());
for (int i = 0; i < pils.size(); i++) {
pils.set(i, pils.get(i) + xxxId);
}
}
for (VTECChange m : msg.getChanges()) {
if (m.getSite().equals("*ALL") || m.getPil().equals("*ALL*")) {
allFound = true;
}
String msgPilxxx = m.getPil() + m.getXxxid();
if (m.getSite().equals(sid)) {
if ((pils == null) && m.getPil().equals(pil)) {
if ((pils == null) && msgPilxxx.equals(pilxxx)) {
if (brain()) {
brained = m.getPil();
}

View file

@ -82,6 +82,7 @@ import com.raytheon.viz.radar.util.StationUtils;
* ------------ ---------- ----------- --------------------------
* Mar 23, 2010 #4473 rjpeter Initial creation
* Feb 21, 2014 DR 16744 D. Friedman Add getUpdateConstraints
* Apr 1, 2014 DR 17220 D. Friedman Handle uninitialized grid inventory
*
* </pre>
*
@ -398,6 +399,11 @@ public class RadarAdapter {
}
public Map<String, RequestConstraint> getUpdateConstraints() {
RadarStation radarStation = getConfiguredRadar();
if (radarStation == null) {
// Can happen if grid inventory has not been initialized
return null;
}
RadarProductCodeMapping rpcMap = RadarProductCodeMapping.getInstance();
HashSet<Integer> productCodes = new HashSet<Integer>();
for (String abbrev : rpcMap.getParameterAbbrevs()) {
@ -406,8 +412,8 @@ public class RadarAdapter {
Map<String, RequestConstraint> rcMap = new HashMap<String, RequestConstraint>();
rcMap.put(RadarAdapter.PLUGIN_NAME_QUERY, new RequestConstraint(
RADAR_SOURCE));
rcMap.put(ICAO_QUERY, new RequestConstraint(getConfiguredRadar()
.getRdaId().toLowerCase()));
rcMap.put(ICAO_QUERY, new RequestConstraint(radarStation.getRdaId()
.toLowerCase()));
rcMap.put(
PRODUCT_CODE_QUERY,
new RequestConstraint(Arrays.toString(new ArrayList<Integer>(

View file

@ -34,8 +34,22 @@
</layout>
</appender>
<appender name="TextDBSrvRequestLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="${edex.home}/logs/edex-request-textdbSrvRequest-%d{yyyyMMdd}.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<appender name="ProductSrvRequestLogAsync" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="ProductSrvRequestLog" />
<appender-ref ref="ProductSrvRequestLog"/>
</appender>
<appender name="TextDBSrvRequestLogAsync" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="TextDBSrvRequestLog"/>
</appender>
<!-- ThriftSrv (RemoteRequestRouteWrapper) request log -->
@ -85,6 +99,11 @@
<appender-ref ref="ProductSrvRequestLogAsync"/>
</logger>
<logger name="TextDBSrvRequestLogger" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="TextDBSrvRequestLogAsync"/>
</logger>
<logger name="ThriftSrvRequestLogger" additivity="false">
<level value="Info"/>
<appender-ref ref="ThriftSrvRequestLogAsync" />

View file

@ -34,10 +34,10 @@
# 10/20/08 njensen Initial Creation.
# 01/17/13 1486 dgilling Make a new-style class.
# 09/23/13 16614 njensen Fixed reload method
# 03/25/14 2963 randerso Added check to instantiate method to
# verify module contains desired class
# throw a useful error message if not
#
#
#
import os, string
import sys, inspect, traceback
@ -104,8 +104,12 @@ class MasterInterface(object):
return self.__instanceMap.has_key(moduleName)
def instantiate(self, moduleName, className, **kwargs):
if sys.modules[moduleName].__dict__.has_key(className):
instance = sys.modules[moduleName].__dict__.get(className)(**kwargs)
self.__instanceMap[moduleName] = instance
else:
msg = "Module %s (in %s) has no class named %s" % (moduleName, sys.modules[moduleName].__file__, className)
raise Exception(msg)
def runMethod(self, moduleName, className, methodName, **kwargs):
instance = self.__instanceMap[moduleName]

View file

@ -48,6 +48,7 @@ VariableList = [
# If Flooding is "Yes", the system will insert a statement in the
# product when FFA, FLW, or FLS is in effect.
#("Flooding?" , "No", "radio", ["Yes","No"]),
#(("Include Tropical?", "includeTropical") , "No", "radio", ["Yes","No"]),
]
#**********************************************************************

View file

@ -20,21 +20,26 @@
package com.raytheon.edex.plugin.gfe.server.notify;
import java.util.List;
import java.util.Set;
import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.activetable.VTECChange;
import com.raytheon.uf.common.activetable.VTECTableChangeNotification;
import com.raytheon.uf.common.dataplugin.gfe.textproduct.DraftProduct;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.FileUpdatedMessage.FileChangeType;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.SiteMap;
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.core.EDEXUtil;
import com.raytheon.uf.edex.core.EdexException;
/**
* Listener to handle VTEC Table Change notifications
@ -46,6 +51,10 @@ import com.raytheon.uf.common.util.FileUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 5, 2012 randerso Initial creation
* Mar 25, 2014 #2884 randerso Added xxxid to check for disabling drafts
* Fixed to work with sites other than the EDEX site
* Added work around to Localization not sending
* FileUpdatedMessages on EDEX
*
* </pre>
*
@ -65,23 +74,32 @@ public class VTECTableChangeListener {
}
private void checkDrafts(ActiveTableMode tableName, VTECChange change) {
String siteid = change.getSite();
String officeId = change.getSite();
String pil = change.getPil();
String xxxid = change.getXxxid();
String awipspil = officeId + pil + xxxid; // the KKKKCCCXXX
statusHandler.handle(Priority.EVENTA, "checkDrafts: " + tableName + ":"
+ siteid + ":" + pil);
+ awipspil);
String mode = "Standard";
if (tableName.equals(ActiveTableMode.PRACTICE)) {
mode = "PRACTICE";
}
String awipspil = siteid + pil; // only the KKKKCCC
Set<String> siteList = SiteMap.getInstance()
.getSite3LetterIds(officeId);
IPathManager pathMgr = PathManagerFactory.getPathManager();
LocalizationContext siteContext = pathMgr.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
LocalizationContext[] contexts = new LocalizationContext[siteList
.size()];
int i = 0;
for (String siteId : siteList) {
contexts[i++] = pathMgr.getContextForSite(
LocalizationType.CAVE_STATIC, siteId);
}
String path = FileUtil.join("gfe", "drafts");
LocalizationFile[] inv = pathMgr.listFiles(siteContext, path, null,
false, true);
LocalizationFile[] inv = pathMgr.listFiles(contexts, path, null, false,
true);
for (LocalizationFile lf : inv) {
String[] tokens = lf.getFile().getName().split("-");
@ -98,19 +116,35 @@ public class VTECTableChangeListener {
boolean markit = false;
// attempt a match for the pil in the DisableTable of related pils
// attempt a match for the pil in the DisableTable of related
// pils
List<String> pils = VTECTableChangeNotification.DisableTable
.get(pil);
if (pils != null) {
markit = pils.contains(fpil.substring(4, 7));
} else if (awipspil.equals(fpil.substring(0, 7))) {
markit = pils.contains(fpil.substring(4, 7))
&& xxxid.equals(fpil.substring(7, fpil.length()));
} else if (awipspil.equals(fpil)) {
markit = true;
} else if (siteid.equals("*ALL*")) {
} else if (officeId.equals("*ALL*")) {
// This is for the clear hazards GUI.
markit = true;
}
if (markit) {
markDraft(lf);
// TODO: remove sending of FileUpdateMessage after DR #2768 is
// fixed
try {
EDEXUtil.getMessageProducer().sendAsync(
"utilityNotify",
new FileUpdatedMessage(lf.getContext(), lf
.getName(), FileChangeType.UPDATED, lf
.getTimeStamp().getTime()));
} catch (EdexException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
}

View file

@ -110,7 +110,7 @@
<level>SFC</level>
</levels>
</gridParameterInfo>
<gribParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<gridParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<short_name>hailprob</short_name>
<long_name>Hail Probability</long_name>
<units>%</units>
@ -123,8 +123,8 @@
<levels>
<level>SFC</level>
</levels>
</gribParameterInfo>
<gribParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</gridParameterInfo>
<gridParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<short_name>windprob</short_name>
<long_name>Damaging Wind Probability</long_name>
<units>%</units>
@ -137,8 +137,8 @@
<levels>
<level>SFC</level>
</levels>
</gribParameterInfo>
<gribParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</gridParameterInfo>
<gridParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<short_name>sigtrndprob</short_name>
<long_name>Extreme Tornado Probability</long_name>
<units>%</units>
@ -151,8 +151,8 @@
<levels>
<level>SFC</level>
</levels>
</gribParameterInfo>
<gribParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</gridParameterInfo>
<gridParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<short_name>sighailprob</short_name>
<long_name>Extreme Hail Probability</long_name>
<units>%</units>
@ -165,8 +165,8 @@
<levels>
<level>SFC</level>
</levels>
</gribParameterInfo>
<gribParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</gridParameterInfo>
<gridParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<short_name>sigwindprob</short_name>
<long_name>Extreme Damaging Wind Probability</long_name>
<units>%</units>
@ -179,8 +179,8 @@
<levels>
<level>SFC</level>
</levels>
</gribParameterInfo>
<gribParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</gridParameterInfo>
<gridParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<short_name>prsvr</short_name>
<long_name>Combined Severe Probability</long_name>
<units>%</units>
@ -193,8 +193,8 @@
<levels>
<level>SFC</level>
</levels>
</gribParameterInfo>
<gribParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</gridParameterInfo>
<gridParameterInfo xsi:type="parameterInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<short_name>prsigsv</short_name>
<long_name>Combined Extreme Severe Probability</long_name>
<units>%</units>
@ -208,5 +208,5 @@
<levels>
<level>SFC</level>
</levels>
</gribParameterInfo>
</gridParameterInfo>
</gridParamInfo>

View file

@ -0,0 +1,18 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="utility-camel" xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler">
<route id="utilityNotify">
<from uri="vm://utilityNotify" />
<bean ref="serializationUtil" method="transformToThrift" />
<to uri="jms-generic:topic:edex.alerts.utility?timeToLive=60000" />
</route>
</camelContext>
</beans>

View file

@ -37,14 +37,4 @@
<constructor-arg ref="streamSrv"/>
</bean>
<camelContext id="utility-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
<route id="utilityNotify">
<from uri="vm://utilityNotify" />
<bean ref="serializationUtil" method="transformToThrift" />
<to uri="jms-generic:topic:edex.alerts.utility?timeToLive=60000" />
</route>
</camelContext>
</beans>

View file

@ -22,6 +22,23 @@ package com.raytheon.uf.common.activetable;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* VTEC Change container for VTECTableChangeNotification
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 26, 2014 randerso Initial creation
* Mar 25, 2014 #2884 randerso Added xxxid to VTECChange
*
* </pre>
*
* @author randerso
* @version 1.0
*/
@DynamicSerialize
public class VTECChange {
@DynamicSerializeElement
@ -33,13 +50,17 @@ public class VTECChange {
@DynamicSerializeElement
private String phensig;
@DynamicSerializeElement
private String xxxid;
public VTECChange() {
}
public VTECChange(String site, String pil, String phensig) {
public VTECChange(String site, String pil, String phensig, String xxxid) {
this.site = site;
this.pil = pil;
this.phensig = phensig;
this.xxxid = xxxid;
}
public String getSite() {
@ -54,6 +75,10 @@ public class VTECChange {
return phensig;
}
public String getXxxid() {
return xxxid;
}
public void setSite(String site) {
this.site = site;
}
@ -66,10 +91,14 @@ public class VTECChange {
this.phensig = phensig;
}
public void setXxxid(String xxxid) {
this.xxxid = xxxid;
}
@Override
public String toString() {
return String.format("(Site:%s, Pil:%s, PhenSig:%s)", site, pil,
phensig);
return String.format("(Site:%s, Pil:%s, PhenSig:%s, xxxID:%s)", site,
pil, phensig, xxxid);
}
}

View file

@ -31,9 +31,11 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.TreeMap;
import java.util.regex.Matcher;
@ -65,6 +67,7 @@ import com.raytheon.uf.common.localization.exception.LocalizationOpFailedExcepti
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.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.FileUtil;
@ -89,6 +92,8 @@ import com.raytheon.uf.common.util.FileUtil;
* Aug 28, 2013 2299 rferrel purgeExpiredFromArchive now returns the number of files purged.
* Dec 04, 2013 2603 rferrel Changes to improve archive purging.
* Dec 17, 2013 2603 rjpeter Fix directory purging.
* Mar 21, 2014 2835 rjpeter Optimized getDisplayData to only scan directories to the depth required to
* populate the display label.
* </pre>
*
* @author rferrel
@ -105,7 +110,7 @@ public class ArchiveConfigManager {
public final String ARCHIVE_DIR = "archiver/purger";
/** Localization manager. */
protected IPathManager pathMgr;
protected final IPathManager pathMgr;
private final Map<String, LocalizationFile> archiveNameToLocalizationFileMap = new HashMap<String, LocalizationFile>();
@ -715,15 +720,16 @@ public class ArchiveConfigManager {
List<File> fileList = new LinkedList<File>();
ArchiveConfig archiveConfig = displayData.archiveConfig;
for (CategoryDataSet dataSet : displayData.dataSets) {
Map<CategoryDataSet, Set<File>> fullMatchDirs = getDirs(new File(
archiveConfig.getRootDir()), displayData.getLabelDirMap());
for (Map.Entry<CategoryDataSet, Set<File>> entry : fullMatchDirs
.entrySet()) {
CategoryDataSet dataSet = entry.getKey();
int[] timeIndices = dataSet.getTimeIndices();
String filePatternStr = dataSet.getFilePattern();
boolean dirOnly = dataSet.isDirOnly();
List<File> dirs = displayData.dirsMap.get(dataSet);
Set<File> dirs = entry.getValue();
int beginIndex = archiveConfig.getRootDir().length();
@ -790,24 +796,31 @@ public class ArchiveConfigManager {
/**
* Get a list of directories matching the categories directory patterns that
* are sub-directories of the archive's root directory.
* are sub-directories of the archive's root directory. maxDepth is the
* depth of directories to list, 0 for no listing, 1 for root directory,
* etc.
*
* @param archiveConfig
* @param categoryConfig
* @param maxDepth
* @return dirs
*/
private Map<CategoryDataSet, List<File>> getDirs(File rootFile,
CategoryConfig categoryConfig) {
List<File> resultDirs = null;
List<File> dirs = new ArrayList<File>();
List<File> tmpDirs = new ArrayList<File>();
List<File> swpDirs = null;
CategoryConfig categoryConfig, int maxDepth) {
List<CategoryDataSet> dataSets = categoryConfig.getDataSetList();
Map<CategoryDataSet, List<File>> rval = new HashMap<CategoryDataSet, List<File>>(
dataSets.size(), 1);
// keep an in memory map since some of the categories cause the same
// directories to be listed over and over
if (maxDepth > 0) {
List<File> resultDirs = null;
List<File> dirs = new ArrayList<File>();
List<File> tmpDirs = new ArrayList<File>();
List<File> swpDirs = null;
/*
* keep an in memory map since some of the categories cause the same
* directories to be listed over and over
*/
Map<File, List<File>> polledDirs = new HashMap<File, List<File>>();
for (CategoryDataSet dataSet : dataSets) {
@ -818,11 +831,13 @@ public class ArchiveConfigManager {
dirs.clear();
dirs.add(rootFile);
tmpDirs.clear();
int depth = 0;
for (String regex : subExpr) {
Pattern subPattern = Pattern.compile("^" + regex + "$");
IOFileFilter filter = FileFilterUtils
.makeDirectoryOnly(new RegexFileFilter(subPattern));
.makeDirectoryOnly(new RegexFileFilter(
subPattern));
for (File dir : dirs) {
List<File> dirList = polledDirs.get(dir);
@ -833,8 +848,106 @@ public class ArchiveConfigManager {
}
if (dirList != null) {
tmpDirs.addAll(FileFilterUtils.filterList(filter,
dirList));
tmpDirs.addAll(FileFilterUtils.filterList(
filter, dirList));
}
}
swpDirs = dirs;
dirs = tmpDirs;
tmpDirs = swpDirs;
tmpDirs.clear();
depth++;
if (depth >= maxDepth) {
break;
}
}
resultDirs.addAll(dirs);
}
rval.put(dataSet, resultDirs);
}
}
return rval;
}
/**
* Gets the directories that fully match the given data sets. Starts with
* the directories that previously matched up to displayLabel generation.
*
* @param rootFile
* @param dataSetMap
* @return
*/
private Map<CategoryDataSet, Set<File>> getDirs(File rootFile,
Map<CategoryDataSet, Set<File>> dataSetMap) {
Map<CategoryDataSet, Set<File>> rval = new HashMap<CategoryDataSet, Set<File>>(
dataSetMap.size(), 1);
int rootFileDepth = rootFile.getAbsolutePath().split(File.separator).length;
Set<File> dirs = new HashSet<File>();
Set<File> tmpDirs = new HashSet<File>();
Set<File> swpDirs = null;
/*
* keep in memory map since some of the categories cause the same
* directories to be listed over and over
*/
Map<File, List<File>> polledDirs = new HashMap<File, List<File>>();
for (Map.Entry<CategoryDataSet, Set<File>> entry : dataSetMap
.entrySet()) {
CategoryDataSet dataSet = entry.getKey();
Set<File> resultDirs = new HashSet<File>();
Set<File> dirsToScan = entry.getValue();
for (File dirToScan : dirsToScan) {
// determine depth of file that was already matched
String[] tokens = dirToScan.getAbsolutePath().split(
File.separator);
DIR_PATTERN_LOOP: for (String dirPattern : dataSet
.getDirPatterns()) {
String[] subExpr = dirPattern.split(File.separator);
dirs.clear();
dirs.add(dirToScan);
tmpDirs.clear();
int subExprIndex = 0;
for (int i = rootFileDepth; i < tokens.length; i++) {
Pattern subPattern = Pattern.compile("^"
+ subExpr[subExprIndex++] + "$");
Matcher m = subPattern.matcher(tokens[i]);
if (!m.matches()) {
continue DIR_PATTERN_LOOP;
}
}
while (subExprIndex < subExpr.length) {
Pattern subPattern = Pattern.compile("^"
+ subExpr[subExprIndex++] + "$");
IOFileFilter filter = FileFilterUtils
.makeDirectoryOnly(new RegexFileFilter(
subPattern));
for (File dir : dirs) {
List<File> dirList = polledDirs.get(dir);
if (dirList == null) {
File[] list = dir.listFiles();
// When null something has purged the directory.
if (list != null) {
dirList = Arrays.asList(list);
polledDirs.put(dir, dirList);
}
}
if (dirList != null) {
tmpDirs.addAll(FileFilterUtils.filterList(
filter, dirList));
}
}
@ -846,6 +959,8 @@ public class ArchiveConfigManager {
resultDirs.addAll(dirs);
}
}
rval.put(dataSet, resultDirs);
}
@ -866,27 +981,67 @@ public class ArchiveConfigManager {
*/
public List<DisplayData> getDisplayData(String archiveName,
String categoryName, boolean setSelect) {
ITimer timer = TimeUtil.getTimer();
timer.start();
Map<String, List<File>> displayMap = new HashMap<String, List<File>>();
ArchiveConfig archiveConfig = archiveMap.get(archiveName);
String rootDirName = archiveConfig.getRootDir();
CategoryConfig categoryConfig = findCategory(archiveConfig,
categoryName);
File rootFile = new File(rootDirName);
TreeMap<String, DisplayData> displays = new TreeMap<String, DisplayData>();
Map<CategoryDataSet, List<File>> dirMap = getDirs(rootFile,
categoryConfig);
int maxDepth = 0;
for (CategoryDataSet dataSet : categoryConfig.getDataSetList()) {
List<String> dataSetDirPatterns = dataSet.getDirPatterns();
maxDepth = Math.max(maxDepth,
dataSet.getMaxDirDepthForDisplayLabel());
}
File rootFile = new File(rootDirName);
TreeMap<String, Map<CategoryDataSet, Set<File>>> displays = new TreeMap<String, Map<CategoryDataSet, Set<File>>>();
Map<CategoryDataSet, List<File>> dirMap = getDirs(rootFile,
categoryConfig, maxDepth);
for (CategoryDataSet dataSet : categoryConfig.getDataSetList()) {
List<String[]> dataSetDirPatterns = dataSet.getSplitDirPatterns();
List<File> dirs = dirMap.get(dataSet);
int beginIndex = rootFile.getAbsolutePath().length() + 1;
List<Pattern> patterns = new ArrayList<Pattern>(
dataSetDirPatterns.size());
for (String dirPattern : dataSetDirPatterns) {
Pattern pattern = Pattern.compile("^" + dirPattern + "$");
/*
* Need to limit patterns by maxDepth so that matching works
* correctly on the shortened directory. This could cause a few
* false hits, but can't be helped without doing a full match which
* is too costly.
*/
StringBuilder builder = new StringBuilder(100);
for (String[] dirTokens : dataSetDirPatterns) {
int depth = 0;
for (String token : dirTokens) {
if (depth > 0) {
/*
* The config files specifically use / to delimit
* directories in the patterns. It does not depend on
* the platform, specifically since its regex extra
* handling would need to be added to handle \ if it was
* ever used. Also window clients aren't going to mount
* /data_store and /archive which is all the servers
* knows/exports.
*/
builder.append("/");
}
builder.append(token);
depth++;
if (depth >= maxDepth) {
break;
}
}
Pattern pattern = Pattern.compile("^" + builder.toString()
+ "$");
patterns.add(pattern);
builder.setLength(0);
}
MessageFormat msgfmt = new MessageFormat(dataSet.getDisplayLabel());
@ -906,22 +1061,26 @@ public class ArchiveConfigManager {
}
String displayLabel = msgfmt.format(args, sb, pos0)
.toString();
Map<CategoryDataSet, Set<File>> matchingDatasets = displays
.get(displayLabel);
if (matchingDatasets == null) {
matchingDatasets = new HashMap<CategoryDataSet, Set<File>>();
displays.put(displayLabel, matchingDatasets);
}
Set<File> labelDirs = matchingDatasets.get(dataSet);
if (labelDirs == null) {
labelDirs = new HashSet<File>();
matchingDatasets.put(dataSet, labelDirs);
}
labelDirs.add(dir);
List<File> displayDirs = displayMap.get(displayLabel);
if (displayDirs == null) {
displayDirs = new ArrayList<File>();
displayDirs = new LinkedList<File>();
displayMap.put(displayLabel, displayDirs);
}
displayDirs.add(dir);
DisplayData displayData = displays.get(displayLabel);
if (displayData == null) {
displayData = new DisplayData(archiveConfig,
categoryConfig, dataSet, displayLabel);
displays.put(displayLabel, displayData);
} else if (!displayData.dataSets.contains(dataSet)) {
displayData.dataSets.add(dataSet);
}
displayData.dirsMap.put(dataSet, displayDirs);
break;
}
}
@ -931,7 +1090,18 @@ public class ArchiveConfigManager {
List<DisplayData> displayDataList = new ArrayList<DisplayData>(
displays.size());
displayDataList.addAll(displays.values());
for (String label : displays.keySet()) {
displayDataList.add(new DisplayData(archiveConfig, categoryConfig,
displays.get(label), label));
}
timer.stop();
if (statusHandler.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.debug("DisplayData for " + archiveName + " - "
+ categoryName + " maxDepth " + maxDepth + " took "
+ timer.getElapsedTime());
}
return displayDataList;
}

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.common.archive.config;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.regex.Matcher;
@ -45,6 +46,8 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Oct 02, 2013 #2147 rferrel Allow Date to ignore hour in time stamp.
* Dec 10, 2013 #2624 rferrel Added Julian date.
* Dec 17, 2013 2603 rjpeter Clear low order time fields on time generation.
* Mar 21, 2014 2835 rjpeter Add methods to determine max directory depth
* needed to populate display labels.
* </pre>
*
* @author rferrel
@ -67,6 +70,25 @@ public class CategoryDataSet {
private static final int TIMESTAMP_INDEX = 0;
private static final Pattern LABEL_BACK_REF_FINDER = Pattern
.compile("\\{(\\d+)\\}");
/**
* The config files specifically use / to delimit directories in the
* patterns. It does not depend on the platform, specifically since its
* regex extra handling would need to be added to handle \ if it was ever
* used. Also window clients aren't going to mount /data_store and /archive
* which is all the servers knows/exports.
*/
private static final Pattern DIR_SPLITTER = Pattern.compile("/");
/**
* Not technically sound due to optional capturing groups, but good enough
* for performance optimization of directory scanning.
*/
private static final Pattern GROUP_FINDER = Pattern
.compile("[^\\\\\\(]?+\\([^\\?]");
/**
* Types of times and the number of indices for getting the time stamp from
* patterns.
@ -118,6 +140,24 @@ public class CategoryDataSet {
return dirPatterns;
}
/**
* Returns the directory patterns split on /. Not using File.separator due
* to this splitting on escape characters on a windows based platform.
*
* @return
*/
public List<String[]> getSplitDirPatterns() {
if (dirPatterns != null) {
List<String[]> rval = new ArrayList<String[]>(dirPatterns.size());
for (String dirPat : dirPatterns) {
rval.add(DIR_SPLITTER.split(dirPat));
}
return rval;
}
return null;
}
public void setDirPatterns(List<String> dirPatterns) {
this.dirPatterns = dirPatterns;
}
@ -313,6 +353,64 @@ public class CategoryDataSet {
return fileTime;
}
/**
* Returns the max directory depth scan needed to resolve the display label.
* 0 implies no scan, 1 is all files under root, etc.
*
* @return
*/
public int getMaxDirDepthForDisplayLabel() {
int rval = 0;
if ((displayLabel != null) && (displayLabel.length() > 0)
&& (dirPatterns != null) && (dirPatterns.size() > 0)) {
Matcher m = LABEL_BACK_REF_FINDER.matcher(displayLabel);
/* find all back references, keeping only highest one */
int maxBackReference = -1;
while (m.find()) {
int backReference = Integer.parseInt(m.group(1));
maxBackReference = Math.max(maxBackReference, backReference);
}
if (maxBackReference >= 0) {
for (String[] tokens : getSplitDirPatterns()) {
rval = Math.max(rval,
depthForCapturingGroup(tokens, maxBackReference));
}
}
}
return rval;
}
/**
* Parses tokens looking for the directory depth to scan to get groupToFind.
* This is not perfect and optional capturing groups will throw this off.
*
* @param tokens
* @param groupToFind
* @return
*/
private int depthForCapturingGroup(String[] tokens, int groupToFind) {
int rval = 0;
if (groupToFind == 0) {
rval = tokens.length;
} else {
int groupCount = 0;
for (String token : tokens) {
rval++;
Matcher m = GROUP_FINDER.matcher(token);
while (m.find()) {
groupCount++;
}
if (groupCount >= groupToFind) {
break;
}
}
}
return rval;
}
/*
* (non-Javadoc)
*

View file

@ -3,9 +3,9 @@ package com.raytheon.uf.common.archive.config;
import java.io.File;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.raytheon.uf.common.util.SizeUtil;
@ -24,7 +24,7 @@ import com.raytheon.uf.common.util.SizeUtil;
* Aug 02, 2013 2224 rferrel Changes to include DataSet in configuration.
* Aug 06, 2013 2222 rferrel Changes to display all selected data.
* Aug 14, 2013 2220 rferrel Add priority comparator.
*
* Mar 24, 2014 2835 rjpeter Changed method signatures, add volatile to multi-threaded variables.
* </pre>
*
* @author rferrel
@ -94,8 +94,7 @@ public class DisplayData implements Comparable<DisplayData> {
/** The data's category configuration. */
protected final CategoryConfig categoryConfig;
protected final List<CategoryDataSet> dataSets = new ArrayList<CategoryDataSet>(
1);
protected final List<CategoryDataSet> dataSets;
/** The display label for this data. */
protected final String displayLabel;
@ -104,20 +103,20 @@ public class DisplayData implements Comparable<DisplayData> {
* Mappings of a list of directories for the display label matching the data
* set's directory patterns and found under the archive's root directory.
*/
protected final Map<CategoryDataSet, List<File>> dirsMap = new HashMap<CategoryDataSet, List<File>>();
protected final Map<CategoryDataSet, Set<File>> labelDirMap;
/**
* For use by GUI to indicate display label's row is selected.
*/
private boolean selected = false;
private volatile boolean selected = false;
/**
* Indicates data is visible in the display.
*/
private boolean visible = false;
private volatile boolean visible = false;
/** For use by GUI for indicating the size of the directories' contents. */
private long size = UNKNOWN_SIZE;
private volatile long size = UNKNOWN_SIZE;
/**
* Constructor.
@ -128,12 +127,14 @@ public class DisplayData implements Comparable<DisplayData> {
* @param displayLabel
*/
public DisplayData(ArchiveConfig archiveConfig,
CategoryConfig categoryConfig, CategoryDataSet dataSet,
String displayLabel) {
CategoryConfig categoryConfig,
Map<CategoryDataSet, Set<File>> dataSetsAndDirs, String displayLabel) {
this.archiveConfig = archiveConfig;
this.categoryConfig = categoryConfig;
this.displayLabel = displayLabel;
this.dataSets.add(dataSet);
this.dataSets = new ArrayList<CategoryDataSet>(dataSetsAndDirs.keySet());
this.labelDirMap = dataSetsAndDirs;
}
/**
@ -244,6 +245,7 @@ public class DisplayData implements Comparable<DisplayData> {
/**
* Determine if the object contains the same data as the instance.
*/
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
@ -283,6 +285,10 @@ public class DisplayData implements Comparable<DisplayData> {
return categoryConfig.getName();
}
public Map<CategoryDataSet, Set<File>> getLabelDirMap() {
return labelDirMap;
}
/*
* (non-Javadoc)
*

View file

@ -0,0 +1,71 @@
/**
* 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.archive.request;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Authorization request for Case Creation.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 25, 2014 2853 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
@DynamicSerialize
public class ArchiveCaseCreationAuthRequest extends ArchiveAdminAuthRequest {
/** Resource property value for case directory location. */
@DynamicSerializeElement
private String caseDirectory;
/** Default constructor. */
public ArchiveCaseCreationAuthRequest() {
super();
}
/**
* Getter.
*
* @return caseDirectory
*/
public String getCaseDirectory() {
return caseDirectory;
}
/**
* Setter.
*
* @param caseDirectory
*/
public void setCaseDirectory(String caseDirectory) {
this.caseDirectory = caseDirectory;
}
}

View file

@ -21,11 +21,9 @@ package com.raytheon.uf.common.dataplugin.gfe.textproduct;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import com.raytheon.uf.common.dataplugin.gfe.StatusConstants;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.SerializationException;
@ -37,7 +35,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
/**
* TODO Add Description
* Handles saving and loading of draft GFE text products
*
* <pre>
*
@ -45,6 +43,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 23, 2010 randerso Initial creation
* Mar 26, 2014 #2884 randerso Code clean up
*
* </pre>
*
@ -54,7 +53,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
@DynamicSerialize
public class DraftProduct {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DraftProduct.class);
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DraftProduct.class);
@DynamicSerializeElement
private ProductDefinition productDefinition;
@ -94,15 +95,10 @@ public class DraftProduct {
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
out = lf.openOutputStream();
out.write(bytes);
} catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} catch (IOException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} finally {
if (out != null) {
@ -120,21 +116,15 @@ public class DraftProduct {
public static DraftProduct load(LocalizationFile lf)
throws SerializationException {
File file = lf.getFile();
byte[] bytes = null;
FileInputStream in = null;
try {
in = new FileInputStream(file);
File file = lf.getFile(true);
in = lf.openInputStream();
bytes = new byte[(int) file.length()];
in.read(bytes);
} catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} catch (IOException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} finally {
if (in != null) {
@ -147,6 +137,6 @@ public class DraftProduct {
}
}
return (DraftProduct) SerializationUtil.transformFromThrift(bytes);
return SerializationUtil.transformFromThrift(DraftProduct.class, bytes);
}
}

View file

@ -57,6 +57,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* PluginDataObject.
* May 16, 2013 1869 bsteffen Remove DataURI column from qc.
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Feb 27, 2014 2852 rferrel Add getter/setter to FakePointDataView.
*
* </pre>
*
@ -683,6 +684,14 @@ public class QCRecord extends PluginDataObject implements ISpatialEnabled {
@DynamicSerializeElement
@Column(name = "idx")
int curIdx;
public int getCurIdx() {
return curIdx;
}
public void setCurIdx(int curIdx) {
this.curIdx = curIdx;
}
}
public QCRecord() {

View file

@ -25,6 +25,7 @@ import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest.OrderMode;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
@ -43,8 +44,10 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Mar 12, 2012 bsteffen Initial creation
* Mar 20, 2013 2910 bsteffen Add warning for duplicate coverages.
*
*
* </pre>
*
@ -74,17 +77,29 @@ public class GridCoverageLookup {
initializeMaps();
DbQueryRequest query = new DbQueryRequest();
query.setEntityClass(GridCoverage.class.getName());
query.setOrderByField("id", OrderMode.DESC);
try {
DbQueryResponse resp = (DbQueryResponse) RequestRouter.route(query);
for (Map<String, Object> map : resp.getResults()) {
GridCoverage coverage = (GridCoverage) map.get(null);
coverageToId.put(coverage, coverage.getId());
Integer oldValue = coverageToId.put(coverage, coverage.getId());
if (oldValue != null) {
statusHandler
.handle(Priority.WARN,
"Two grid coverages were found in the database that are spatially equivalent(id="
+ oldValue
+ ","
+ coverage.getId()
+ ")");
}
idToCoverage.put(coverage.getId(), coverage);
}
} catch (Exception e) {
// do not rethrow, the lookup is not broken at this point so if the
// problems persist then more exceptions will come from the actual
// lookup methods themselves.
/*
* Do not rethrow, the lookup is not broken at this point so if the
* problems persist then more exceptions will come from the actual
* lookup methods themselves.
*/
statusHandler.handle(Priority.PROBLEM,
"Error occurred retrieving coverages from server.", e);
}

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.common.util.ServiceLoaderUtil;
* Feb 07, 2013 1543 djohnson Use ServiceLoader to find how to load jaxbable classes, defaulting to SerializableManager.
* Mar 21, 2013 1794 djohnson ServiceLoaderUtil now requires the requesting class.
* May 01, 2013 1968 djohnson Prevent deadlock due to SerializableManager threads needing to serialize things.
* Mar 26, 2014 2884 randerso Fixed broken javadoc link
*
* </pre>
*
@ -327,9 +328,9 @@ public final class SerializationUtil {
* the object as bytes
* @return the Java object
* @throws SerializationException
* @deprecated Use {@link #transformFromThrift(Class, byte[]) which performs
* the cast for you, and wraps any {@link ClassCastException}s
* in a serialization exception
* @deprecated Use {@link #transformFromThrift(Class, byte[])} which
* performs the cast for you, and wraps any
* {@link ClassCastException}s in a serialization exception
*/
@Deprecated
public static Object transformFromThrift(byte[] bytes)

View file

@ -27,6 +27,7 @@
# ------------ ---------- ----------- --------------------------
# 06/11/13 #2083 randerso Log active table changes, save backups
# 03/06/14 #2883 randerso Pass siteId into mergeFromJava
# 03/25/14 #2884 randerso Added xxxid to VTECChange
#
import time
@ -195,7 +196,7 @@ class ActiveTable(VTECTableUtil.VTECTableUtil):
changedFlag = True
#determine changes for notifications
rec = (newR['officeid'], newR['pil'], newR['phensig'])
rec = (newR['officeid'], newR['pil'], newR['phensig'], newR['xxxid'])
if rec not in changes:
changes.append(rec)
@ -309,7 +310,7 @@ def mergeFromJava(siteId, activeTable, newRecords, logger, mode, offsetSecs=0):
if (changedFlag):
from com.raytheon.uf.common.activetable import VTECChange
for c in changes:
changeList.add(VTECChange(c[0],c[1],c[2]))
changeList.add(VTECChange(c[0],c[1],c[2],c[3]))
from com.raytheon.uf.common.activetable import MergeResult
result = MergeResult(updatedList, purgedList, changeList)

View file

@ -32,7 +32,7 @@
# 01/25/13 1447 dgilling Initial Creation.
# 03/19/13 1447 dgilling Merge A1 DR 21434.
# 06/11/13 #2083 randerso Move backups to edex_static
#
# 03/25/14 #2884 randerso Added xxxid to VTECChange
#
@ -264,7 +264,7 @@ class MergeVTEC(VTECTableUtil.VTECTableUtil):
changed = True
if changed:
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'], othRec['xxxid'])
if chgRec not in changes:
changes.append(chgRec)
@ -285,7 +285,7 @@ class MergeVTEC(VTECTableUtil.VTECTableUtil):
oldReplaceEntriesAct.append(activeTable[i])
activeTable[i] = othRec #replace the record
chgRec = (activeTable[i]['officeid'],
activeTable[i]['pil'], activeTable[i]['phensig'])
activeTable[i]['pil'], activeTable[i]['phensig'], activeTable[i]['xxxid'])
if chgRec not in changes:
changes.append(chgRec)
else:
@ -298,7 +298,7 @@ class MergeVTEC(VTECTableUtil.VTECTableUtil):
if found == 0:
missingEntriesAct.append(othRec)
activeTable.append(othRec) #add the record
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'], othRec['xxxid'])
if chgRec not in changes:
changes.append(chgRec)
@ -326,7 +326,7 @@ class MergeVTEC(VTECTableUtil.VTECTableUtil):
newReplaceEntriesPast.append(othRec)
oldReplaceEntriesPast.append(activeTable[maxETNIndex])
activeTable[maxETNIndex] = othRec #replace record
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'], othRec['xxxid'])
if chgRec not in changes:
changes.append(chgRec)
@ -334,7 +334,7 @@ class MergeVTEC(VTECTableUtil.VTECTableUtil):
if maxETN is None:
missingEntriesPast.append(othRec)
activeTable.append(othRec) #add the record
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'])
chgRec = (othRec['officeid'], othRec['pil'], othRec['phensig'], othRec['xxxid'])
if chgRec not in changes:
changes.append(chgRec)
@ -382,7 +382,7 @@ class MergeVTEC(VTECTableUtil.VTECTableUtil):
changeList = ArrayList()
for c in self._changes:
changeList.add(VTECChange(c[0],c[1],c[2]))
changeList.add(VTECChange(c[0],c[1],c[2],c[3]))
result = MergeResult(updatedList, purgedList, changeList)
return result

View file

@ -2,12 +2,22 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean id="archiveAdminAuthorization"
<bean id="archiveRetentionAuthorization"
class="com.raytheon.uf.edex.archive.useradmin.ArchiveAdminPrivilegedRequestHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.archive.request.ArchiveAdminAuthRequest" />
<constructor-arg ref="archiveAdminAuthorization" />
<constructor-arg ref="archiveRetentionAuthorization" />
</bean>
<bean id="archiveCaseCreationAuthorization"
class="com.raytheon.uf.edex.archive.useradmin.ArchiveCaseCreationAuthRequestHandler" />
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg
value="com.raytheon.uf.common.archive.request.ArchiveCaseCreationAuthRequest" />
<constructor-arg ref="archiveCaseCreationAuthorization" />
</bean>
</beans>

View file

@ -12,5 +12,8 @@ archive.purge.cron=0+5+0/2+*+*+?
# compress database records
archive.compression.enable=false
# To change Default case directory.
#archive.case.directory=/data/archiver
# to disable a specific archive, use property archive.disable=pluginName,pluginName...
#archive.disable=grid,text,acars

View file

@ -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.edex.archive.useradmin;
import com.raytheon.uf.common.archive.request.ArchiveAdminAuthRequest;
import com.raytheon.uf.common.archive.request.ArchiveCaseCreationAuthRequest;
/**
* Handler for Case Creation dialog authorization.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 25, 2014 2853 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class ArchiveCaseCreationAuthRequestHandler extends
ArchiveAdminPrivilegedRequestHandler {
private final String CASE_DIR_KEY = "archive.case.directory";
private final String CASE_DIR_DEFAULT = "/data/archiver";
@Override
public ArchiveAdminAuthRequest handleRequest(ArchiveAdminAuthRequest request)
throws Exception {
super.handleRequest(request);
if (request instanceof ArchiveCaseCreationAuthRequest) {
ArchiveCaseCreationAuthRequest req = (ArchiveCaseCreationAuthRequest) request;
req.setCaseDirectory(System.getProperty(CASE_DIR_KEY,
CASE_DIR_DEFAULT));
}
return request;
}
}

View file

@ -46,9 +46,12 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ------------- -------- ----------- --------------------------
* Mar 26, 2012 bsteffen Initial creation
* Mar 07, 2013 1771 bsteffen fix gridcoverage duplicate checks.
* Mar 20, 2013 2910 bsteffen Commit transaction within cluster locks.
*
*
*
* </pre>
*
@ -96,6 +99,8 @@ public class GetGridCoverageHandler implements
coverage.initialize();
sess.saveOrUpdate(coverage);
rval = coverage;
trans.commit();
trans = null;
}
} finally {
ClusterLockUtils.deleteLock(ct.getId().getName(), ct
@ -103,7 +108,6 @@ public class GetGridCoverageHandler implements
}
}
trans.commit();
} catch (Exception e) {
statusHandler.error("Error occurred looking up GridCoverage["
+ coverage.getName() + "]", e);

View file

@ -65,10 +65,11 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 4/7/09 1994 bphillip Initial Creation
* ------------- -------- ----------- --------------------------
* Apr 07, 2009 1994 bphillip Initial Creation
* Mar 14, 2013 1587 bsteffen Fix static data persisting to datastore.
* Mar 27, 2013 1821 bsteffen Speed up GridInfoCache.
* Mar 20, 2013 2910 bsteffen Clear dataURI after loading cached info.
*
* </pre>
*
@ -246,6 +247,8 @@ public class GridDao extends PluginDao {
+ record.getDataURI(), e);
return false;
}
/* Clear the dataURI just in case something changed. */
record.setDataURI(null);
return true;
}
@ -325,15 +328,6 @@ public class GridDao extends PluginDao {
}
}
record.setLocation(dbCoverage);
if (!coverage.getId().equals(dbCoverage.getId())) {
record.setDataURI(null);
try {
record.constructDataURI();
} catch (PluginException e) {
logger.info("Error constructing dataURI: " + record);
return false;
}
}
return true;
}
@ -382,7 +376,7 @@ public class GridDao extends PluginDao {
QueryResult result = (QueryResult) this.executeNativeSql(sqlString
.toString());
for (int i = 0; i < result.getResultCount(); i++) {
orphanedIds.remove((Integer) result.getRowColumnValue(i, 0));
orphanedIds.remove(result.getRowColumnValue(i, 0));
}
if (!orphanedIds.isEmpty()) {
sqlString = new StringBuilder(orphanedIds.size() * 15 + 60);

View file

@ -9,6 +9,7 @@ Require-Bundle: com.raytheon.edex.common,
com.raytheon.edex.textdb,
org.apache.commons.logging,
org.apache.commons.lang,
com.raytheon.uf.common.status,
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.text,
com.raytheon.uf.common.site;bundle-version="1.12.1152"

View file

@ -10,9 +10,7 @@
<route id="textdbsrvXml">
<from uri="ref:textdbsrvXml_from" />
<bean ref="serializationUtil" method="unmarshalFromXml" />
<bean ref="textdbsrv" method="processMessage" />
<bean ref="serializationUtil" method="marshalToXml" />
<bean ref="textdbsrv" method="processXmlMessage" />
</route>
</camelContext>
</beans>

View file

@ -19,12 +19,15 @@
**/
package com.raytheon.uf.edex.services;
import static com.raytheon.uf.edex.services.textdbimpl.CommandExecutor.createErrorMessage;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.edex.services.textdbimpl.CommandExecutor;
import com.raytheon.uf.edex.services.textdbsrv.ICommandExecutor;
@ -35,179 +38,100 @@ import com.raytheon.uf.edex.services.textdbsrv.ICommandExecutor;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 03, 2008 1538 jkorman Initial implementation
* Oct 03, 2008 1538 jkorman Initial implementation.
* Mar 26, 2014 2835 rjpeter Added logging.
* </pre>
*
* @author jkorman
* @version 1.0
*/
public class TextDBSrv {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(TextDBSrv.class);
private static final IUFStatusHandler textDbSrvLogger = UFStatus
.getNamedHandler("TextDBSrvRequestLogger");
private static Integer instanceId = 0;
private Integer serviceInstanceId = null;
// private boolean jmxModeOn = false;
// private ObjectName serviceJmxId = null;
// private boolean serviceRegistered = false;
// Exposed properties
// private String serviceName = null;
private int messageCount = 0;
private Log logger = LogFactory.getLog(getClass());
private ICommandExecutor executor = null;
public TextDBSrv() {
super();
synchronized (instanceId) {
instanceId = instanceId + 1;
serviceInstanceId = new Integer(instanceId);
}
executor = new CommandExecutor();
}
// /**
// *
// */
// public String process(String text) throws EdexException {
// String retMsg = "";
// if (text != null) {
//
// try {
// messageCount++;
// String xmlMessage = null;
// try {
// Object m = unmarshalFromXml(text);
//
// Message sMessage = null;
//
// if (m instanceof Message) {
//
// sMessage = executeMessage((Message) m);
//
// if (sMessage != null) {
// xmlMessage = marshalToXml(sMessage);
// } else {
// xmlMessage =
// marshalToXml(createErrorMessage("ERROR:Null return from execute"));
// }
// } else {
// String errMsg = "Message content was null";
// if (m != null) {
// errMsg = "ERROR:Incorrect message type "
// + m.getClass().getName();
// }
// xmlMessage = marshalToXml(createErrorMessage(errMsg));
// }
// } catch (Exception e) {
// logger.error("Error processing message", e);
// // attempt to send an error message back to the client.
// try {
// xmlMessage =
// marshalToXml(createErrorMessage("ERROR:Exception processing message"));
// } catch (JAXBException e1) {
// logger.error(e1);
// }
// }
//
// retMsg = xmlMessage;
//
// } catch (Exception e) {
// logger.error("Error getting message payload", e);
// }
// }
//
// if (retMsg == null) {
// retMsg = "An error occurred";
// }
//
// return retMsg;
// }
/**
* Processes an xml message from the text db service endpoint.
*
* @param xml
* @return
*/
public String processXmlMessage(String xml) {
ITimer timer = TimeUtil.getTimer();
timer.start();
String sizeString = SizeUtil.prettyByteSize(xml.length());
textDbSrvLogger.info("Processing xml message of length: " + sizeString);
Message returnMessage = null;
String outXml = null;
try {
Message message = SerializationUtil.unmarshalFromXml(Message.class,
xml);
returnMessage = processMessage(message);
outXml = SerializationUtil.marshalToXml(returnMessage);
} catch (JAXBException e) {
statusHandler.error("Serialization of message failed", e);
outXml = "";
}
timer.stop();
StringBuilder sb = new StringBuilder(300);
sb.append("Processed message in ").append(timer.getElapsedTime())
.append("ms, ");
sb.append("request was size ").append(sizeString);
sb.append(", response was size ").append(
SizeUtil.prettyByteSize(outXml.length()));
textDbSrvLogger.info(sb.toString());
return outXml;
}
/**
* Processes a textdb message.
*
* @param message
* @return
*/
public Message processMessage(Message message) {
Message returnMessage = null;
try {
if (message != null) {
messageCount++;
returnMessage = executeMessage(message);
if (returnMessage == null) {
returnMessage = createErrorMessage("ERROR:Null return from execute");
returnMessage = CommandExecutor
.createErrorMessage("ERROR:Null return from execute");
}
} else {
String errMsg = "Message content was null";
returnMessage = createErrorMessage(errMsg);
returnMessage = CommandExecutor.createErrorMessage(errMsg);
}
} catch (Exception e) {
e.printStackTrace();
returnMessage = CommandExecutor
.createErrorMessage("Processing of message failed: "
+ e.getLocalizedMessage());
statusHandler.error("Processing of message failed", e);
}
return returnMessage;
}
// /**
// *
// * @return
// */
// public boolean isJmxModeOn() {
// return jmxModeOn;
// }
//
// /**
// *
// * @param desiredMode
// */
// public void setJmxModeOn(boolean desiredJmxMode) {
// jmxModeOn = desiredJmxMode;
// // if (desiredJmxMode) {
// // register(serviceName);
// // }
// }
// /**
// * Get the name of this service.
// *
// * @return The service name.
// */
// @Override
// public String getServiceName() {
// return serviceName;
// }
//
// /**
// * Set the name of this service.
// *
// * @param serviceName
// * The service name.
// */
// public void setServiceName(String serviceName) {
// this.serviceName = serviceName;
// }
// /**
// * Clear the message count to zero.
// */
// @Override
// public void clearMessageCount() {
// messageCount = 0;
// }
//
// /**
// * Get a count of messages processed since startup or the last reset.
// *
// * @return Message count.
// */
// @Override
// public int getMessageCount() {
// return messageCount;
// }
/**
*
* @param command
@ -236,67 +160,7 @@ public class TextDBSrv {
*/
private synchronized void executeCommand(String command) {
if ("read".equals(command)) {
logger.info("Processing command");
statusHandler.info("Processing command");
}
}
// /**
// * Register this service with the JMX management.
// */
// protected void register(String name) {
// if (serviceRegistered || !isJmxModeOn()) {
// return;
// }
//
// String domain = rightShortenName(
// this.getClass().getPackage().getName(), 2);
//
// // Get the MBean server for the platform
// MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
// try {
// // register the "server" dummy class, if necessary
// ObjectName dummyId = new ObjectName(domain + ":type=server");
// if (!mbs.isRegistered(dummyId)) {
// mbs.registerMBean(new ServerGroup(), dummyId);
// }
// // register this class as an MBean
// serviceJmxId = new ObjectName(domain + ":type=server,name=" + name
// + "." + serviceInstanceId);
// StandardMBean smbean = new StandardMBean(this,
// TextDBSrvInterface.class);
// mbs.registerMBean(smbean, serviceJmxId);
// serviceRegistered = true;
// } catch (Exception e) {
// logger.error("register(2) failed to register with JMX server", e);
//
// serviceRegistered = false;
// jmxModeOn = false;
// }
// }
//
// /**
// * Unregister this service from the JMX server. This should be called
// prior
// * to shutting down the service.
// */
// protected void unRegister(String name) {
// if (!serviceRegistered || !isJmxModeOn()) {
// return;
// }
// // Get the MBean server for the platform
// MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
// try {
// if (mbs.isRegistered(serviceJmxId)) {
// mbs.unregisterMBean(serviceJmxId);
// }
//
// serviceRegistered = false;
// logger.info("JMX Monitoring for " + serviceName + " stopped");
// } catch (Exception e) {
// logger.error("register(2) failed to register with JMX server", e);
// serviceRegistered = false;
// jmxModeOn = false;
// }
// }
}

View file

@ -1,4 +1,32 @@
#!/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.
##
##############################################################################
# Create GFE Start Script
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 03/20/14 #2933 randerso Fixed for Dual Domain
##############################################################################
if [ ${#AWIPS_HOME} = 0 ]
then
path_to_script=`readlink -f $0`
@ -39,7 +67,15 @@ fi
chmod +x ${LAUNCH_SCRIPT}
SITE_LOWER=`echo ${AW_SITE_IDENTIFIER}|tr [a-z] [A-Z]`
if [ -z $PRIMARY_SITES ]
then
LOCAL_SITE=${AW_SITE_IDENTIFIER}
else
IFS=','
site_list=($PRIMARY_SITES)
LOCAL_SITE=${site_list[0]}
fi
SITE_LOWER=`echo ${LOCAL_SITE}|tr [a-z] [A-Z]`
echo $SITE_LOWER > $SCRIPTS_DIR/siteID.txt
log_msg "GFE launch script created for ${SITE_CAPS}"

View file

@ -1,4 +1,33 @@
#!/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.
##
##############################################################################
# Process Received Configuration
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 03/20/14 #2933 randerso Changed PRDDIR and LOGDIR to use
Backup site's configuration
##############################################################################
import_file=${1}
log_msg The import_file is: $import_file
@ -179,8 +208,15 @@ BACKUP_MHSID=$(egrep "GFESUITE_MHSID" ${backup_config})
FAILED_MHSID=$(egrep "GFESUITE_MHSID" ${failed_config})
BACKUP_SERVER=$(egrep "GFESUITE_SERVER" ${backup_config})
FAILED_SERVER=$(egrep "GFESUITE_SERVER" ${failed_config})
sed -i "s/$FAILED_SERVER/$BACKUP_SERVER/" ${failed_config}
BACKUP_LOGDIR=$(egrep "GFESUITE_LOGDIR" ${backup_config})
FAILED_LOGDIR=$(egrep "GFESUITE_LOGDIR" ${failed_config})
BACKUP_PRDDIR=$(egrep "GFESUITE_PRDDIR" ${backup_config})
FAILED_PRDDIR=$(egrep "GFESUITE_PRDDIR" ${failed_config})
sed -i "s/$FAILED_MHSID/$BACKUP_MHSID/" ${failed_config}
sed -i "s/$FAILED_SERVER/$BACKUP_SERVER/" ${failed_config}
sed -i "s/$FAILED_LOGDIR/$BACKUP_LOGDIR/" ${failed_config}
sed -i "s/$FAILED_PRDDIR/$BACKUP_PRDDIR/" ${failed_config}
sed -i "s/98000000/$SVCBU_FAILED_SITE_PORT/" ${failed_config}
cd ${SVCBU_HOME}

View file

@ -19,6 +19,7 @@
##
# File auto-generated against equivalent DynamicSerialize Java class
# 03/25/14 #2884 randerso Added xxxid to VTECChange
class VTECChange(object):
@ -26,6 +27,7 @@ class VTECChange(object):
self.site = None
self.pil = None
self.phensig = None
self.xxxid = None
def getSite(self):
return self.site
@ -45,3 +47,8 @@ class VTECChange(object):
def setPhensig(self, phensig):
self.phensig = phensig
def getXxxid(self):
return self.xxxid
def setXxxid(self, xxxid):
self.xxxid = xxxid

View file

@ -412,7 +412,7 @@ if [ "${1}" = "-viz" ]; then
buildRPM "awips2-common-base"
#buildRPM "awips2-python-numpy"
#buildRPM "awips2-ant"
#buildRPM "awips2-python-dynamicserialize"
buildRPM "awips2-python-dynamicserialize"
#buildRPM "awips2-python"
#buildRPM "awips2-adapt-native"
#unpackHttpdPypies
@ -422,8 +422,8 @@ if [ "${1}" = "-viz" ]; then
#buildRPM "awips2-httpd-pypies"
#buildRPM "awips2-hydroapps-shared"
#buildRPM "awips2-rcm"
#buildRPM "awips2-gfesuite-client"
#buildRPM "awips2-gfesuite-server"
buildRPM "awips2-gfesuite-client"
buildRPM "awips2-gfesuite-server"
#buildRPM "awips2-tools"
#buildRPM "awips2-cli"
buildCAVE
@ -437,7 +437,7 @@ fi
if [ "${1}" = "-edex" ]; then
##buildRPM "awips2-common-base"
buildRPM "awips2"
#buildRPM "awips2"
buildEDEX
if [ $? -ne 0 ]; then
exit 1