Merge branch 'omaha_13.5.1' into development

Conflicts:
	cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java
	cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/PointSubsetManagerDlg.java
	cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java
	edexOsgi/com.raytheon.uf.common.datadelivery.registry/src/com/raytheon/uf/common/datadelivery/registry/SiteSubscription.java

Former-commit-id: 12248cade1 [formerly 43316cbff9] [formerly 12248cade1 [formerly 43316cbff9] [formerly 532d41787b [formerly df49d4d975e97a6b6c35e710dfd8244455eb21eb]]]
Former-commit-id: 532d41787b
Former-commit-id: 251b3c1a9e [formerly cb3e34813f]
Former-commit-id: 316d2ec667
This commit is contained in:
Steve Harris 2013-06-17 15:29:01 -05:00
commit 01dee712d5
77 changed files with 2969 additions and 1990 deletions

View file

@ -1,108 +0,0 @@
/**
* 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.viz;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* Convenience class for taking retention hours and converting to days/hours.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class RetentionHours {
private int retentionHours;
/**
* Constructor with default 7 day retention.
*/
public RetentionHours() {
this(7 * TimeUtil.HOURS_PER_DAY);
}
/**
* Constructor specify retention hours.
*
* @param retentionHours
*/
public RetentionHours(int retentionHours) {
this.retentionHours = retentionHours;
}
/**
* Set retention to this number of days.
*
* @param days
*/
public void setDays(int days) {
retentionHours = days * TimeUtil.HOURS_PER_DAY;
}
/**
* Convert retention hours to days. Note values are truncated so a retention
* of 23 hours will return 0 days.
*
* @return days
*/
public int getDays() {
return retentionHours / TimeUtil.HOURS_PER_DAY;
}
/**
* Get retention in hours.
*
* @return
*/
public int getHours() {
return retentionHours;
}
/**
* Set number hours of retention.
*
* @param hours
*/
public void setHours(int hours) {
retentionHours = hours;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "RetentionHours [days:" + getDays() + ", hours:" + getHours()
+ "]";
}
}

View file

@ -21,7 +21,7 @@ package com.raytheon.uf.viz.archive.data;
import java.util.List;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.DisplayData;
/**
* This class used to maintain the state of a category so it can be restored
@ -42,17 +42,27 @@ import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
*/
public class CategoryInfo {
/** Archive name for the category. */
private final String archiveName;
/** Category's name. */
private final String categoryName;
private final List<ArchiveConfigManager.DisplayData> displayInfoList;
/** List of display items for the category. */
private final List<DisplayData> displayDataList;
/**
* Contructor.
*
* @param archiveName
* @param categoryName
* @param displayInfoList
*/
public CategoryInfo(String archiveName, String categoryName,
List<ArchiveConfigManager.DisplayData> displayInfoList) {
List<DisplayData> displayInfoList) {
this.archiveName = archiveName;
this.categoryName = categoryName;
this.displayInfoList = displayInfoList;
this.displayDataList = displayInfoList;
}
public String getArchiveName() {
@ -63,7 +73,7 @@ public class CategoryInfo {
return categoryName;
}
public List<ArchiveConfigManager.DisplayData> getDisplayInfoList() {
return displayInfoList;
public List<DisplayData> getDisplayDataList() {
return displayDataList;
}
}

View file

@ -1,217 +0,0 @@
/**
* 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.viz.archive.data;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.util.FileUtil;
/**
* This class uses a obtains information on a File in a Job in order to remove
* from the UI thread.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 15, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class DirInfo {
private static final SizeJob sizeJob = new DirInfo.SizeJob();
final private DisplayData displayInfo;
private final List<File> files = new ArrayList<File>();
private final Calendar startCal;
private final Calendar endCal;
public static void clearQueue() {
sizeJob.clearQueue();
}
public static void addUpdateListener(IUpdateListener listener) {
sizeJob.listeners.add(listener);
}
public static void removeUpdateListener(IUpdateListener listener) {
sizeJob.listeners.remove(listener);
}
public DirInfo(DisplayData displayInfo, Calendar startCal, Calendar endCal) {
this.displayInfo = displayInfo;
this.startCal = startCal;
this.endCal = endCal;
DirInfo.sizeJob.queue(this);
}
public DisplayData getDisplayInfo() {
return displayInfo;
}
/**
* Job to determine the size for a directory and its contents on a non-UI
* thread.
*/
static private class SizeJob extends Job {
private ConcurrentLinkedQueue<DirInfo> queue = new ConcurrentLinkedQueue<DirInfo>();
private final ConcurrentLinkedQueue<DisplayData> selectedQueue = new ConcurrentLinkedQueue<ArchiveConfigManager.DisplayData>();
private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
List<IUpdateListener> listeners = new ArrayList<IUpdateListener>();
/**
* Add entry to queue and if pending selected entries add them to the
* queue with same start/end times.
*
* @param fileInfo
*/
protected void queue(DirInfo fileInfo) {
queue.add(fileInfo);
if (getState() == Job.NONE) {
schedule();
}
}
/**
* Clear list off pending data but save selected entries still needing
* sizes.
*/
protected void clearQueue() {
List<DirInfo> pending = new ArrayList<DirInfo>();
// Drain queue queue.removeAll() doesn't work.
while (!queue.isEmpty()) {
pending.add(queue.remove());
}
if (getState() != NONE) {
cancel();
}
// Save selected items that do not have sizes.
for (DirInfo dirInfo : pending) {
DisplayData displayData = dirInfo.getDisplayInfo();
if (displayData.isSelected() && displayData.getSize() < 0L) {
if (!selectedQueue.contains(displayData)) {
selectedQueue.add(displayData);
}
}
}
}
public SizeJob() {
super("Size Job");
setSystem(true);
}
@Override
protected IStatus run(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
mainLoop: while (!queue.isEmpty()) {
DirInfo dirInfo = queue.remove();
stopComputeSize.set(false);
DisplayData displayData = dirInfo.displayInfo;
Calendar startCal = dirInfo.startCal;
Calendar endCal = dirInfo.endCal;
List<File> files = manager.getDisplayFiles(displayData,
startCal, endCal);
// Is size still needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue;
}
dirInfo.files.clear();
dirInfo.files.addAll(files);
long size = 0L;
for (File file : dirInfo.files) {
// Skip when size no longer needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue mainLoop;
}
if (file.isDirectory()) {
size += FileUtil.sizeOfDirectory(file);
} else {
size += file.length();
}
}
displayData.setSize(size);
List<DirInfo> list = new ArrayList<DirInfo>();
list.add(dirInfo);
for (IUpdateListener listener : listeners) {
listener.update(list);
}
if (!stopComputeSize.get()) {
// Place any pending selections at end of the queue.
while (!selectedQueue.isEmpty()) {
DisplayData data = selectedQueue.remove();
new DirInfo(data, startCal, endCal);
}
}
}
return Status.OK_STATUS;
}
@Override
protected void canceling() {
stopComputeSize.set(true);
}
}
}

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.archive.data;
import java.util.List;
import com.raytheon.uf.common.archive.config.DisplayData;
/**
* Interface for methods for getting totals needed by the ArchiveTableComp.
*
@ -40,5 +44,5 @@ public interface IArchiveTotals {
/**
* Update total selected items and sizes.
*/
public void updateTotals();
public void updateTotals(List<DisplayData> displayDatas);
}

View file

@ -43,5 +43,5 @@ public interface IUpdateListener {
*
* @param dirInfos
*/
public void update(List<DirInfo> dirInfos);
public void update(List<SizeJobRequest> request);
}

View file

@ -0,0 +1,206 @@
package com.raytheon.uf.viz.archive.data;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.util.FileUtil;
/**
* Job to determine the size for a directory and its contents on a non-UI
* thread.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 13, 2013 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class SizeJob extends Job {
/** The queue for requested sizes. */
private final ConcurrentLinkedQueue<SizeJobRequest> queue = new ConcurrentLinkedQueue<SizeJobRequest>();
/**
* Pending selected entries that still need to have the sizes determined.
*/
private final ConcurrentLinkedQueue<DisplayData> selectedQueue = new ConcurrentLinkedQueue<DisplayData>();
/**
* Indicates the job should stop computing the size of the current
* non-selected entry.
*/
private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
/**
* The listeners to inform when job is done with an entry.
*/
private final List<IUpdateListener> listeners = new ArrayList<IUpdateListener>();
/**
* Constructor.
*/
public SizeJob() {
super("Size Job");
setSystem(true);
}
/**
* Add a Listener to inform when job has completed information on an entry.
*
* @param listener
*/
public void addUpdateListener(IUpdateListener listener) {
listeners.add(listener);
}
/**
* Remove a listener.
*
* @param listener
*/
public void removeUpdateListener(IUpdateListener listener) {
listeners.remove(listener);
}
/**
* Add entry to queue and if pending selected entries add them to the queue
* with same start/end times.
*
* @param fileInfo
*/
public void queue(SizeJobRequest fileInfo) {
queue.add(fileInfo);
if (getState() == Job.NONE) {
schedule();
}
}
/**
* Clear queue but save selected entries still needing sizes.
*/
public void clearQueue() {
List<SizeJobRequest> pending = new ArrayList<SizeJobRequest>();
// Drain queue queue.removeAll() doesn't work.
while (!queue.isEmpty()) {
pending.add(queue.remove());
}
if (getState() != NONE) {
cancel();
}
// Save selected items that do not have sizes.
for (SizeJobRequest dirInfo : pending) {
DisplayData displayData = dirInfo.getDisplayData();
if (displayData.isSelected() && displayData.getSize() < 0L) {
if (!selectedQueue.contains(displayData)) {
selectedQueue.add(displayData);
}
}
}
}
/**
* Requeue pending entries.
*
* @param startCal
* @param endCal
*/
public void requeueSelected(Calendar startCal, Calendar endCal) {
if (!selectedQueue.isEmpty()) {
DisplayData displayData = selectedQueue.remove();
queue(new SizeJobRequest(displayData, startCal, endCal));
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
* IProgressMonitor)
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.OK_STATUS;
}
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
mainLoop: while (!queue.isEmpty()) {
SizeJobRequest dirInfo = queue.remove();
stopComputeSize.set(false);
DisplayData displayData = dirInfo.displayData;
Calendar startCal = dirInfo.startCal;
Calendar endCal = dirInfo.endCal;
List<File> files = manager.getDisplayFiles(displayData, startCal,
endCal);
// Size no longer needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue;
}
dirInfo.files.clear();
dirInfo.files.addAll(files);
long size = 0L;
for (File file : dirInfo.files) {
// Skip when size no longer needed.
if (!displayData.isSelected() && stopComputeSize.get()) {
continue mainLoop;
}
if (file.isDirectory()) {
size += FileUtil.sizeOfDirectory(file);
} else {
size += file.length();
}
}
displayData.setSize(size);
List<SizeJobRequest> list = new ArrayList<SizeJobRequest>();
list.add(dirInfo);
for (IUpdateListener listener : listeners) {
listener.update(list);
}
}
return Status.OK_STATUS;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.jobs.Job#canceling()
*/
@Override
protected void canceling() {
queue.clear();
stopComputeSize.set(true);
}
}

View file

@ -0,0 +1,82 @@
/**
* 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.viz.archive.data;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.raytheon.uf.common.archive.config.DisplayData;
/**
* This class obtains information on a File in a Job in order to remove it from
* the UI thread.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 15, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class SizeJobRequest {
/** Information from archive configuration manager. */
final DisplayData displayData;
/** Files or directories to obtain information on. */
final List<File> files = new ArrayList<File>();
/** Start time inclusive. */
final Calendar startCal;
/** End time exclusive. */
final Calendar endCal;
/**
* Create and entry and place it on the queue.
*
* @param displayData
* @param startCal
* @param endCal
*/
public SizeJobRequest(DisplayData displayData, Calendar startCal,
Calendar endCal) {
this.displayData = displayData;
this.startCal = startCal;
this.endCal = endCal;
}
/**
*
* @return displayData
*/
public DisplayData getDisplayData() {
return displayData;
}
}

View file

@ -25,6 +25,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -38,16 +42,18 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.archive.config.ArchiveConfig;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.ArchiveInfo;
import com.raytheon.uf.viz.archive.data.CategoryInfo;
import com.raytheon.uf.viz.archive.data.DirInfo;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
import com.raytheon.uf.viz.archive.data.IUpdateListener;
import com.raytheon.uf.viz.archive.data.SizeJob;
import com.raytheon.uf.viz.archive.data.SizeJobRequest;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* Abstract base class for Archive dialogs. Contains and manages information
@ -61,6 +67,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 30, 2013 1965 bgonzale Initial creation
* Jun 10, 2013 1966 rferrel Change to allow Case Creation to extend.
*
* </pre>
*
@ -69,30 +76,35 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
*/
public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
IArchiveTotals {
private static final String UNKNOWN_SIZE_TEXT = "????MB";
IArchiveTotals, IUpdateListener {
/** Table composite that holds the table controls. */
private ArchiveTableComp tableComp;
/** Archive config combo box. */
/** Archive configuration combo box. */
private Combo archCfgCbo;
/** Category combo box. */
private Combo categoryCbo;
/** Information for populating the various table displays. */
private final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
protected final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
private Cursor busyCursor;
/**
* Boolean to indicate when DisplayData is created should its selection be
* set based on the information in the configuration files.
*/
protected boolean setSelect = false;
protected TableType tableType;
protected final SizeJob sizeJob = new SizeJob();
/**
* @param parentShell
*/
public AbstractArchiveDlg(Shell parentShell) {
super(parentShell);
setupCursor();
}
/**
@ -101,7 +113,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
public AbstractArchiveDlg(Shell parentShell, int swtStyle) {
super(parentShell, swtStyle);
setupCursor();
}
/**
@ -111,41 +122,16 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
public AbstractArchiveDlg(Shell parentShell, int style, int caveStyle) {
super(parentShell, style, caveStyle);
setupCursor();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.data.IArchiveTotals#getTotalSelectedItems()
*/
// @Override
public int getTotalSelectedItems() {
int totalSelected = 0;
for (ArchiveInfo archiveInfo : archiveInfoMap.values()) {
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayInfo : categoryInfo
.getDisplayInfoList()) {
if (displayInfo.isSelected()) {
++totalSelected;
}
}
}
}
updateTotalSizeLabel();
return totalSelected;
}
public List<DisplayData> getAllSelected() {
List<DisplayData> allSelected = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> allSelected = new ArrayList<DisplayData>();
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
.getDisplayDataList()) {
if (displayData.isSelected()) {
allSelected.add(displayData);
}
@ -201,30 +187,6 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
return null;
}
protected void updateTotalSizeLabel() {
long totalSize = 0;
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
if (displayData.isSelected()) {
long size = displayData.getSize();
if (size < 0) {
// Size still being computed.
setTotalSizeText(UNKNOWN_SIZE_TEXT);
return;
} else {
totalSize += size;
}
}
}
}
}
setTotalSizeText(SizeUtil.prettyByteSize(totalSize));
}
/**
* This method is called by the AbstractArchiveDlg to set the size text.
*
@ -232,6 +194,8 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
protected abstract void setTotalSizeText(String sizeStringText);
protected abstract void setTotalSelectedItems(int totalSize);
/**
* This method is called by the AbstractArchiveDlg to get the start of the
* time frame that bounds the data for the dialog.
@ -248,19 +212,13 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*/
protected abstract Calendar getEnd();
/**
* This method is called by the AbstractArchiveDlg when the combo boxes are
* updated.
*/
protected abstract void selectionsUpdated();
/**
* Create the Archive and Category combo controls.
*
* @param comp
* Composite to put the controls in.
*/
protected void createComboControls(Composite comp) {
protected Composite createComboControls(Composite comp) {
Composite comboComp = new Composite(comp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
@ -277,9 +235,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
archCfgCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String archiveName = archCfgCbo.getItem(archCfgCbo
.getSelectionIndex());
populateCategoryCbo(archiveName);
archiveComboSelection();
}
});
@ -293,47 +249,68 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
categoryCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String archiveName = archCfgCbo.getItem(archCfgCbo
.getSelectionIndex());
String categoryName = categoryCbo.getItem(categoryCbo
.getSelectionIndex());
populateTableComp(archiveName, categoryName);
categoryComboSelection();
}
});
ArchiveConfigManager.getInstance().reset();
createTable();
populateComboBoxes();
updateTableComp();
return comboComp;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
*/
@Override
protected void preOpened() {
super.preOpened();
// Setup to display blank dialog with busy cursor while getting data.
Job job = new Job("setup") {
@Override
protected IStatus run(IProgressMonitor monitor) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
setCursorBusy(true);
initInfo();
populateComboBoxes();
updateTableComp();
}
});
return Status.OK_STATUS;
}
};
job.schedule();
}
/**
* Create the table control.
*/
protected void createTable() {
tableComp = new ArchiveTableComp(shell, TableType.Case, this);
tableComp = new ArchiveTableComp(shell, tableType, this);
sizeJob.addUpdateListener(this);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
sizeJob.removeUpdateListener(this);
sizeJob.cancel();
}
/**
* Update table based on current item selections in archive and category.
*/
protected void updateTableComp() {
populateTableComp(getSelectedArchiveName(), getSelectedCategoryName());
}
/**
* Init busyCursor. On close, make sure that cursor reverts back to unbusy
* state if it isn't already.
*/
private void setupCursor() {
busyCursor = getParent().getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
this.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
setCursorBusy(false);
}
});
populateTableComp();
}
/**
@ -349,63 +326,173 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
if (doSelect) {
archCfgCbo.select(0);
String archiveName = archCfgCbo.getItem(0);
populateCategoryCbo(archiveName);
archiveComboSelection();
}
}
/**
* Method invoked when archive combo selection is changed.
*/
protected void archiveComboSelection() {
populateCategoryCbo();
}
/**
* Populate the category combo based on the archive name and populate the
* table.
*
* @param archiveName
*/
private void populateCategoryCbo(String archiveName) {
private void populateCategoryCbo() {
String archiveName = getSelectedArchiveName();
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
categoryCbo.removeAll();
for (String categoryName : manager.getCategoryNames(archiveName)) {
categoryCbo.add(categoryName);
}
categoryCbo.select(0);
String categoryName = categoryCbo.getItem(0);
populateTableComp(archiveName, categoryName);
categoryComboSelection();
}
private void populateTableComp(String archiveName, String categoryName) {
/**
* Method invoked when the category combo selection is changed.
*/
protected void categoryComboSelection() {
populateTableComp();
}
/**
* Populates the archive/category combo boxes and obtains the display data.
*/
private void initInfo() {
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
Calendar startCal = getStart();
Calendar endCal = getEnd();
String[] archiveNames = manager.getArchiveDataNamesList();
for (String archiveName : archiveNames) {
ArchiveInfo archiveInfo = new ArchiveInfo();
archiveInfoMap.put(archiveName, archiveInfo);
String[] categoryNames = manager.getCategoryNames(manager
.getArchive(archiveName));
for (String categoryName : categoryNames) {
List<DisplayData> displayDatas = manager.getDisplayData(
archiveName, categoryName, setSelect);
CategoryInfo categoryInfo = new CategoryInfo(archiveName,
categoryName, displayDatas);
archiveInfo.add(categoryInfo);
for (DisplayData displayData : displayDatas) {
if (displayData.isSelected()) {
sizeJob.queue(new SizeJobRequest(displayData, startCal,
endCal));
}
}
}
}
}
/**
* Populate the table based on the currently selected archive, category and
* adjust sizes on the display table.
*/
protected void populateTableComp() {
String archiveName = getSelectedArchiveName();
String categoryName = getSelectedCategoryName();
Calendar startCal = getStart();
Calendar endCal = getEnd();
setCursorBusy(true);
DirInfo.clearQueue();
sizeJob.clearQueue();
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
if (archiveInfo == null) {
archiveInfo = new ArchiveInfo();
archiveInfoMap.put(archiveName, archiveInfo);
}
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
if (categoryInfo == null) {
ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
List<DisplayData> displayInfos = manager.getDisplayInfo(
archiveName, categoryName);
categoryInfo = new CategoryInfo(archiveName, categoryName,
displayInfos);
archiveInfo.add(categoryInfo);
}
for (DisplayData displayInfo : categoryInfo.getDisplayInfoList()) {
new DirInfo(displayInfo, getStart(), getEnd());
for (DisplayData displayData : categoryInfo.getDisplayDataList()) {
sizeJob.queue(new SizeJobRequest(displayData, startCal, endCal));
}
sizeJob.requeueSelected(startCal, endCal);
tableComp.populateTable(categoryInfo.getDisplayInfoList());
selectionsUpdated();
tableComp.populateTable(categoryInfo.getDisplayDataList());
setCursorBusy(false);
}
private void setCursorBusy(boolean state) {
/**
* Set the shells cursor to the desire state.
*
* @param state
*/
protected void setCursorBusy(boolean state) {
Cursor cursor = null;
if (state) {
cursor = busyCursor;
cursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
}
shell.setCursor(cursor);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.data.IArchiveTotals#updateTotals(java.util
* .List)
*/
@Override
public void updateTotals(List<DisplayData> displayDatas) {
long totalSize = 0;
int totalSelected = 0;
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayDataList()) {
if (displayData.isSelected()) {
++totalSelected;
if (totalSize != DisplayData.UNKNOWN_SIZE) {
long size = displayData.getSize();
if (size >= 0) {
totalSize += size;
} else {
totalSize = DisplayData.UNKNOWN_SIZE;
}
}
}
}
}
}
String sizeMsg = null;
if (totalSize == DisplayData.UNKNOWN_SIZE) {
sizeMsg = DisplayData.UNKNOWN_SIZE_LABEL;
} else {
sizeMsg = SizeUtil.prettyByteSize(totalSize);
}
setTotalSizeText(sizeMsg);
setTotalSelectedItems(totalSelected);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.data.IUpdateListener#update(java.util.List)
*/
@Override
public void update(List<SizeJobRequest> dirInfos) {
final List<DisplayData> displayDatas = new ArrayList<DisplayData>(
dirInfos.size());
for (SizeJobRequest request : dirInfos) {
displayDatas.add(request.getDisplayData());
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
tableComp.updateSize(displayDatas);
updateTotals(null);
}
});
}
}

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.archive.ui;
import java.util.Calendar;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@ -34,12 +35,10 @@ import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.archive.config.ArchiveConfig;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
/**
* Archive retention dialog.
@ -52,6 +51,7 @@ import com.raytheon.uf.viz.archive.data.IArchiveTotals;
* ------------ ---------- ----------- --------------------------
* May 23, 2013 #1964 lvenable Initial creation
* May 31, 2013 #1965 bgonzale Initial work for updating retention configurations.
* Jun 10, 2013 #1966 rferrel Implemented hooks to get display and save to work.
*
* </pre>
*
@ -61,12 +61,17 @@ import com.raytheon.uf.viz.archive.data.IArchiveTotals;
public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
IArchiveTotals {
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ArchiveRetentionDlg.class);
/** Current Archive/Category selection's minimum retention hours. */
private RetentionHours minRetention;
private Spinner minRetentionSpnr;
/** Current Archive/Category selection's extended retention hours. */
private RetentionHours extRetention;
private Spinner extRetentionSpnr;
/** Displays the total number of selected items for all tables. */
private Label totalSelectedItems;
/** Displays the total size of selected items. */
private Label totalSizeLbl;
// TODO in the future, get this value from a user text box
protected static final String ARCHIVE_DIR = "/archive_dir";
@ -80,6 +85,8 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
public ArchiveRetentionDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
this.setSelect = true;
this.tableType = TableType.Retention;
}
@Override
@ -100,6 +107,8 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
gl.marginWidth = 0;
gl.horizontalSpacing = 0;
mainComp.setLayout(gl);
ArchiveConfigManager.getInstance().reset();
init();
}
@ -110,7 +119,6 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
createRetentionControls();
GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createBottomActionButtons();
selectionsUpdated();
}
/**
@ -118,7 +126,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
*/
private void createRetentionControls() {
Composite retentionComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(5, false);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
retentionComp.setLayout(gl);
retentionComp.setLayoutData(gd);
@ -127,6 +135,7 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
* Top row of controls.
*/
createComboControls(retentionComp);
createTable();
// composite for retention time selection
Composite selectionComp = new Composite(retentionComp, SWT.NONE);
@ -141,38 +150,27 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
minRetentionLbl.setLayoutData(gd);
gd = new GridData(60, SWT.DEFAULT);
minRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
Spinner minRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
minRetentionSpnr.setIncrement(1);
minRetentionSpnr.setPageIncrement(5);
minRetentionSpnr.setMaximum(Integer.MAX_VALUE);
minRetentionSpnr.setMinimum(1);
minRetentionSpnr.setLayoutData(gd);
final Combo minRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
Combo minRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
| SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
minRetentionCbo.addSelectionListener(new SelectionAdapter() {
minRetention = new RetentionHours(1, minRetentionSpnr, minRetentionCbo) {
@Override
public void widgetSelected(SelectionEvent e) {
int retentionHours = handleRetentionSelection(minRetentionCbo,
minRetentionSpnr);
if (retentionHours != -1) {
ArchiveConfig archive = getSelectedArchive();
if (archive != null) {
archive.setRetentionHours(retentionHours);
}
}
protected void handleTimeSelection() {
super.handleTimeSelection();
getSelectedArchive().setRetentionHours(getHours());
}
});
minRetentionCbo.add("Hours");
minRetentionCbo.add("Days");
minRetentionCbo.select(0);
minRetentionCbo.setData(minRetentionCbo.getItem(minRetentionCbo
.getSelectionIndex()));
};
/*
* Bottom row of controls.
*/
gd = new GridData();
gd.horizontalIndent = 20;
Label extRetentionLbl = new Label(selectionComp, SWT.NONE);
@ -180,33 +178,23 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
extRetentionLbl.setLayoutData(gd);
gd = new GridData(60, SWT.DEFAULT);
extRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
Spinner extRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
extRetentionSpnr.setIncrement(1);
extRetentionSpnr.setPageIncrement(5);
extRetentionSpnr.setMaximum(Integer.MAX_VALUE);
extRetentionSpnr.setMinimum(1);
extRetentionSpnr.setMinimum(0);
extRetentionSpnr.setLayoutData(gd);
final Combo extRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
Combo extRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
| SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
extRetentionCbo.addSelectionListener(new SelectionAdapter() {
extRetention = new RetentionHours(1, extRetentionSpnr, extRetentionCbo) {
@Override
public void widgetSelected(SelectionEvent e) {
int retentionHours = handleRetentionSelection(extRetentionCbo,
extRetentionSpnr);
if (retentionHours != -1) {
CategoryConfig category = getSelectedCategory();
if (category != null) {
category.setRetentionHours(retentionHours);
}
}
protected void handleTimeSelection() {
super.handleTimeSelection();
getSelectedCategory().setRetentionHours(getHours());
}
});
extRetentionCbo.add("Hours");
extRetentionCbo.add("Days");
extRetentionCbo.select(0);
extRetentionCbo.setData(extRetentionCbo.getItem(extRetentionCbo
.getSelectionIndex()));
};
}
/**
@ -215,32 +203,31 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
private void createBottomActionButtons() {
Composite actionControlComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(3, false);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
actionControlComp.setLayout(gl);
actionControlComp.setLayoutData(gd);
Button calcSizeBtn = new Button(actionControlComp, SWT.PUSH);
calcSizeBtn.setText(" Calculate Sizes ");
calcSizeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// TODO : add calculate size functionality
// With Roger's automated size calculation code, this doesn't
// seem relevant unless it is for calculating compressed size
}
});
// TODO - For the future ?
// Button calcSizeBtn = new Button(actionControlComp, SWT.PUSH);
// calcSizeBtn.setText(" Calculate Sizes ");
// calcSizeBtn.addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(SelectionEvent e) {
// // TODO : add calculate size functionality
// // With Roger's automated size calculation code, this doesn't
// // seem relevant unless it is for calculating compressed size
// }
// });
Button saveBtn = new Button(actionControlComp, SWT.PUSH);
saveBtn.setText(" Save... ");
saveBtn.setText(" Save ");
saveBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
ArchiveConfigManager manager = ArchiveConfigManager
.getInstance();
// TODO
// List<DisplayData> allSelected = getAllSelected();
// manager.save();
manager.save();
}
});
@ -256,58 +243,32 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
});
}
/**
* Handle the retention selection for both minimum and extended retention.
/*
* (non-Javadoc)
*
* @param comboBox
* Retention combo box.
* @param spinner
* Retention spinner.
* @return hours entered if changed; -1 if not changed
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#setTotalSizeText(java
* .lang.String)
*/
private int handleRetentionSelection(Combo comboBox, Spinner spinner) {
// If the selection didn't change then just return.
if (comboBox.getItem(comboBox.getSelectionIndex()).equals(
(String) comboBox.getData())) {
return -1;
}
int time = 0;
if (comboBox.getItem(comboBox.getSelectionIndex()).equals("Hours")) {
time = convertTime(true, spinner.getSelection());
} else {
time = convertTime(false, spinner.getSelection());
}
spinner.setSelection(time);
comboBox.setData(comboBox.getItem(comboBox.getSelectionIndex()));
return time;
}
/**
* Covert time from either hours to days or days to hours.
*
* @param daysToHours
* Flag indicating how to convert the time.
* @param time
* Time to be converted.
* @return The converted time.
*/
private int convertTime(boolean daysToHours, int time) {
int convertedTime = 0;
if (daysToHours) {
convertedTime = time * 24;
} else {
convertedTime = time / 24;
}
return convertedTime;
}
@Override
protected void setTotalSizeText(String sizeStringText) {
// TODO Auto-generated method stub
if (totalSizeLbl != null && !totalSizeLbl.isDisposed()) {
totalSizeLbl.setText(sizeStringText);
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#setTotalSelectedItems
* (int)
*/
@Override
protected void setTotalSelectedItems(int totalSize) {
if (totalSelectedItems != null && !totalSelectedItems.isDisposed()) {
totalSelectedItems.setText("" + totalSize);
}
}
/*
@ -332,23 +293,45 @@ public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
return null;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#updateTotals(java.util
* .List)
*/
@Override
public void updateTotals() {
ArchiveConfig archive = getSelectedArchive();
if (archive != null) {
if (minRetentionSpnr != null) {
minRetentionSpnr.setSelection(archive.getRetentionHours());
CategoryConfig category = getSelectedCategory();
if (category != null) {
extRetentionSpnr.setSelection(category.getRetentionHours());
}
public void updateTotals(List<DisplayData> displayDatas) {
super.updateTotals(displayDatas);
if (displayDatas != null) {
for (DisplayData displayData : displayDatas) {
displayData.updateCategory();
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#archiveComboSelection()
*/
@Override
protected void selectionsUpdated() {
// Not used.
protected void archiveComboSelection() {
super.archiveComboSelection();
minRetention.setHours(getSelectedArchive().getRetentionHours());
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#categoryComboSelection
* ()
*/
@Override
protected void categoryComboSelection() {
super.categoryComboSelection();
extRetention.setHours(getSelectedCategory().getRetentionHours());
}
}

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.viz.archive.ui;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
@ -37,7 +38,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
@ -59,8 +60,8 @@ import com.raytheon.uf.viz.archive.data.IArchiveTotals;
*/
public class ArchiveTableComp extends Composite {
/** Key for getting Display Information state. */
private final String DISPLAY_INFO_KEY = "displayInfo";
/** Key for getting Display Data. */
private final String DISPLAY_DATA_KEY = "displayData";
/** Table control. */
private Table table;
@ -80,9 +81,10 @@ public class ArchiveTableComp extends Composite {
};
/** Current table type. */
private TableType tableType = TableType.Retention;
private final TableType type;
private IArchiveTotals iArchiveTotals;
/** Allows the parent dialog log to update other total displays. */
private final IArchiveTotals iArchiveTotals;
/**
* Constructor.
@ -96,7 +98,7 @@ public class ArchiveTableComp extends Composite {
IArchiveTotals iTotalSelectedSize) {
super(parent, 0);
tableType = type;
this.type = type;
this.iArchiveTotals = iTotalSelectedSize;
init();
}
@ -114,9 +116,10 @@ public class ArchiveTableComp extends Composite {
this.setLayoutData(gd);
createTable();
createTableLabels();
updateSelectionLabels();
if (type != TableType.Retention) {
createTableLabels();
}
}
/**
@ -138,9 +141,9 @@ public class ArchiveTableComp extends Composite {
pathColumn.setText("Label");
TableColumn sizeColumn = new TableColumn(table, SWT.CENTER);
if (tableType == TableType.Retention) {
if (type == TableType.Retention) {
sizeColumn.setText("Current Size");
} else if (tableType == TableType.Case) {
} else if (type == TableType.Case) {
sizeColumn.setText("Size");
}
@ -159,7 +162,9 @@ public class ArchiveTableComp extends Composite {
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateSelectionLabels();
if (e.detail == SWT.CHECK) {
updateSelectionLabels();
}
}
});
}
@ -190,15 +195,17 @@ public class ArchiveTableComp extends Composite {
TableItem[] itemArray = table.getItems();
int count = 0;
long tableTotalSize = 0;
List<DisplayData> displayDatas = new ArrayList<DisplayData>(
itemArray.length);
for (TableItem ti : itemArray) {
DisplayData displayInfo = (DisplayData) ti
.getData(DISPLAY_INFO_KEY);
DisplayData displayData = (DisplayData) ti
.getData(DISPLAY_DATA_KEY);
if (ti.getChecked()) {
++count;
displayInfo.setSelected(true);
displayData.setSelected(true);
if (tableTotalSize >= 0) {
long diSize = displayInfo.getSize();
long diSize = displayData.getSize();
if (diSize < 0) {
tableTotalSize = diSize;
} else {
@ -206,18 +213,21 @@ public class ArchiveTableComp extends Composite {
}
}
} else {
displayInfo.setSelected(false);
displayData.setSelected(false);
}
displayDatas.add(displayData);
}
selectedLbl.setText("Table Selected Items: " + count);
if (selectedLbl != null) {
selectedLbl.setText("Table Selected Items: " + count);
String sizeString = DisplayData.UNKNOWN_SIZE_LABEL;
if (tableTotalSize >= 0) {
sizeString = SizeUtil.prettyByteSize(tableTotalSize);
String sizeString = DisplayData.UNKNOWN_SIZE_LABEL;
if (tableTotalSize >= 0) {
sizeString = SizeUtil.prettyByteSize(tableTotalSize);
}
sizeLbl.setText("Table Selected Size: " + sizeString);
}
sizeLbl.setText("Table Selected Size: " + sizeString);
iArchiveTotals.updateTotals();
iArchiveTotals.updateTotals(displayDatas);
}
/**
@ -283,7 +293,6 @@ public class ArchiveTableComp extends Composite {
*/
private void handleCheckSelectedRow(boolean check) {
TableItem[] itemArray = table.getSelection();
System.out.println("handleCheckSelectedRow: " + check);
for (TableItem ti : itemArray) {
ti.setChecked(check);
}
@ -307,12 +316,12 @@ public class ArchiveTableComp extends Composite {
updateSelectionLabels();
}
public void updateSize(List<DisplayData> displayInfos) {
public void updateSize(List<DisplayData> displayDatas) {
TableItem[] itemArray = table.getItems();
for (DisplayData displayInfo : displayInfos) {
for (DisplayData displayData : displayDatas) {
for (TableItem ti : itemArray) {
if (displayInfo.equals(ti.getData(DISPLAY_INFO_KEY))) {
if (displayData.equals(ti.getData(DISPLAY_DATA_KEY))) {
setItemSize(ti);
}
}
@ -325,15 +334,15 @@ public class ArchiveTableComp extends Composite {
* TODO : this is just for display purposes. This will go away when the
* functionality is implemented.
*/
protected void populateTable(List<DisplayData> displayInfoArray) {
protected void populateTable(List<DisplayData> displayDataArray) {
table.removeAll();
for (DisplayData displayInfo : displayInfoArray) {
for (DisplayData displayData : displayDataArray) {
TableItem item = new TableItem(table, SWT.NONE);
item.setData(DISPLAY_INFO_KEY, displayInfo);
item.setChecked(displayInfo.isSelected());
item.setText(0, displayInfo.getDisplayLabel());
item.setData(DISPLAY_DATA_KEY, displayData);
item.setChecked(displayData.isSelected());
item.setText(0, displayData.getDisplayLabel());
item.setChecked(displayInfo.isSelected());
item.setChecked(displayData.isSelected());
setItemSize(item);
}
for (int i = 0; i < 2; i++) {
@ -345,8 +354,13 @@ public class ArchiveTableComp extends Composite {
updateSelectionLabels();
}
/**
* Update table items size column.
*
* @param item
*/
private void setItemSize(TableItem item) {
long size = ((DisplayData) item.getData(DISPLAY_INFO_KEY)).getSize();
long size = ((DisplayData) item.getData(DISPLAY_DATA_KEY)).getSize();
if (size < 0L) {
item.setText(1, DisplayData.UNKNOWN_SIZE_LABEL);
} else {

View file

@ -24,9 +24,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@ -35,7 +33,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
@ -52,18 +49,17 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.ArchiveInfo;
import com.raytheon.uf.viz.archive.data.CategoryInfo;
import com.raytheon.uf.viz.archive.data.DirInfo;
import com.raytheon.uf.viz.archive.data.IArchiveTotals;
import com.raytheon.uf.viz.archive.data.IUpdateListener;
import com.raytheon.uf.viz.archive.data.SizeJobRequest;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.dialogs.AwipsCalendar;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
@ -76,18 +72,17 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 23, 2013 #1964 lvenable Initial creation
* May 23, 2013 #1964 lvenable Initial creation
* Jun 10, 2013 #1966 rferrel Implemented back in hooks for display
* and generation of cases.
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
IUpdateListener {
/** Table control */
private ArchiveTableComp tableComp;
public class CaseCreationDlg extends AbstractArchiveDlg implements
IArchiveTotals, IUpdateListener {
/** Start time label. */
private Label startTimeLbl;
@ -101,12 +96,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
/** End date. */
private Date endDate;
/** Archive configuration combo box. */
private Combo archCfgCbo;
/** Category combo box. */
private Combo categoryCbo;
/** Action to bring up the case name dialog. */
private Button caseNameCreate;
@ -150,9 +139,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
/** Archive configuration manager */
private ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
/** Information for populating the various table displays. */
private final Map<String, ArchiveInfo> archiveInfoMap = new HashMap<String, ArchiveInfo>();
/** Number of selected items. */
private int selectedItemsSize = 0;
@ -165,8 +151,15 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
public CaseCreationDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
this.setSelect = false;
this.tableType = TableType.Case;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
@ -177,6 +170,13 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
setText("Archive Case Creation");
@ -192,16 +192,10 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
init();
}
@Override
protected void disposed() {
DirInfo.removeUpdateListener(this);
}
/**
* Initialize method to create all of the composite & controls.
*/
private void init() {
DirInfo.addUpdateListener(this);
createTimeControls();
GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createCaseCompressionControls();
@ -210,8 +204,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
createTable();
GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createBottomActionButtons();
populateComboBoxes();
}
/**
@ -276,46 +268,15 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
createCompressionControls(caseCompressionComp);
}
/**
* Create the Archive and Category combo controls.
/*
* (non-Javadoc)
*
* @param comp
* Composite to put the controls in.
* @see
* com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#createComboControls
* (org.eclipse.swt.widgets.Composite)
*/
private void createComboControls(Composite comp) {
Composite comboComp = new Composite(comp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
comboComp.setLayout(gl);
comboComp.setLayoutData(gd);
Label archCfgLbl = new Label(comboComp, SWT.NONE);
archCfgLbl.setText("Archive Config: ");
gd = new GridData(200, SWT.DEFAULT);
archCfgCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
| SWT.BORDER | SWT.READ_ONLY);
archCfgCbo.setLayoutData(gd);
archCfgCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
populateCategoryCbo(getSelectedArchiveName());
}
});
Label catLbl = new Label(comboComp, SWT.NONE);
catLbl.setText("Category: ");
gd = new GridData(200, SWT.DEFAULT);
categoryCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
| SWT.BORDER | SWT.READ_ONLY);
categoryCbo.setLayoutData(gd);
categoryCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
populateTableComp();
}
});
protected Composite createComboControls(Composite comp) {
Composite comboComp = super.createComboControls(comp);
caseNameCreate = new Button(comboComp, SWT.PUSH);
caseNameCreate.setText(" Case Name... ");
@ -328,9 +289,10 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
});
caseNameCreate.setToolTipText("Must first select \"Case Location\".");
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
caseNameLbl = new Label(comboComp, SWT.BORDER);
caseNameLbl.setLayoutData(gd);
return comboComp;
}
/**
@ -423,6 +385,9 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
handleFileSizeChangeSelection();
}
});
fileSizeCbo.add("MB");
fileSizeCbo.add("GB");
fileSizeCbo.select(0);
}
/**
@ -460,13 +425,6 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
locationStateLbl.setLayoutData(gd);
}
/**
* Create the table control.
*/
private void createTable() {
tableComp = new ArchiveTableComp(shell, TableType.Case, this);
}
/**
* Create the bottom action buttons.
*/
@ -478,15 +436,16 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
actionControlComp.setLayout(gl);
actionControlComp.setLayoutData(gd);
Button exportBtn = new Button(actionControlComp, SWT.PUSH);
exportBtn.setText(" Export Case Config... ");
exportBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
}
});
// TODO - Future implementation.
// Button exportBtn = new Button(actionControlComp, SWT.PUSH);
// exportBtn.setText(" Export Case Config... ");
// exportBtn.addSelectionListener(new SelectionAdapter() {
//
// @Override
// public void widgetSelected(SelectionEvent e) {
//
// }
// });
generateBtn = new Button(actionControlComp, SWT.PUSH);
generateBtn.setText(" Generate ");
@ -514,14 +473,11 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
* Display modal dialog that performs the Generation of the case.
*/
private void generateCase() {
setBusy(true);
setCursorBusy(true);
File targetDir = (File) locationLbl.getData();
File caseDir = (File) caseNameLbl.getData();
// TODO investigate using just Date or long values for start/end
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
Calendar endCal = TimeUtil.newCalendar();
endCal.setTimeInMillis(endDate.getTime());
Calendar startCal = getStart();
Calendar endCal = getEnd();
List<DisplayData> displayDatas = getSelectedData();
boolean doCompress = compressChk.getSelection();
@ -549,7 +505,7 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
@Override
public void dialogClosed(Object returnValue) {
setBusy(false);
setCursorBusy(false);
}
});
dialog.open();
@ -791,170 +747,12 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
return str;
}
/**
* Initial set up of the combo boxes.
*/
private void populateComboBoxes() {
boolean doSelect = false;
for (String archiveName : manager.getArchiveDataNamesList()) {
archCfgCbo.add(archiveName);
doSelect = true;
}
if (doSelect) {
archCfgCbo.select(0);
String archiveName = archCfgCbo.getItem(0);
populateCategoryCbo(archiveName);
}
fileSizeCbo.add("MB");
fileSizeCbo.add("GB");
fileSizeCbo.select(0);
fileSizeCbo
.setData(fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()));
protected void setTotalSizeText(String text) {
uncompressSizeLbl.setText(text);
}
/**
* Populate the category combo based on the archive name and populate the
* table.
*
* @param archiveName
*/
private void populateCategoryCbo(String archiveName) {
categoryCbo.removeAll();
for (String categoryName : manager.getCategoryNames(archiveName)) {
categoryCbo.add(categoryName);
}
categoryCbo.select(0);
populateTableComp();
}
private void populateTableComp() {
String archiveName = getSelectedArchiveName();
String categoryName = getSelectedCategoryName();
setBusy(true);
DirInfo.clearQueue();
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
if (archiveInfo == null) {
archiveInfo = new ArchiveInfo();
archiveInfoMap.put(archiveName, archiveInfo);
}
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
if (categoryInfo == null) {
List<DisplayData> displayInfos = manager.getDisplayInfo(
archiveName, categoryName);
categoryInfo = new CategoryInfo(archiveName, categoryName,
displayInfos);
archiveInfo.add(categoryInfo);
}
// TODO investigate using just Date or long values for start/end
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
Calendar endCal = TimeUtil.newCalendar();
endCal.setTimeInMillis(endDate.getTime());
List<DisplayData> recomputList = new ArrayList<ArchiveConfigManager.DisplayData>();
for (DisplayData displayInfo : categoryInfo.getDisplayInfoList()) {
// Queue unknown sizes first
if (displayInfo.getSize() < 0L) {
new DirInfo(displayInfo, startCal, endCal);
} else {
recomputList.add(displayInfo);
}
}
// Recompute sizes
for (DisplayData displayData : recomputList) {
new DirInfo(displayData, startCal, endCal);
}
tableComp.populateTable(categoryInfo.getDisplayInfoList());
updateTotals();
setBusy(false);
}
private void setBusy(boolean state) {
Cursor cursor = null;
if (state) {
cursor = getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
}
shell.setCursor(cursor);
}
@Override
public void update(List<DirInfo> dirInfos) {
final List<DisplayData> displayInfos = new ArrayList<ArchiveConfigManager.DisplayData>();
for (DirInfo dirInfo : dirInfos) {
displayInfos.add(dirInfo.getDisplayInfo());
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
tableComp.updateSize(displayInfos);
updateTotals();
}
});
}
/**
* Obtain the selected archive name.
*
* @return archiveName
*/
private String getSelectedArchiveName() {
return archCfgCbo.getItem(archCfgCbo.getSelectionIndex());
}
/**
* Obtain the selected category name.
*
* @return categoryName
*/
private String getSelectedCategoryName() {
return categoryCbo.getItem(categoryCbo.getSelectionIndex());
}
/**
* Updates the estimated uncompressed size of selected entries.
*/
public void updateTotals() {
long totalSize = 0;
int totalSelected = 0;
boolean unknownSize = false;
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
if (displayData.isSelected()) {
++totalSelected;
if (!unknownSize) {
long size = displayData.getSize();
if (size >= 0) {
totalSize += size;
} else {
unknownSize = true;
}
}
}
}
}
}
protected void setTotalSelectedItems(int totalSelected) {
selectedItemsSize = totalSelected;
String sizeMsg = null;
if (unknownSize) {
sizeMsg = DisplayData.UNKNOWN_SIZE_LABEL;
} else {
sizeMsg = SizeUtil.prettyByteSize(totalSize);
}
uncompressSizeLbl.setText(sizeMsg);
totalSelectedItemsLbl.setText("" + totalSelected);
checkGenerateButton();
}
@ -964,13 +762,13 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
* display table and and other selected entries.
*/
private void resetSizes() {
List<DisplayData> selectedDatas = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> selectedDatas = new ArrayList<DisplayData>();
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
.getDisplayDataList()) {
displayData.setSize(DisplayData.UNKNOWN_SIZE);
if (displayData.isSelected()) {
selectedDatas.add(displayData);
@ -984,15 +782,14 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
if (selectedDatas.size() > 0) {
String archiveName = getSelectedArchiveName();
String categoryName = getSelectedCategoryName();
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
Calendar endCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(endDate.getTime());
Calendar startCal = getStart();
Calendar endCal = getEnd();
for (DisplayData displayData : selectedDatas) {
if (!displayData.isArchive(archiveName)
|| !displayData.isCategory(categoryName)) {
new DirInfo(displayData, startCal, endCal);
sizeJob.queue(new SizeJobRequest(displayData, startCal,
endCal));
}
}
}
@ -1005,13 +802,13 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
* @return selectedDatas
*/
private List<DisplayData> getSelectedData() {
List<DisplayData> selectedDatas = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> selectedDatas = new ArrayList<DisplayData>();
for (String archiveName : archiveInfoMap.keySet()) {
ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
for (String categoryName : archiveInfo.getCategoryNames()) {
CategoryInfo categoryInfo = archiveInfo.get(categoryName);
for (DisplayData displayData : categoryInfo
.getDisplayInfoList()) {
.getDisplayDataList()) {
if (displayData.isSelected()) {
selectedDatas.add(displayData);
}
@ -1020,4 +817,28 @@ public class CaseCreationDlg extends CaveSWTDialog implements IArchiveTotals,
}
return selectedDatas;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getStart()
*/
// @Override
protected Calendar getStart() {
Calendar startCal = TimeUtil.newCalendar();
startCal.setTimeInMillis(startDate.getTime());
return startCal;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getEnd()
*/
// @Override
protected Calendar getEnd() {
Calendar endCal = TimeUtil.newCalendar();
endCal.setTimeInMillis(endDate.getTime());
return endCal;
}
}

View file

@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
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;

View file

@ -0,0 +1,188 @@
/**
* 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.viz.archive.ui;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.time.util.TimeUtil;
/**
* Convenience class for taking retention hours and converting to days/hours.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 2, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class RetentionHours {
/** Minimum value for the spinner. */
private final int minUnit;
/** The retention hours. */
private int retentionHours;
/** Spinner for the time assume hours or days. */
private Spinner timeSpnr;
/** Combo box assume to determine use of Hours or Days. */
private Combo timeUnitCombo;
/**
* Constructor with default 7 day retention.
*/
public RetentionHours(int minUnit, Spinner timeSpnr, Combo timeUnitCombo) {
this.minUnit = minUnit;
this.timeSpnr = timeSpnr;
this.timeUnitCombo = timeUnitCombo;
init();
}
/**
* Set up Listeners on the combo boxes for time conversion.
*/
private void init() {
timeSpnr.setMinimum(minUnit);
timeSpnr.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleTimeSelection();
}
});
timeUnitCombo.removeAll();
timeUnitCombo.add("Hours");
timeUnitCombo.add("Days");
timeUnitCombo.select(0);
timeUnitCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleTimeUnitSelection();
handleTimeSelection();
}
});
timeUnitCombo.setData(timeUnitCombo.getItem(timeUnitCombo
.getSelectionIndex()));
}
/**
* Get retention in hours.
*
* @return
*/
public int getHours() {
return retentionHours;
}
/**
* Set number hours of retention.
*
* @param hours
*/
public void setHours(int hours) {
if (hours < minUnit) {
hours = minUnit;
}
retentionHours = hours;
int time = retentionHours;
if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
"Days")) {
time /= TimeUtil.HOURS_PER_DAY;
}
timeSpnr.setSelection(time);
// Based on the time unit retentionHours and GUI may need updating.
handleTimeSelection();
}
/**
* Handle the retention selection for both minimum and extended retention.
*
* @param timeUnitCombo
* Retention combo box.
* @param timeSpinner
* Retention spinner.
* @return hours entered if changed; -1 if not changed
*/
private void handleTimeUnitSelection() {
int time = 0;
if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
"Hours")) {
time = convertTime(true, timeSpnr.getSelection());
} else {
time = convertTime(false, timeSpnr.getSelection());
}
timeSpnr.setSelection(time);
timeUnitCombo.setData(timeUnitCombo.getItem(timeUnitCombo
.getSelectionIndex()));
}
/**
* Covert time from either hours to days or days to hours.
*
* @param daysToHours
* Flag indicating how to convert the time.
* @param time
* Time to be converted.
* @return The converted time.
*/
private int convertTime(boolean daysToHours, int time) {
int convertedTime = 0;
if (daysToHours) {
convertedTime = time * TimeUtil.HOURS_PER_DAY;
retentionHours = convertedTime;
} else {
convertedTime = time / TimeUtil.HOURS_PER_DAY;
retentionHours = convertedTime * TimeUtil.HOURS_PER_DAY;
}
return convertedTime;
}
/**
* Adjust retention hours based on combo boxes current values.
*/
protected void handleTimeSelection() {
int time = timeSpnr.getSelection();
if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
"Days")) {
time *= TimeUtil.HOURS_PER_DAY;
}
retentionHours = time;
}
}

View file

@ -68,11 +68,11 @@ import com.vividsolutions.jts.geom.Coordinate;
/**
* This is a common composite that is used to hold the area controls.
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 28, 2012 lvenable Initial creation.
@ -90,9 +90,10 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Dec 11, 2012 1264 mpduff Fix validaiton of lat/lon text fields.
* Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d
*
* Jun 14, 2013 2064 mpduff Reset controls on load.
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
@ -187,7 +188,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Constructor.
*
*
* @param parent
* Parent composite.
* @param groupTxt
@ -237,6 +238,7 @@ public class AreaComp extends Composite implements ISubset {
setupData();
createControls();
updateRegionControls();
if (regionRdo.getSelection()) {
// Try to find the smallest region that intersects, assum regions
// are listed largest to smallest.
@ -293,7 +295,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Create the bound controls.
*
*
* @param group
* Group container.
*/
@ -361,7 +363,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Create the region and bounding box controls.
*
*
* @param group
* Group container.
*/
@ -486,7 +488,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Add a separator line to the display.
*
*
* @param parentComp
* Parent component.
*/
@ -502,7 +504,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable/Disable the region and bounding box controls. The bounding box
* control will always be the disabled if the region controls are enabled.
*
*
*/
public void updateRegionControls() {
enableCustomControls(manualRdo.getSelection());
@ -513,7 +515,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Set controls enabled based on flag.
*
*
* @param flag
* true if controls should be enabled
*/
@ -524,7 +526,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Set text controls enabled based on flag.
*
*
* @param flag
* true if text controls should be enabled
*/
@ -544,7 +546,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Get the text background based on if the control is enabled or not
*
*
* @param enabled
* enabled flag
*/
@ -560,7 +562,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable the regions control based on the flag.
*
*
* @param flag
* enabled state of the controls
*/
@ -575,7 +577,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable the bounding box controls base on the flag.
*
*
* @param flag
* enabled state of the controls
*/
@ -585,7 +587,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable all controls using flag.
*
*
* @param flag
* on/off toggle for controls.
*/
@ -753,7 +755,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Get the user Regions.
*
*
* @return array of user regions
*/
private String[] getUserRegions() {
@ -852,7 +854,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Get a double from text.
*
*
* @param text
* The double String
* @return double, Double.NaN if unable to parse
@ -879,6 +881,10 @@ public class AreaComp extends Composite implements ISubset {
}
}
/**
* {@inheritDoc}
*/
@Override
public void updateBounds(ReferencedEnvelope envelope) {
Coordinate ul = EnvelopeUtils.getUpperLeftLatLon(envelope);
Coordinate lr = EnvelopeUtils.getLowerRightLatLon(envelope);
@ -895,7 +901,7 @@ public class AreaComp extends Composite implements ISubset {
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.viz.datadelivery.subscription.subset.ISubset#
* updateSelectionState(boolean, java.lang.String)
*/
@ -906,7 +912,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Select the custom radio button
*
*
* @param regionName
*/
public void setRegion(String regionName) {
@ -941,12 +947,11 @@ public class AreaComp extends Composite implements ISubset {
}
index++;
}
}
/**
* Select the custom radio button.
*
*
* @return region name
*/
public String getRegionName() {
@ -980,7 +985,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Switch to "My Regions" as the active selection and select the provided
* region name.
*
*
* @param regionName
*/
public void showMyRegions(String regionName) {
@ -1009,7 +1014,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* @return the envelopeValid
*/
public boolean isEnvelopeValid() {
public boolean isEnvelopeValid() {
return envelopeValid;
}
@ -1033,6 +1038,6 @@ public class AreaComp extends Composite implements ISubset {
validateBoundsText();
}
}
}
}

View file

@ -99,7 +99,8 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Add Shared sites.
* Jun 04, 2013 223 mpduff Modify for point data.
* Jun 04, 2013 223 mpduff Modify for point data.
* Jun 12, 2013 2038 djohnson No longer modal.
*
* </pre>
*
@ -184,7 +185,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
* true for new subscription, false for edit
*/
public CreateSubscriptionDlg(Shell parent, boolean create) {
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
super(parent, SWT.DIALOG_TRIM,
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
this.create = create;

View file

@ -51,6 +51,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* Nov 29, 2012 djohnson Initial creation
* May 22, 2013 1650 djohnson Add more bandwidth information.
* Jun 12, 2013 2038 djohnson Maximum allowed size is returned in kilobytes.
*
* </pre>
*
@ -133,7 +134,7 @@ public class DisplayForceApplyPromptDialog extends CaveSWTDialog {
sizeLabel
.setText("Maximum allowed size with current latency: "
+ SizeUtil
.prettyByteSize(configuration.maximumAllowedSize));
.prettyKiloByteSize(configuration.maximumAllowedSize));
sizeLabel
.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}

View file

@ -125,6 +125,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* May 28, 2013 1650 djohnson Allow specifying filters for what subscriptions to show.
* Jun 05, 2013 2064 mpduff Fix for filtering combo boxes.
* Jun 06, 2013 2030 mpduff Refactored help.
* Jun 14, 2013 2064 mpduff Check for null/disposed sort column.
* </pre>
*
* @author mpduff
@ -1050,6 +1051,11 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
}
}
// If null get the first one
if (sortedTableColumn == null) {
sortedTableColumn = tableComp.getTable().getColumn(0);
}
tableComp.updateSortDirection(sortedTableColumn,
tableComp.getSubscriptionData(), false);
tableComp.populateTable();

View file

@ -83,6 +83,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 14, 2013 2000 djohnson Check for subscription overlap/duplication.
* May 23, 2013 1650 djohnson Move out some presentation logic to DisplayForceApplyPromptDialog.
* Jun 12, 2013 2038 djohnson Launch subscription manager on the UI thread.
*
* </pre>
*
@ -649,9 +650,14 @@ public class SubscriptionService implements ISubscriptionService {
return new SubscriptionServiceResult(true);
case EDIT_SUBSCRIPTIONS:
if (!result.config.isNotAbleToScheduleOnlyTheSubscription()) {
new SubscriptionManagerAction()
.loadSubscriptionManager(SubscriptionManagerFilters
.getByNames(result.config.wouldBeUnscheduledSubscriptions));
VizApp.runSync(new Runnable() {
@Override
public void run() {
new SubscriptionManagerAction()
.loadSubscriptionManager(SubscriptionManagerFilters
.getByNames(result.config.wouldBeUnscheduledSubscriptions));
}
});
}
return new SubscriptionServiceResult(true);
default:

View file

@ -102,6 +102,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* May 15, 2013 1040 mpduff Place markNotBusyInUIThread in a finally block.
* May 23, 2013 2020 mpduff Call updateControls();
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
* Jun 14, 2013 2064 mpduff Null check for sorted column.
*
* </pre>
*
@ -573,6 +574,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
sortDirectionMap.put(tc.getText(), SortDirection.ASCENDING);
}
// If no sorted column specified then use the first column
if (sortedColumn == null || sortedColumn.isDisposed()) {
sortedColumn = table.getColumn(0);
}
populateTable();
}

View file

@ -99,6 +99,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Jun 04, 2013 223 mpduff Added grid specific items to this class.
* Jun 11, 2013 2064 mpduff Fix editing of subscriptions.
* Jun 14, 2013 2108 mpduff Refactored DataSizeUtils.
*
*
@ -604,22 +605,33 @@ public class GriddedSubsetManagerDlg
Time dataSetTime = dataSet.getTime();
Time newTime = new Time();
newTime.setEnd(dataSetTime.getEnd());
newTime.setFormat(dataSetTime.getFormat());
newTime.setNumTimes(dataSetTime.getNumTimes());
newTime.setRequestEnd(dataSetTime.getRequestEnd());
newTime.setRequestStart(dataSetTime.getRequestStart());
newTime.setStart(dataSetTime.getStart());
newTime.setStep(dataSetTime.getStep());
newTime.setStepUnit(dataSetTime.getStepUnit());
if (sub instanceof AdhocSubscription) {
newTime = setupDataSpecificTime(newTime, sub);
sub.setTime(newTime);
} else if (!create) {
newTime.setCycleTimes(this.subscription.getTime().getCycleTimes());
}
Time time = sub.getTime();
List<String> fcstHours = time.getFcstHours();
String[] selectedItems = this.timingTabControls
.getSelectedFcstHours();
List<Integer> fcstIndices = new ArrayList<Integer>();
for (String hr : selectedItems) {
fcstIndices.add(fcstHours.indexOf(hr));
}
sub.setTime(newTime);
time.setSelectedTimeIndices(fcstIndices);
subscription.setTime(time);
} else {
newTime.setEnd(dataSetTime.getEnd());
newTime.setFormat(dataSetTime.getFormat());
newTime.setNumTimes(dataSetTime.getNumTimes());
newTime.setRequestEnd(dataSetTime.getRequestEnd());
newTime.setRequestStart(dataSetTime.getRequestStart());
newTime.setStart(dataSetTime.getStart());
newTime.setStep(dataSetTime.getStep());
newTime.setStepUnit(dataSetTime.getStepUnit());
sub.setTime(newTime);
}
GriddedCoverage cov = (GriddedCoverage) dataSet.getCoverage();
cov.setModelName(dataSet.getDataSetName());

View file

@ -34,6 +34,8 @@ import org.eclipse.swt.widgets.TabItem;
import org.geotools.geometry.jts.ReferencedEnvelope;
import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.PointDataSet;
import com.raytheon.uf.common.datadelivery.registry.PointTime;
@ -55,6 +57,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 04, 2013 223 mpduff Initial creation.
* Jun 11, 2013 2064 mpduff Fix editing of subscriptions.
* Jun 14, 2013 2108 mpduff Refactored DataSizeUtils and
* implement subset size.
*
@ -203,13 +206,18 @@ public class PointSubsetManagerDlg extends
sub.setDataSetSize(50);
Coverage cov = new Coverage();
cov.setEnvelope(dataSet.getCoverage().getEnvelope());
setCoverage(sub, cov);
List<Parameter> paramList = new ArrayList<Parameter>();
Map<String, Parameter> paramMap = dataSet.getParameters();
List<DataLevelType> levelTypeList = new ArrayList<DataLevelType>();
levelTypeList.add(new DataLevelType(DataLevelType.LevelType.SFC));
for (String key : paramMap.keySet()) {
paramList.add(paramMap.get(key));
Parameter p = paramMap.get(key);
p.setDataType(DataType.POINT);
p.setLevelType(levelTypeList);
paramList.add(p);
}
sub.setParameter(paramList);

View file

@ -59,6 +59,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Dec 18, 2012 1439 mpduff Redo subset name validation.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Feb 20, 2013 1589 mpduff Fix to allow saving custom areas.
* Jun 14, 2013 2064 mpudff Force an update of region controls.
*
* </pre>
*
@ -333,10 +334,9 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
i++;
}
} else {
areaComp.updateRegionControls();
}
areaComp.updateRegionControls();
}
/**

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* ------------ ---------- ----------- --------------------------
* May 14, 2013 2000 djohnson Initial creation
* May 23, 2013 1650 djohnson Reword change bandwidth message.
* Jun 12, 2013 2064 mpduff Update label.
*
* </pre>
*
@ -91,8 +92,7 @@ public class BandwidthTab extends SystemApplyCancelTab {
protected void initializeTabComponents(Composite mainComp) {
GridLayout gl = new GridLayout(1, false);
GridData gd = new GridData(SWT.VERTICAL, SWT.DEFAULT, true, false);
Composite configurationComposite = new Composite(mainComp,
SWT.NONE);
Composite configurationComposite = new Composite(mainComp, SWT.NONE);
configurationComposite.setLayout(gl);
configurationComposite.setLayoutData(gd);
@ -114,7 +114,7 @@ public class BandwidthTab extends SystemApplyCancelTab {
gd = new GridData(165, SWT.DEFAULT);
Label availBandwith = new Label(outerComp, SWT.NONE);
availBandwith.setLayoutData(gd);
availBandwith.setText("OPSNET Bandwidth (KB):");
availBandwith.setText("OPSNET Bandwidth (kB/s):");
final Spinner availBandwidthSpinner = new Spinner(outerComp, SWT.BORDER);
availBandwidthSpinner.setMinimum(0);

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
@ -76,6 +77,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* May 15, 2013 1040 mpduff Using Set for office Ids.
* May 20, 2013 2000 djohnson Add message to inform the user changes were applied.
* Jun 04, 2013 223 mpduff Add point data stuff.
* Jun 11, 2013 2064 mpduff Don't output Parameter header if none exist.
* Jun 12, 2013 2064 mpduff Use SizeUtil to format data size output.
* </pre>
*
* @author mpduff
@ -275,7 +278,7 @@ public class DataDeliveryUtils {
DATA_SIZE("Data Size", null) {
@Override
public String getDisplayData(SubscriptionManagerRowData rd) {
return String.valueOf(rd.getDataSetSize());
return SizeUtil.prettyKiloByteSize(rd.getDataSetSize());
}
},
/** Column Group Name */
@ -628,7 +631,8 @@ public class DataDeliveryUtils {
.append(newline);
fmtStr.append("Dataset Name: ").append(sub.getDataSetName())
.append(newline);
fmtStr.append("Dataset Size: ").append(sub.getDataSetSize())
fmtStr.append("Dataset Size: ")
.append(SizeUtil.prettyKiloByteSize(sub.getDataSetSize()))
.append(newline);
fmtStr.append("Provider: ").append(sub.getProvider()).append(newline);
fmtStr.append("Office IDs: ")
@ -696,7 +700,7 @@ public class DataDeliveryUtils {
}
List<Parameter> parmArray = sub.getParameter();
if (parmArray != null) {
if (!CollectionUtil.isNullOrEmpty(parmArray)) {
fmtStr.append("Parameters:").append(newline);
for (Parameter p : parmArray) {
fmtStr.append("------ Name: ").append(p.getName())

View file

@ -77,17 +77,14 @@ public class DerivedRequestableData extends AbstractRequestableData {
public Object getDataValue(Object arg) throws VizException {
DerivedParameterRequest request = createDerparRequest(arg);
try {
List<?> finalResult = DerivedParameterGenerator.calculate(request);
if (finalResult != null && finalResult.size() > 0) {
if (finalResult.size() == 1) {
return new IDataRecord[] { ((IDataRecord) finalResult
.get(0)) };
} else if (finalResult.size() == 4) {
return new IDataRecord[] {
((FloatDataRecord) finalResult.get(0)),
((FloatDataRecord) finalResult.get(1)),
((FloatDataRecord) finalResult.get(2)),
((FloatDataRecord) finalResult.get(3)) };
List<IDataRecord> finalResult = DerivedParameterGenerator
.calculate(request);
if (finalResult != null && !finalResult.isEmpty()) {
if (finalResult.size() == 4 || finalResult.size() == 1) {
for (IDataRecord rec : finalResult) {
rec.setName(request.getParameterAbbreviation());
}
return finalResult.toArray(new IDataRecord[0]);
} else {
throw new VizException(
"Error processing derived parameter, expecting scalar or vector data. Vector data must return speed, dir, u, and v components.");

View file

@ -31,7 +31,8 @@ Developed on the Raytheon Visualization Environment (viz)
-Dqpid.dest_syntax=BURL
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dlog4j.configuration=log4j-alertviz.xml</vmArgs>
-Dlog4j.configuration=log4j-alertviz.xml
-Dthrift.stream.maxsize=200</vmArgs>
</launcherArgs>
<windowImages/>

View file

@ -45,9 +45,11 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.uf.viz.d2d.core.map.IDataScaleResource;
import com.raytheon.viz.core.rsc.ICombinedResourceData;
import com.raytheon.viz.grid.inv.GribDataCubeAlertMessageParser;
@ -66,6 +68,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 12, 2009 njensen Initial creation
* Jun 17, 2013 2107 bsteffen Enable sampling by default for several
* display types.
*
* </pre>
*
@ -131,7 +135,22 @@ public class GridResourceData extends AbstractRequestableResourceData implements
+ " plugin is not supported.");
}
}
sampling = sampling == null ? false : sampling;
if (sampling == null) {
if (loadProperties.getCapabilities().hasCapability(
DisplayTypeCapability.class)) {
DisplayType dType = loadProperties.getCapabilities()
.getCapability(this, DisplayTypeCapability.class)
.getDisplayType();
if (dType == DisplayType.BARB || dType == DisplayType.CONTOUR
|| dType == DisplayType.ICON) {
sampling = false;
} else {
sampling = true;
}
} else {
sampling = true;
}
}
return new D2DGridResource(this, loadProperties);
}

View file

@ -71,6 +71,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Sep 2, 2008 randerso Initial creation
* May 01,2013 15920 lbousaidi gages get updated after clicking on
* Regenerate Hour Fields without closing 7x7 Gui.
* Jun 05,2013 15961 lbousaidi added routines for set Bad/set not bad buttons
* to reflect the state of the gages.
* </pre>
*
* @author randerso
@ -612,26 +614,32 @@ public class Display7x7Dialog extends CaveSWTDialog {
@Override
public void widgetSelected(SelectionEvent e) {
if (setBad.getText() == "Set Not Bad") {
if (setBad.getText().equalsIgnoreCase("Set Not Bad")) {
workingGage.setIs_bad(false);
String gval = null;
String wid = workingGage.getId();
badGage.remove(wid);
notBadGage.add(wid);
MPEDataManager.getInstance().addEditedGage(workingGage);
//remove bad gage from list
if (!notBadGage.isEmpty() && !editGage.isEmpty()) {
for (int i = 0; i < notBadGage.size(); i++) {
String gd = notBadGage.get(i);
MPEDataManager.getInstance().removeBadGage(gd);
}
}
if ((workingGage.getGval() == -999.f)
|| (workingGage.getGval() == -9999.f)) {
gval = "missing";
gageValue.setText(gval);
workingGage.setEdit("");
workingGage.setManedit(oldManedit);
workingGage.setEdit(gval);
valueLabel.setText("0.00");
valueScale.setSelection(0);
} else {
gval = String.format("%.2f", workingGage.getGval());
String xval = gval + " in.";
gageValue.setText(xval);
workingGage.setEdit("");
workingGage.setManedit(oldManedit);
workingGage.setEdit(gval);
valueLabel.setText(gval);
valueScale.setSelection(((int) (100 * Float
.parseFloat(gval))));
@ -647,7 +655,6 @@ public class Display7x7Dialog extends CaveSWTDialog {
gageValue.setText(gval);
workingGage.setEdit("b");
oldManedit = workingGage.isManedit();
workingGage.setManedit(true);
editGage.put(wid, workingGage);
if (!badGage.contains(wid)) {
badGage.add(wid);
@ -656,6 +663,18 @@ public class Display7x7Dialog extends CaveSWTDialog {
notBadGage.remove(wid);
}
setBad.setText("Set Not Bad");
//add bad gage to the list.
if (!badGage.isEmpty() && !editGage.isEmpty()) {
for (int i = 0; i < badGage.size(); i++) {
String gd = badGage.get(i);
MPEDataManager.getInstance().addBadGage(gd);
}
}
}
//when you set bad or not bad add gage or remove it from list
if ((!notBadGage.isEmpty() || !badGage.isEmpty())
&& !editGage.isEmpty()) {
MPEDataManager.getInstance().writeBadGageList();
}
}
});
@ -907,7 +926,9 @@ public class Display7x7Dialog extends CaveSWTDialog {
valueLabel.setText(String.format("%4.2f", scaleVal / 100.0f));
if (gageVal.equalsIgnoreCase("bad")) {
setBad.setText("Set Not Bad");
}
} else {
setBad.setText("Set Bad");
}
undoMissing.setEnabled(false);
updateGridField(displayTypes[prodSetCbo.getSelectionIndex()]);
@ -917,10 +938,10 @@ public class Display7x7Dialog extends CaveSWTDialog {
MPEDisplayManager mgr = MPEDisplayManager.getCurrent();
if (selectedFieldData != fieldType) {
selectedFieldData = fieldType;
mgr.displayFieldData(fieldType);
populateGrid();
gridComp.notifyListeners(SWT.Paint, new Event());
mgr.displayFieldData(fieldType);
}
populateGrid();
gridComp.notifyListeners(SWT.Paint, new Event());
}
/**

View file

@ -28,7 +28,8 @@
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-XX:OnOutOfMemoryError=&quot;capture -t no -p $pid &amp;&quot;
-Dlog4j.configuration=log4j-viz-core.xml</vmArgs>
-Dlog4j.configuration=log4j-viz-core.xml
-Dthrift.stream.maxsize=200</vmArgs>
<vmArgsLin>-Xmx1280M</vmArgsLin>
<vmArgsWin>-Dfile.encoding=UTF-8 -Xmx768M</vmArgsWin>
</launcherArgs>

View file

@ -24,7 +24,8 @@
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dlog4j.configuration=log4j-viz-core-developer.xml</vmArgs>
-Dlog4j.configuration=log4j-viz-core-developer.xml
-Dthrift.stream.maxsize=200</vmArgs>
<vmArgsWin>-Dfile.encoding=UTF-8</vmArgsWin>
</launcherArgs>

View file

@ -286,7 +286,7 @@ public class RedbookFrame implements IRenderable {
if (!currBlock.equals("")) {
status.unhandledPackets = true;
statusHandler
.warn("Unhandled redbook packet: (mode="
.debug("Unhandled redbook packet: (mode="
+ block.getMode() + ", submode="
+ block.getSubMode() + ")");
}

View file

@ -261,10 +261,10 @@ public class RedbookResource extends
if (status != null) {
if (status.unhandledPackets) {
statusHandler
.info("Warning: Unrecognized redbook packets found. Rendering may not be complete.");
.debug("Warning: Unrecognized redbook packets found. Rendering may not be complete.");
} else if (status.vectorRenderingWarning) {
statusHandler
.info("Warning: Some redbook vectors could not be rendered. Rendering may not be complete.");
.debug("Warning: Some redbook vectors could not be rendered. Rendering may not be complete.");
}
}
}

View file

@ -20,8 +20,11 @@
package com.raytheon.viz.texteditor.qc;
import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -53,6 +56,8 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* 20 JUL 2012 15006 mgamazaychikov Do not perform search for a list of
* county/zones names in the MWS segment heading.
* 07 NOV 2012 15003 mgamazaychikov Do not perform QC check on standalone MWS headline.
* 21 MAY 2013 16200 Qinglu Lin Prevent countyOrZoneCounter from being increased for a line
* that has no word County/Parish/Municipality in it.
*
* </pre>
*
@ -119,6 +124,27 @@ public class TextSegmentCheck implements IQCCheck {
czmType = 3;
}
Set<String> countyParishMunicipality = new HashSet<String>();
for (String countyType : QualityControl
.getCountyTypeMap().values()) {
if (countyType.length() > 1) {
countyParishMunicipality.add(countyType.trim());
} else {
}
}
for (String key : QualityControl.getCountyTypeMap().keySet()) {
if (QualityControl.getCountyTypeMap()
.get(key).length() <= 1) {
if (key.length() > 1) {
countyParishMunicipality.add(key);
}
}
}
countyParishMunicipality.remove("AK");
countyParishMunicipality.remove("DC");
countyParishMunicipality.add("CITY");
String[] separatedLines = body.split("\n");
for (String line : separatedLines) {
@ -401,12 +427,24 @@ public class TextSegmentCheck implements IQCCheck {
}
if (line.trim().length() > 0) {
countyOrZoneCounter++;
continue;
} else {
// ran into a blank line, done
insideFirstBullet = false;
int cpmCounter = 0;
Iterator<String> iter = countyParishMunicipality.iterator();
while(iter.hasNext()) {
if (line.contains(iter.next())) {
break;
} else {
cpmCounter += 1;
continue;
}
}
if (cpmCounter != countyParishMunicipality.size()) {
if (line.trim().length() > 0) {
countyOrZoneCounter++;
continue;
} else {
// ran into a blank line, done
insideFirstBullet = false;
}
}
}

View file

@ -685,4 +685,48 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
return;
}
/**
* Alter product parameters
*
* @param selectedKey
* @param selectedValue
* @param productParameters
*/
@Override
public void alterProductParameters(String selectedKey,
String selectedValue,
HashMap<String, RequestConstraint> productParameters) {
if (selectedKey.equalsIgnoreCase("line")) {
LineString line = ToolsDataManager.getInstance().getBaseline(
selectedValue);
RequestConstraint stationRC = new RequestConstraint();
stationRC.setConstraintType(RequestConstraint.ConstraintType.IN);
String sourceKey = productParameters.get("pluginName")
.getConstraintValue();
Collection<String> closest = new ArrayList<String>();
for (Coordinate c : line.getCoordinates()) {
SurfaceObsLocation loc = getClosestStation(c, sourceKey,
closest);
if (loc == null) {
break;
}
closest.add(loc.getStationId());
stationRC.addToConstraintValueList(loc.getStationId());
}
productParameters.put("location.stationId", stationRC);
} else if (selectedKey.equalsIgnoreCase("point")) {
Coordinate point = PointsDataManager.getInstance().getCoordinate(
selectedValue);
String sourceKey = productParameters.get("pluginName")
.getConstraintValue();
SurfaceObsLocation closestStation = getClosestStation(point,
sourceKey);
productParameters.put("location.stationId", new RequestConstraint(
closestStation.getStationId()));
return;
}
return;
}
}

View file

@ -41,10 +41,12 @@ import com.raytheon.viz.core.contours.util.FortConBuf;
import com.raytheon.viz.core.contours.util.FortConConfig;
import com.raytheon.viz.warngen.gui.WarngenLayer;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.CoordinateSequence;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineSegment;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
@ -62,6 +64,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* 12/06/2012 DR 15559 Qinglu Lin Added round() methods.
* 04/16/2013 DR 16045 Qinglu Lin Relocated removeDuplicateCoordinate(), computeSlope(),
* computeCoordinate(), and adjustPolygon from WarngenUIState.
* 05/23/2013 DR 16169 D. Friedman Improve redraw-from-hatched-area polygons.
*
* </pre>
*
@ -98,7 +101,7 @@ public class PolygonUtil {
}
public Polygon hatchWarningArea(Polygon origPolygon,
Geometry origWarningArea) throws VizException {
Geometry origWarningArea, Polygon oldWarningPolygon) throws VizException {
float[][] contourAreaData = toFloatData(origWarningArea);
// Create contouring configuration
@ -143,7 +146,9 @@ public class PolygonUtil {
boolean showContour = false;
if (contour != null && !showContour) {
rval = awips1PointReduction(contour, origPolygon, origWarningArea,
config);
config, oldWarningPolygon);
if (rval == null)
return (Polygon) origPolygon.clone();
} else if (contour != null) {
// Create a polygon from the contour
GeometryFactory gf = new GeometryFactory();
@ -158,16 +163,34 @@ public class PolygonUtil {
}
/**
* @return
* @return null if the original warningPolygon should be used
*/
private Polygon awips1PointReduction(Coordinate[] longest,
Polygon warningPolygon, Geometry warningArea, FortConConfig config)
throws VizException {
Polygon warningPolygon, Geometry warningArea, FortConConfig config,
Polygon oldWarningPolygon) throws VizException {
Coordinate[] vertices = warningPolygon.getCoordinates();
vertices = Arrays.copyOf(vertices, vertices.length - 1);
// Extract data
float[][] contourPolyData = toFloatData(warningPolygon);
float[][] currentPolyData = toFloatData(warningArea);
// If same area is hatched, just use the current polygon.
if (areasEqual(contourPolyData, currentPolyData)) {
/*
* If the polygon is an intersection between what the user drew and
* the original polygon from a previous product, we may still want
* to reduce the number of points...
*/
if (oldWarningPolygon != null) {
Polygon p = removeCollinear(warningPolygon);
return layer.convertGeom(p, latLonToContour);
} else
return null;
} else if (oldWarningPolygon != null &&
areasEqual(toFloatData(oldWarningPolygon), currentPolyData)) {
return layer.convertGeom(oldWarningPolygon, latLonToContour);
}
// Contour the polygon
ContourContainer container = FortConBuf
@ -424,6 +447,15 @@ public class PolygonUtil {
return rval;
}
private boolean areasEqual(float[][] a, float[][] b) {
if (a.length != b.length)
return false;
for (int r = 0; r < a.length; ++r)
if (! Arrays.equals(a[r], b[r]))
return false;
return true;
}
private List<Coordinate[]> toCoordinateList(List<float[]> pts) {
List<Coordinate[]> contours = new ArrayList<Coordinate[]>(pts.size());
for (float[] f : pts) {
@ -847,6 +879,64 @@ public class PolygonUtil {
}
/**
* Remove vertices that are (very close) to being collinear with both
* adjacent vertices.
*/
private static Polygon removeCollinear(Polygon polygon) {
ArrayList<Coordinate> coords = new ArrayList<Coordinate>(
Arrays.asList(polygon.getExteriorRing().getCoordinates()));
boolean changed = false;
if (coords.size() <= 4) // i.e., 3 real vertices
return polygon;
coords.remove(coords.size() - 1);
for (int i = 0; i < coords.size() && coords.size() > 3; ++i) {
int j = (i + 1) % coords.size();
Coordinate pi = coords.get(i);
Coordinate pj = coords.get(j);
Coordinate pk = coords.get((j + 1) % coords.size());
double ux = pj.x - pi.x;
double uy = pj.y - pi.y;
double vx = pk.x - pj.x;
double vy = pk.y - pj.y;
double crs = ux * vy - vx * uy; // cross product
double ul = Math.sqrt(ux * ux + uy * uy);
double vl = Math.sqrt(vx * vx + vy * vy);
if (ul != 0)
crs /= ul;
if (vl != 0)
crs /= vl;
if (Math.abs(crs) <= 0.01) {
coords.remove(j);
--i;
changed = true;
}
}
if (changed) {
coords.add(new Coordinate(coords.get(0)));
GeometryFactory gf = polygon.getFactory();
try {
Polygon p = gf.createPolygon(gf.createLinearRing(coords
.toArray(new Coordinate[coords.size()])), null);
if (p.isValid())
return p;
else
return polygon;
} catch (IllegalArgumentException e) {
/*
* An invalid ring can be created when the original has an
* "orphan vertex." Just return the original.
*/
return polygon;
}
} else
return polygon;
}
private float[][] toFloatData(Geometry warningArea) throws VizException {
Geometry contoured = layer.convertGeom(warningArea, latLonToContour);
List<Geometry> geomList = new ArrayList<Geometry>(
@ -859,13 +949,10 @@ public class PolygonUtil {
}
GeometryFactory gf = warningArea.getFactory();
Point point = gf.createPoint(new Coordinate(0, 0));
CoordinateSequence pointCS = point.getCoordinateSequence();
float[][] contourAreaData = new float[nx][ny];
Geometry[][] points = new Geometry[nx][ny];
for (int x = 0; x < nx; ++x) {
for (int y = 0; y < ny; ++y) {
points[x][y] = gf.createPoint(new Coordinate(x, y));
}
}
for (PreparedGeometry geom : prepped) {
Envelope env = geom.getGeometry().getEnvelopeInternal();
int startX = (int) env.getMinX();
@ -882,8 +969,11 @@ public class PolygonUtil {
for (int x = startX; x < width; ++x) {
for (int y = startY; y < height; ++y) {
pointCS.setOrdinate(0, 0, x);
pointCS.setOrdinate(0, 1, y);
point.geometryChanged();
if (contourAreaData[x][y] == 0.0f
&& geom.intersects(points[x][y])) {
&& geom.intersects(point)) {
contourAreaData[x][y] = 1.0f;
}
}

View file

@ -32,7 +32,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -55,7 +54,6 @@ import org.geotools.referencing.GeodeticCalculator;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.activetable.ActiveTableRecord;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration;
@ -77,6 +75,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
@ -118,6 +117,7 @@ import com.raytheon.viz.warngen.util.FipsUtil;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineSegment;
import com.vividsolutions.jts.geom.LinearRing;
@ -175,7 +175,9 @@ import com.vividsolutions.jts.io.WKTReader;
* 04/23/1013 DR 16064 Qinglu Lin Added removeDuplicateGid() and applies it in populateStrings().
* 04/24/2013 1943 jsanchez Replaced used of areaConfig with areaSource.
* 05/16/2013 2008 jsanchez Allowed warned areas for follow ups to be resized to less than 10%
* 05/17/2013 DR 16064 Qinglu Lin Merged the fix done in 13.4.1.
* 05/23/2013 DR 16169 D. Friedman Improve redraw-from-hatched-area polygons.
* 05/31/2013 DR 16237 D. Friedman Refactor goespatial data routines and watch handling.
* 06/05/2013 DR 16279 D. Friedman Fix determination of frame time from parsed storm track.
* </pre>
*
* @author mschenke
@ -203,6 +205,106 @@ public class WarngenLayer extends AbstractStormTrackResource {
int nx, ny;
}
private static class GeospatialDataAccessor {
GeospatialDataList geoData;
AreaSourceConfiguration areaConfig;
public GeospatialDataAccessor(GeospatialDataList geoData,
AreaSourceConfiguration areaConfig) {
if (geoData == null || areaConfig == null) {
throw new IllegalArgumentException("GeospatialDataAccessor must not be null");
}
this.geoData = geoData;
this.areaConfig = areaConfig;
}
/**
* Build the geometry area that intersects the cwa filter for the polygon in
* local projection space
*
* @param polygon
* polygon to intersect with in lat/lon space
* @return the warning area in screen projection
*/
private Geometry buildArea(Polygon polygon) {
polygon = latLonToLocal(polygon);
Geometry area = null;
if (polygon != null) {
for (GeospatialData r : geoData.features) {
PreparedGeometry prepGeom = (PreparedGeometry) r.attributes
.get(GeospatialDataList.LOCAL_PREP_GEOM);
try {
Geometry intersection = GeometryUtil.intersection(polygon,
prepGeom);
if (intersection.isEmpty()) {
continue;
}
if (area == null) {
area = intersection;
} else {
area = GeometryUtil.union(area, intersection);
}
} catch (Exception e) {
// TODO handle exception correctly!!!
e.printStackTrace();
}
}
}
return localToLatLon(area);
}
/**
* Converts the lat lon geometry to screen space
*
* @param geom
* @return
*/
public <T> T latLonToLocal(T geom) {
return convertGeom(geom, geoData.latLonToLocal);
}
/**
* Converts the screen geometry to a lat lon projection
*
* @param geom
* @return
*/
public <T> T localToLatLon(T geom) {
return convertGeom(geom, geoData.localToLatLon);
}
private String getFips(GeospatialData data) {
return (String) data.attributes.get(areaConfig.getFipsField());
}
private String getFips(Geometry g) {
Object o = g.getUserData();
if (o != null) {
return getFips(((CountyUserData) o).entry);
} else {
for (int n = 0; n < g.getNumGeometries(); ++n) {
Geometry g2 = g.getGeometryN(n);
if (g != g2) {
String fips = getFips(g2);
if (fips != null)
return fips;
}
}
}
return null;
}
private Set<String> getAllFipsInArea(Geometry warningArea) {
Set<String> fipsIds = new HashSet<String>();
for (int n = 0; n < warningArea.getNumGeometries(); ++n) {
Geometry area = warningArea.getGeometryN(n);
fipsIds.add(getFips(area));
}
return fipsIds;
}
}
private class CustomMaps extends Job {
private Set<String> customMaps = new HashSet<String>();
@ -270,6 +372,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
private Polygon warningPolygon;
private Polygon oldWarningPolygon;
public AreaHatcher(PolygonUtil polygonUtil) {
super("Hatching Warning Area");
setSystem(true);
@ -298,7 +402,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
Polygon hatched = polygonUtil.hatchWarningArea(
warningPolygon,
removeCounties(warningArea,
state.getFipsOutsidePolygon()));
state.getFipsOutsidePolygon()),
oldWarningPolygon);
if (hatched != null) {
// DR 15559
Coordinate[] coords = hatched.getCoordinates();
@ -326,10 +431,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
public synchronized void hatchArea(Polygon warningPolygon,
Geometry warningArea) {
Geometry warningArea, Polygon oldWarningPolygon) {
synchronized (polygonUtil) {
this.warningPolygon = warningPolygon;
this.warningArea = warningArea;
this.oldWarningPolygon = oldWarningPolygon;
}
schedule();
}
@ -409,6 +515,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
private GeospatialDataList geoData = null;
private GeospatialDataAccessor geoAccessor = null;
private WarningAction warningAction = WarningAction.NEW;
static {
@ -862,8 +970,40 @@ public class WarngenLayer extends AbstractStormTrackResource {
long t0 = System.currentTimeMillis();
String site = getLocalizedSite();
synchronized (siteMap) {
loadGeodataForConfiguration(config);
String areaSource = config.getGeospatialConfig().getAreaSource();
geoData = siteMap.get(areaSource + "." + site);
geoAccessor = new GeospatialDataAccessor(geoData,
config.getHatchedAreaSource());
try {
areaHatcher = new AreaHatcher(new PolygonUtil(this, geoData.nx,
geoData.ny, 20, geoData.localExtent,
geoData.localToLatLon));
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}// end synchronize
customMaps.loadCustomMaps(Arrays.asList(config.getMaps()));
this.configuration = config;
System.out.println("Total time to init warngen config = "
+ (System.currentTimeMillis() - t0) + "ms");
}
/** Adds geospatial data to siteMap and timezoneMap for the given
* template configuration. This must not have any site effects on the
* currently loaded template or the current product being edited.
* @param config
*/
private void loadGeodataForConfiguration(WarngenConfiguration config) {
Map<String, GeospatialMetadata> metadataMap = GeospatialFactory
.getMetaDataMap(config);
String site = getLocalizedSite();
synchronized (siteMap) {
for (String areaSource : metadataMap.keySet()) {
@ -985,24 +1125,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
}
}
String areaSource = config.getGeospatialConfig().getAreaSource();
geoData = siteMap.get(areaSource + "." + site);
try {
areaHatcher = new AreaHatcher(new PolygonUtil(this, geoData.nx,
geoData.ny, 20, geoData.localExtent,
geoData.localToLatLon));
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}// end synchronize
customMaps.loadCustomMaps(Arrays.asList(config.getMaps()));
this.configuration = config;
System.out.println("Total time to init warngen config = "
+ (System.currentTimeMillis() - t0) + "ms");
}
public GeospatialData[] getGeodataFeatures(String areaSource,
@ -1128,55 +1251,57 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
/**
* Creates and sets a geometry based on county header of the watch
*
* @param activeTableRecord
* Returns a set of UGCs for each area in the CWA that intersects the given
* polygon.
*/
public void createGeometryForWatches(Polygon polygon,
List<ActiveTableRecord> records) {
// Build area once
Geometry area = buildArea(polygon);
for (ActiveTableRecord activeTableRecord : records) {
Map<String, String[]> countyMap = FipsUtil
.parseCountyHeader(activeTableRecord.getUgcZone());
// get area with precalculated area
activeTableRecord.setGeometry(getArea(area, countyMap, false));
public Set<String> getUgcsForCountyWatches(Polygon polygon) throws Exception {
GeospatialDataAccessor gda = getCountyGeospatialDataAcessor();
Set<String> ugcs = new HashSet<String>();
for (String fips : gda.getAllFipsInArea(gda.buildArea(polygon))) {
ugcs.add(FipsUtil.getUgcFromFips(fips));
}
return ugcs;
}
/**
* Build the geometry area that intersects the cwa filter for the polygon in
* local projection space
*
* @param polygon
* polygon to intersect with in lat/lon space
* @return the warning area in screen projection
*/
private Geometry buildArea(Polygon polygon) {
polygon = latLonToLocal(polygon);
Geometry area = null;
if (polygon != null) {
for (GeospatialData r : geoData.features) {
PreparedGeometry prepGeom = (PreparedGeometry) r.attributes
.get(GeospatialDataList.LOCAL_PREP_GEOM);
try {
Geometry intersection = GeometryUtil.intersection(polygon,
prepGeom);
if (intersection.isEmpty()) {
continue;
}
if (area == null) {
area = intersection;
} else {
area = GeometryUtil.union(area, intersection);
}
} catch (Exception e) {
// TODO handle exception correctly!!!
e.printStackTrace();
public Set<String> getAllCountyUgcs() throws Exception {
GeospatialDataAccessor gda = getCountyGeospatialDataAcessor();
Set<String> ugcs = new HashSet<String>();
for (GeospatialData r : gda.geoData.features) {
ugcs.add(FipsUtil.getUgcFromFips(gda.getFips(r)));
}
return ugcs;
}
private GeospatialDataAccessor getCountyGeospatialDataAcessor() throws Exception {
GeospatialDataList gdl = searchCountyGeospatialDataAccessor();
if (gdl == null) {
// Cause county geospatial data to be loaded
// TODO: Should not be referencing tornadoWarning.
WarngenConfiguration torConfig = WarngenConfiguration.loadConfig("tornadoWarning", getLocalizedSite());
loadGeodataForConfiguration(torConfig);
gdl = searchCountyGeospatialDataAccessor();
}
// TODO: There should be some way to get the "county" configuration by name
// independent of a template
AreaSourceConfiguration areaConfig = new AreaSourceConfiguration();
areaConfig.setFipsField("FIPS");
return new GeospatialDataAccessor(gdl, areaConfig);
}
private GeospatialDataList searchCountyGeospatialDataAccessor() {
synchronized (siteMap) {
for (Map.Entry<String, GeospatialDataList> entry : siteMap.entrySet()) {
String[] keyParts = entry.getKey().split("\\.");
if (keyParts.length == 2
&& "county".equalsIgnoreCase(keyParts[0])
&& getLocalizedSite().equals(keyParts[1])) {
return entry.getValue();
}
}
}
return localToLatLon(area);
return null;
}
/**
@ -1304,7 +1429,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
* @return
*/
private Geometry getArea(Polygon polygon, Map<String, String[]> countyMap) {
return getArea(buildArea(polygon), countyMap, true);
return getArea(geoAccessor.buildArea(polygon), countyMap, true);
}
/**
@ -2134,17 +2259,12 @@ public class WarngenLayer extends AbstractStormTrackResource {
Matcher m = tmlPtrn.matcher(rawMessage);
if (m.find()) {
int day = warnRecord.getIssueTime().get(Calendar.DAY_OF_MONTH);
int hour = Integer.parseInt(m.group(1));
int minute = Integer.parseInt(m.group(2));
// Handles when a warning is created before 0Z but issued after 0Z
if (hour > warnRecord.getIssueTime().get(Calendar.HOUR_OF_DAY)) {
day -= 1;
}
frameTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
frameTime.set(Calendar.DAY_OF_MONTH, day);
frameTime.set(Calendar.HOUR_OF_DAY, hour);
frameTime.set(Calendar.MINUTE, minute);
frameTime = TimeUtil.timeOfDayToAbsoluteTime(
hour * TimeUtil.SECONDS_PER_HOUR +
minute * TimeUtil.SECONDS_PER_MINUTE,
warnRecord.getIssueTime());
} else {
frameTime = warnRecord.getIssueTime();
}
@ -2569,40 +2689,53 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
private String getFips(GeospatialData data) {
for (AreaSourceConfiguration areaSource : configuration
.getAreaSources()) {
if (areaSource.getType() == AreaType.HATCHING) {
return (String) data.attributes.get(areaSource.getFipsField());
}
}
return null;
return geoAccessor.getFips(data);
}
private String getFips(Geometry g) {
Object o = g.getUserData();
if (o != null) {
return getFips(((CountyUserData) o).entry);
} else {
for (int n = 0; n < g.getNumGeometries(); ++n) {
Geometry g2 = g.getGeometryN(n);
if (g != g2) {
String fips = getFips(g2);
if (fips != null)
return fips;
}
}
}
return null;
return geoAccessor.getFips(g);
}
private void warningAreaChanged() {
state.snappedToArea = false;
if (areaHatcher != null) {
areaHatcher.hatchArea(state.getWarningPolygon(),
state.getWarningArea());
Polygon polygon = state.getWarningPolygon();
polygon = tryToIntersectWithOriginalPolygon(polygon);
areaHatcher.hatchArea(polygon,
state.getWarningArea(),
state.getOldWarningPolygon());
}
}
/**
* Try to determine the intersection of the given polygon with the original
* warning polygon. If there is no original polygon, if the result of the
* intersection is not a single polygon, or if a problem occurs, just return
* the original polygon. The purpose of this is to pass the polygon that
* best represents the user's intent to the polygon redrawing algorithm.
*/
private Polygon tryToIntersectWithOriginalPolygon(Polygon polygon) {
if (state.getOldWarningPolygon() != null) {
try {
Geometry g = polygon.intersection(state.getOldWarningPolygon());
Polygon newPolygon = null;
if (g instanceof Polygon) {
newPolygon = (Polygon) g;
} else if (g instanceof GeometryCollection
&& g.getNumGeometries() == 1
&& g.getGeometryN(0) instanceof Polygon) {
newPolygon = (Polygon) g.getGeometryN(0);
}
if (newPolygon != null && newPolygon.isValid()) {
polygon = newPolygon;
}
} catch (TopologyException e) {
// ignore
}
}
return polygon;
}
private Collection<GeospatialData> getDataWithFips(String fips) {
List<GeospatialData> data = new ArrayList<GeospatialData>();
for (GeospatialData d : geoData.features) {
@ -2614,12 +2747,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
private Set<String> getAllFipsInArea(Geometry warningArea) {
Set<String> fipsIds = new HashSet<String>();
for (int n = 0; n < warningArea.getNumGeometries(); ++n) {
Geometry area = warningArea.getGeometryN(n);
fipsIds.add(getFips(area));
}
return fipsIds;
return geoAccessor.getAllFipsInArea(warningArea);
}
private Geometry removeCounty(Geometry warningArea, String fipsToRemove) {
@ -2816,7 +2944,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
* @return
*/
@SuppressWarnings("unchecked")
public <T> T convertGeom(T geom, MathTransform transform) {
static public <T> T convertGeom(T geom, MathTransform transform) {
if (geom == null) {
return null;
}

View file

@ -82,6 +82,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
@ -151,6 +152,7 @@ import com.vividsolutions.jts.io.WKTReader;
* Feb 15, 2013 15820 Qinglu Lin Added createOfficeTimezoneMap() and added logic so that localtimezone
* and secondtimezone can get correct values when warning area covers two time zones.
* May 10, 2013 1951 rjpeter Updated ugcZones references
* May 30, 2013 DR 16237 D. Friedman Fix watch query.
* </pre>
*
* @author njensen
@ -1008,13 +1010,18 @@ public class TemplateRunner {
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(recordType);
request.addConstraint("startTime", new RequestConstraint(
startConstraintTime.toString(),
TimeUtil.formatDate(startConstraintTime),
ConstraintType.LESS_THAN_EQUALS));
request.addConstraint("endTime", new RequestConstraint(
endConstraintTime.toString(),
TimeUtil.formatDate(endConstraintTime),
ConstraintType.GREATER_THAN_EQUALS));
/*
* TODO: Currently limited to filtering out one of
* ("CAN","EXP"). Could use "Act" in addition to "act", but this
* should really be fixed the underlying system.
request.addConstraint("act", new RequestConstraint("CAN",
ConstraintType.NOT_EQUALS));
*/
request.addConstraint("act", new RequestConstraint("EXP",
ConstraintType.NOT_EQUALS));
request.addConstraint("phensig", new RequestConstraint(
@ -1022,19 +1029,21 @@ public class TemplateRunner {
// TODO: Talk to Jonathan about this... Do I even need officeid
// IN or is ugc zone good enough?
Set<String> ugcZones = new HashSet<String>();
for (AffectedAreas area : affectedAreas) {
ugcZones.add(FipsUtil.getUgc(area));
}
/* Get all UGCs in the CWA now so that the watches will be
* formatted with all portions of the affected state(s).
*
* Filtering for valid UGCs is performed in processATEntries
*/
RequestConstraint ugcConstraint = new RequestConstraint("",
ConstraintType.IN);
ugcConstraint.setConstraintValueList(ugcZones);
ugcConstraint.setConstraintValueList(warngenLayer.getAllCountyUgcs());
request.addConstraint("ugcZone", ugcConstraint);
// These are the only fields we need for processing watches
request.addFields(new String[] { "issueTime", "startTime",
"endTime", "ugcZone", "phensig", "vtecstr" });
"endTime", "ugcZone", "phensig", "vtecstr",
"etn", "act" });
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
@ -1042,35 +1051,44 @@ public class TemplateRunner {
List<ActiveTableRecord> records = new ArrayList<ActiveTableRecord>(
response.getNumResults());
for (Map<String, Object> result : response.getResults()) {
/* TODO: Doing this here because only "EXP" is filtered
* out by the query. Remove "act" from the field list
* once this is fixed.
*/
if ("CAN".equals(result.get("act")))
continue;
ActiveTableRecord record = recordType.newInstance();
record.setIssueTime((Calendar) result.get("issuetime"));
record.setStartTime((Calendar) result.get("starttime"));
record.setEndTime((Calendar) result.get("endtime"));
record.setUgcZone((String) result.get("ugczone"));
record.setIssueTime((Calendar) result.get("issueTime"));
record.setStartTime((Calendar) result.get("startTime"));
record.setEndTime((Calendar) result.get("endTime"));
record.setUgcZone((String) result.get("ugcZone"));
record.setPhensig((String) result.get("phensig"));
record.setVtecstr((String) result.get("vtecstr"));
record.setEtn((String) result.get("etn"));
records.add(record);
}
if (records.size() > 0) {
long t0, t1;
t0 = System.currentTimeMillis();
Polygon watchArea = (Polygon) polygon
.buffer(milesToKilometer.convert(config
.getHatchedAreaSource()
.getIncludedWatchAreaBuffer())
/ KmToDegrees);
t1 = System.currentTimeMillis();
System.out.println("getWatches.polygonBuffer time: "
+ (t1 - t0));
Set<String> validUgcZones;
try {
long t0, t1;
t0 = System.currentTimeMillis();
Polygon watchArea = (Polygon) polygon
.buffer(milesToKilometer.convert(config
.getHatchedAreaSource()
.getIncludedWatchAreaBuffer())
/ KmToDegrees);
t1 = System.currentTimeMillis();
System.out.println("getWatches.polygonBuffer time: "
+ (t1 - t0));
validUgcZones = warngenLayer.getUgcsForCountyWatches(watchArea);
} catch (RuntimeException e) {
statusHandler.handle(Priority.ERROR,
"Error determining areas to search for watches.", e);
return rval;
}
t0 = System.currentTimeMillis();
warngenLayer.createGeometryForWatches(watchArea, records);
t1 = System.currentTimeMillis();
System.out.println("getWatches.createWatchGeometry time: "
+ (t1 - t0));
rval = processATEntries(records, warngenLayer);
rval = processATEntries(records, warngenLayer, validUgcZones);
}
}
}
@ -1097,10 +1115,12 @@ public class TemplateRunner {
* @param activeTable
* List of entries for active watches
* @param warngenLayer
* @param validUgcZones
* @return
*/
private static WatchUtil processATEntries(
List<ActiveTableRecord> activeTable, WarngenLayer warngenLayer) {
List<ActiveTableRecord> activeTable, WarngenLayer warngenLayer,
Set<String> validUgcZones) {
WatchUtil rval = new WatchUtil();
TreeMap<WeatherAdvisoryWatch, WatchWork> map = new TreeMap<WeatherAdvisoryWatch, TemplateRunner.WatchWork>();
@ -1131,8 +1151,8 @@ public class TemplateRunner {
/*
* Currently reports all zones in the watch even if a given zone is
* not in the warning polygon. If the logic is changed to only show
* the portions of the watch near our warning polygon, perform the
* isEmpty check here.
* the portions of the watch near our warning polygon, filter on
* validUgcZones here.
*/
WeatherAdvisoryWatch waw = new WeatherAdvisoryWatch();
waw.setPhensig(ar.getPhensig());
@ -1151,16 +1171,18 @@ public class TemplateRunner {
work = new WatchWork(waw);
map.put(waw, work);
}
// TODO: Building geometry just to perform this test is probably
// inefficient with the post-DR-15430 logic...
if (!ar.getGeometry().isEmpty()) {
if (validUgcZones.contains(ar.getUgcZone())) {
work.valid = true;
}
/*
* TODO: Currently adding all zones to the list even if they are not
* in the CWA. Validation is currently done in
* determineAffectedPortions to avoid redundant work.
* There are no checks here to determine whether or not the given
* zone is in the CWA. That should have already been done the query
* performed in getWatches.
*
* There is also validation performed later in
* determineAffectedPortions.
*/
work.ugcZone.add(ar.getUgcZone());
}

View file

@ -70,6 +70,8 @@ import com.vividsolutions.jts.geom.Geometry;
* Apr 22, 2013 jsanchez Set the issue time for follow up warnings.
* May 07, 2013 1973 rferrel Corrections when getting Issue time.
* May 10, 2013 1951 rjpeter Updated ugcZones references
* May 31, 2013 DR 16264 D. Friedman Fix query in prepare method.
* Jun 05, 2013 DR 16279 D. Friedman Fix updating of issuance time for followups.
* </pre>
*
* @author mschenke
@ -486,7 +488,7 @@ public class CurrentWarnings {
long t0 = System.currentTimeMillis();
RequestConstraint constraint = new RequestConstraint(null,
ConstraintType.IN);
constraint.setBetweenValueList(dataURIs.toArray(new String[0]));
constraint.setConstraintValueList(dataURIs.toArray(new String[0]));
request.addConstraint("dataURI", constraint);
request.setEntityClass(getWarningClass());
try {

View file

@ -49,6 +49,7 @@ import com.raytheon.viz.warnings.DateUtil;
* with generated list of counties.
* Apr 25, 2013 1877 jsanchez Sorted the UGC line for cancellations.
* May 10, 2013 1951 rjpeter Updated ugcZones references
* May 31, 2013 DR 16237 D. Friedman Added getUgcFromFips.
* </pre>
*
* @author bwoodle
@ -133,13 +134,17 @@ public class FipsUtil {
}
public static String getUgc(AffectedAreas area) {
return getUgcFromFips(area.getFips());
}
public static String getUgcFromFips(String fips) {
String ugc = null;
if (Character.isDigit(area.getFips().charAt(0))) {
ugc = fipsToState.get(area.getFips().substring(0, 2)) + "C"
+ area.getFips().substring(2, 5);
if (Character.isDigit(fips.charAt(0))) {
ugc = fipsToState.get(fips.substring(0, 2)) + "C"
+ fips.substring(2, 5);
} else {
ugc = area.getFips().substring(0, 2) + "Z"
+ area.getFips().substring(area.getFips().length() - 3);
ugc = fips.substring(0, 2) + "Z"
+ fips.substring(fips.length() - 3);
}
return ugc;
}

View file

@ -0,0 +1,23 @@
#!/bin/bash
SQL_SCRIPT="changeDataTypeEnumToUppercase.sql"
# ensure that the sql script is present
if [ ! -f ${SQL_SCRIPT} ]; then
echo "ERROR: the required sql script - ${SQL_SCRIPT} was not found."
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: update started - changing DataType to an Uppercase enum"
# run the update
/awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT}
if [ $? -ne 0 ]; then
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: the update has completed successfully!"
exit 0

View file

@ -0,0 +1,32 @@
/**
* 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.
**/
\set ON_ERROR_STOP 1
\connect metadata;
-- Start a transaction
BEGIN;
-- Update dataSetType="Grid" references to dataSetType="GRID"
update ebxml.value set stringvalue = regexp_replace(stringvalue, 'dataSetType="Grid"', 'dataSetType="GRID"', 'g');
-- Update dataType="Grid" references to dataType="GRID"
update ebxml.value set stringvalue = regexp_replace(stringvalue, 'dataType="Grid"', 'dataType="GRID"', 'g');
-- Commit the transaction
END;

View file

@ -0,0 +1,22 @@
#!/bin/bash
SQL_SCRIPT="removeDeliveryOptions.sql"
# ensure that the sql script is present
if [ ! -f ${SQL_SCRIPT} ]; then
echo "ERROR: the required sql script - ${SQL_SCRIPT} was not found."
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: update started - removing delivery options from Subscription Manager"
# Update the database
/awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT}
if [ $? -ne 0 ]; then
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: the update has completed successfully!"
exit 0

View file

@ -1,14 +1,6 @@
#!/bin/bash
SQL_SCRIPT="removeDeliveryOptions.sql"
# ensure that the sql script is present
if [ ! -f ${SQL_SCRIPT} ]; then
echo "ERROR: the required sql script - ${SQL_SCRIPT} was not found."
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: update started - removing delivery options from Subscription Manager"
echo "INFO: update started - removing delivery options from Subscription Manager localization files"
# Update subscription manager configuration files
for DIRECTORY in `find /awips2/edex/data/utility/cave_static/ -type d -name subscriptionManagerConfig`
@ -29,13 +21,6 @@ do
done
done
# Update the database
/awips2/psql/bin/psql -U awips -d metadata -f ${SQL_SCRIPT}
if [ $? -ne 0 ]; then
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: the update has completed successfully!"
exit 0

View file

@ -0,0 +1,47 @@
#!/bin/bash
XSLT_SCRIPT="updateProviderType.xsl"
# ensure that the xslt script is present
if [ ! -f ${XSLT_SCRIPT} ]; then
echo "ERROR: the required xslt script - ${XSLT_SCRIPT} was not found."
echo "FATAL: the update has failed!"
exit 1
fi
echo "INFO: update started - updating ProviderType to be a class proper in the database"
# Dump the provider rows from the database for modification
PROVIDER_ROWS=/tmp/provider_rows.tmp
psql -U awips -d metadata -c "\copy (select key, stringvalue from ebxml.value where stringvalue like '%<provider %') To '${PROVIDER_ROWS}'";
# Get old separator
OIFS=$IFS
IFS=$'\n'
for f in `cat ${PROVIDER_ROWS}`
do
IFS=$'\t'
arr2=( $f )
KEY=${arr2[0]}
XML_FILE=/tmp/${KEY}.xml
# Write out database contents
echo "${arr2[1]}" > ${XML_FILE}
# Remove carriage returns
sed -i 's/\\n//g' ${XML_FILE}
# Run the xslt transform on the tmp file
xsltproc ${XSLT_SCRIPT} ${XML_FILE} > ${XML_FILE}.new
# Insert the new xml into the database
NEW_XML=`cat ${XML_FILE}.new`
psql -U awips -d metadata -c "UPDATE ebxml.value SET stringvalue = '${NEW_XML}' WHERE key = '${KEY}'"
done
# Restore old separator
IFS=$OIFS
echo "INFO: the update has completed successfully!"
exit 0

View file

@ -8,20 +8,20 @@ if [ ! -f ${XSLT_SCRIPT} ]; then
exit 1
fi
echo "INFO: update started - updating ProviderType to be a class proper"
echo "INFO: update started - updating ProviderType to be a class proper in localization files"
# Update subscription manager configuration files
for FILE in `find /awips2/edex/data/utility/common_static -iname \*-harvester.xml`
do
cp $FILE $FILE.bak
xsltproc ${XSLT_SCRIPT} ${FILE}.bak > ${FILE}
# Make sure each command succeeds
if [ $? -ne 0 ]; then
echo "FATAL: the update has failed!"
exit 1
fi
# Delete the md5 file
rm $FILE.md5
done

View file

@ -111,6 +111,9 @@ wrapper.java.additional.db.9=-Ddb.metadata.pool.max=${METADATA_POOL_MAX}
# site ID of EDEX for localization and site aware services
wrapper.java.additional.site.1=-Daw.site.identifier=${AW_SITE_IDENTIFIER}
# the archive root directory, also where the edex/data/manual endpoint will place files
wrapper.java.additional.archive.1=-Ddata.archive.root=${DATA_ARCHIVE_ROOT}
# determines which architecture.properties file to use
wrapper.java.additional.arch.1=-Dedex.arch=${EDEX_BITS}-bit
@ -124,6 +127,10 @@ wrapper.java.additional.web.2=-Dconfidential.port=8443
# is removed from SerializationManager
wrapper.java.additional.misc.1=-DinitializeHibernatables=true
# the max size in MB of any stream sent to thrift, this prevents the OutOfMemory
# errors reported by thrift sometimes when the stream is corrupt/incorrect
wrapper.java.additional.thrift.maxStreamSize=-Dthrift.stream.maxsize=200
# enables yourkit profiling, determined by flag to start.sh
wrapper.java.additional.profile.1=${PROFILER_PARAM_1}

View file

@ -22,6 +22,7 @@ package com.raytheon.edex.plugin.gfe.db.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
@ -53,6 +54,8 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
* logic into D2DGridDatabase.
* 05/03/13 #1974 randerso Changed queryByParmId to look for parm with duration
* suffix first.
* 05/22/13 #1974 randerso Fix bug introduced by the previous fix where query for
* T (T%hr) returned TP6hr
*
* </pre>
*
@ -181,6 +184,21 @@ public class GFED2DDao extends GridDao {
@SuppressWarnings("unchecked")
List<Object[]> firstTry = (List<Object[]>) this.queryByCriteria(query);
// TODO use a regular expression match in the query to eliminate the
// need to remove the false matches below
// remove false matches
Pattern pattern = Pattern.compile("^" + d2dParmName + "(\\d+)hr$");
Iterator<Object[]> iter = firstTry.iterator();
while (iter.hasNext()) {
Object[] row = iter.next();
Matcher matcher = pattern.matcher((String) row[2]);
if (!matcher.matches()) {
iter.remove();
}
}
SortedMap<Integer, Integer> dataTimes = new TreeMap<Integer, Integer>();
if (firstTry.isEmpty()) {
query = new DatabaseQuery(GridRecord.class.getName());
@ -201,13 +219,12 @@ public class GFED2DDao extends GridDao {
dataTimes.put((Integer) row[0], (Integer) row[1]);
}
} else {
Pattern p = Pattern.compile("^" + d2dParmName + "(\\d+)hr$");
int i = 0;
while (i < firstTry.size()) {
Object[] row = firstTry.get(i++);
Integer fcstHr = (Integer) row[0];
Integer id = (Integer) row[1];
Matcher matcher = p.matcher((String) row[2]);
Matcher matcher = pattern.matcher((String) row[2]);
int dur = Integer.MAX_VALUE;
if (matcher.matches()) {
dur = Integer.parseInt(matcher.group(1));
@ -218,7 +235,7 @@ public class GFED2DDao extends GridDao {
if (fcstHr.equals(nextRow[0])) {
i = j;
String nextParam = (String) nextRow[2];
Matcher nextMatcher = p.matcher(nextParam);
Matcher nextMatcher = pattern.matcher(nextParam);
int nextDur = Integer.MAX_VALUE;
if (nextMatcher.matches()) {
nextDur = Integer.parseInt(nextMatcher.group(1));

View file

@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -1053,6 +1054,11 @@ public class GridParmManager {
PurgeLogger.logInfo("Purging " + dbId, "gfe");
}
}
// kludge to keep dbMap in synch until GridParmManager/D2DParmICache
// merge/refactor
dbMap.keySet().retainAll(databases);
createDbNotification(siteID, databases);
return sr;
@ -1080,7 +1086,7 @@ public class GridParmManager {
sr = getDbInventory(siteID);
if (!sr.isOkay()) {
sr.addMessage("VersionPurge failed - couldn't get inventory");
sr.addMessage("GridsPurge failed - couldn't get inventory");
return sr;
}
@ -1245,9 +1251,11 @@ public class GridParmManager {
}
public static void purgeDbCache(String siteID) {
for (DatabaseID dbId : dbMap.keySet()) {
Iterator<DatabaseID> iter = dbMap.keySet().iterator();
while (iter.hasNext()) {
DatabaseID dbId = iter.next();
if (dbId.getSiteId().equals(siteID)) {
removeDbFromMap(dbId);
iter.remove();
}
}
}
@ -1392,10 +1400,6 @@ public class GridParmManager {
"Unable to purge model database: " + id, e);
}
}
removeDbFromMap(id);
}
public static void removeDbFromMap(DatabaseID id) {
dbMap.remove(id);
}
@ -1425,7 +1429,7 @@ public class GridParmManager {
}
for (DatabaseID dbId : invChanged.getDeletions()) {
removeDbFromMap(dbId);
dbMap.remove(dbId);
}
}
}

View file

@ -345,7 +345,6 @@
<alias base="TPCSG">Surge10Pct</alias>
<alias base="TP-ECMWF">tp_ecmwf</alias>
<alias base="tpFWR">tp_FWR</alias>
<alias base="tpHPC">tp_HPC</alias>
<alias base="tpKRF">tp_KRF</alias>
<alias base="tpMSR">tp_MSR</alias>
<alias base="tpORN">tp_ORN</alias>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purgeRuleSet>
<key>phensig</key>
<defaultRule>
<period>01-00:00:00</period>
</defaultRule>
<rule>
<keyValue>FA.Y</keyValue>
<period>05-00:00:00</period>
</rule>
<rule>
<keyValue>FA.W</keyValue>
<period>05-00:00:00</period>
</rule>
<rule>
<keyValue>FF.W</keyValue>
<period>05-00:00:00</period>
</rule>
</purgeRuleSet>

View file

@ -36,7 +36,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* &lt;name>Raw&lt;/name>
* &lt;rootDir>/data_store/&lt;/rootDir>
* &lt;!-- default retention hours for a category. -->
* &lt;retentionHours>168&lt;/retentionHours>
* &lt;minRetentionHours>168&lt;/minRetentionHours>
* &lt;category>
* &lt;name>Model grib&lt;/name>
* ...
@ -83,7 +83,7 @@ public class ArchiveConfig implements Comparable<ArchiveConfig> {
* Minimum number of hours the purger should retain data. May be overridden
* for a given category.
*/
@XmlElement(name = "retentionHours")
@XmlElement(name = "minRetentionHours")
private int retentionHours;
/**
@ -168,7 +168,7 @@ public class ArchiveConfig implements Comparable<ArchiveConfig> {
public List<CategoryConfig> getCategoryList() {
return new ArrayList<CategoryConfig>(categoryList);
}
/**
* @param categoryName
* @return The named CategoryConfig; null if not found

View file

@ -46,6 +46,9 @@ import org.apache.commons.io.filefilter.RegexFileFilter;
import com.raytheon.uf.common.archive.exception.ArchiveException;
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.LocalizationFileInputStream;
import com.raytheon.uf.common.localization.LocalizationFileOutputStream;
@ -270,8 +273,8 @@ public class ArchiveConfigManager {
for (CategoryConfig category : archive.getCategoryList()) {
Calendar purgeTime = calculateExpiration(archive, category);
for (DisplayData display : getDisplayInfo(archive.getName(),
category.getName())) {
for (DisplayData display : getDisplayData(archive.getName(),
category.getName(), true)) {
List<File> displayFiles = getDisplayFiles(display, null,
purgeTime);
for (File file : displayFiles) {
@ -355,10 +358,18 @@ public class ArchiveConfigManager {
* Save the cached configuration.
*/
public void save() {
LocalizationContext siteContext = pathMgr.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
for (String archiveName : archiveMap.keySet()) {
ArchiveConfig archiveConfig = archiveMap.get(archiveName);
LocalizationFile lFile = archiveNameToLocalizationFileMap
.get(archiveName);
if (lFile.getContext().getLocalizationLevel() != LocalizationLevel.SITE) {
// Modify the site not the base file.
LocalizationFile tlFile = pathMgr.getLocalizationFile(
siteContext, lFile.getName());
lFile = tlFile;
}
saveArchiveConfig(lFile, archiveConfig);
}
}
@ -555,8 +566,13 @@ public class ArchiveConfigManager {
* @param categoryName
* @return displayInfoList order by display label
*/
public List<DisplayData> getDisplayInfo(String archiveName,
public List<DisplayData> getDisplayData(String archiveName,
String categoryName) {
return getDisplayData(archiveName, categoryName, false);
}
public List<DisplayData> getDisplayData(String archiveName,
String categoryName, boolean setSelect) {
Map<String, List<File>> displayMap = new HashMap<String, List<File>>();
ArchiveConfig archiveConfig = archiveMap.get(archiveName);
@ -598,12 +614,16 @@ public class ArchiveConfigManager {
}
}
List<DisplayData> displayInfoList = new ArrayList<ArchiveConfigManager.DisplayData>();
List<DisplayData> displayInfoList = new ArrayList<DisplayData>();
for (String displayLabel : displays) {
DisplayData displayInfo = new DisplayData(archiveConfig,
DisplayData displayData = new DisplayData(archiveConfig,
categoryConfig, displayLabel, displayMap.get(displayLabel));
displayInfoList.add(displayInfo);
if (setSelect) {
displayData.setSelected(categoryConfig
.getSelectedDisplayNames().contains(displayLabel));
}
displayInfoList.add(displayData);
}
return displayInfoList;
@ -671,149 +691,4 @@ public class ArchiveConfigManager {
return archiveConfig;
}
/**
* This class contains the information on directories that are associated
* with a display label. Allows a GUI to maintain the state of the display
* instead of the manager.
*/
public static class DisplayData {
/** Label to use when size not yet known. */
public static final String UNKNOWN_SIZE_LABEL = "????";
/** A negative value to indicate unknown size. */
public static final long UNKNOWN_SIZE = -1L;
/** The data's archive configuration. */
protected final ArchiveConfig archiveConfig;
/** The data's category configration. */
protected final CategoryConfig categoryConfig;
/** The display label for this data. */
protected final String displayLabel;
/**
* List of directories for the display label matching the category's
* directory pattern and found under the archive's root directory.
*/
protected final List<File> dirs;
/**
* For use by GUI to indicate. Use to indicate selected for retention or
* for placing in a case.
*/
private boolean selected = false;
/** For use by GUI for indicating the size of the directories' contents. */
private long size = UNKNOWN_SIZE;
/**
* Constructor.
*
* @param archiveConfig
* @param categoryConfig
* @param displayLabel
* @param dirs
*/
public DisplayData(ArchiveConfig archiveConfig,
CategoryConfig categoryConfig, String displayLabel,
List<File> dirs) {
this.archiveConfig = archiveConfig;
this.categoryConfig = categoryConfig;
this.displayLabel = displayLabel;
this.dirs = dirs;
}
/**
* Is instance selected.
*
* @return selected
*/
public boolean isSelected() {
return selected;
}
/**
* Set selected state.
*
* @param selected
*/
public void setSelected(boolean selected) {
this.selected = selected;
}
/**
*
* @return displayLabel.
*/
public String getDisplayLabel() {
return displayLabel;
}
/**
* The size of the directories' contents.
*
* @return size
*/
public long getSize() {
return size;
}
/**
* Set the size of the directories' contents.
*
* @param size
*/
public void setSize(long size) {
this.size = size;
}
/**
* The archive's root directory name.
*
* @return rootDir
*/
public String getRootDir() {
return archiveConfig.getRootDir();
}
/**
* Determine if this is the name of the archive.
*
* @param archiveName
* @return
*/
public boolean isArchive(String archiveName) {
return archiveConfig.getName().equals(archiveName);
}
/**
* Determine if this is the name of the category.
*
* @param categoryName
* @return
*/
public boolean isCategory(String categoryName) {
return categoryConfig.getName().equals(categoryName);
}
/**
* Determine if the object contains the same data as the instance.
*/
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object instanceof DisplayData) {
DisplayData displayData = (DisplayData) object;
return (archiveConfig == displayData.archiveConfig
&& categoryConfig == displayData.categoryConfig && displayLabel
.equals(displayData.displayLabel));
}
return false;
}
}
}

View file

@ -19,6 +19,9 @@
**/
package com.raytheon.uf.common.archive.config;
import java.util.Collection;
import java.util.TreeSet;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@ -80,7 +83,7 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
* Minimum number of hours the purger should retain data. When 0 use the
* parent archive's value.
*/
@XmlElement(name = "retentionHours")
@XmlElement(name = "extRetentionHours")
private int retentionHours;
/**
@ -141,6 +144,9 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
@XmlElement(name = "filePattern")
private String filePattern;
@XmlElement(name = "selectedDisplayName")
private final Collection<String> selectedDisplayNames = new TreeSet<String>();
/*
* Constructor.
*/
@ -252,6 +258,24 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
this.filePattern = filePattern;
}
public Collection<String> getSelectedDisplayNames() {
return selectedDisplayNames;
}
public void setSelectedDisplayNames(
Collection<String> selectedDisplayNameList) {
selectedDisplayNames.clear();
selectedDisplayNameList.addAll(selectedDisplayNameList);
}
public void addSelectedDisplayName(String displayName) {
selectedDisplayNames.add(displayName);
}
public void removeSelectedDisplayName(String displayName) {
selectedDisplayNames.remove(displayName);
}
/*
* (non-Javadoc)
*
@ -276,6 +300,18 @@ public class CategoryConfig implements Comparable<CategoryConfig> {
sb.append(", filePattern: ").append(getFilePattern());
sb.append(", displayLabel: ").append(getDisplay());
sb.append(", dateGroupIndices: ").append(getDateGroupIndices());
sb.append(", selectedDisplayNames: ");
if (selectedDisplayNames == null) {
sb.append("null");
} else {
sb.append("[");
String prefix = "\"";
for (String displayName : selectedDisplayNames) {
sb.append(prefix).append(displayName).append("\"");
prefix = " ,\"";
}
sb.append("]");
}
sb.append("]");
return sb.toString();
}

View file

@ -0,0 +1,189 @@
package com.raytheon.uf.common.archive.config;
import java.io.File;
import java.util.List;
/**
* This class contains the information on directories that are associated with a
* display label. Allows a GUI to maintain the state of the display instead of
* the manager.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 7, 2013 1966 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class DisplayData implements Comparable<DisplayData> {
/** Label to use when size not yet known. */
public static final String UNKNOWN_SIZE_LABEL = "????";
/** A negative value to indicate unknown size. */
public static final long UNKNOWN_SIZE = -1L;
/** The data's archive configuration. */
protected final ArchiveConfig archiveConfig;
/** The data's category configuration. */
protected final CategoryConfig categoryConfig;
/** The display label for this data. */
protected final String displayLabel;
/**
* List of directories for the display label matching the category's
* directory pattern and found under the archive's root directory.
*/
protected final List<File> dirs;
/**
* For use by GUI to indicate. Use to indicate selected for retention or for
* placing in a case.
*/
private boolean selected = false;
/** For use by GUI for indicating the size of the directories' contents. */
private long size = UNKNOWN_SIZE;
/**
* Constructor.
*
* @param archiveConfig
* @param categoryConfig
* @param displayLabel
* @param dirs
*/
public DisplayData(ArchiveConfig archiveConfig,
CategoryConfig categoryConfig, String displayLabel, List<File> dirs) {
this.archiveConfig = archiveConfig;
this.categoryConfig = categoryConfig;
this.displayLabel = displayLabel;
this.dirs = dirs;
}
/**
* Is instance selected.
*
* @return selected
*/
public boolean isSelected() {
return selected;
}
/**
* Set selected state.
*
* @param selected
*/
public void setSelected(boolean selected) {
this.selected = selected;
}
/**
*
* @return displayLabel.
*/
public String getDisplayLabel() {
return displayLabel;
}
/**
* The size of the directories' contents.
*
* @return size
*/
public long getSize() {
return size;
}
/**
* Set the size of the directories' contents.
*
* @param size
*/
public void setSize(long size) {
this.size = size;
}
/**
* The archive's root directory name.
*
* @return rootDir
*/
public String getRootDir() {
return archiveConfig.getRootDir();
}
/**
* Determine if this is the name of the archive.
*
* @param archiveName
* @return
*/
public boolean isArchive(String archiveName) {
return archiveConfig.getName().equals(archiveName);
}
/**
* Determine if this is the name of the category.
*
* @param categoryName
* @return
*/
public boolean isCategory(String categoryName) {
return categoryConfig.getName().equals(categoryName);
}
/**
* Update the information for the category.
*/
public void updateCategory() {
if (isSelected()) {
categoryConfig.addSelectedDisplayName(displayLabel);
} else {
categoryConfig.removeSelectedDisplayName(displayLabel);
}
}
/**
* Determine if the object contains the same data as the instance.
*/
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object instanceof DisplayData) {
DisplayData displayData = (DisplayData) object;
return compareTo(displayData) == 0;
}
return false;
}
/*
* (non-Javadoc)
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
public int compareTo(DisplayData o) {
int result = archiveConfig.getName().compareTo(
o.archiveConfig.getName());
if (result == 0) {
result = categoryConfig.getName().compareTo(
o.categoryConfig.getName());
if (result == 0) {
result = displayLabel.compareTo(o.displayLabel);
}
}
return result;
}
}

View file

@ -93,15 +93,17 @@ import com.raytheon.uf.common.util.ByteArrayOutputStreamPool.ByteArrayOutputStre
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 7/1/06 #1088 chammack Initial Creation.
* 5/17/10 #5901 njensen Moved to common
* 5/17/10 #5901 njensen Moved to common
* 03/02/11 #8045 rferrel Add connect reestablished message.
* 07/17/12 #911 njensen Refactored significantly
* 08/09/12 15307 snaples Added putEntitiy in postStreamingEntity.
* 01/07/13 DR 15294 D. Friedman Added streaming requests.
* Jan 24, 2013 1526 njensen Added postDynamicSerialize()
* 07/17/12 #911 njensen Refactored significantly
* 08/09/12 15307 snaples Added putEntitiy in postStreamingEntity.
* 01/07/13 DR 15294 D. Friedman Added streaming requests.
* Jan 24, 2013 1526 njensen Added postDynamicSerialize()
* Feb 20, 2013 1628 bsteffen clean up Inflaters used by
* HttpClient.
* HttpClient.
* Mar 11, 2013 1786 mpduff Add https capability.
* Jun 12, 2013 2102 njensen Better error handling when using
* DynamicSerializeStreamHandler
*
* </pre>
*
@ -642,6 +644,30 @@ public class HttpClient {
}
}
if (resp.getStatusLine().getStatusCode() != SUCCESS_CODE
&& handlerCallback instanceof DynamicSerializeStreamHandler) {
// the status code can be returned and/or processed
// depending on which post method and handlerCallback is used,
// so we only want to error off here if we're using a
// DynamicSerializeStreamHandler because deserializing will fail
// badly
String exceptionMsg = "HTTP server returned error code: "
+ resp.getStatusLine().getStatusCode();
DefaultInternalStreamHandler errorHandler = new DefaultInternalStreamHandler();
String serverErrorMsg = null;
try {
errorHandler.handleStream(resp.getEntity().getContent());
serverErrorMsg = new String(errorHandler.byteResult);
} catch (IOException e) {
statusHandler
.warn("Error reading the server's error message");
}
if (serverErrorMsg != null) {
exceptionMsg += "\n" + serverErrorMsg;
}
throw new CommunicationException(exceptionMsg);
}
// should only be able to get here if we didn't encounter the
// exceptions above on the most recent try
processResponse(resp, handlerCallback);

View file

@ -63,7 +63,7 @@ public class DynamicSerializeStreamHandler implements IStreamHandler {
SerializationType.Thrift).deserialize(is);
} catch (SerializationException e) {
throw new CommunicationException(
"Error deserializing streamed response");
"Error deserializing streamed response", e);
}
}

View file

@ -33,6 +33,7 @@ import java.util.Set;
* ------------ ---------- ----------- --------------------------
* Nov 29, 2012 1286 djohnson Initial creation
* May 28, 2013 1650 djohnson More information when failing to schedule.
* Jun 12, 2013 2038 djohnson Maximum allowed size is returned in kilobytes.
*
* </pre>
*
@ -84,7 +85,7 @@ public interface IProposeScheduleResponse {
* Get the required dataset size for the subscription to not unschedule any
* subscriptions.
*
* @return the required dataset size
* @return the required dataset size, in kilobytes
*/
long getRequiredDataSetSize();
}

View file

@ -58,6 +58,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* Mar 29, 2013 1841 djohnson Renamed to UserSubscription.
* May 15, 2013 1040 mpduff Added addOfficeId.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Jun 12, 2013 2038 djohnson Set registryId from each constructor with arguments.
* Jun 13, 2013 2095 djohnson Duplicate 13.5.1 change so bandwidth manager deletes subscriptions correctly.
*
* </pre>

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.jms.JmsPooledProducer;
* ------------ ---------- ----------- --------------------------
* Dec fi8, 2011 rjpeter Initial creation
* Feb 26, 2013 1642 rjpeter Added volatile references for better concurrency handling.
* Jun 07, 2013 DR 16316 rjpeter Fix memory leak
* </pre>
*
* @author rjpeter
@ -70,6 +71,8 @@ public class JmsProducerWrapper implements MessageProducer {
if (exceptionOccurred) {
mgr.setExceptionOccurred(true);
}
return true;
}
}

View file

@ -54,7 +54,9 @@ import com.facebook.thrift.transport.TTransport;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 7, 2008 chammack Initial creation
* Jun 17, 2010 #5091 njensen Added primitive list methods
* Jun 17, 2010 #5091 njensen Added primitive list methods
* Jun 12, 2013 2102 njensen Added max read length to prevent out
* of memory errors due to bad stream
*
* </pre>
*
@ -66,13 +68,34 @@ public class SelfDescribingBinaryProtocol extends TBinaryProtocol {
public static final byte FLOAT = 64;
/**
* This is to ensure a safety check because if the stream has bad bytes at
* the start, thrift may try to allocate something huge, such as GBs of
* data, and then the JVM will blow up about OutOfMemory errors.
**/
private static int MAX_READ_LENGTH;
static {
try {
int sizeInMB = Integer.parseInt(System
.getProperty("thrift.stream.maxsize"));
MAX_READ_LENGTH = sizeInMB * 1024 * 1024;
} catch (Throwable t) {
System.err
.println("Error reading property thrift.stream.maxsize - falling back to default of 200 MB");
t.printStackTrace();
MAX_READ_LENGTH = 200 * 1024 * 1024;
}
}
public SelfDescribingBinaryProtocol(TTransport trans) {
super(trans);
this(trans, false, true);
}
public SelfDescribingBinaryProtocol(TTransport trans, boolean strictRead,
boolean strictWrite) {
super(trans, strictRead, strictWrite);
this.setReadLength(MAX_READ_LENGTH);
}
/*

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.common.time.domain.api.ITimePoint;
* Feb 15, 2013 1638 mschenke Moved Util.getUnixTime into TimeUtil
* Mar 20, 2013 1774 randerso Add SECONDS_PER_DAY, changed SECONDS_PER_HOUR to int.
* Apr 24, 2013 1628 mschenke Added GMT TimeZone Object constant
* Jun 05, 2013 DR 16279 D. Friedman Add timeOfDayToAbsoluteTime
* </pre>
*
* @author njensen
@ -425,6 +426,33 @@ public final class TimeUtil {
}
}
/** Converts a time-of-day (in seconds) to an absolute time given an
* absolute reference time. The resulting time is within a day of the
* reference time.
* @param timeOfDaySeconds The time of day in seconds past midnight
* @param referenceTime The reference time (should have GMT time zone)
* @return
*/
public static Calendar timeOfDayToAbsoluteTime(int timeOfDaySeconds, Calendar referenceTime) {
Calendar targetDay = (Calendar) referenceTime.clone();
int refTimeTodSeconds = referenceTime.get(Calendar.HOUR_OF_DAY) * SECONDS_PER_HOUR
+ referenceTime.get(Calendar.MINUTE) * SECONDS_PER_MINUTE
+ referenceTime.get(Calendar.SECOND);
int absTodDiff = Math.abs(refTimeTodSeconds - timeOfDaySeconds);
if (absTodDiff < SECONDS_PER_DAY - absTodDiff) {
// nothing; use current targetDay
} else if (refTimeTodSeconds < timeOfDaySeconds) {
targetDay.add(Calendar.DAY_OF_MONTH, -1);
} else {
targetDay.add(Calendar.DAY_OF_MONTH, 1);
}
targetDay.set(Calendar.HOUR_OF_DAY, 0);
targetDay.set(Calendar.MINUTE, 0);
targetDay.set(Calendar.SECOND, 0);
targetDay.add(Calendar.SECOND, timeOfDaySeconds);
return targetDay;
}
/**
* Disabled constructor.
*/

View file

@ -29,6 +29,7 @@ package com.raytheon.uf.common.util;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 24, 2012 njensen Initial creation
* Jun 12, 2013 2064 mpduff Add prettyKiloByteSize.
*
* </pre>
*
@ -53,7 +54,7 @@ public class SizeUtil {
* @return the pretty String representation of the byte size
*/
public static String prettyByteSize(long numberOfBytes) {
float n = (float) numberOfBytes;
float n = numberOfBytes;
int reps = 0;
while (n > BYTES_PER && reps < REP_PREFIX.length - 1) {
reps++;
@ -66,4 +67,17 @@ public class SizeUtil {
return sb.toString();
}
/**
* Transforms a number of kilobytes to a pretty string based on the total
* number of bytes, e.g. B, kB, MB, or GB as fitting. For example: 1000 ->
* 1000B, 10000 -> 9.7kB, 100000 -> 97.6kB, 1000000 -> 976.5kB, 10000000 ->
* 9.5MB
*
* @param numberOfKiloBytes
* * the number to transform to a pretty string
* @return the pretty String representation of the byte size
*/
public static String prettyKiloByteSize(long numberOfKiloBytes) {
return prettyByteSize(numberOfKiloBytes * BYTES_PER);
}
}

View file

@ -23,14 +23,14 @@
<name> - Required tag. The id for the archive such as Raw or Processed.
Used in the GUIs to filter which archive to display.
<rootDir> - Required tag. The root directory on the edex server for the archive.
<retentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<minRetentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<category> - Logical grouping of archive's sub-directories.
The <category> has six types of tags:
<name> - Required tag. The id for the category such as grib2 or redbook.
Used in the GUIs to filter what is the display in the table.
<retentionHours> - Optional tag. The retentionHours for this category.
Default is the archive's <retentionHours>.
<extRetentionHours> - Optional tag. The extended retentionHours for selected directories of this category.
Default is the archive's <minRetentionHours>.
<dirPattern> - Required tag. A regex pattern for finding directories for this category.
The pattern is relative to the archive's <rootDir>. Wildcard patterns do not cross directory
delimiter /. Thus to match 3 levels of directories you would need .*/.*/.* .
@ -47,6 +47,9 @@
This is used to determine what files/directories to retain or a range of directories/files to copy
for case creation. Note to get the group's index the <dirPattern> and <filePattern> are combined.
Thus if there are 5 groups in the <dirPattern> then the first group in the <filePattern> is index 6.
<selectedDisplayNames> - A directory matching <dirPattern>. These are selected directories from the Retention GUI. The purger
will used the category's <extRetentionHours> instead of the Arhivie's <minRetentionHours>.
An optional tag; may have more then one.
Patterns and groups.
The <dirPattern> and <filePattern> use Java regex expressions; similar to the ldm's pqact.conf file.
For more details see http://docs.oracle.com/javase/tutorial/essential/regex/
@ -81,21 +84,69 @@
<archive>
<name>Processed</name>
<rootDir>/awips2/edex/data/archive/</rootDir>
<retentionHours>168</retentionHours>
<minRetentionHours>24</minRetentionHours>
<category>
<name>binlightning</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(binlightning)</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>bufr</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(bufrascat|bufrhdw|bufrmosLAMP|bufrncwf|bufrsigwx|bufrssmi|bufrua)</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>bufrsigwx</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(bufrsigwx)/(.*)</dirPattern>
<displayLabel>{1} : {2}</displayLabel>
<dateGroupIndices>3,4,5,6</dateGroupIndices>
<filePattern>.*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>group</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(acars|airmet|airep|cwa|cwat)</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>grib</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>grib/(.*)/(.*)</dirPattern>
<displayLabel>{1} : {2}</displayLabel>
<dateGroupIndices>3,4,5,6</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.*</filePattern>
</category>
<category>
<name>grid</name>
<extRetentionHours>168</extRetentionHours>
<dirPattern>grid/(.*)/(.*)</dirPattern>
<displayLabel>{1} : {2}</displayLabel>
<dateGroupIndices>3,4,5,6</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})-.*</filePattern>
</category>
<category>
<name>redbook</name>
<retentionHours>0</retentionHours>
<dirPattern>hdf5/(redbook)</dirPattern>
<extRetentionHours>168</extRetentionHours>
<dirPattern>redbook/(.*)</dirPattern>
<displayLabel>{1}</displayLabel>
<filePattern>redbook-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
<category>
<name>obs</name>
<retentionHours>0</retentionHours>
<dirPattern>hdf5/(obs)</dirPattern>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(fssobs|obs)</dirPattern>
<displayLabel>{1}</displayLabel>
<filePattern>metar-(\d{4})-(\d{2})-(\d{2})-(\d{2})\.*</filePattern>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
<filePattern>[^/]*-(\d{4})-(\d{2})-(\d{2})-(\d{2})\..*</filePattern>
</category>
</archive>

View file

@ -23,14 +23,14 @@
<name> - Required tag. The id for the archive such as Raw or Processed.
Used in the GUIs to filter which archive to display.
<rootDir> - Required tag. The root directory on the edex server for the archive.
<retentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<minRetentionHours> - Required tag. The default number of hours to retain data in the <rootDir>
<category> - Logical grouping of archive's sub-directories.
The <category> has six types of tags:
<name> - Required tag. The id for the category such as grib2 or redbook.
Used in the GUIs to filter what is the display in the table.
<retentionHours> - Optional tag. The retentionHours for this category.
Default is the archive's <retentionHours>.
<extRetentionHours> - Optional tag. The extended retentionHours for selected directories of this category.
Default is the archive's <minRetentionHours>.
<dirPattern> - Required tag. A regex pattern for finding directories for this category.
The pattern is relative to the archive's <rootDir>. Wildcard patterns do not cross directory
delimiter /. Thus to match 3 levels of directories you would need .*/.*/.* .
@ -47,6 +47,9 @@
This is used to determine what files/directories to retain or a range of directories/files to copy
for case creation. Note to get the group's index the <dirPattern> and <filePattern> are combined.
Thus if there are 5 groups in the <dirPattern> then the first group in the <filePattern> is index 6.
<selectedDisplayNames> - A directory matching <dirPattern>. These are selected directories from the Retention GUI. The purger
will used the category's <extRetentionHours> instead of the Arhivie's <minRetentionHours>.
An optional tag; may have more then one.
Patterns and groups.
The <dirPattern> and <filePattern> use Java regex expressions; similar to the ldm's pqact.conf file.
For more details see http://docs.oracle.com/javase/tutorial/essential/regex/
@ -81,31 +84,31 @@
<archive>
<name>Raw</name>
<rootDir>/data_store/</rootDir>
<retentionHours>168</retentionHours>
<minRetentionHours>24</minRetentionHours>
<category>
<name>Model grib</name>
<retentionHours>0</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>grib/(\d{4})(\d{2})(\d{2})/(\d{2})/(.*)</dirPattern>
<displayLabel>{5}</displayLabel>
<dateGroupIndices>1,2,3,4</dateGroupIndices>
</category>
<category>
<name>Model grib2</name>
<retentionHours>0</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(grib2)/(\d{4})(\d{2})(\d{2})/(\d{2})/(.*)</dirPattern>
<displayLabel>{1} - {6}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
</category>
<category>
<name>Model other</name>
<retentionHours>0</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>(acars|airmet|binlightning|bufrmos|bufrua|bufrsigwx|convsigmet|goessndg|manual|mdlsndg|poessndg|profiler|shef|text)/(\d{4})(\d{2})(\d{2})/(\d{2})</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
</category>
<category>
<name>Satellite</name>
<retentionHours>101</retentionHours>
<extRetentionHours>168</extRetentionHours>
<dirPattern>sat/(\d{4})(\d{2})(\d{2})/(\d{2})/(.*)</dirPattern>
<displayLabel>{5}</displayLabel>
<dateGroupIndices>1,2,3,4</dateGroupIndices>

View file

@ -220,7 +220,9 @@ public class SubscriptionIntegrityVerifier {
try {
DataSet dataSet = DataDeliveryHandlers.getDataSetHandler()
.getById(event.getId());
dataSetUpdated(dataSet);
if (dataSet != null) {
dataSetUpdated(dataSet);
}
} catch (RegistryHandlerException e) {
statusHandler
.handle(Priority.ERROR,

View file

@ -91,6 +91,8 @@
<permission id="com.raytheon.localization.site/common_static/datadelivery"/>
<permission id="com.raytheon.localization.site/common_static/archive"/>
<user userId="ALL">
<userPermission>com.raytheon.localization.site/common_static/purge</userPermission>
<userPermission>com.raytheon.localization.site/cave_static/colormaps</userPermission>
@ -122,6 +124,7 @@
<userPermission>com.raytheon.localization.site/common_static/shef</userPermission>
<userPermission>com.raytheon.localization.site/common_static/roles</userPermission>
<userPermission>com.raytheon.localization.site/common_static/datadelivery</userPermission>
<userPermission>com.raytheon.localization.site/common_static/archive</userPermission>
</user>
</nwsRoleData>

View file

@ -1 +0,0 @@
113970873e314bd551282f4d9b2b1a2ca47ea413

View file

View file

@ -30,7 +30,8 @@
# ------------ ---------- ----------- --------------------------
# 08/17/10 njensen Initial Creation.
# 01/11/13 bkowal Pypies will now read the hdf5 root from configuration
# 01/17/13 1490 bkowal Relocated the configuration of pypies
# 01/17/13 1490 bkowal Relocated the configuration of pypies
# 06/12/13 2102 njensen Raise uncaught exceptions to force http code 500
#
#
@ -111,7 +112,8 @@ def pypies_response(request):
except:
# Absolutely should not reach this, if we do, need to fix code
logger.error("Uncaught exception! " + IDataStore._exc())
return Response("Very bad uncaught exception, check pypies log")
# want to re-raise the error as that will cause PyPIES to return http error code 500
raise
def __prepareResponse(resp):

View file

@ -238,6 +238,21 @@ if [ "${1}" = "2" ]; then
rm -rf /awips2/cave.bak
fi
# determine if an installation of awips2-common-base is already present
# (edex has been installed before CAVE on an ADAM machine)
if [ -f /awips2/.cave/installCAVECommon.sh ]; then
# copy common-base files to cave
cp -r /awips2/.cave/.repository /awips2/cave/
cp /awips2/.cave/installCAVECommon.sh /awips2/cave
# install the common-base feature
/bin/bash /awips2/cave/installCAVECommon.sh
rm -f /awips2/cave/installCAVECommon.sh
# cleanup
rm -rf /awips2/.cave
fi
%preun
# Backup the core CAVE jar files so that they are
# not removed during the uninstallation of a previous

View file

@ -72,45 +72,28 @@ if [ $? -ne 0 ]; then
exit 1
fi
RPMS_CORE=%{_baseline_workspace}/rpms/awips2.core
RPMS_COMMON_BASE=${RPMS_CORE}/Installer.common-base
SCRIPTS=${RPMS_COMMON_BASE}/scripts
cp -vf ${RPMS_COMMON_BASE}/scripts/* %{_build_root}/awips2/cave
if [ $? -ne 0 ]; then
exit 1
fi
%pre
%post
# Set all paths required by CAVE before installing.
export LD_LIBRARY_PATH=/awips2/java/lib:/awips2/python/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=libpython.so
if [ -d /awips2/cave/lib ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib/lib_illusion:$LD_LIBRARY_PATH
fi
if [ -d /awips2/cave/lib64 ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib64/lib_illusion:$LD_LIBRARY_PATH
fi
# Need to use awips2-java to do this.
export PATH=/awips2/java/bin:/awips2/python/bin:${PATH}
export JAVA_HOME="/awips2/java/jre"
# Set the CAVE logfile location.
export LOGFILE_CAVE=/dev/null
# Use the eclipse p2 manager.
CAVE_EXE="/awips2/cave/cave"
NOSPLASH_ARG="-nosplash"
DIRECTOR_APP="-application org.eclipse.equinox.p2.director"
DESTINATION_ARG="-destination /awips2/cave"
INSTALL_ARG="-i com.raytheon.uf.common.base.feature.feature.group"
UNINSTALL_ARG="-u com.raytheon.uf.common.base.feature.feature.group"
REPO="-repository file:/awips2/cave/.repository/"
COMMON_CMD="${CAVE_EXE} ${NOSPLASH_ARG} ${DIRECTOR_APP} ${DESTINATION_ARG}"
INSTALL_CMD="${COMMON_CMD} ${INSTALL_ARG} ${REPO}"
UNINSTALL_CMD="${COMMON_CMD} ${UNINSTALL_ARG}"
# EDEX installed?
# when the plugins are for EDEX, we just leave
# them on the filesystem; no action required.
rpm -q awips2-edex > /dev/null 2>&1
if [ $? -ne 0 ]; then
# remove the edex plugins
rm -rf /awips2/edex
# hide the edex plugins
pushd . > /dev/null 2>&1
cd /awips2
rm -rf .edex
mv edex .edex
popd > /dev/null 2>&1
fi
# CAVE installed?
@ -119,51 +102,25 @@ fi
# use the p2 director to install from a repository.
rpm -q awips2-cave > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Uninstall any existing components since the p2 director does not
# support updating.
# If the feature is not installed, this does not fail quietly.
# Determine if the feature needs to be uninstalled.
${UNINSTALL_CMD} -verifyOnly > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_TIMESTAMP=`date`
echo "uninstall previous STARTED: ${LOG_TIMESTAMP}"
${UNINSTALL_CMD}
LOG_TIMESTAMP=`date`
echo "uninstall previous COMPLETE: ${LOG_TIMESTAMP}"
fi
# complete the install
LOG_TIMESTAMP=`date`
echo "installation STARTED: ${LOG_TIMESTAMP}"
${INSTALL_CMD}
if [ $? -ne 0 ]; then
exit 1
fi
LOG_TIMESTAMP=`date`
echo "installation COMPLETE: ${LOG_TIMESTAMP}"
# remove the repository
if [ -f /awips2/cave/.repository/artifacts.xml ]; then
rm -f /awips2/cave/.repository/artifacts.xml
fi
if [ -f /awips2/cave/.repository/content.xml ]; then
rm -f /awips2/cave/.repository/content.xml
fi
if [ -d /awips2/cave/.repository/features ]; then
rm -rf /awips2/cave/.repository/features
fi
if [ -d /awips2/cave/.repository/plugins ]; then
rm -rf /awips2/cave/.repository/plugins
fi
/bin/bash /awips2/cave/installCAVECommon.sh
rm -f /awips2/cave/installCAVECommon.sh
else
# remove the cave repository
rm -rf /awips2/cave
# hide the cave repository
pushd . > /dev/null 2>&1
cd /awips2
rm -rf .cave
mv cave .cave
popd > /dev/null 2>&1
fi
%preun
if [ -d /awips2/.cave ]; then
rm -rf /awips2/.cave
fi
if [ -d /awips2/.edex ]; then
rm -rf /awips2/.edex
fi
%postun
%clean
@ -175,5 +132,7 @@ rm -rf ${RPM_BUILD_ROOT}
%dir /awips2/edex
/awips2/edex/*
%dir /awips2/cave
/awips2/cave/*
%dir /awips2/cave/.repository
/awips2/cave/.repository/*
/awips2/cave/.repository/*

View file

@ -0,0 +1,70 @@
#!/bin/bash
# Set all paths required by CAVE before installing.
export LD_LIBRARY_PATH=/awips2/java/lib:/awips2/python/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=libpython.so
if [ -d /awips2/cave/lib ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib/lib_illusion:$LD_LIBRARY_PATH
fi
if [ -d /awips2/cave/lib64 ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib64/lib_illusion:$LD_LIBRARY_PATH
fi
# Need to use awips2-java to do this.
export PATH=/awips2/java/bin:/awips2/python/bin:${PATH}
export JAVA_HOME="/awips2/java/jre"
# Set the CAVE logfile location.
export LOGFILE_CAVE=/dev/null
# Use the eclipse p2 manager.
CAVE_EXE="/awips2/cave/cave"
NOSPLASH_ARG="-nosplash"
DIRECTOR_APP="-application org.eclipse.equinox.p2.director"
DESTINATION_ARG="-destination /awips2/cave"
INSTALL_ARG="-i com.raytheon.uf.common.base.feature.feature.group"
UNINSTALL_ARG="-u com.raytheon.uf.common.base.feature.feature.group"
REPO="-repository file:/awips2/cave/.repository/"
COMMON_CMD="${CAVE_EXE} ${NOSPLASH_ARG} ${DIRECTOR_APP} ${DESTINATION_ARG}"
INSTALL_CMD="${COMMON_CMD} ${INSTALL_ARG} ${REPO}"
UNINSTALL_CMD="${COMMON_CMD} ${UNINSTALL_ARG}"
# Uninstall any existing components since the p2 director does not
# support updating.
# If the feature is not installed, this does not fail quietly.
# Determine if the feature needs to be uninstalled.
${UNINSTALL_CMD} -verifyOnly > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_TIMESTAMP=`date`
echo "uninstall previous STARTED: ${LOG_TIMESTAMP}"
${UNINSTALL_CMD}
LOG_TIMESTAMP=`date`
echo "uninstall previous COMPLETE: ${LOG_TIMESTAMP}"
fi
# complete the install
LOG_TIMESTAMP=`date`
echo "installation STARTED: ${LOG_TIMESTAMP}"
${INSTALL_CMD}
if [ $? -ne 0 ]; then
exit 1
fi
LOG_TIMESTAMP=`date`
echo "installation COMPLETE: ${LOG_TIMESTAMP}"
# remove the repository
if [ -f /awips2/cave/.repository/artifacts.xml ]; then
rm -f /awips2/cave/.repository/artifacts.xml
fi
if [ -f /awips2/cave/.repository/content.xml ]; then
rm -f /awips2/cave/.repository/content.xml
fi
if [ -d /awips2/cave/.repository/features ]; then
rm -rf /awips2/cave/.repository/features
fi
if [ -d /awips2/cave/.repository/plugins ]; then
rm -rf /awips2/cave/.repository/plugins
fi

View file

@ -282,7 +282,7 @@ su ${AWIPS_DEFAULT_USER} -c \
"${SQL_SHARE_DIR}/createHMDB.sh ${PSQL_INSTALL} ${AWIPS_DEFAULT_PORT} ${AWIPS_DEFAULT_USER} ${SQL_SHARE_DIR} ${SQL_LOG}"
update_createEbxml
execute_psql_sql_script ${SQL_SHARE_DIR}/createEbxml.sql postgres
execute_psql_sql_script ${SQL_SHARE_DIR}/createEbxml.sql metadata
execute_psql_sql_script ${SQL_SHARE_DIR}/vtec_initial_setup.sql metadata
control_pg_ctl "stop"

View file

@ -125,6 +125,16 @@ if [ -f /etc/init.d/edex_camel ]; then
/sbin/chkconfig --add edex_camel
fi
# determine if an installation of awips2-common-base is already present
# (CAVE has been installed before edex on an ADAM machine)
if [ -d /awips2/.edex ]; then
# copy the common-base contributions to the EDEX installation
cp -r /awips2/.edex/* /awips2/edex
# cleanup
rm -rf /awips2/.edex
fi
%preun
if [ "${1}" = "1" ]; then
exit 0

View file

@ -73,6 +73,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.util.BandwidthUtil;
* Feb 26, 2013 1643 djohnson BandwidthService extends reusable class.
* Feb 27, 2013 1644 djohnson Bandwidth service is the WFO version.
* May 20, 2013 1650 djohnson Add test for returning required dataset size.
* Jun 12, 2013 2038 djohnson Add test for returning required dataset size on subscription update.
*
* </pre>
*
@ -393,6 +394,31 @@ public class BandwidthServiceIntTest extends AbstractWfoBandwidthManagerIntTest
expectedRequiredDataSetSize, requiredDataSetSize);
}
@Test
public void testProposeScheduleSubscriptionsSecondDoesntFitReturnsRequiredSizeForSubscriptionUpdate() {
Subscription subscription = createSubscriptionThatFillsHalfABucket();
subscription.getTime().setCycleTimes(
Arrays.asList(Integer.valueOf(6), Integer.valueOf(8)));
Set<String> unscheduledSubscriptions = service.schedule(subscription);
verifyNoSubscriptionsWereUnscheduled(unscheduledSubscriptions);
// We can only fit up to a bucket
final long expectedRequiredDataSetSize = createSubscriptionThatFillsUpABucket()
.getDataSetSize();
// Try to update the subscription to fill two buckets
subscription.setDataSetSize(createSubscriptionThatFillsUpTwoBuckets()
.getDataSetSize());
final long requiredDataSetSize = service.proposeSchedule(subscription)
.getRequiredDataSetSize();
assertEquals(
"The required dataset size should have been returned from propose schedule!",
expectedRequiredDataSetSize, requiredDataSetSize);
}
@Test
public void testDetermineRequiredSizeReturnsZeroIfUnableToFitAtAll() {

View file

@ -43,8 +43,8 @@ import org.junit.Test;
import com.raytheon.uf.common.archive.config.ArchiveConfig;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConfigManager.DisplayData;
import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.archive.exception.ArchiveException;
import com.raytheon.uf.common.localization.PathManagerFactoryTest;
import com.raytheon.uf.common.time.util.TimeUtil;
@ -294,8 +294,8 @@ public class ArchiveConfigManagerTest {
ArchiveException {
CategoryConfig satCategory = getCategory(archive, SAT_CAT_NAME);
List<DisplayData> displays =
manager.getDisplayInfo(archive.getName(), satCategory.getName());
List<DisplayData> selectedDisplays = new ArrayList<ArchiveConfigManager.DisplayData>();
manager.getDisplayData(archive.getName(), satCategory.getName());
List<DisplayData> selectedDisplays = new ArrayList<DisplayData>();
for (DisplayData displayData : displays) {
if (displayData.getDisplayLabel().equals(satNameForArchive)) {
selectedDisplays.add(displayData);